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 fidl::endpoints::ControlHandle for CounterControlHandle {
626    fn shutdown(&self) {
627        self.inner.shutdown()
628    }
629
630    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
631        self.inner.shutdown_with_epitaph(status)
632    }
633
634    fn is_closed(&self) -> bool {
635        self.inner.channel().is_closed()
636    }
637    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
638        self.inner.channel().on_closed()
639    }
640
641    #[cfg(target_os = "fuchsia")]
642    fn signal_peer(
643        &self,
644        clear_mask: zx::Signals,
645        set_mask: zx::Signals,
646    ) -> Result<(), zx_status::Status> {
647        use fidl::Peered;
648        self.inner.channel().signal_peer(clear_mask, set_mask)
649    }
650}
651
652impl CounterControlHandle {}
653
654#[must_use = "FIDL methods require a response to be sent"]
655#[derive(Debug)]
656pub struct CounterGetInspectVmoResponder {
657    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
658    tx_id: u32,
659}
660
661/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
662/// if the responder is dropped without sending a response, so that the client
663/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
664impl std::ops::Drop for CounterGetInspectVmoResponder {
665    fn drop(&mut self) {
666        self.control_handle.shutdown();
667        // Safety: drops once, never accessed again
668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
669    }
670}
671
672impl fidl::endpoints::Responder for CounterGetInspectVmoResponder {
673    type ControlHandle = CounterControlHandle;
674
675    fn control_handle(&self) -> &CounterControlHandle {
676        &self.control_handle
677    }
678
679    fn drop_without_shutdown(mut self) {
680        // Safety: drops once, never accessed again due to mem::forget
681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
682        // Prevent Drop from running (which would shut down the channel)
683        std::mem::forget(self);
684    }
685}
686
687impl CounterGetInspectVmoResponder {
688    /// Sends a response to the FIDL transaction.
689    ///
690    /// Sets the channel to shutdown if an error occurs.
691    pub fn send(
692        self,
693        mut status: i32,
694        mut buffer: fidl_fuchsia_mem::Buffer,
695    ) -> Result<(), fidl::Error> {
696        let _result = self.send_raw(status, buffer);
697        if _result.is_err() {
698            self.control_handle.shutdown();
699        }
700        self.drop_without_shutdown();
701        _result
702    }
703
704    /// Similar to "send" but does not shutdown the channel if an error occurs.
705    pub fn send_no_shutdown_on_err(
706        self,
707        mut status: i32,
708        mut buffer: fidl_fuchsia_mem::Buffer,
709    ) -> Result<(), fidl::Error> {
710        let _result = self.send_raw(status, buffer);
711        self.drop_without_shutdown();
712        _result
713    }
714
715    fn send_raw(
716        &self,
717        mut status: i32,
718        mut buffer: fidl_fuchsia_mem::Buffer,
719    ) -> Result<(), fidl::Error> {
720        self.control_handle.inner.send::<CounterGetInspectVmoResponse>(
721            (status, &mut buffer),
722            self.tx_id,
723            0x6ea9b2e6b2791b81,
724            fidl::encoding::DynamicFlags::empty(),
725        )
726    }
727}
728
729#[must_use = "FIDL methods require a response to be sent"]
730#[derive(Debug)]
731pub struct CounterUpdateInspectVmoResponder {
732    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
733    tx_id: u32,
734}
735
736/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
737/// if the responder is dropped without sending a response, so that the client
738/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
739impl std::ops::Drop for CounterUpdateInspectVmoResponder {
740    fn drop(&mut self) {
741        self.control_handle.shutdown();
742        // Safety: drops once, never accessed again
743        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
744    }
745}
746
747impl fidl::endpoints::Responder for CounterUpdateInspectVmoResponder {
748    type ControlHandle = CounterControlHandle;
749
750    fn control_handle(&self) -> &CounterControlHandle {
751        &self.control_handle
752    }
753
754    fn drop_without_shutdown(mut self) {
755        // Safety: drops once, never accessed again due to mem::forget
756        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
757        // Prevent Drop from running (which would shut down the channel)
758        std::mem::forget(self);
759    }
760}
761
762impl CounterUpdateInspectVmoResponder {
763    /// Sends a response to the FIDL transaction.
764    ///
765    /// Sets the channel to shutdown if an error occurs.
766    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
767        let _result = self.send_raw(status);
768        if _result.is_err() {
769            self.control_handle.shutdown();
770        }
771        self.drop_without_shutdown();
772        _result
773    }
774
775    /// Similar to "send" but does not shutdown the channel if an error occurs.
776    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
777        let _result = self.send_raw(status);
778        self.drop_without_shutdown();
779        _result
780    }
781
782    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
783        self.control_handle.inner.send::<CounterUpdateInspectVmoResponse>(
784            (status,),
785            self.tx_id,
786            0x1d25eb7995a0539f,
787            fidl::encoding::DynamicFlags::empty(),
788        )
789    }
790}
791
792#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
793pub struct CpuResourceMarker;
794
795impl fidl::endpoints::ProtocolMarker for CpuResourceMarker {
796    type Proxy = CpuResourceProxy;
797    type RequestStream = CpuResourceRequestStream;
798    #[cfg(target_os = "fuchsia")]
799    type SynchronousProxy = CpuResourceSynchronousProxy;
800
801    const DEBUG_NAME: &'static str = "fuchsia.kernel.CpuResource";
802}
803impl fidl::endpoints::DiscoverableProtocolMarker for CpuResourceMarker {}
804
805pub trait CpuResourceProxyInterface: Send + Sync {
806    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
807    fn r#get(&self) -> Self::GetResponseFut;
808}
809#[derive(Debug)]
810#[cfg(target_os = "fuchsia")]
811pub struct CpuResourceSynchronousProxy {
812    client: fidl::client::sync::Client,
813}
814
815#[cfg(target_os = "fuchsia")]
816impl fidl::endpoints::SynchronousProxy for CpuResourceSynchronousProxy {
817    type Proxy = CpuResourceProxy;
818    type Protocol = CpuResourceMarker;
819
820    fn from_channel(inner: fidl::Channel) -> Self {
821        Self::new(inner)
822    }
823
824    fn into_channel(self) -> fidl::Channel {
825        self.client.into_channel()
826    }
827
828    fn as_channel(&self) -> &fidl::Channel {
829        self.client.as_channel()
830    }
831}
832
833#[cfg(target_os = "fuchsia")]
834impl CpuResourceSynchronousProxy {
835    pub fn new(channel: fidl::Channel) -> Self {
836        Self { client: fidl::client::sync::Client::new(channel) }
837    }
838
839    pub fn into_channel(self) -> fidl::Channel {
840        self.client.into_channel()
841    }
842
843    /// Waits until an event arrives and returns it. It is safe for other
844    /// threads to make concurrent requests while waiting for an event.
845    pub fn wait_for_event(
846        &self,
847        deadline: zx::MonotonicInstant,
848    ) -> Result<CpuResourceEvent, fidl::Error> {
849        CpuResourceEvent::decode(self.client.wait_for_event::<CpuResourceMarker>(deadline)?)
850    }
851
852    /// Get a CPU resource handle.
853    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
854        let _response = self
855            .client
856            .send_query::<fidl::encoding::EmptyPayload, CpuResourceGetResponse, CpuResourceMarker>(
857                (),
858                0x41e1103acf4215e4,
859                fidl::encoding::DynamicFlags::empty(),
860                ___deadline,
861            )?;
862        Ok(_response.resource)
863    }
864}
865
866#[cfg(target_os = "fuchsia")]
867impl From<CpuResourceSynchronousProxy> for zx::NullableHandle {
868    fn from(value: CpuResourceSynchronousProxy) -> Self {
869        value.into_channel().into()
870    }
871}
872
873#[cfg(target_os = "fuchsia")]
874impl From<fidl::Channel> for CpuResourceSynchronousProxy {
875    fn from(value: fidl::Channel) -> Self {
876        Self::new(value)
877    }
878}
879
880#[cfg(target_os = "fuchsia")]
881impl fidl::endpoints::FromClient for CpuResourceSynchronousProxy {
882    type Protocol = CpuResourceMarker;
883
884    fn from_client(value: fidl::endpoints::ClientEnd<CpuResourceMarker>) -> Self {
885        Self::new(value.into_channel())
886    }
887}
888
889#[derive(Debug, Clone)]
890pub struct CpuResourceProxy {
891    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
892}
893
894impl fidl::endpoints::Proxy for CpuResourceProxy {
895    type Protocol = CpuResourceMarker;
896
897    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
898        Self::new(inner)
899    }
900
901    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
902        self.client.into_channel().map_err(|client| Self { client })
903    }
904
905    fn as_channel(&self) -> &::fidl::AsyncChannel {
906        self.client.as_channel()
907    }
908}
909
910impl CpuResourceProxy {
911    /// Create a new Proxy for fuchsia.kernel/CpuResource.
912    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
913        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
914        Self { client: fidl::client::Client::new(channel, protocol_name) }
915    }
916
917    /// Get a Stream of events from the remote end of the protocol.
918    ///
919    /// # Panics
920    ///
921    /// Panics if the event stream was already taken.
922    pub fn take_event_stream(&self) -> CpuResourceEventStream {
923        CpuResourceEventStream { event_receiver: self.client.take_event_receiver() }
924    }
925
926    /// Get a CPU resource handle.
927    pub fn r#get(
928        &self,
929    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
930    {
931        CpuResourceProxyInterface::r#get(self)
932    }
933}
934
935impl CpuResourceProxyInterface for CpuResourceProxy {
936    type GetResponseFut = fidl::client::QueryResponseFut<
937        fidl::Resource,
938        fidl::encoding::DefaultFuchsiaResourceDialect,
939    >;
940    fn r#get(&self) -> Self::GetResponseFut {
941        fn _decode(
942            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
943        ) -> Result<fidl::Resource, fidl::Error> {
944            let _response = fidl::client::decode_transaction_body::<
945                CpuResourceGetResponse,
946                fidl::encoding::DefaultFuchsiaResourceDialect,
947                0x41e1103acf4215e4,
948            >(_buf?)?;
949            Ok(_response.resource)
950        }
951        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
952            (),
953            0x41e1103acf4215e4,
954            fidl::encoding::DynamicFlags::empty(),
955            _decode,
956        )
957    }
958}
959
960pub struct CpuResourceEventStream {
961    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
962}
963
964impl std::marker::Unpin for CpuResourceEventStream {}
965
966impl futures::stream::FusedStream for CpuResourceEventStream {
967    fn is_terminated(&self) -> bool {
968        self.event_receiver.is_terminated()
969    }
970}
971
972impl futures::Stream for CpuResourceEventStream {
973    type Item = Result<CpuResourceEvent, fidl::Error>;
974
975    fn poll_next(
976        mut self: std::pin::Pin<&mut Self>,
977        cx: &mut std::task::Context<'_>,
978    ) -> std::task::Poll<Option<Self::Item>> {
979        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
980            &mut self.event_receiver,
981            cx
982        )?) {
983            Some(buf) => std::task::Poll::Ready(Some(CpuResourceEvent::decode(buf))),
984            None => std::task::Poll::Ready(None),
985        }
986    }
987}
988
989#[derive(Debug)]
990pub enum CpuResourceEvent {}
991
992impl CpuResourceEvent {
993    /// Decodes a message buffer as a [`CpuResourceEvent`].
994    fn decode(
995        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
996    ) -> Result<CpuResourceEvent, fidl::Error> {
997        let (bytes, _handles) = buf.split_mut();
998        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
999        debug_assert_eq!(tx_header.tx_id, 0);
1000        match tx_header.ordinal {
1001            _ => Err(fidl::Error::UnknownOrdinal {
1002                ordinal: tx_header.ordinal,
1003                protocol_name: <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1004            }),
1005        }
1006    }
1007}
1008
1009/// A Stream of incoming requests for fuchsia.kernel/CpuResource.
1010pub struct CpuResourceRequestStream {
1011    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1012    is_terminated: bool,
1013}
1014
1015impl std::marker::Unpin for CpuResourceRequestStream {}
1016
1017impl futures::stream::FusedStream for CpuResourceRequestStream {
1018    fn is_terminated(&self) -> bool {
1019        self.is_terminated
1020    }
1021}
1022
1023impl fidl::endpoints::RequestStream for CpuResourceRequestStream {
1024    type Protocol = CpuResourceMarker;
1025    type ControlHandle = CpuResourceControlHandle;
1026
1027    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1028        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1029    }
1030
1031    fn control_handle(&self) -> Self::ControlHandle {
1032        CpuResourceControlHandle { inner: self.inner.clone() }
1033    }
1034
1035    fn into_inner(
1036        self,
1037    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1038    {
1039        (self.inner, self.is_terminated)
1040    }
1041
1042    fn from_inner(
1043        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1044        is_terminated: bool,
1045    ) -> Self {
1046        Self { inner, is_terminated }
1047    }
1048}
1049
1050impl futures::Stream for CpuResourceRequestStream {
1051    type Item = Result<CpuResourceRequest, fidl::Error>;
1052
1053    fn poll_next(
1054        mut self: std::pin::Pin<&mut Self>,
1055        cx: &mut std::task::Context<'_>,
1056    ) -> std::task::Poll<Option<Self::Item>> {
1057        let this = &mut *self;
1058        if this.inner.check_shutdown(cx) {
1059            this.is_terminated = true;
1060            return std::task::Poll::Ready(None);
1061        }
1062        if this.is_terminated {
1063            panic!("polled CpuResourceRequestStream after completion");
1064        }
1065        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1066            |bytes, handles| {
1067                match this.inner.channel().read_etc(cx, bytes, handles) {
1068                    std::task::Poll::Ready(Ok(())) => {}
1069                    std::task::Poll::Pending => return std::task::Poll::Pending,
1070                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1071                        this.is_terminated = true;
1072                        return std::task::Poll::Ready(None);
1073                    }
1074                    std::task::Poll::Ready(Err(e)) => {
1075                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1076                            e.into(),
1077                        ))));
1078                    }
1079                }
1080
1081                // A message has been received from the channel
1082                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1083
1084                std::task::Poll::Ready(Some(match header.ordinal {
1085                    0x41e1103acf4215e4 => {
1086                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1087                        let mut req = fidl::new_empty!(
1088                            fidl::encoding::EmptyPayload,
1089                            fidl::encoding::DefaultFuchsiaResourceDialect
1090                        );
1091                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1092                        let control_handle = CpuResourceControlHandle { inner: this.inner.clone() };
1093                        Ok(CpuResourceRequest::Get {
1094                            responder: CpuResourceGetResponder {
1095                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1096                                tx_id: header.tx_id,
1097                            },
1098                        })
1099                    }
1100                    _ => Err(fidl::Error::UnknownOrdinal {
1101                        ordinal: header.ordinal,
1102                        protocol_name:
1103                            <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1104                    }),
1105                }))
1106            },
1107        )
1108    }
1109}
1110
1111/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
1112/// `ZX_RSRC_SYSTEM_CPU_BASE`.
1113#[derive(Debug)]
1114pub enum CpuResourceRequest {
1115    /// Get a CPU resource handle.
1116    Get { responder: CpuResourceGetResponder },
1117}
1118
1119impl CpuResourceRequest {
1120    #[allow(irrefutable_let_patterns)]
1121    pub fn into_get(self) -> Option<(CpuResourceGetResponder)> {
1122        if let CpuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
1123    }
1124
1125    /// Name of the method defined in FIDL
1126    pub fn method_name(&self) -> &'static str {
1127        match *self {
1128            CpuResourceRequest::Get { .. } => "get",
1129        }
1130    }
1131}
1132
1133#[derive(Debug, Clone)]
1134pub struct CpuResourceControlHandle {
1135    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1136}
1137
1138impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1139    fn shutdown(&self) {
1140        self.inner.shutdown()
1141    }
1142
1143    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1144        self.inner.shutdown_with_epitaph(status)
1145    }
1146
1147    fn is_closed(&self) -> bool {
1148        self.inner.channel().is_closed()
1149    }
1150    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1151        self.inner.channel().on_closed()
1152    }
1153
1154    #[cfg(target_os = "fuchsia")]
1155    fn signal_peer(
1156        &self,
1157        clear_mask: zx::Signals,
1158        set_mask: zx::Signals,
1159    ) -> Result<(), zx_status::Status> {
1160        use fidl::Peered;
1161        self.inner.channel().signal_peer(clear_mask, set_mask)
1162    }
1163}
1164
1165impl CpuResourceControlHandle {}
1166
1167#[must_use = "FIDL methods require a response to be sent"]
1168#[derive(Debug)]
1169pub struct CpuResourceGetResponder {
1170    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1171    tx_id: u32,
1172}
1173
1174/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1175/// if the responder is dropped without sending a response, so that the client
1176/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1177impl std::ops::Drop for CpuResourceGetResponder {
1178    fn drop(&mut self) {
1179        self.control_handle.shutdown();
1180        // Safety: drops once, never accessed again
1181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1182    }
1183}
1184
1185impl fidl::endpoints::Responder for CpuResourceGetResponder {
1186    type ControlHandle = CpuResourceControlHandle;
1187
1188    fn control_handle(&self) -> &CpuResourceControlHandle {
1189        &self.control_handle
1190    }
1191
1192    fn drop_without_shutdown(mut self) {
1193        // Safety: drops once, never accessed again due to mem::forget
1194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1195        // Prevent Drop from running (which would shut down the channel)
1196        std::mem::forget(self);
1197    }
1198}
1199
1200impl CpuResourceGetResponder {
1201    /// Sends a response to the FIDL transaction.
1202    ///
1203    /// Sets the channel to shutdown if an error occurs.
1204    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1205        let _result = self.send_raw(resource);
1206        if _result.is_err() {
1207            self.control_handle.shutdown();
1208        }
1209        self.drop_without_shutdown();
1210        _result
1211    }
1212
1213    /// Similar to "send" but does not shutdown the channel if an error occurs.
1214    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1215        let _result = self.send_raw(resource);
1216        self.drop_without_shutdown();
1217        _result
1218    }
1219
1220    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1221        self.control_handle.inner.send::<CpuResourceGetResponse>(
1222            (resource,),
1223            self.tx_id,
1224            0x41e1103acf4215e4,
1225            fidl::encoding::DynamicFlags::empty(),
1226        )
1227    }
1228}
1229
1230#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1231pub struct DebugBrokerMarker;
1232
1233impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1234    type Proxy = DebugBrokerProxy;
1235    type RequestStream = DebugBrokerRequestStream;
1236    #[cfg(target_os = "fuchsia")]
1237    type SynchronousProxy = DebugBrokerSynchronousProxy;
1238
1239    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1240}
1241impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1242
1243pub trait DebugBrokerProxyInterface: Send + Sync {
1244    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1245    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1246    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1247    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1248}
1249#[derive(Debug)]
1250#[cfg(target_os = "fuchsia")]
1251pub struct DebugBrokerSynchronousProxy {
1252    client: fidl::client::sync::Client,
1253}
1254
1255#[cfg(target_os = "fuchsia")]
1256impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1257    type Proxy = DebugBrokerProxy;
1258    type Protocol = DebugBrokerMarker;
1259
1260    fn from_channel(inner: fidl::Channel) -> Self {
1261        Self::new(inner)
1262    }
1263
1264    fn into_channel(self) -> fidl::Channel {
1265        self.client.into_channel()
1266    }
1267
1268    fn as_channel(&self) -> &fidl::Channel {
1269        self.client.as_channel()
1270    }
1271}
1272
1273#[cfg(target_os = "fuchsia")]
1274impl DebugBrokerSynchronousProxy {
1275    pub fn new(channel: fidl::Channel) -> Self {
1276        Self { client: fidl::client::sync::Client::new(channel) }
1277    }
1278
1279    pub fn into_channel(self) -> fidl::Channel {
1280        self.client.into_channel()
1281    }
1282
1283    /// Waits until an event arrives and returns it. It is safe for other
1284    /// threads to make concurrent requests while waiting for an event.
1285    pub fn wait_for_event(
1286        &self,
1287        deadline: zx::MonotonicInstant,
1288    ) -> Result<DebugBrokerEvent, fidl::Error> {
1289        DebugBrokerEvent::decode(self.client.wait_for_event::<DebugBrokerMarker>(deadline)?)
1290    }
1291
1292    /// Pass debug command through to the kernel shell.
1293    /// Look at zx_debug_send_command syscall handling to find valid values.
1294    pub fn r#send_debug_command(
1295        &self,
1296        mut command: &str,
1297        ___deadline: zx::MonotonicInstant,
1298    ) -> Result<i32, fidl::Error> {
1299        let _response = self.client.send_query::<
1300            DebugBrokerSendDebugCommandRequest,
1301            DebugBrokerSendDebugCommandResponse,
1302            DebugBrokerMarker,
1303        >(
1304            (command,),
1305            0x1ee270f83b5d6ff6,
1306            fidl::encoding::DynamicFlags::empty(),
1307            ___deadline,
1308        )?;
1309        Ok(_response.status)
1310    }
1311
1312    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1313    pub fn r#set_tracing_enabled(
1314        &self,
1315        mut enabled: bool,
1316        ___deadline: zx::MonotonicInstant,
1317    ) -> Result<i32, fidl::Error> {
1318        let _response = self.client.send_query::<
1319            DebugBrokerSetTracingEnabledRequest,
1320            DebugBrokerSetTracingEnabledResponse,
1321            DebugBrokerMarker,
1322        >(
1323            (enabled,),
1324            0x12e368d05329b30e,
1325            fidl::encoding::DynamicFlags::empty(),
1326            ___deadline,
1327        )?;
1328        Ok(_response.status)
1329    }
1330}
1331
1332#[cfg(target_os = "fuchsia")]
1333impl From<DebugBrokerSynchronousProxy> for zx::NullableHandle {
1334    fn from(value: DebugBrokerSynchronousProxy) -> Self {
1335        value.into_channel().into()
1336    }
1337}
1338
1339#[cfg(target_os = "fuchsia")]
1340impl From<fidl::Channel> for DebugBrokerSynchronousProxy {
1341    fn from(value: fidl::Channel) -> Self {
1342        Self::new(value)
1343    }
1344}
1345
1346#[cfg(target_os = "fuchsia")]
1347impl fidl::endpoints::FromClient for DebugBrokerSynchronousProxy {
1348    type Protocol = DebugBrokerMarker;
1349
1350    fn from_client(value: fidl::endpoints::ClientEnd<DebugBrokerMarker>) -> Self {
1351        Self::new(value.into_channel())
1352    }
1353}
1354
1355#[derive(Debug, Clone)]
1356pub struct DebugBrokerProxy {
1357    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1358}
1359
1360impl fidl::endpoints::Proxy for DebugBrokerProxy {
1361    type Protocol = DebugBrokerMarker;
1362
1363    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1364        Self::new(inner)
1365    }
1366
1367    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1368        self.client.into_channel().map_err(|client| Self { client })
1369    }
1370
1371    fn as_channel(&self) -> &::fidl::AsyncChannel {
1372        self.client.as_channel()
1373    }
1374}
1375
1376impl DebugBrokerProxy {
1377    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1378    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1379        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1380        Self { client: fidl::client::Client::new(channel, protocol_name) }
1381    }
1382
1383    /// Get a Stream of events from the remote end of the protocol.
1384    ///
1385    /// # Panics
1386    ///
1387    /// Panics if the event stream was already taken.
1388    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1389        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1390    }
1391
1392    /// Pass debug command through to the kernel shell.
1393    /// Look at zx_debug_send_command syscall handling to find valid values.
1394    pub fn r#send_debug_command(
1395        &self,
1396        mut command: &str,
1397    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1398        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1399    }
1400
1401    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1402    pub fn r#set_tracing_enabled(
1403        &self,
1404        mut enabled: bool,
1405    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1406        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1407    }
1408}
1409
1410impl DebugBrokerProxyInterface for DebugBrokerProxy {
1411    type SendDebugCommandResponseFut =
1412        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1413    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1414        fn _decode(
1415            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1416        ) -> Result<i32, fidl::Error> {
1417            let _response = fidl::client::decode_transaction_body::<
1418                DebugBrokerSendDebugCommandResponse,
1419                fidl::encoding::DefaultFuchsiaResourceDialect,
1420                0x1ee270f83b5d6ff6,
1421            >(_buf?)?;
1422            Ok(_response.status)
1423        }
1424        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1425            (command,),
1426            0x1ee270f83b5d6ff6,
1427            fidl::encoding::DynamicFlags::empty(),
1428            _decode,
1429        )
1430    }
1431
1432    type SetTracingEnabledResponseFut =
1433        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1434    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1435        fn _decode(
1436            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1437        ) -> Result<i32, fidl::Error> {
1438            let _response = fidl::client::decode_transaction_body::<
1439                DebugBrokerSetTracingEnabledResponse,
1440                fidl::encoding::DefaultFuchsiaResourceDialect,
1441                0x12e368d05329b30e,
1442            >(_buf?)?;
1443            Ok(_response.status)
1444        }
1445        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1446            (enabled,),
1447            0x12e368d05329b30e,
1448            fidl::encoding::DynamicFlags::empty(),
1449            _decode,
1450        )
1451    }
1452}
1453
1454pub struct DebugBrokerEventStream {
1455    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1456}
1457
1458impl std::marker::Unpin for DebugBrokerEventStream {}
1459
1460impl futures::stream::FusedStream for DebugBrokerEventStream {
1461    fn is_terminated(&self) -> bool {
1462        self.event_receiver.is_terminated()
1463    }
1464}
1465
1466impl futures::Stream for DebugBrokerEventStream {
1467    type Item = Result<DebugBrokerEvent, fidl::Error>;
1468
1469    fn poll_next(
1470        mut self: std::pin::Pin<&mut Self>,
1471        cx: &mut std::task::Context<'_>,
1472    ) -> std::task::Poll<Option<Self::Item>> {
1473        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1474            &mut self.event_receiver,
1475            cx
1476        )?) {
1477            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1478            None => std::task::Poll::Ready(None),
1479        }
1480    }
1481}
1482
1483#[derive(Debug)]
1484pub enum DebugBrokerEvent {}
1485
1486impl DebugBrokerEvent {
1487    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1488    fn decode(
1489        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1490    ) -> Result<DebugBrokerEvent, fidl::Error> {
1491        let (bytes, _handles) = buf.split_mut();
1492        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1493        debug_assert_eq!(tx_header.tx_id, 0);
1494        match tx_header.ordinal {
1495            _ => Err(fidl::Error::UnknownOrdinal {
1496                ordinal: tx_header.ordinal,
1497                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1498            }),
1499        }
1500    }
1501}
1502
1503/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1504pub struct DebugBrokerRequestStream {
1505    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1506    is_terminated: bool,
1507}
1508
1509impl std::marker::Unpin for DebugBrokerRequestStream {}
1510
1511impl futures::stream::FusedStream for DebugBrokerRequestStream {
1512    fn is_terminated(&self) -> bool {
1513        self.is_terminated
1514    }
1515}
1516
1517impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1518    type Protocol = DebugBrokerMarker;
1519    type ControlHandle = DebugBrokerControlHandle;
1520
1521    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1522        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1523    }
1524
1525    fn control_handle(&self) -> Self::ControlHandle {
1526        DebugBrokerControlHandle { inner: self.inner.clone() }
1527    }
1528
1529    fn into_inner(
1530        self,
1531    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1532    {
1533        (self.inner, self.is_terminated)
1534    }
1535
1536    fn from_inner(
1537        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1538        is_terminated: bool,
1539    ) -> Self {
1540        Self { inner, is_terminated }
1541    }
1542}
1543
1544impl futures::Stream for DebugBrokerRequestStream {
1545    type Item = Result<DebugBrokerRequest, fidl::Error>;
1546
1547    fn poll_next(
1548        mut self: std::pin::Pin<&mut Self>,
1549        cx: &mut std::task::Context<'_>,
1550    ) -> std::task::Poll<Option<Self::Item>> {
1551        let this = &mut *self;
1552        if this.inner.check_shutdown(cx) {
1553            this.is_terminated = true;
1554            return std::task::Poll::Ready(None);
1555        }
1556        if this.is_terminated {
1557            panic!("polled DebugBrokerRequestStream after completion");
1558        }
1559        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1560            |bytes, handles| {
1561                match this.inner.channel().read_etc(cx, bytes, handles) {
1562                    std::task::Poll::Ready(Ok(())) => {}
1563                    std::task::Poll::Pending => return std::task::Poll::Pending,
1564                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1565                        this.is_terminated = true;
1566                        return std::task::Poll::Ready(None);
1567                    }
1568                    std::task::Poll::Ready(Err(e)) => {
1569                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1570                            e.into(),
1571                        ))));
1572                    }
1573                }
1574
1575                // A message has been received from the channel
1576                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1577
1578                std::task::Poll::Ready(Some(match header.ordinal {
1579                    0x1ee270f83b5d6ff6 => {
1580                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1581                        let mut req = fidl::new_empty!(
1582                            DebugBrokerSendDebugCommandRequest,
1583                            fidl::encoding::DefaultFuchsiaResourceDialect
1584                        );
1585                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1586                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1587                        Ok(DebugBrokerRequest::SendDebugCommand {
1588                            command: req.command,
1589
1590                            responder: DebugBrokerSendDebugCommandResponder {
1591                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1592                                tx_id: header.tx_id,
1593                            },
1594                        })
1595                    }
1596                    0x12e368d05329b30e => {
1597                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1598                        let mut req = fidl::new_empty!(
1599                            DebugBrokerSetTracingEnabledRequest,
1600                            fidl::encoding::DefaultFuchsiaResourceDialect
1601                        );
1602                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1603                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1604                        Ok(DebugBrokerRequest::SetTracingEnabled {
1605                            enabled: req.enabled,
1606
1607                            responder: DebugBrokerSetTracingEnabledResponder {
1608                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1609                                tx_id: header.tx_id,
1610                            },
1611                        })
1612                    }
1613                    _ => Err(fidl::Error::UnknownOrdinal {
1614                        ordinal: header.ordinal,
1615                        protocol_name:
1616                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1617                    }),
1618                }))
1619            },
1620        )
1621    }
1622}
1623
1624/// Acts on behalf of the caller to interact with privileged debug system calls.
1625#[derive(Debug)]
1626pub enum DebugBrokerRequest {
1627    /// Pass debug command through to the kernel shell.
1628    /// Look at zx_debug_send_command syscall handling to find valid values.
1629    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1630    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1631    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1632}
1633
1634impl DebugBrokerRequest {
1635    #[allow(irrefutable_let_patterns)]
1636    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1637        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1638            Some((command, responder))
1639        } else {
1640            None
1641        }
1642    }
1643
1644    #[allow(irrefutable_let_patterns)]
1645    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1646        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1647            Some((enabled, responder))
1648        } else {
1649            None
1650        }
1651    }
1652
1653    /// Name of the method defined in FIDL
1654    pub fn method_name(&self) -> &'static str {
1655        match *self {
1656            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1657            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1658        }
1659    }
1660}
1661
1662#[derive(Debug, Clone)]
1663pub struct DebugBrokerControlHandle {
1664    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1665}
1666
1667impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1668    fn shutdown(&self) {
1669        self.inner.shutdown()
1670    }
1671
1672    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1673        self.inner.shutdown_with_epitaph(status)
1674    }
1675
1676    fn is_closed(&self) -> bool {
1677        self.inner.channel().is_closed()
1678    }
1679    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1680        self.inner.channel().on_closed()
1681    }
1682
1683    #[cfg(target_os = "fuchsia")]
1684    fn signal_peer(
1685        &self,
1686        clear_mask: zx::Signals,
1687        set_mask: zx::Signals,
1688    ) -> Result<(), zx_status::Status> {
1689        use fidl::Peered;
1690        self.inner.channel().signal_peer(clear_mask, set_mask)
1691    }
1692}
1693
1694impl DebugBrokerControlHandle {}
1695
1696#[must_use = "FIDL methods require a response to be sent"]
1697#[derive(Debug)]
1698pub struct DebugBrokerSendDebugCommandResponder {
1699    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1700    tx_id: u32,
1701}
1702
1703/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1704/// if the responder is dropped without sending a response, so that the client
1705/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1706impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1707    fn drop(&mut self) {
1708        self.control_handle.shutdown();
1709        // Safety: drops once, never accessed again
1710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1711    }
1712}
1713
1714impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1715    type ControlHandle = DebugBrokerControlHandle;
1716
1717    fn control_handle(&self) -> &DebugBrokerControlHandle {
1718        &self.control_handle
1719    }
1720
1721    fn drop_without_shutdown(mut self) {
1722        // Safety: drops once, never accessed again due to mem::forget
1723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1724        // Prevent Drop from running (which would shut down the channel)
1725        std::mem::forget(self);
1726    }
1727}
1728
1729impl DebugBrokerSendDebugCommandResponder {
1730    /// Sends a response to the FIDL transaction.
1731    ///
1732    /// Sets the channel to shutdown if an error occurs.
1733    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1734        let _result = self.send_raw(status);
1735        if _result.is_err() {
1736            self.control_handle.shutdown();
1737        }
1738        self.drop_without_shutdown();
1739        _result
1740    }
1741
1742    /// Similar to "send" but does not shutdown the channel if an error occurs.
1743    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1744        let _result = self.send_raw(status);
1745        self.drop_without_shutdown();
1746        _result
1747    }
1748
1749    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1750        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1751            (status,),
1752            self.tx_id,
1753            0x1ee270f83b5d6ff6,
1754            fidl::encoding::DynamicFlags::empty(),
1755        )
1756    }
1757}
1758
1759#[must_use = "FIDL methods require a response to be sent"]
1760#[derive(Debug)]
1761pub struct DebugBrokerSetTracingEnabledResponder {
1762    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1763    tx_id: u32,
1764}
1765
1766/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1767/// if the responder is dropped without sending a response, so that the client
1768/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1769impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1770    fn drop(&mut self) {
1771        self.control_handle.shutdown();
1772        // Safety: drops once, never accessed again
1773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1774    }
1775}
1776
1777impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1778    type ControlHandle = DebugBrokerControlHandle;
1779
1780    fn control_handle(&self) -> &DebugBrokerControlHandle {
1781        &self.control_handle
1782    }
1783
1784    fn drop_without_shutdown(mut self) {
1785        // Safety: drops once, never accessed again due to mem::forget
1786        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1787        // Prevent Drop from running (which would shut down the channel)
1788        std::mem::forget(self);
1789    }
1790}
1791
1792impl DebugBrokerSetTracingEnabledResponder {
1793    /// Sends a response to the FIDL transaction.
1794    ///
1795    /// Sets the channel to shutdown if an error occurs.
1796    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1797        let _result = self.send_raw(status);
1798        if _result.is_err() {
1799            self.control_handle.shutdown();
1800        }
1801        self.drop_without_shutdown();
1802        _result
1803    }
1804
1805    /// Similar to "send" but does not shutdown the channel if an error occurs.
1806    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1807        let _result = self.send_raw(status);
1808        self.drop_without_shutdown();
1809        _result
1810    }
1811
1812    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1813        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1814            (status,),
1815            self.tx_id,
1816            0x12e368d05329b30e,
1817            fidl::encoding::DynamicFlags::empty(),
1818        )
1819    }
1820}
1821
1822#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1823pub struct DebugResourceMarker;
1824
1825impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1826    type Proxy = DebugResourceProxy;
1827    type RequestStream = DebugResourceRequestStream;
1828    #[cfg(target_os = "fuchsia")]
1829    type SynchronousProxy = DebugResourceSynchronousProxy;
1830
1831    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1832}
1833impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1834
1835pub trait DebugResourceProxyInterface: Send + Sync {
1836    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1837    fn r#get(&self) -> Self::GetResponseFut;
1838}
1839#[derive(Debug)]
1840#[cfg(target_os = "fuchsia")]
1841pub struct DebugResourceSynchronousProxy {
1842    client: fidl::client::sync::Client,
1843}
1844
1845#[cfg(target_os = "fuchsia")]
1846impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1847    type Proxy = DebugResourceProxy;
1848    type Protocol = DebugResourceMarker;
1849
1850    fn from_channel(inner: fidl::Channel) -> Self {
1851        Self::new(inner)
1852    }
1853
1854    fn into_channel(self) -> fidl::Channel {
1855        self.client.into_channel()
1856    }
1857
1858    fn as_channel(&self) -> &fidl::Channel {
1859        self.client.as_channel()
1860    }
1861}
1862
1863#[cfg(target_os = "fuchsia")]
1864impl DebugResourceSynchronousProxy {
1865    pub fn new(channel: fidl::Channel) -> Self {
1866        Self { client: fidl::client::sync::Client::new(channel) }
1867    }
1868
1869    pub fn into_channel(self) -> fidl::Channel {
1870        self.client.into_channel()
1871    }
1872
1873    /// Waits until an event arrives and returns it. It is safe for other
1874    /// threads to make concurrent requests while waiting for an event.
1875    pub fn wait_for_event(
1876        &self,
1877        deadline: zx::MonotonicInstant,
1878    ) -> Result<DebugResourceEvent, fidl::Error> {
1879        DebugResourceEvent::decode(self.client.wait_for_event::<DebugResourceMarker>(deadline)?)
1880    }
1881
1882    /// Get a debug resource handle.
1883    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1884        let _response = self.client.send_query::<
1885            fidl::encoding::EmptyPayload,
1886            DebugResourceGetResponse,
1887            DebugResourceMarker,
1888        >(
1889            (),
1890            0x1d79d77ea12a6474,
1891            fidl::encoding::DynamicFlags::empty(),
1892            ___deadline,
1893        )?;
1894        Ok(_response.resource)
1895    }
1896}
1897
1898#[cfg(target_os = "fuchsia")]
1899impl From<DebugResourceSynchronousProxy> for zx::NullableHandle {
1900    fn from(value: DebugResourceSynchronousProxy) -> Self {
1901        value.into_channel().into()
1902    }
1903}
1904
1905#[cfg(target_os = "fuchsia")]
1906impl From<fidl::Channel> for DebugResourceSynchronousProxy {
1907    fn from(value: fidl::Channel) -> Self {
1908        Self::new(value)
1909    }
1910}
1911
1912#[cfg(target_os = "fuchsia")]
1913impl fidl::endpoints::FromClient for DebugResourceSynchronousProxy {
1914    type Protocol = DebugResourceMarker;
1915
1916    fn from_client(value: fidl::endpoints::ClientEnd<DebugResourceMarker>) -> Self {
1917        Self::new(value.into_channel())
1918    }
1919}
1920
1921#[derive(Debug, Clone)]
1922pub struct DebugResourceProxy {
1923    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1924}
1925
1926impl fidl::endpoints::Proxy for DebugResourceProxy {
1927    type Protocol = DebugResourceMarker;
1928
1929    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1930        Self::new(inner)
1931    }
1932
1933    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1934        self.client.into_channel().map_err(|client| Self { client })
1935    }
1936
1937    fn as_channel(&self) -> &::fidl::AsyncChannel {
1938        self.client.as_channel()
1939    }
1940}
1941
1942impl DebugResourceProxy {
1943    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1944    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1945        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1946        Self { client: fidl::client::Client::new(channel, protocol_name) }
1947    }
1948
1949    /// Get a Stream of events from the remote end of the protocol.
1950    ///
1951    /// # Panics
1952    ///
1953    /// Panics if the event stream was already taken.
1954    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1955        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1956    }
1957
1958    /// Get a debug resource handle.
1959    pub fn r#get(
1960        &self,
1961    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1962    {
1963        DebugResourceProxyInterface::r#get(self)
1964    }
1965}
1966
1967impl DebugResourceProxyInterface for DebugResourceProxy {
1968    type GetResponseFut = fidl::client::QueryResponseFut<
1969        fidl::Resource,
1970        fidl::encoding::DefaultFuchsiaResourceDialect,
1971    >;
1972    fn r#get(&self) -> Self::GetResponseFut {
1973        fn _decode(
1974            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1975        ) -> Result<fidl::Resource, fidl::Error> {
1976            let _response = fidl::client::decode_transaction_body::<
1977                DebugResourceGetResponse,
1978                fidl::encoding::DefaultFuchsiaResourceDialect,
1979                0x1d79d77ea12a6474,
1980            >(_buf?)?;
1981            Ok(_response.resource)
1982        }
1983        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
1984            (),
1985            0x1d79d77ea12a6474,
1986            fidl::encoding::DynamicFlags::empty(),
1987            _decode,
1988        )
1989    }
1990}
1991
1992pub struct DebugResourceEventStream {
1993    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1994}
1995
1996impl std::marker::Unpin for DebugResourceEventStream {}
1997
1998impl futures::stream::FusedStream for DebugResourceEventStream {
1999    fn is_terminated(&self) -> bool {
2000        self.event_receiver.is_terminated()
2001    }
2002}
2003
2004impl futures::Stream for DebugResourceEventStream {
2005    type Item = Result<DebugResourceEvent, fidl::Error>;
2006
2007    fn poll_next(
2008        mut self: std::pin::Pin<&mut Self>,
2009        cx: &mut std::task::Context<'_>,
2010    ) -> std::task::Poll<Option<Self::Item>> {
2011        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2012            &mut self.event_receiver,
2013            cx
2014        )?) {
2015            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
2016            None => std::task::Poll::Ready(None),
2017        }
2018    }
2019}
2020
2021#[derive(Debug)]
2022pub enum DebugResourceEvent {}
2023
2024impl DebugResourceEvent {
2025    /// Decodes a message buffer as a [`DebugResourceEvent`].
2026    fn decode(
2027        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2028    ) -> Result<DebugResourceEvent, fidl::Error> {
2029        let (bytes, _handles) = buf.split_mut();
2030        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2031        debug_assert_eq!(tx_header.tx_id, 0);
2032        match tx_header.ordinal {
2033            _ => Err(fidl::Error::UnknownOrdinal {
2034                ordinal: tx_header.ordinal,
2035                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2036            }),
2037        }
2038    }
2039}
2040
2041/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
2042pub struct DebugResourceRequestStream {
2043    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2044    is_terminated: bool,
2045}
2046
2047impl std::marker::Unpin for DebugResourceRequestStream {}
2048
2049impl futures::stream::FusedStream for DebugResourceRequestStream {
2050    fn is_terminated(&self) -> bool {
2051        self.is_terminated
2052    }
2053}
2054
2055impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
2056    type Protocol = DebugResourceMarker;
2057    type ControlHandle = DebugResourceControlHandle;
2058
2059    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2060        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2061    }
2062
2063    fn control_handle(&self) -> Self::ControlHandle {
2064        DebugResourceControlHandle { inner: self.inner.clone() }
2065    }
2066
2067    fn into_inner(
2068        self,
2069    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2070    {
2071        (self.inner, self.is_terminated)
2072    }
2073
2074    fn from_inner(
2075        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2076        is_terminated: bool,
2077    ) -> Self {
2078        Self { inner, is_terminated }
2079    }
2080}
2081
2082impl futures::Stream for DebugResourceRequestStream {
2083    type Item = Result<DebugResourceRequest, fidl::Error>;
2084
2085    fn poll_next(
2086        mut self: std::pin::Pin<&mut Self>,
2087        cx: &mut std::task::Context<'_>,
2088    ) -> std::task::Poll<Option<Self::Item>> {
2089        let this = &mut *self;
2090        if this.inner.check_shutdown(cx) {
2091            this.is_terminated = true;
2092            return std::task::Poll::Ready(None);
2093        }
2094        if this.is_terminated {
2095            panic!("polled DebugResourceRequestStream after completion");
2096        }
2097        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2098            |bytes, handles| {
2099                match this.inner.channel().read_etc(cx, bytes, handles) {
2100                    std::task::Poll::Ready(Ok(())) => {}
2101                    std::task::Poll::Pending => return std::task::Poll::Pending,
2102                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2103                        this.is_terminated = true;
2104                        return std::task::Poll::Ready(None);
2105                    }
2106                    std::task::Poll::Ready(Err(e)) => {
2107                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2108                            e.into(),
2109                        ))));
2110                    }
2111                }
2112
2113                // A message has been received from the channel
2114                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2115
2116                std::task::Poll::Ready(Some(match header.ordinal {
2117                    0x1d79d77ea12a6474 => {
2118                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2119                        let mut req = fidl::new_empty!(
2120                            fidl::encoding::EmptyPayload,
2121                            fidl::encoding::DefaultFuchsiaResourceDialect
2122                        );
2123                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2124                        let control_handle =
2125                            DebugResourceControlHandle { inner: this.inner.clone() };
2126                        Ok(DebugResourceRequest::Get {
2127                            responder: DebugResourceGetResponder {
2128                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2129                                tx_id: header.tx_id,
2130                            },
2131                        })
2132                    }
2133                    _ => Err(fidl::Error::UnknownOrdinal {
2134                        ordinal: header.ordinal,
2135                        protocol_name:
2136                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2137                    }),
2138                }))
2139            },
2140        )
2141    }
2142}
2143
2144/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2145/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2146#[derive(Debug)]
2147pub enum DebugResourceRequest {
2148    /// Get a debug resource handle.
2149    Get { responder: DebugResourceGetResponder },
2150}
2151
2152impl DebugResourceRequest {
2153    #[allow(irrefutable_let_patterns)]
2154    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2155        if let DebugResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2156    }
2157
2158    /// Name of the method defined in FIDL
2159    pub fn method_name(&self) -> &'static str {
2160        match *self {
2161            DebugResourceRequest::Get { .. } => "get",
2162        }
2163    }
2164}
2165
2166#[derive(Debug, Clone)]
2167pub struct DebugResourceControlHandle {
2168    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2169}
2170
2171impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2172    fn shutdown(&self) {
2173        self.inner.shutdown()
2174    }
2175
2176    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2177        self.inner.shutdown_with_epitaph(status)
2178    }
2179
2180    fn is_closed(&self) -> bool {
2181        self.inner.channel().is_closed()
2182    }
2183    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2184        self.inner.channel().on_closed()
2185    }
2186
2187    #[cfg(target_os = "fuchsia")]
2188    fn signal_peer(
2189        &self,
2190        clear_mask: zx::Signals,
2191        set_mask: zx::Signals,
2192    ) -> Result<(), zx_status::Status> {
2193        use fidl::Peered;
2194        self.inner.channel().signal_peer(clear_mask, set_mask)
2195    }
2196}
2197
2198impl DebugResourceControlHandle {}
2199
2200#[must_use = "FIDL methods require a response to be sent"]
2201#[derive(Debug)]
2202pub struct DebugResourceGetResponder {
2203    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2204    tx_id: u32,
2205}
2206
2207/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2208/// if the responder is dropped without sending a response, so that the client
2209/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2210impl std::ops::Drop for DebugResourceGetResponder {
2211    fn drop(&mut self) {
2212        self.control_handle.shutdown();
2213        // Safety: drops once, never accessed again
2214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2215    }
2216}
2217
2218impl fidl::endpoints::Responder for DebugResourceGetResponder {
2219    type ControlHandle = DebugResourceControlHandle;
2220
2221    fn control_handle(&self) -> &DebugResourceControlHandle {
2222        &self.control_handle
2223    }
2224
2225    fn drop_without_shutdown(mut self) {
2226        // Safety: drops once, never accessed again due to mem::forget
2227        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2228        // Prevent Drop from running (which would shut down the channel)
2229        std::mem::forget(self);
2230    }
2231}
2232
2233impl DebugResourceGetResponder {
2234    /// Sends a response to the FIDL transaction.
2235    ///
2236    /// Sets the channel to shutdown if an error occurs.
2237    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2238        let _result = self.send_raw(resource);
2239        if _result.is_err() {
2240            self.control_handle.shutdown();
2241        }
2242        self.drop_without_shutdown();
2243        _result
2244    }
2245
2246    /// Similar to "send" but does not shutdown the channel if an error occurs.
2247    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2248        let _result = self.send_raw(resource);
2249        self.drop_without_shutdown();
2250        _result
2251    }
2252
2253    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2254        self.control_handle.inner.send::<DebugResourceGetResponse>(
2255            (resource,),
2256            self.tx_id,
2257            0x1d79d77ea12a6474,
2258            fidl::encoding::DynamicFlags::empty(),
2259        )
2260    }
2261}
2262
2263#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2264pub struct DebuglogResourceMarker;
2265
2266impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2267    type Proxy = DebuglogResourceProxy;
2268    type RequestStream = DebuglogResourceRequestStream;
2269    #[cfg(target_os = "fuchsia")]
2270    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2271
2272    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2273}
2274impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2275
2276pub trait DebuglogResourceProxyInterface: Send + Sync {
2277    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2278    fn r#get(&self) -> Self::GetResponseFut;
2279}
2280#[derive(Debug)]
2281#[cfg(target_os = "fuchsia")]
2282pub struct DebuglogResourceSynchronousProxy {
2283    client: fidl::client::sync::Client,
2284}
2285
2286#[cfg(target_os = "fuchsia")]
2287impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2288    type Proxy = DebuglogResourceProxy;
2289    type Protocol = DebuglogResourceMarker;
2290
2291    fn from_channel(inner: fidl::Channel) -> Self {
2292        Self::new(inner)
2293    }
2294
2295    fn into_channel(self) -> fidl::Channel {
2296        self.client.into_channel()
2297    }
2298
2299    fn as_channel(&self) -> &fidl::Channel {
2300        self.client.as_channel()
2301    }
2302}
2303
2304#[cfg(target_os = "fuchsia")]
2305impl DebuglogResourceSynchronousProxy {
2306    pub fn new(channel: fidl::Channel) -> Self {
2307        Self { client: fidl::client::sync::Client::new(channel) }
2308    }
2309
2310    pub fn into_channel(self) -> fidl::Channel {
2311        self.client.into_channel()
2312    }
2313
2314    /// Waits until an event arrives and returns it. It is safe for other
2315    /// threads to make concurrent requests while waiting for an event.
2316    pub fn wait_for_event(
2317        &self,
2318        deadline: zx::MonotonicInstant,
2319    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2320        DebuglogResourceEvent::decode(
2321            self.client.wait_for_event::<DebuglogResourceMarker>(deadline)?,
2322        )
2323    }
2324
2325    /// Get a debuglog resource handle.
2326    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2327        let _response = self.client.send_query::<
2328            fidl::encoding::EmptyPayload,
2329            DebuglogResourceGetResponse,
2330            DebuglogResourceMarker,
2331        >(
2332            (),
2333            0x6e78c1ff74765225,
2334            fidl::encoding::DynamicFlags::empty(),
2335            ___deadline,
2336        )?;
2337        Ok(_response.resource)
2338    }
2339}
2340
2341#[cfg(target_os = "fuchsia")]
2342impl From<DebuglogResourceSynchronousProxy> for zx::NullableHandle {
2343    fn from(value: DebuglogResourceSynchronousProxy) -> Self {
2344        value.into_channel().into()
2345    }
2346}
2347
2348#[cfg(target_os = "fuchsia")]
2349impl From<fidl::Channel> for DebuglogResourceSynchronousProxy {
2350    fn from(value: fidl::Channel) -> Self {
2351        Self::new(value)
2352    }
2353}
2354
2355#[cfg(target_os = "fuchsia")]
2356impl fidl::endpoints::FromClient for DebuglogResourceSynchronousProxy {
2357    type Protocol = DebuglogResourceMarker;
2358
2359    fn from_client(value: fidl::endpoints::ClientEnd<DebuglogResourceMarker>) -> Self {
2360        Self::new(value.into_channel())
2361    }
2362}
2363
2364#[derive(Debug, Clone)]
2365pub struct DebuglogResourceProxy {
2366    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2367}
2368
2369impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2370    type Protocol = DebuglogResourceMarker;
2371
2372    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2373        Self::new(inner)
2374    }
2375
2376    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2377        self.client.into_channel().map_err(|client| Self { client })
2378    }
2379
2380    fn as_channel(&self) -> &::fidl::AsyncChannel {
2381        self.client.as_channel()
2382    }
2383}
2384
2385impl DebuglogResourceProxy {
2386    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2387    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2388        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2389        Self { client: fidl::client::Client::new(channel, protocol_name) }
2390    }
2391
2392    /// Get a Stream of events from the remote end of the protocol.
2393    ///
2394    /// # Panics
2395    ///
2396    /// Panics if the event stream was already taken.
2397    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2398        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2399    }
2400
2401    /// Get a debuglog resource handle.
2402    pub fn r#get(
2403        &self,
2404    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2405    {
2406        DebuglogResourceProxyInterface::r#get(self)
2407    }
2408}
2409
2410impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2411    type GetResponseFut = fidl::client::QueryResponseFut<
2412        fidl::Resource,
2413        fidl::encoding::DefaultFuchsiaResourceDialect,
2414    >;
2415    fn r#get(&self) -> Self::GetResponseFut {
2416        fn _decode(
2417            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2418        ) -> Result<fidl::Resource, fidl::Error> {
2419            let _response = fidl::client::decode_transaction_body::<
2420                DebuglogResourceGetResponse,
2421                fidl::encoding::DefaultFuchsiaResourceDialect,
2422                0x6e78c1ff74765225,
2423            >(_buf?)?;
2424            Ok(_response.resource)
2425        }
2426        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2427            (),
2428            0x6e78c1ff74765225,
2429            fidl::encoding::DynamicFlags::empty(),
2430            _decode,
2431        )
2432    }
2433}
2434
2435pub struct DebuglogResourceEventStream {
2436    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2437}
2438
2439impl std::marker::Unpin for DebuglogResourceEventStream {}
2440
2441impl futures::stream::FusedStream for DebuglogResourceEventStream {
2442    fn is_terminated(&self) -> bool {
2443        self.event_receiver.is_terminated()
2444    }
2445}
2446
2447impl futures::Stream for DebuglogResourceEventStream {
2448    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2449
2450    fn poll_next(
2451        mut self: std::pin::Pin<&mut Self>,
2452        cx: &mut std::task::Context<'_>,
2453    ) -> std::task::Poll<Option<Self::Item>> {
2454        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2455            &mut self.event_receiver,
2456            cx
2457        )?) {
2458            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2459            None => std::task::Poll::Ready(None),
2460        }
2461    }
2462}
2463
2464#[derive(Debug)]
2465pub enum DebuglogResourceEvent {}
2466
2467impl DebuglogResourceEvent {
2468    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2469    fn decode(
2470        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2471    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2472        let (bytes, _handles) = buf.split_mut();
2473        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2474        debug_assert_eq!(tx_header.tx_id, 0);
2475        match tx_header.ordinal {
2476            _ => Err(fidl::Error::UnknownOrdinal {
2477                ordinal: tx_header.ordinal,
2478                protocol_name:
2479                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2480            }),
2481        }
2482    }
2483}
2484
2485/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2486pub struct DebuglogResourceRequestStream {
2487    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2488    is_terminated: bool,
2489}
2490
2491impl std::marker::Unpin for DebuglogResourceRequestStream {}
2492
2493impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2494    fn is_terminated(&self) -> bool {
2495        self.is_terminated
2496    }
2497}
2498
2499impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2500    type Protocol = DebuglogResourceMarker;
2501    type ControlHandle = DebuglogResourceControlHandle;
2502
2503    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2504        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2505    }
2506
2507    fn control_handle(&self) -> Self::ControlHandle {
2508        DebuglogResourceControlHandle { inner: self.inner.clone() }
2509    }
2510
2511    fn into_inner(
2512        self,
2513    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2514    {
2515        (self.inner, self.is_terminated)
2516    }
2517
2518    fn from_inner(
2519        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2520        is_terminated: bool,
2521    ) -> Self {
2522        Self { inner, is_terminated }
2523    }
2524}
2525
2526impl futures::Stream for DebuglogResourceRequestStream {
2527    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2528
2529    fn poll_next(
2530        mut self: std::pin::Pin<&mut Self>,
2531        cx: &mut std::task::Context<'_>,
2532    ) -> std::task::Poll<Option<Self::Item>> {
2533        let this = &mut *self;
2534        if this.inner.check_shutdown(cx) {
2535            this.is_terminated = true;
2536            return std::task::Poll::Ready(None);
2537        }
2538        if this.is_terminated {
2539            panic!("polled DebuglogResourceRequestStream after completion");
2540        }
2541        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2542            |bytes, handles| {
2543                match this.inner.channel().read_etc(cx, bytes, handles) {
2544                    std::task::Poll::Ready(Ok(())) => {}
2545                    std::task::Poll::Pending => return std::task::Poll::Pending,
2546                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2547                        this.is_terminated = true;
2548                        return std::task::Poll::Ready(None);
2549                    }
2550                    std::task::Poll::Ready(Err(e)) => {
2551                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2552                            e.into(),
2553                        ))));
2554                    }
2555                }
2556
2557                // A message has been received from the channel
2558                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2559
2560                std::task::Poll::Ready(Some(match header.ordinal {
2561                    0x6e78c1ff74765225 => {
2562                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2563                        let mut req = fidl::new_empty!(
2564                            fidl::encoding::EmptyPayload,
2565                            fidl::encoding::DefaultFuchsiaResourceDialect
2566                        );
2567                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2568                        let control_handle =
2569                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2570                        Ok(DebuglogResourceRequest::Get {
2571                            responder: DebuglogResourceGetResponder {
2572                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2573                                tx_id: header.tx_id,
2574                            },
2575                        })
2576                    }
2577                    _ => Err(fidl::Error::UnknownOrdinal {
2578                        ordinal: header.ordinal,
2579                        protocol_name:
2580                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2581                    }),
2582                }))
2583            },
2584        )
2585    }
2586}
2587
2588/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2589/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2590#[derive(Debug)]
2591pub enum DebuglogResourceRequest {
2592    /// Get a debuglog resource handle.
2593    Get { responder: DebuglogResourceGetResponder },
2594}
2595
2596impl DebuglogResourceRequest {
2597    #[allow(irrefutable_let_patterns)]
2598    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2599        if let DebuglogResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2600    }
2601
2602    /// Name of the method defined in FIDL
2603    pub fn method_name(&self) -> &'static str {
2604        match *self {
2605            DebuglogResourceRequest::Get { .. } => "get",
2606        }
2607    }
2608}
2609
2610#[derive(Debug, Clone)]
2611pub struct DebuglogResourceControlHandle {
2612    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2613}
2614
2615impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2616    fn shutdown(&self) {
2617        self.inner.shutdown()
2618    }
2619
2620    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2621        self.inner.shutdown_with_epitaph(status)
2622    }
2623
2624    fn is_closed(&self) -> bool {
2625        self.inner.channel().is_closed()
2626    }
2627    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2628        self.inner.channel().on_closed()
2629    }
2630
2631    #[cfg(target_os = "fuchsia")]
2632    fn signal_peer(
2633        &self,
2634        clear_mask: zx::Signals,
2635        set_mask: zx::Signals,
2636    ) -> Result<(), zx_status::Status> {
2637        use fidl::Peered;
2638        self.inner.channel().signal_peer(clear_mask, set_mask)
2639    }
2640}
2641
2642impl DebuglogResourceControlHandle {}
2643
2644#[must_use = "FIDL methods require a response to be sent"]
2645#[derive(Debug)]
2646pub struct DebuglogResourceGetResponder {
2647    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2648    tx_id: u32,
2649}
2650
2651/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2652/// if the responder is dropped without sending a response, so that the client
2653/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2654impl std::ops::Drop for DebuglogResourceGetResponder {
2655    fn drop(&mut self) {
2656        self.control_handle.shutdown();
2657        // Safety: drops once, never accessed again
2658        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2659    }
2660}
2661
2662impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2663    type ControlHandle = DebuglogResourceControlHandle;
2664
2665    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2666        &self.control_handle
2667    }
2668
2669    fn drop_without_shutdown(mut self) {
2670        // Safety: drops once, never accessed again due to mem::forget
2671        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2672        // Prevent Drop from running (which would shut down the channel)
2673        std::mem::forget(self);
2674    }
2675}
2676
2677impl DebuglogResourceGetResponder {
2678    /// Sends a response to the FIDL transaction.
2679    ///
2680    /// Sets the channel to shutdown if an error occurs.
2681    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2682        let _result = self.send_raw(resource);
2683        if _result.is_err() {
2684            self.control_handle.shutdown();
2685        }
2686        self.drop_without_shutdown();
2687        _result
2688    }
2689
2690    /// Similar to "send" but does not shutdown the channel if an error occurs.
2691    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2692        let _result = self.send_raw(resource);
2693        self.drop_without_shutdown();
2694        _result
2695    }
2696
2697    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2698        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2699            (resource,),
2700            self.tx_id,
2701            0x6e78c1ff74765225,
2702            fidl::encoding::DynamicFlags::empty(),
2703        )
2704    }
2705}
2706
2707#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2708pub struct EnergyInfoResourceMarker;
2709
2710impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2711    type Proxy = EnergyInfoResourceProxy;
2712    type RequestStream = EnergyInfoResourceRequestStream;
2713    #[cfg(target_os = "fuchsia")]
2714    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2715
2716    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2717}
2718impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2719
2720pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2721    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2722    fn r#get(&self) -> Self::GetResponseFut;
2723}
2724#[derive(Debug)]
2725#[cfg(target_os = "fuchsia")]
2726pub struct EnergyInfoResourceSynchronousProxy {
2727    client: fidl::client::sync::Client,
2728}
2729
2730#[cfg(target_os = "fuchsia")]
2731impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2732    type Proxy = EnergyInfoResourceProxy;
2733    type Protocol = EnergyInfoResourceMarker;
2734
2735    fn from_channel(inner: fidl::Channel) -> Self {
2736        Self::new(inner)
2737    }
2738
2739    fn into_channel(self) -> fidl::Channel {
2740        self.client.into_channel()
2741    }
2742
2743    fn as_channel(&self) -> &fidl::Channel {
2744        self.client.as_channel()
2745    }
2746}
2747
2748#[cfg(target_os = "fuchsia")]
2749impl EnergyInfoResourceSynchronousProxy {
2750    pub fn new(channel: fidl::Channel) -> Self {
2751        Self { client: fidl::client::sync::Client::new(channel) }
2752    }
2753
2754    pub fn into_channel(self) -> fidl::Channel {
2755        self.client.into_channel()
2756    }
2757
2758    /// Waits until an event arrives and returns it. It is safe for other
2759    /// threads to make concurrent requests while waiting for an event.
2760    pub fn wait_for_event(
2761        &self,
2762        deadline: zx::MonotonicInstant,
2763    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2764        EnergyInfoResourceEvent::decode(
2765            self.client.wait_for_event::<EnergyInfoResourceMarker>(deadline)?,
2766        )
2767    }
2768
2769    /// Get an EnergyInfo resource handle.
2770    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2771        let _response = self.client.send_query::<
2772            fidl::encoding::EmptyPayload,
2773            EnergyInfoResourceGetResponse,
2774            EnergyInfoResourceMarker,
2775        >(
2776            (),
2777            0x5f5cc9f0745f61d0,
2778            fidl::encoding::DynamicFlags::empty(),
2779            ___deadline,
2780        )?;
2781        Ok(_response.resource)
2782    }
2783}
2784
2785#[cfg(target_os = "fuchsia")]
2786impl From<EnergyInfoResourceSynchronousProxy> for zx::NullableHandle {
2787    fn from(value: EnergyInfoResourceSynchronousProxy) -> Self {
2788        value.into_channel().into()
2789    }
2790}
2791
2792#[cfg(target_os = "fuchsia")]
2793impl From<fidl::Channel> for EnergyInfoResourceSynchronousProxy {
2794    fn from(value: fidl::Channel) -> Self {
2795        Self::new(value)
2796    }
2797}
2798
2799#[cfg(target_os = "fuchsia")]
2800impl fidl::endpoints::FromClient for EnergyInfoResourceSynchronousProxy {
2801    type Protocol = EnergyInfoResourceMarker;
2802
2803    fn from_client(value: fidl::endpoints::ClientEnd<EnergyInfoResourceMarker>) -> Self {
2804        Self::new(value.into_channel())
2805    }
2806}
2807
2808#[derive(Debug, Clone)]
2809pub struct EnergyInfoResourceProxy {
2810    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2811}
2812
2813impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2814    type Protocol = EnergyInfoResourceMarker;
2815
2816    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2817        Self::new(inner)
2818    }
2819
2820    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2821        self.client.into_channel().map_err(|client| Self { client })
2822    }
2823
2824    fn as_channel(&self) -> &::fidl::AsyncChannel {
2825        self.client.as_channel()
2826    }
2827}
2828
2829impl EnergyInfoResourceProxy {
2830    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2831    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2832        let protocol_name =
2833            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2834        Self { client: fidl::client::Client::new(channel, protocol_name) }
2835    }
2836
2837    /// Get a Stream of events from the remote end of the protocol.
2838    ///
2839    /// # Panics
2840    ///
2841    /// Panics if the event stream was already taken.
2842    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2843        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2844    }
2845
2846    /// Get an EnergyInfo resource handle.
2847    pub fn r#get(
2848        &self,
2849    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2850    {
2851        EnergyInfoResourceProxyInterface::r#get(self)
2852    }
2853}
2854
2855impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2856    type GetResponseFut = fidl::client::QueryResponseFut<
2857        fidl::Resource,
2858        fidl::encoding::DefaultFuchsiaResourceDialect,
2859    >;
2860    fn r#get(&self) -> Self::GetResponseFut {
2861        fn _decode(
2862            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2863        ) -> Result<fidl::Resource, fidl::Error> {
2864            let _response = fidl::client::decode_transaction_body::<
2865                EnergyInfoResourceGetResponse,
2866                fidl::encoding::DefaultFuchsiaResourceDialect,
2867                0x5f5cc9f0745f61d0,
2868            >(_buf?)?;
2869            Ok(_response.resource)
2870        }
2871        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2872            (),
2873            0x5f5cc9f0745f61d0,
2874            fidl::encoding::DynamicFlags::empty(),
2875            _decode,
2876        )
2877    }
2878}
2879
2880pub struct EnergyInfoResourceEventStream {
2881    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2882}
2883
2884impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2885
2886impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2887    fn is_terminated(&self) -> bool {
2888        self.event_receiver.is_terminated()
2889    }
2890}
2891
2892impl futures::Stream for EnergyInfoResourceEventStream {
2893    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2894
2895    fn poll_next(
2896        mut self: std::pin::Pin<&mut Self>,
2897        cx: &mut std::task::Context<'_>,
2898    ) -> std::task::Poll<Option<Self::Item>> {
2899        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2900            &mut self.event_receiver,
2901            cx
2902        )?) {
2903            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2904            None => std::task::Poll::Ready(None),
2905        }
2906    }
2907}
2908
2909#[derive(Debug)]
2910pub enum EnergyInfoResourceEvent {}
2911
2912impl EnergyInfoResourceEvent {
2913    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2914    fn decode(
2915        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2916    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2917        let (bytes, _handles) = buf.split_mut();
2918        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2919        debug_assert_eq!(tx_header.tx_id, 0);
2920        match tx_header.ordinal {
2921            _ => Err(fidl::Error::UnknownOrdinal {
2922                ordinal: tx_header.ordinal,
2923                protocol_name:
2924                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2925            }),
2926        }
2927    }
2928}
2929
2930/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2931pub struct EnergyInfoResourceRequestStream {
2932    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2933    is_terminated: bool,
2934}
2935
2936impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2937
2938impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2939    fn is_terminated(&self) -> bool {
2940        self.is_terminated
2941    }
2942}
2943
2944impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2945    type Protocol = EnergyInfoResourceMarker;
2946    type ControlHandle = EnergyInfoResourceControlHandle;
2947
2948    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2949        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2950    }
2951
2952    fn control_handle(&self) -> Self::ControlHandle {
2953        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2954    }
2955
2956    fn into_inner(
2957        self,
2958    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2959    {
2960        (self.inner, self.is_terminated)
2961    }
2962
2963    fn from_inner(
2964        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2965        is_terminated: bool,
2966    ) -> Self {
2967        Self { inner, is_terminated }
2968    }
2969}
2970
2971impl futures::Stream for EnergyInfoResourceRequestStream {
2972    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
2973
2974    fn poll_next(
2975        mut self: std::pin::Pin<&mut Self>,
2976        cx: &mut std::task::Context<'_>,
2977    ) -> std::task::Poll<Option<Self::Item>> {
2978        let this = &mut *self;
2979        if this.inner.check_shutdown(cx) {
2980            this.is_terminated = true;
2981            return std::task::Poll::Ready(None);
2982        }
2983        if this.is_terminated {
2984            panic!("polled EnergyInfoResourceRequestStream after completion");
2985        }
2986        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2987            |bytes, handles| {
2988                match this.inner.channel().read_etc(cx, bytes, handles) {
2989                    std::task::Poll::Ready(Ok(())) => {}
2990                    std::task::Poll::Pending => return std::task::Poll::Pending,
2991                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2992                        this.is_terminated = true;
2993                        return std::task::Poll::Ready(None);
2994                    }
2995                    std::task::Poll::Ready(Err(e)) => {
2996                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2997                            e.into(),
2998                        ))));
2999                    }
3000                }
3001
3002                // A message has been received from the channel
3003                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3004
3005                std::task::Poll::Ready(Some(match header.ordinal {
3006                0x5f5cc9f0745f61d0 => {
3007                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3008                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3009                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3010                    let control_handle = EnergyInfoResourceControlHandle {
3011                        inner: this.inner.clone(),
3012                    };
3013                    Ok(EnergyInfoResourceRequest::Get {
3014                        responder: EnergyInfoResourceGetResponder {
3015                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3016                            tx_id: header.tx_id,
3017                        },
3018                    })
3019                }
3020                _ => Err(fidl::Error::UnknownOrdinal {
3021                    ordinal: header.ordinal,
3022                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3023                }),
3024            }))
3025            },
3026        )
3027    }
3028}
3029
3030/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3031/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
3032#[derive(Debug)]
3033pub enum EnergyInfoResourceRequest {
3034    /// Get an EnergyInfo resource handle.
3035    Get { responder: EnergyInfoResourceGetResponder },
3036}
3037
3038impl EnergyInfoResourceRequest {
3039    #[allow(irrefutable_let_patterns)]
3040    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
3041        if let EnergyInfoResourceRequest::Get { responder } = self {
3042            Some((responder))
3043        } else {
3044            None
3045        }
3046    }
3047
3048    /// Name of the method defined in FIDL
3049    pub fn method_name(&self) -> &'static str {
3050        match *self {
3051            EnergyInfoResourceRequest::Get { .. } => "get",
3052        }
3053    }
3054}
3055
3056#[derive(Debug, Clone)]
3057pub struct EnergyInfoResourceControlHandle {
3058    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3059}
3060
3061impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
3062    fn shutdown(&self) {
3063        self.inner.shutdown()
3064    }
3065
3066    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3067        self.inner.shutdown_with_epitaph(status)
3068    }
3069
3070    fn is_closed(&self) -> bool {
3071        self.inner.channel().is_closed()
3072    }
3073    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3074        self.inner.channel().on_closed()
3075    }
3076
3077    #[cfg(target_os = "fuchsia")]
3078    fn signal_peer(
3079        &self,
3080        clear_mask: zx::Signals,
3081        set_mask: zx::Signals,
3082    ) -> Result<(), zx_status::Status> {
3083        use fidl::Peered;
3084        self.inner.channel().signal_peer(clear_mask, set_mask)
3085    }
3086}
3087
3088impl EnergyInfoResourceControlHandle {}
3089
3090#[must_use = "FIDL methods require a response to be sent"]
3091#[derive(Debug)]
3092pub struct EnergyInfoResourceGetResponder {
3093    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
3094    tx_id: u32,
3095}
3096
3097/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
3098/// if the responder is dropped without sending a response, so that the client
3099/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3100impl std::ops::Drop for EnergyInfoResourceGetResponder {
3101    fn drop(&mut self) {
3102        self.control_handle.shutdown();
3103        // Safety: drops once, never accessed again
3104        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3105    }
3106}
3107
3108impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
3109    type ControlHandle = EnergyInfoResourceControlHandle;
3110
3111    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
3112        &self.control_handle
3113    }
3114
3115    fn drop_without_shutdown(mut self) {
3116        // Safety: drops once, never accessed again due to mem::forget
3117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3118        // Prevent Drop from running (which would shut down the channel)
3119        std::mem::forget(self);
3120    }
3121}
3122
3123impl EnergyInfoResourceGetResponder {
3124    /// Sends a response to the FIDL transaction.
3125    ///
3126    /// Sets the channel to shutdown if an error occurs.
3127    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3128        let _result = self.send_raw(resource);
3129        if _result.is_err() {
3130            self.control_handle.shutdown();
3131        }
3132        self.drop_without_shutdown();
3133        _result
3134    }
3135
3136    /// Similar to "send" but does not shutdown the channel if an error occurs.
3137    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3138        let _result = self.send_raw(resource);
3139        self.drop_without_shutdown();
3140        _result
3141    }
3142
3143    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3144        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
3145            (resource,),
3146            self.tx_id,
3147            0x5f5cc9f0745f61d0,
3148            fidl::encoding::DynamicFlags::empty(),
3149        )
3150    }
3151}
3152
3153#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3154pub struct HypervisorResourceMarker;
3155
3156impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3157    type Proxy = HypervisorResourceProxy;
3158    type RequestStream = HypervisorResourceRequestStream;
3159    #[cfg(target_os = "fuchsia")]
3160    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3161
3162    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3163}
3164impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3165
3166pub trait HypervisorResourceProxyInterface: Send + Sync {
3167    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3168    fn r#get(&self) -> Self::GetResponseFut;
3169}
3170#[derive(Debug)]
3171#[cfg(target_os = "fuchsia")]
3172pub struct HypervisorResourceSynchronousProxy {
3173    client: fidl::client::sync::Client,
3174}
3175
3176#[cfg(target_os = "fuchsia")]
3177impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3178    type Proxy = HypervisorResourceProxy;
3179    type Protocol = HypervisorResourceMarker;
3180
3181    fn from_channel(inner: fidl::Channel) -> Self {
3182        Self::new(inner)
3183    }
3184
3185    fn into_channel(self) -> fidl::Channel {
3186        self.client.into_channel()
3187    }
3188
3189    fn as_channel(&self) -> &fidl::Channel {
3190        self.client.as_channel()
3191    }
3192}
3193
3194#[cfg(target_os = "fuchsia")]
3195impl HypervisorResourceSynchronousProxy {
3196    pub fn new(channel: fidl::Channel) -> Self {
3197        Self { client: fidl::client::sync::Client::new(channel) }
3198    }
3199
3200    pub fn into_channel(self) -> fidl::Channel {
3201        self.client.into_channel()
3202    }
3203
3204    /// Waits until an event arrives and returns it. It is safe for other
3205    /// threads to make concurrent requests while waiting for an event.
3206    pub fn wait_for_event(
3207        &self,
3208        deadline: zx::MonotonicInstant,
3209    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3210        HypervisorResourceEvent::decode(
3211            self.client.wait_for_event::<HypervisorResourceMarker>(deadline)?,
3212        )
3213    }
3214
3215    /// Get a hypervisor resource handle.
3216    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3217        let _response = self.client.send_query::<
3218            fidl::encoding::EmptyPayload,
3219            HypervisorResourceGetResponse,
3220            HypervisorResourceMarker,
3221        >(
3222            (),
3223            0x1c312131d3b824a2,
3224            fidl::encoding::DynamicFlags::empty(),
3225            ___deadline,
3226        )?;
3227        Ok(_response.resource)
3228    }
3229}
3230
3231#[cfg(target_os = "fuchsia")]
3232impl From<HypervisorResourceSynchronousProxy> for zx::NullableHandle {
3233    fn from(value: HypervisorResourceSynchronousProxy) -> Self {
3234        value.into_channel().into()
3235    }
3236}
3237
3238#[cfg(target_os = "fuchsia")]
3239impl From<fidl::Channel> for HypervisorResourceSynchronousProxy {
3240    fn from(value: fidl::Channel) -> Self {
3241        Self::new(value)
3242    }
3243}
3244
3245#[cfg(target_os = "fuchsia")]
3246impl fidl::endpoints::FromClient for HypervisorResourceSynchronousProxy {
3247    type Protocol = HypervisorResourceMarker;
3248
3249    fn from_client(value: fidl::endpoints::ClientEnd<HypervisorResourceMarker>) -> Self {
3250        Self::new(value.into_channel())
3251    }
3252}
3253
3254#[derive(Debug, Clone)]
3255pub struct HypervisorResourceProxy {
3256    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3257}
3258
3259impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3260    type Protocol = HypervisorResourceMarker;
3261
3262    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3263        Self::new(inner)
3264    }
3265
3266    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3267        self.client.into_channel().map_err(|client| Self { client })
3268    }
3269
3270    fn as_channel(&self) -> &::fidl::AsyncChannel {
3271        self.client.as_channel()
3272    }
3273}
3274
3275impl HypervisorResourceProxy {
3276    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3277    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3278        let protocol_name =
3279            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3280        Self { client: fidl::client::Client::new(channel, protocol_name) }
3281    }
3282
3283    /// Get a Stream of events from the remote end of the protocol.
3284    ///
3285    /// # Panics
3286    ///
3287    /// Panics if the event stream was already taken.
3288    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3289        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3290    }
3291
3292    /// Get a hypervisor resource handle.
3293    pub fn r#get(
3294        &self,
3295    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3296    {
3297        HypervisorResourceProxyInterface::r#get(self)
3298    }
3299}
3300
3301impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3302    type GetResponseFut = fidl::client::QueryResponseFut<
3303        fidl::Resource,
3304        fidl::encoding::DefaultFuchsiaResourceDialect,
3305    >;
3306    fn r#get(&self) -> Self::GetResponseFut {
3307        fn _decode(
3308            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3309        ) -> Result<fidl::Resource, fidl::Error> {
3310            let _response = fidl::client::decode_transaction_body::<
3311                HypervisorResourceGetResponse,
3312                fidl::encoding::DefaultFuchsiaResourceDialect,
3313                0x1c312131d3b824a2,
3314            >(_buf?)?;
3315            Ok(_response.resource)
3316        }
3317        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3318            (),
3319            0x1c312131d3b824a2,
3320            fidl::encoding::DynamicFlags::empty(),
3321            _decode,
3322        )
3323    }
3324}
3325
3326pub struct HypervisorResourceEventStream {
3327    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3328}
3329
3330impl std::marker::Unpin for HypervisorResourceEventStream {}
3331
3332impl futures::stream::FusedStream for HypervisorResourceEventStream {
3333    fn is_terminated(&self) -> bool {
3334        self.event_receiver.is_terminated()
3335    }
3336}
3337
3338impl futures::Stream for HypervisorResourceEventStream {
3339    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3340
3341    fn poll_next(
3342        mut self: std::pin::Pin<&mut Self>,
3343        cx: &mut std::task::Context<'_>,
3344    ) -> std::task::Poll<Option<Self::Item>> {
3345        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3346            &mut self.event_receiver,
3347            cx
3348        )?) {
3349            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3350            None => std::task::Poll::Ready(None),
3351        }
3352    }
3353}
3354
3355#[derive(Debug)]
3356pub enum HypervisorResourceEvent {}
3357
3358impl HypervisorResourceEvent {
3359    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3360    fn decode(
3361        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3362    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3363        let (bytes, _handles) = buf.split_mut();
3364        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3365        debug_assert_eq!(tx_header.tx_id, 0);
3366        match tx_header.ordinal {
3367            _ => Err(fidl::Error::UnknownOrdinal {
3368                ordinal: tx_header.ordinal,
3369                protocol_name:
3370                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3371            }),
3372        }
3373    }
3374}
3375
3376/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3377pub struct HypervisorResourceRequestStream {
3378    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3379    is_terminated: bool,
3380}
3381
3382impl std::marker::Unpin for HypervisorResourceRequestStream {}
3383
3384impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3385    fn is_terminated(&self) -> bool {
3386        self.is_terminated
3387    }
3388}
3389
3390impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3391    type Protocol = HypervisorResourceMarker;
3392    type ControlHandle = HypervisorResourceControlHandle;
3393
3394    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3395        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3396    }
3397
3398    fn control_handle(&self) -> Self::ControlHandle {
3399        HypervisorResourceControlHandle { inner: self.inner.clone() }
3400    }
3401
3402    fn into_inner(
3403        self,
3404    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3405    {
3406        (self.inner, self.is_terminated)
3407    }
3408
3409    fn from_inner(
3410        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3411        is_terminated: bool,
3412    ) -> Self {
3413        Self { inner, is_terminated }
3414    }
3415}
3416
3417impl futures::Stream for HypervisorResourceRequestStream {
3418    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3419
3420    fn poll_next(
3421        mut self: std::pin::Pin<&mut Self>,
3422        cx: &mut std::task::Context<'_>,
3423    ) -> std::task::Poll<Option<Self::Item>> {
3424        let this = &mut *self;
3425        if this.inner.check_shutdown(cx) {
3426            this.is_terminated = true;
3427            return std::task::Poll::Ready(None);
3428        }
3429        if this.is_terminated {
3430            panic!("polled HypervisorResourceRequestStream after completion");
3431        }
3432        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3433            |bytes, handles| {
3434                match this.inner.channel().read_etc(cx, bytes, handles) {
3435                    std::task::Poll::Ready(Ok(())) => {}
3436                    std::task::Poll::Pending => return std::task::Poll::Pending,
3437                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3438                        this.is_terminated = true;
3439                        return std::task::Poll::Ready(None);
3440                    }
3441                    std::task::Poll::Ready(Err(e)) => {
3442                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3443                            e.into(),
3444                        ))));
3445                    }
3446                }
3447
3448                // A message has been received from the channel
3449                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3450
3451                std::task::Poll::Ready(Some(match header.ordinal {
3452                0x1c312131d3b824a2 => {
3453                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3454                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3455                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3456                    let control_handle = HypervisorResourceControlHandle {
3457                        inner: this.inner.clone(),
3458                    };
3459                    Ok(HypervisorResourceRequest::Get {
3460                        responder: HypervisorResourceGetResponder {
3461                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3462                            tx_id: header.tx_id,
3463                        },
3464                    })
3465                }
3466                _ => Err(fidl::Error::UnknownOrdinal {
3467                    ordinal: header.ordinal,
3468                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3469                }),
3470            }))
3471            },
3472        )
3473    }
3474}
3475
3476/// Protocol for providing the hypervisor resource.
3477#[derive(Debug)]
3478pub enum HypervisorResourceRequest {
3479    /// Get a hypervisor resource handle.
3480    Get { responder: HypervisorResourceGetResponder },
3481}
3482
3483impl HypervisorResourceRequest {
3484    #[allow(irrefutable_let_patterns)]
3485    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3486        if let HypervisorResourceRequest::Get { responder } = self {
3487            Some((responder))
3488        } else {
3489            None
3490        }
3491    }
3492
3493    /// Name of the method defined in FIDL
3494    pub fn method_name(&self) -> &'static str {
3495        match *self {
3496            HypervisorResourceRequest::Get { .. } => "get",
3497        }
3498    }
3499}
3500
3501#[derive(Debug, Clone)]
3502pub struct HypervisorResourceControlHandle {
3503    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3504}
3505
3506impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3507    fn shutdown(&self) {
3508        self.inner.shutdown()
3509    }
3510
3511    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3512        self.inner.shutdown_with_epitaph(status)
3513    }
3514
3515    fn is_closed(&self) -> bool {
3516        self.inner.channel().is_closed()
3517    }
3518    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3519        self.inner.channel().on_closed()
3520    }
3521
3522    #[cfg(target_os = "fuchsia")]
3523    fn signal_peer(
3524        &self,
3525        clear_mask: zx::Signals,
3526        set_mask: zx::Signals,
3527    ) -> Result<(), zx_status::Status> {
3528        use fidl::Peered;
3529        self.inner.channel().signal_peer(clear_mask, set_mask)
3530    }
3531}
3532
3533impl HypervisorResourceControlHandle {}
3534
3535#[must_use = "FIDL methods require a response to be sent"]
3536#[derive(Debug)]
3537pub struct HypervisorResourceGetResponder {
3538    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3539    tx_id: u32,
3540}
3541
3542/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3543/// if the responder is dropped without sending a response, so that the client
3544/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3545impl std::ops::Drop for HypervisorResourceGetResponder {
3546    fn drop(&mut self) {
3547        self.control_handle.shutdown();
3548        // Safety: drops once, never accessed again
3549        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3550    }
3551}
3552
3553impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3554    type ControlHandle = HypervisorResourceControlHandle;
3555
3556    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3557        &self.control_handle
3558    }
3559
3560    fn drop_without_shutdown(mut self) {
3561        // Safety: drops once, never accessed again due to mem::forget
3562        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3563        // Prevent Drop from running (which would shut down the channel)
3564        std::mem::forget(self);
3565    }
3566}
3567
3568impl HypervisorResourceGetResponder {
3569    /// Sends a response to the FIDL transaction.
3570    ///
3571    /// Sets the channel to shutdown if an error occurs.
3572    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3573        let _result = self.send_raw(resource);
3574        if _result.is_err() {
3575            self.control_handle.shutdown();
3576        }
3577        self.drop_without_shutdown();
3578        _result
3579    }
3580
3581    /// Similar to "send" but does not shutdown the channel if an error occurs.
3582    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3583        let _result = self.send_raw(resource);
3584        self.drop_without_shutdown();
3585        _result
3586    }
3587
3588    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3589        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3590            (resource,),
3591            self.tx_id,
3592            0x1c312131d3b824a2,
3593            fidl::encoding::DynamicFlags::empty(),
3594        )
3595    }
3596}
3597
3598#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3599pub struct InfoResourceMarker;
3600
3601impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3602    type Proxy = InfoResourceProxy;
3603    type RequestStream = InfoResourceRequestStream;
3604    #[cfg(target_os = "fuchsia")]
3605    type SynchronousProxy = InfoResourceSynchronousProxy;
3606
3607    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3608}
3609impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3610
3611pub trait InfoResourceProxyInterface: Send + Sync {
3612    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3613    fn r#get(&self) -> Self::GetResponseFut;
3614}
3615#[derive(Debug)]
3616#[cfg(target_os = "fuchsia")]
3617pub struct InfoResourceSynchronousProxy {
3618    client: fidl::client::sync::Client,
3619}
3620
3621#[cfg(target_os = "fuchsia")]
3622impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3623    type Proxy = InfoResourceProxy;
3624    type Protocol = InfoResourceMarker;
3625
3626    fn from_channel(inner: fidl::Channel) -> Self {
3627        Self::new(inner)
3628    }
3629
3630    fn into_channel(self) -> fidl::Channel {
3631        self.client.into_channel()
3632    }
3633
3634    fn as_channel(&self) -> &fidl::Channel {
3635        self.client.as_channel()
3636    }
3637}
3638
3639#[cfg(target_os = "fuchsia")]
3640impl InfoResourceSynchronousProxy {
3641    pub fn new(channel: fidl::Channel) -> Self {
3642        Self { client: fidl::client::sync::Client::new(channel) }
3643    }
3644
3645    pub fn into_channel(self) -> fidl::Channel {
3646        self.client.into_channel()
3647    }
3648
3649    /// Waits until an event arrives and returns it. It is safe for other
3650    /// threads to make concurrent requests while waiting for an event.
3651    pub fn wait_for_event(
3652        &self,
3653        deadline: zx::MonotonicInstant,
3654    ) -> Result<InfoResourceEvent, fidl::Error> {
3655        InfoResourceEvent::decode(self.client.wait_for_event::<InfoResourceMarker>(deadline)?)
3656    }
3657
3658    /// Get an info resource handle.
3659    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3660        let _response = self.client.send_query::<
3661            fidl::encoding::EmptyPayload,
3662            InfoResourceGetResponse,
3663            InfoResourceMarker,
3664        >(
3665            (),
3666            0x1de8edcb4abc2067,
3667            fidl::encoding::DynamicFlags::empty(),
3668            ___deadline,
3669        )?;
3670        Ok(_response.resource)
3671    }
3672}
3673
3674#[cfg(target_os = "fuchsia")]
3675impl From<InfoResourceSynchronousProxy> for zx::NullableHandle {
3676    fn from(value: InfoResourceSynchronousProxy) -> Self {
3677        value.into_channel().into()
3678    }
3679}
3680
3681#[cfg(target_os = "fuchsia")]
3682impl From<fidl::Channel> for InfoResourceSynchronousProxy {
3683    fn from(value: fidl::Channel) -> Self {
3684        Self::new(value)
3685    }
3686}
3687
3688#[cfg(target_os = "fuchsia")]
3689impl fidl::endpoints::FromClient for InfoResourceSynchronousProxy {
3690    type Protocol = InfoResourceMarker;
3691
3692    fn from_client(value: fidl::endpoints::ClientEnd<InfoResourceMarker>) -> Self {
3693        Self::new(value.into_channel())
3694    }
3695}
3696
3697#[derive(Debug, Clone)]
3698pub struct InfoResourceProxy {
3699    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3700}
3701
3702impl fidl::endpoints::Proxy for InfoResourceProxy {
3703    type Protocol = InfoResourceMarker;
3704
3705    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3706        Self::new(inner)
3707    }
3708
3709    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3710        self.client.into_channel().map_err(|client| Self { client })
3711    }
3712
3713    fn as_channel(&self) -> &::fidl::AsyncChannel {
3714        self.client.as_channel()
3715    }
3716}
3717
3718impl InfoResourceProxy {
3719    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3720    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3721        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3722        Self { client: fidl::client::Client::new(channel, protocol_name) }
3723    }
3724
3725    /// Get a Stream of events from the remote end of the protocol.
3726    ///
3727    /// # Panics
3728    ///
3729    /// Panics if the event stream was already taken.
3730    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3731        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3732    }
3733
3734    /// Get an info resource handle.
3735    pub fn r#get(
3736        &self,
3737    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3738    {
3739        InfoResourceProxyInterface::r#get(self)
3740    }
3741}
3742
3743impl InfoResourceProxyInterface for InfoResourceProxy {
3744    type GetResponseFut = fidl::client::QueryResponseFut<
3745        fidl::Resource,
3746        fidl::encoding::DefaultFuchsiaResourceDialect,
3747    >;
3748    fn r#get(&self) -> Self::GetResponseFut {
3749        fn _decode(
3750            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3751        ) -> Result<fidl::Resource, fidl::Error> {
3752            let _response = fidl::client::decode_transaction_body::<
3753                InfoResourceGetResponse,
3754                fidl::encoding::DefaultFuchsiaResourceDialect,
3755                0x1de8edcb4abc2067,
3756            >(_buf?)?;
3757            Ok(_response.resource)
3758        }
3759        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3760            (),
3761            0x1de8edcb4abc2067,
3762            fidl::encoding::DynamicFlags::empty(),
3763            _decode,
3764        )
3765    }
3766}
3767
3768pub struct InfoResourceEventStream {
3769    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3770}
3771
3772impl std::marker::Unpin for InfoResourceEventStream {}
3773
3774impl futures::stream::FusedStream for InfoResourceEventStream {
3775    fn is_terminated(&self) -> bool {
3776        self.event_receiver.is_terminated()
3777    }
3778}
3779
3780impl futures::Stream for InfoResourceEventStream {
3781    type Item = Result<InfoResourceEvent, fidl::Error>;
3782
3783    fn poll_next(
3784        mut self: std::pin::Pin<&mut Self>,
3785        cx: &mut std::task::Context<'_>,
3786    ) -> std::task::Poll<Option<Self::Item>> {
3787        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3788            &mut self.event_receiver,
3789            cx
3790        )?) {
3791            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3792            None => std::task::Poll::Ready(None),
3793        }
3794    }
3795}
3796
3797#[derive(Debug)]
3798pub enum InfoResourceEvent {}
3799
3800impl InfoResourceEvent {
3801    /// Decodes a message buffer as a [`InfoResourceEvent`].
3802    fn decode(
3803        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3804    ) -> Result<InfoResourceEvent, fidl::Error> {
3805        let (bytes, _handles) = buf.split_mut();
3806        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3807        debug_assert_eq!(tx_header.tx_id, 0);
3808        match tx_header.ordinal {
3809            _ => Err(fidl::Error::UnknownOrdinal {
3810                ordinal: tx_header.ordinal,
3811                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3812            }),
3813        }
3814    }
3815}
3816
3817/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3818pub struct InfoResourceRequestStream {
3819    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3820    is_terminated: bool,
3821}
3822
3823impl std::marker::Unpin for InfoResourceRequestStream {}
3824
3825impl futures::stream::FusedStream for InfoResourceRequestStream {
3826    fn is_terminated(&self) -> bool {
3827        self.is_terminated
3828    }
3829}
3830
3831impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3832    type Protocol = InfoResourceMarker;
3833    type ControlHandle = InfoResourceControlHandle;
3834
3835    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3836        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3837    }
3838
3839    fn control_handle(&self) -> Self::ControlHandle {
3840        InfoResourceControlHandle { inner: self.inner.clone() }
3841    }
3842
3843    fn into_inner(
3844        self,
3845    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3846    {
3847        (self.inner, self.is_terminated)
3848    }
3849
3850    fn from_inner(
3851        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3852        is_terminated: bool,
3853    ) -> Self {
3854        Self { inner, is_terminated }
3855    }
3856}
3857
3858impl futures::Stream for InfoResourceRequestStream {
3859    type Item = Result<InfoResourceRequest, fidl::Error>;
3860
3861    fn poll_next(
3862        mut self: std::pin::Pin<&mut Self>,
3863        cx: &mut std::task::Context<'_>,
3864    ) -> std::task::Poll<Option<Self::Item>> {
3865        let this = &mut *self;
3866        if this.inner.check_shutdown(cx) {
3867            this.is_terminated = true;
3868            return std::task::Poll::Ready(None);
3869        }
3870        if this.is_terminated {
3871            panic!("polled InfoResourceRequestStream after completion");
3872        }
3873        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3874            |bytes, handles| {
3875                match this.inner.channel().read_etc(cx, bytes, handles) {
3876                    std::task::Poll::Ready(Ok(())) => {}
3877                    std::task::Poll::Pending => return std::task::Poll::Pending,
3878                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3879                        this.is_terminated = true;
3880                        return std::task::Poll::Ready(None);
3881                    }
3882                    std::task::Poll::Ready(Err(e)) => {
3883                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3884                            e.into(),
3885                        ))));
3886                    }
3887                }
3888
3889                // A message has been received from the channel
3890                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3891
3892                std::task::Poll::Ready(Some(match header.ordinal {
3893                    0x1de8edcb4abc2067 => {
3894                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3895                        let mut req = fidl::new_empty!(
3896                            fidl::encoding::EmptyPayload,
3897                            fidl::encoding::DefaultFuchsiaResourceDialect
3898                        );
3899                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3900                        let control_handle =
3901                            InfoResourceControlHandle { inner: this.inner.clone() };
3902                        Ok(InfoResourceRequest::Get {
3903                            responder: InfoResourceGetResponder {
3904                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3905                                tx_id: header.tx_id,
3906                            },
3907                        })
3908                    }
3909                    _ => Err(fidl::Error::UnknownOrdinal {
3910                        ordinal: header.ordinal,
3911                        protocol_name:
3912                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3913                    }),
3914                }))
3915            },
3916        )
3917    }
3918}
3919
3920/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3921/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3922#[derive(Debug)]
3923pub enum InfoResourceRequest {
3924    /// Get an info resource handle.
3925    Get { responder: InfoResourceGetResponder },
3926}
3927
3928impl InfoResourceRequest {
3929    #[allow(irrefutable_let_patterns)]
3930    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3931        if let InfoResourceRequest::Get { responder } = self { Some((responder)) } else { None }
3932    }
3933
3934    /// Name of the method defined in FIDL
3935    pub fn method_name(&self) -> &'static str {
3936        match *self {
3937            InfoResourceRequest::Get { .. } => "get",
3938        }
3939    }
3940}
3941
3942#[derive(Debug, Clone)]
3943pub struct InfoResourceControlHandle {
3944    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3945}
3946
3947impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3948    fn shutdown(&self) {
3949        self.inner.shutdown()
3950    }
3951
3952    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3953        self.inner.shutdown_with_epitaph(status)
3954    }
3955
3956    fn is_closed(&self) -> bool {
3957        self.inner.channel().is_closed()
3958    }
3959    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3960        self.inner.channel().on_closed()
3961    }
3962
3963    #[cfg(target_os = "fuchsia")]
3964    fn signal_peer(
3965        &self,
3966        clear_mask: zx::Signals,
3967        set_mask: zx::Signals,
3968    ) -> Result<(), zx_status::Status> {
3969        use fidl::Peered;
3970        self.inner.channel().signal_peer(clear_mask, set_mask)
3971    }
3972}
3973
3974impl InfoResourceControlHandle {}
3975
3976#[must_use = "FIDL methods require a response to be sent"]
3977#[derive(Debug)]
3978pub struct InfoResourceGetResponder {
3979    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
3980    tx_id: u32,
3981}
3982
3983/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
3984/// if the responder is dropped without sending a response, so that the client
3985/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3986impl std::ops::Drop for InfoResourceGetResponder {
3987    fn drop(&mut self) {
3988        self.control_handle.shutdown();
3989        // Safety: drops once, never accessed again
3990        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3991    }
3992}
3993
3994impl fidl::endpoints::Responder for InfoResourceGetResponder {
3995    type ControlHandle = InfoResourceControlHandle;
3996
3997    fn control_handle(&self) -> &InfoResourceControlHandle {
3998        &self.control_handle
3999    }
4000
4001    fn drop_without_shutdown(mut self) {
4002        // Safety: drops once, never accessed again due to mem::forget
4003        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4004        // Prevent Drop from running (which would shut down the channel)
4005        std::mem::forget(self);
4006    }
4007}
4008
4009impl InfoResourceGetResponder {
4010    /// Sends a response to the FIDL transaction.
4011    ///
4012    /// Sets the channel to shutdown if an error occurs.
4013    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4014        let _result = self.send_raw(resource);
4015        if _result.is_err() {
4016            self.control_handle.shutdown();
4017        }
4018        self.drop_without_shutdown();
4019        _result
4020    }
4021
4022    /// Similar to "send" but does not shutdown the channel if an error occurs.
4023    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4024        let _result = self.send_raw(resource);
4025        self.drop_without_shutdown();
4026        _result
4027    }
4028
4029    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4030        self.control_handle.inner.send::<InfoResourceGetResponse>(
4031            (resource,),
4032            self.tx_id,
4033            0x1de8edcb4abc2067,
4034            fidl::encoding::DynamicFlags::empty(),
4035        )
4036    }
4037}
4038
4039#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4040pub struct IommuResourceMarker;
4041
4042impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
4043    type Proxy = IommuResourceProxy;
4044    type RequestStream = IommuResourceRequestStream;
4045    #[cfg(target_os = "fuchsia")]
4046    type SynchronousProxy = IommuResourceSynchronousProxy;
4047
4048    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
4049}
4050impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
4051
4052pub trait IommuResourceProxyInterface: Send + Sync {
4053    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4054    fn r#get(&self) -> Self::GetResponseFut;
4055}
4056#[derive(Debug)]
4057#[cfg(target_os = "fuchsia")]
4058pub struct IommuResourceSynchronousProxy {
4059    client: fidl::client::sync::Client,
4060}
4061
4062#[cfg(target_os = "fuchsia")]
4063impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
4064    type Proxy = IommuResourceProxy;
4065    type Protocol = IommuResourceMarker;
4066
4067    fn from_channel(inner: fidl::Channel) -> Self {
4068        Self::new(inner)
4069    }
4070
4071    fn into_channel(self) -> fidl::Channel {
4072        self.client.into_channel()
4073    }
4074
4075    fn as_channel(&self) -> &fidl::Channel {
4076        self.client.as_channel()
4077    }
4078}
4079
4080#[cfg(target_os = "fuchsia")]
4081impl IommuResourceSynchronousProxy {
4082    pub fn new(channel: fidl::Channel) -> Self {
4083        Self { client: fidl::client::sync::Client::new(channel) }
4084    }
4085
4086    pub fn into_channel(self) -> fidl::Channel {
4087        self.client.into_channel()
4088    }
4089
4090    /// Waits until an event arrives and returns it. It is safe for other
4091    /// threads to make concurrent requests while waiting for an event.
4092    pub fn wait_for_event(
4093        &self,
4094        deadline: zx::MonotonicInstant,
4095    ) -> Result<IommuResourceEvent, fidl::Error> {
4096        IommuResourceEvent::decode(self.client.wait_for_event::<IommuResourceMarker>(deadline)?)
4097    }
4098
4099    /// Get an iommu resource handle.
4100    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4101        let _response = self.client.send_query::<
4102            fidl::encoding::EmptyPayload,
4103            IommuResourceGetResponse,
4104            IommuResourceMarker,
4105        >(
4106            (),
4107            0x5af309b619aa7c5b,
4108            fidl::encoding::DynamicFlags::empty(),
4109            ___deadline,
4110        )?;
4111        Ok(_response.resource)
4112    }
4113}
4114
4115#[cfg(target_os = "fuchsia")]
4116impl From<IommuResourceSynchronousProxy> for zx::NullableHandle {
4117    fn from(value: IommuResourceSynchronousProxy) -> Self {
4118        value.into_channel().into()
4119    }
4120}
4121
4122#[cfg(target_os = "fuchsia")]
4123impl From<fidl::Channel> for IommuResourceSynchronousProxy {
4124    fn from(value: fidl::Channel) -> Self {
4125        Self::new(value)
4126    }
4127}
4128
4129#[cfg(target_os = "fuchsia")]
4130impl fidl::endpoints::FromClient for IommuResourceSynchronousProxy {
4131    type Protocol = IommuResourceMarker;
4132
4133    fn from_client(value: fidl::endpoints::ClientEnd<IommuResourceMarker>) -> Self {
4134        Self::new(value.into_channel())
4135    }
4136}
4137
4138#[derive(Debug, Clone)]
4139pub struct IommuResourceProxy {
4140    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4141}
4142
4143impl fidl::endpoints::Proxy for IommuResourceProxy {
4144    type Protocol = IommuResourceMarker;
4145
4146    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4147        Self::new(inner)
4148    }
4149
4150    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4151        self.client.into_channel().map_err(|client| Self { client })
4152    }
4153
4154    fn as_channel(&self) -> &::fidl::AsyncChannel {
4155        self.client.as_channel()
4156    }
4157}
4158
4159impl IommuResourceProxy {
4160    /// Create a new Proxy for fuchsia.kernel/IommuResource.
4161    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4162        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4163        Self { client: fidl::client::Client::new(channel, protocol_name) }
4164    }
4165
4166    /// Get a Stream of events from the remote end of the protocol.
4167    ///
4168    /// # Panics
4169    ///
4170    /// Panics if the event stream was already taken.
4171    pub fn take_event_stream(&self) -> IommuResourceEventStream {
4172        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
4173    }
4174
4175    /// Get an iommu resource handle.
4176    pub fn r#get(
4177        &self,
4178    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4179    {
4180        IommuResourceProxyInterface::r#get(self)
4181    }
4182}
4183
4184impl IommuResourceProxyInterface for IommuResourceProxy {
4185    type GetResponseFut = fidl::client::QueryResponseFut<
4186        fidl::Resource,
4187        fidl::encoding::DefaultFuchsiaResourceDialect,
4188    >;
4189    fn r#get(&self) -> Self::GetResponseFut {
4190        fn _decode(
4191            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4192        ) -> Result<fidl::Resource, fidl::Error> {
4193            let _response = fidl::client::decode_transaction_body::<
4194                IommuResourceGetResponse,
4195                fidl::encoding::DefaultFuchsiaResourceDialect,
4196                0x5af309b619aa7c5b,
4197            >(_buf?)?;
4198            Ok(_response.resource)
4199        }
4200        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4201            (),
4202            0x5af309b619aa7c5b,
4203            fidl::encoding::DynamicFlags::empty(),
4204            _decode,
4205        )
4206    }
4207}
4208
4209pub struct IommuResourceEventStream {
4210    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4211}
4212
4213impl std::marker::Unpin for IommuResourceEventStream {}
4214
4215impl futures::stream::FusedStream for IommuResourceEventStream {
4216    fn is_terminated(&self) -> bool {
4217        self.event_receiver.is_terminated()
4218    }
4219}
4220
4221impl futures::Stream for IommuResourceEventStream {
4222    type Item = Result<IommuResourceEvent, fidl::Error>;
4223
4224    fn poll_next(
4225        mut self: std::pin::Pin<&mut Self>,
4226        cx: &mut std::task::Context<'_>,
4227    ) -> std::task::Poll<Option<Self::Item>> {
4228        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4229            &mut self.event_receiver,
4230            cx
4231        )?) {
4232            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4233            None => std::task::Poll::Ready(None),
4234        }
4235    }
4236}
4237
4238#[derive(Debug)]
4239pub enum IommuResourceEvent {}
4240
4241impl IommuResourceEvent {
4242    /// Decodes a message buffer as a [`IommuResourceEvent`].
4243    fn decode(
4244        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4245    ) -> Result<IommuResourceEvent, fidl::Error> {
4246        let (bytes, _handles) = buf.split_mut();
4247        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4248        debug_assert_eq!(tx_header.tx_id, 0);
4249        match tx_header.ordinal {
4250            _ => Err(fidl::Error::UnknownOrdinal {
4251                ordinal: tx_header.ordinal,
4252                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4253            }),
4254        }
4255    }
4256}
4257
4258/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4259pub struct IommuResourceRequestStream {
4260    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4261    is_terminated: bool,
4262}
4263
4264impl std::marker::Unpin for IommuResourceRequestStream {}
4265
4266impl futures::stream::FusedStream for IommuResourceRequestStream {
4267    fn is_terminated(&self) -> bool {
4268        self.is_terminated
4269    }
4270}
4271
4272impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4273    type Protocol = IommuResourceMarker;
4274    type ControlHandle = IommuResourceControlHandle;
4275
4276    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4277        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4278    }
4279
4280    fn control_handle(&self) -> Self::ControlHandle {
4281        IommuResourceControlHandle { inner: self.inner.clone() }
4282    }
4283
4284    fn into_inner(
4285        self,
4286    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4287    {
4288        (self.inner, self.is_terminated)
4289    }
4290
4291    fn from_inner(
4292        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4293        is_terminated: bool,
4294    ) -> Self {
4295        Self { inner, is_terminated }
4296    }
4297}
4298
4299impl futures::Stream for IommuResourceRequestStream {
4300    type Item = Result<IommuResourceRequest, fidl::Error>;
4301
4302    fn poll_next(
4303        mut self: std::pin::Pin<&mut Self>,
4304        cx: &mut std::task::Context<'_>,
4305    ) -> std::task::Poll<Option<Self::Item>> {
4306        let this = &mut *self;
4307        if this.inner.check_shutdown(cx) {
4308            this.is_terminated = true;
4309            return std::task::Poll::Ready(None);
4310        }
4311        if this.is_terminated {
4312            panic!("polled IommuResourceRequestStream after completion");
4313        }
4314        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4315            |bytes, handles| {
4316                match this.inner.channel().read_etc(cx, bytes, handles) {
4317                    std::task::Poll::Ready(Ok(())) => {}
4318                    std::task::Poll::Pending => return std::task::Poll::Pending,
4319                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4320                        this.is_terminated = true;
4321                        return std::task::Poll::Ready(None);
4322                    }
4323                    std::task::Poll::Ready(Err(e)) => {
4324                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4325                            e.into(),
4326                        ))));
4327                    }
4328                }
4329
4330                // A message has been received from the channel
4331                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4332
4333                std::task::Poll::Ready(Some(match header.ordinal {
4334                    0x5af309b619aa7c5b => {
4335                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4336                        let mut req = fidl::new_empty!(
4337                            fidl::encoding::EmptyPayload,
4338                            fidl::encoding::DefaultFuchsiaResourceDialect
4339                        );
4340                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4341                        let control_handle =
4342                            IommuResourceControlHandle { inner: this.inner.clone() };
4343                        Ok(IommuResourceRequest::Get {
4344                            responder: IommuResourceGetResponder {
4345                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4346                                tx_id: header.tx_id,
4347                            },
4348                        })
4349                    }
4350                    _ => Err(fidl::Error::UnknownOrdinal {
4351                        ordinal: header.ordinal,
4352                        protocol_name:
4353                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4354                    }),
4355                }))
4356            },
4357        )
4358    }
4359}
4360
4361/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4362/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4363#[derive(Debug)]
4364pub enum IommuResourceRequest {
4365    /// Get an iommu resource handle.
4366    Get { responder: IommuResourceGetResponder },
4367}
4368
4369impl IommuResourceRequest {
4370    #[allow(irrefutable_let_patterns)]
4371    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4372        if let IommuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4373    }
4374
4375    /// Name of the method defined in FIDL
4376    pub fn method_name(&self) -> &'static str {
4377        match *self {
4378            IommuResourceRequest::Get { .. } => "get",
4379        }
4380    }
4381}
4382
4383#[derive(Debug, Clone)]
4384pub struct IommuResourceControlHandle {
4385    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4386}
4387
4388impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4389    fn shutdown(&self) {
4390        self.inner.shutdown()
4391    }
4392
4393    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4394        self.inner.shutdown_with_epitaph(status)
4395    }
4396
4397    fn is_closed(&self) -> bool {
4398        self.inner.channel().is_closed()
4399    }
4400    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4401        self.inner.channel().on_closed()
4402    }
4403
4404    #[cfg(target_os = "fuchsia")]
4405    fn signal_peer(
4406        &self,
4407        clear_mask: zx::Signals,
4408        set_mask: zx::Signals,
4409    ) -> Result<(), zx_status::Status> {
4410        use fidl::Peered;
4411        self.inner.channel().signal_peer(clear_mask, set_mask)
4412    }
4413}
4414
4415impl IommuResourceControlHandle {}
4416
4417#[must_use = "FIDL methods require a response to be sent"]
4418#[derive(Debug)]
4419pub struct IommuResourceGetResponder {
4420    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4421    tx_id: u32,
4422}
4423
4424/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4425/// if the responder is dropped without sending a response, so that the client
4426/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4427impl std::ops::Drop for IommuResourceGetResponder {
4428    fn drop(&mut self) {
4429        self.control_handle.shutdown();
4430        // Safety: drops once, never accessed again
4431        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4432    }
4433}
4434
4435impl fidl::endpoints::Responder for IommuResourceGetResponder {
4436    type ControlHandle = IommuResourceControlHandle;
4437
4438    fn control_handle(&self) -> &IommuResourceControlHandle {
4439        &self.control_handle
4440    }
4441
4442    fn drop_without_shutdown(mut self) {
4443        // Safety: drops once, never accessed again due to mem::forget
4444        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4445        // Prevent Drop from running (which would shut down the channel)
4446        std::mem::forget(self);
4447    }
4448}
4449
4450impl IommuResourceGetResponder {
4451    /// Sends a response to the FIDL transaction.
4452    ///
4453    /// Sets the channel to shutdown if an error occurs.
4454    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4455        let _result = self.send_raw(resource);
4456        if _result.is_err() {
4457            self.control_handle.shutdown();
4458        }
4459        self.drop_without_shutdown();
4460        _result
4461    }
4462
4463    /// Similar to "send" but does not shutdown the channel if an error occurs.
4464    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4465        let _result = self.send_raw(resource);
4466        self.drop_without_shutdown();
4467        _result
4468    }
4469
4470    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4471        self.control_handle.inner.send::<IommuResourceGetResponse>(
4472            (resource,),
4473            self.tx_id,
4474            0x5af309b619aa7c5b,
4475            fidl::encoding::DynamicFlags::empty(),
4476        )
4477    }
4478}
4479
4480#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4481pub struct IoportResourceMarker;
4482
4483impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4484    type Proxy = IoportResourceProxy;
4485    type RequestStream = IoportResourceRequestStream;
4486    #[cfg(target_os = "fuchsia")]
4487    type SynchronousProxy = IoportResourceSynchronousProxy;
4488
4489    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4490}
4491impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4492
4493pub trait IoportResourceProxyInterface: Send + Sync {
4494    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4495    fn r#get(&self) -> Self::GetResponseFut;
4496}
4497#[derive(Debug)]
4498#[cfg(target_os = "fuchsia")]
4499pub struct IoportResourceSynchronousProxy {
4500    client: fidl::client::sync::Client,
4501}
4502
4503#[cfg(target_os = "fuchsia")]
4504impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4505    type Proxy = IoportResourceProxy;
4506    type Protocol = IoportResourceMarker;
4507
4508    fn from_channel(inner: fidl::Channel) -> Self {
4509        Self::new(inner)
4510    }
4511
4512    fn into_channel(self) -> fidl::Channel {
4513        self.client.into_channel()
4514    }
4515
4516    fn as_channel(&self) -> &fidl::Channel {
4517        self.client.as_channel()
4518    }
4519}
4520
4521#[cfg(target_os = "fuchsia")]
4522impl IoportResourceSynchronousProxy {
4523    pub fn new(channel: fidl::Channel) -> Self {
4524        Self { client: fidl::client::sync::Client::new(channel) }
4525    }
4526
4527    pub fn into_channel(self) -> fidl::Channel {
4528        self.client.into_channel()
4529    }
4530
4531    /// Waits until an event arrives and returns it. It is safe for other
4532    /// threads to make concurrent requests while waiting for an event.
4533    pub fn wait_for_event(
4534        &self,
4535        deadline: zx::MonotonicInstant,
4536    ) -> Result<IoportResourceEvent, fidl::Error> {
4537        IoportResourceEvent::decode(self.client.wait_for_event::<IoportResourceMarker>(deadline)?)
4538    }
4539
4540    /// Get an IO Port resource handle.
4541    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4542        let _response = self.client.send_query::<
4543            fidl::encoding::EmptyPayload,
4544            IoportResourceGetResponse,
4545            IoportResourceMarker,
4546        >(
4547            (),
4548            0x4db20876b537c52b,
4549            fidl::encoding::DynamicFlags::empty(),
4550            ___deadline,
4551        )?;
4552        Ok(_response.resource)
4553    }
4554}
4555
4556#[cfg(target_os = "fuchsia")]
4557impl From<IoportResourceSynchronousProxy> for zx::NullableHandle {
4558    fn from(value: IoportResourceSynchronousProxy) -> Self {
4559        value.into_channel().into()
4560    }
4561}
4562
4563#[cfg(target_os = "fuchsia")]
4564impl From<fidl::Channel> for IoportResourceSynchronousProxy {
4565    fn from(value: fidl::Channel) -> Self {
4566        Self::new(value)
4567    }
4568}
4569
4570#[cfg(target_os = "fuchsia")]
4571impl fidl::endpoints::FromClient for IoportResourceSynchronousProxy {
4572    type Protocol = IoportResourceMarker;
4573
4574    fn from_client(value: fidl::endpoints::ClientEnd<IoportResourceMarker>) -> Self {
4575        Self::new(value.into_channel())
4576    }
4577}
4578
4579#[derive(Debug, Clone)]
4580pub struct IoportResourceProxy {
4581    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4582}
4583
4584impl fidl::endpoints::Proxy for IoportResourceProxy {
4585    type Protocol = IoportResourceMarker;
4586
4587    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4588        Self::new(inner)
4589    }
4590
4591    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4592        self.client.into_channel().map_err(|client| Self { client })
4593    }
4594
4595    fn as_channel(&self) -> &::fidl::AsyncChannel {
4596        self.client.as_channel()
4597    }
4598}
4599
4600impl IoportResourceProxy {
4601    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4602    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4603        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4604        Self { client: fidl::client::Client::new(channel, protocol_name) }
4605    }
4606
4607    /// Get a Stream of events from the remote end of the protocol.
4608    ///
4609    /// # Panics
4610    ///
4611    /// Panics if the event stream was already taken.
4612    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4613        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4614    }
4615
4616    /// Get an IO Port resource handle.
4617    pub fn r#get(
4618        &self,
4619    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4620    {
4621        IoportResourceProxyInterface::r#get(self)
4622    }
4623}
4624
4625impl IoportResourceProxyInterface for IoportResourceProxy {
4626    type GetResponseFut = fidl::client::QueryResponseFut<
4627        fidl::Resource,
4628        fidl::encoding::DefaultFuchsiaResourceDialect,
4629    >;
4630    fn r#get(&self) -> Self::GetResponseFut {
4631        fn _decode(
4632            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4633        ) -> Result<fidl::Resource, fidl::Error> {
4634            let _response = fidl::client::decode_transaction_body::<
4635                IoportResourceGetResponse,
4636                fidl::encoding::DefaultFuchsiaResourceDialect,
4637                0x4db20876b537c52b,
4638            >(_buf?)?;
4639            Ok(_response.resource)
4640        }
4641        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4642            (),
4643            0x4db20876b537c52b,
4644            fidl::encoding::DynamicFlags::empty(),
4645            _decode,
4646        )
4647    }
4648}
4649
4650pub struct IoportResourceEventStream {
4651    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4652}
4653
4654impl std::marker::Unpin for IoportResourceEventStream {}
4655
4656impl futures::stream::FusedStream for IoportResourceEventStream {
4657    fn is_terminated(&self) -> bool {
4658        self.event_receiver.is_terminated()
4659    }
4660}
4661
4662impl futures::Stream for IoportResourceEventStream {
4663    type Item = Result<IoportResourceEvent, fidl::Error>;
4664
4665    fn poll_next(
4666        mut self: std::pin::Pin<&mut Self>,
4667        cx: &mut std::task::Context<'_>,
4668    ) -> std::task::Poll<Option<Self::Item>> {
4669        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4670            &mut self.event_receiver,
4671            cx
4672        )?) {
4673            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4674            None => std::task::Poll::Ready(None),
4675        }
4676    }
4677}
4678
4679#[derive(Debug)]
4680pub enum IoportResourceEvent {}
4681
4682impl IoportResourceEvent {
4683    /// Decodes a message buffer as a [`IoportResourceEvent`].
4684    fn decode(
4685        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4686    ) -> Result<IoportResourceEvent, fidl::Error> {
4687        let (bytes, _handles) = buf.split_mut();
4688        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4689        debug_assert_eq!(tx_header.tx_id, 0);
4690        match tx_header.ordinal {
4691            _ => Err(fidl::Error::UnknownOrdinal {
4692                ordinal: tx_header.ordinal,
4693                protocol_name:
4694                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4695            }),
4696        }
4697    }
4698}
4699
4700/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4701pub struct IoportResourceRequestStream {
4702    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4703    is_terminated: bool,
4704}
4705
4706impl std::marker::Unpin for IoportResourceRequestStream {}
4707
4708impl futures::stream::FusedStream for IoportResourceRequestStream {
4709    fn is_terminated(&self) -> bool {
4710        self.is_terminated
4711    }
4712}
4713
4714impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4715    type Protocol = IoportResourceMarker;
4716    type ControlHandle = IoportResourceControlHandle;
4717
4718    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4719        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4720    }
4721
4722    fn control_handle(&self) -> Self::ControlHandle {
4723        IoportResourceControlHandle { inner: self.inner.clone() }
4724    }
4725
4726    fn into_inner(
4727        self,
4728    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4729    {
4730        (self.inner, self.is_terminated)
4731    }
4732
4733    fn from_inner(
4734        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4735        is_terminated: bool,
4736    ) -> Self {
4737        Self { inner, is_terminated }
4738    }
4739}
4740
4741impl futures::Stream for IoportResourceRequestStream {
4742    type Item = Result<IoportResourceRequest, fidl::Error>;
4743
4744    fn poll_next(
4745        mut self: std::pin::Pin<&mut Self>,
4746        cx: &mut std::task::Context<'_>,
4747    ) -> std::task::Poll<Option<Self::Item>> {
4748        let this = &mut *self;
4749        if this.inner.check_shutdown(cx) {
4750            this.is_terminated = true;
4751            return std::task::Poll::Ready(None);
4752        }
4753        if this.is_terminated {
4754            panic!("polled IoportResourceRequestStream after completion");
4755        }
4756        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4757            |bytes, handles| {
4758                match this.inner.channel().read_etc(cx, bytes, handles) {
4759                    std::task::Poll::Ready(Ok(())) => {}
4760                    std::task::Poll::Pending => return std::task::Poll::Pending,
4761                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4762                        this.is_terminated = true;
4763                        return std::task::Poll::Ready(None);
4764                    }
4765                    std::task::Poll::Ready(Err(e)) => {
4766                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4767                            e.into(),
4768                        ))));
4769                    }
4770                }
4771
4772                // A message has been received from the channel
4773                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4774
4775                std::task::Poll::Ready(Some(match header.ordinal {
4776                    0x4db20876b537c52b => {
4777                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4778                        let mut req = fidl::new_empty!(
4779                            fidl::encoding::EmptyPayload,
4780                            fidl::encoding::DefaultFuchsiaResourceDialect
4781                        );
4782                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4783                        let control_handle =
4784                            IoportResourceControlHandle { inner: this.inner.clone() };
4785                        Ok(IoportResourceRequest::Get {
4786                            responder: IoportResourceGetResponder {
4787                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4788                                tx_id: header.tx_id,
4789                            },
4790                        })
4791                    }
4792                    _ => Err(fidl::Error::UnknownOrdinal {
4793                        ordinal: header.ordinal,
4794                        protocol_name:
4795                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4796                    }),
4797                }))
4798            },
4799        )
4800    }
4801}
4802
4803/// Protocol for providing an IO Port resource with access to all valid ranges.
4804#[derive(Debug)]
4805pub enum IoportResourceRequest {
4806    /// Get an IO Port resource handle.
4807    Get { responder: IoportResourceGetResponder },
4808}
4809
4810impl IoportResourceRequest {
4811    #[allow(irrefutable_let_patterns)]
4812    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4813        if let IoportResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4814    }
4815
4816    /// Name of the method defined in FIDL
4817    pub fn method_name(&self) -> &'static str {
4818        match *self {
4819            IoportResourceRequest::Get { .. } => "get",
4820        }
4821    }
4822}
4823
4824#[derive(Debug, Clone)]
4825pub struct IoportResourceControlHandle {
4826    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4827}
4828
4829impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4830    fn shutdown(&self) {
4831        self.inner.shutdown()
4832    }
4833
4834    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4835        self.inner.shutdown_with_epitaph(status)
4836    }
4837
4838    fn is_closed(&self) -> bool {
4839        self.inner.channel().is_closed()
4840    }
4841    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4842        self.inner.channel().on_closed()
4843    }
4844
4845    #[cfg(target_os = "fuchsia")]
4846    fn signal_peer(
4847        &self,
4848        clear_mask: zx::Signals,
4849        set_mask: zx::Signals,
4850    ) -> Result<(), zx_status::Status> {
4851        use fidl::Peered;
4852        self.inner.channel().signal_peer(clear_mask, set_mask)
4853    }
4854}
4855
4856impl IoportResourceControlHandle {}
4857
4858#[must_use = "FIDL methods require a response to be sent"]
4859#[derive(Debug)]
4860pub struct IoportResourceGetResponder {
4861    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4862    tx_id: u32,
4863}
4864
4865/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4866/// if the responder is dropped without sending a response, so that the client
4867/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4868impl std::ops::Drop for IoportResourceGetResponder {
4869    fn drop(&mut self) {
4870        self.control_handle.shutdown();
4871        // Safety: drops once, never accessed again
4872        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4873    }
4874}
4875
4876impl fidl::endpoints::Responder for IoportResourceGetResponder {
4877    type ControlHandle = IoportResourceControlHandle;
4878
4879    fn control_handle(&self) -> &IoportResourceControlHandle {
4880        &self.control_handle
4881    }
4882
4883    fn drop_without_shutdown(mut self) {
4884        // Safety: drops once, never accessed again due to mem::forget
4885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4886        // Prevent Drop from running (which would shut down the channel)
4887        std::mem::forget(self);
4888    }
4889}
4890
4891impl IoportResourceGetResponder {
4892    /// Sends a response to the FIDL transaction.
4893    ///
4894    /// Sets the channel to shutdown if an error occurs.
4895    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4896        let _result = self.send_raw(resource);
4897        if _result.is_err() {
4898            self.control_handle.shutdown();
4899        }
4900        self.drop_without_shutdown();
4901        _result
4902    }
4903
4904    /// Similar to "send" but does not shutdown the channel if an error occurs.
4905    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4906        let _result = self.send_raw(resource);
4907        self.drop_without_shutdown();
4908        _result
4909    }
4910
4911    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4912        self.control_handle.inner.send::<IoportResourceGetResponse>(
4913            (resource,),
4914            self.tx_id,
4915            0x4db20876b537c52b,
4916            fidl::encoding::DynamicFlags::empty(),
4917        )
4918    }
4919}
4920
4921#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4922pub struct IrqResourceMarker;
4923
4924impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4925    type Proxy = IrqResourceProxy;
4926    type RequestStream = IrqResourceRequestStream;
4927    #[cfg(target_os = "fuchsia")]
4928    type SynchronousProxy = IrqResourceSynchronousProxy;
4929
4930    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4931}
4932impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4933
4934pub trait IrqResourceProxyInterface: Send + Sync {
4935    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4936    fn r#get(&self) -> Self::GetResponseFut;
4937}
4938#[derive(Debug)]
4939#[cfg(target_os = "fuchsia")]
4940pub struct IrqResourceSynchronousProxy {
4941    client: fidl::client::sync::Client,
4942}
4943
4944#[cfg(target_os = "fuchsia")]
4945impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
4946    type Proxy = IrqResourceProxy;
4947    type Protocol = IrqResourceMarker;
4948
4949    fn from_channel(inner: fidl::Channel) -> Self {
4950        Self::new(inner)
4951    }
4952
4953    fn into_channel(self) -> fidl::Channel {
4954        self.client.into_channel()
4955    }
4956
4957    fn as_channel(&self) -> &fidl::Channel {
4958        self.client.as_channel()
4959    }
4960}
4961
4962#[cfg(target_os = "fuchsia")]
4963impl IrqResourceSynchronousProxy {
4964    pub fn new(channel: fidl::Channel) -> Self {
4965        Self { client: fidl::client::sync::Client::new(channel) }
4966    }
4967
4968    pub fn into_channel(self) -> fidl::Channel {
4969        self.client.into_channel()
4970    }
4971
4972    /// Waits until an event arrives and returns it. It is safe for other
4973    /// threads to make concurrent requests while waiting for an event.
4974    pub fn wait_for_event(
4975        &self,
4976        deadline: zx::MonotonicInstant,
4977    ) -> Result<IrqResourceEvent, fidl::Error> {
4978        IrqResourceEvent::decode(self.client.wait_for_event::<IrqResourceMarker>(deadline)?)
4979    }
4980
4981    /// Get an IRQ resource handle.
4982    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4983        let _response = self
4984            .client
4985            .send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse, IrqResourceMarker>(
4986                (),
4987                0x491be54504b041e9,
4988                fidl::encoding::DynamicFlags::empty(),
4989                ___deadline,
4990            )?;
4991        Ok(_response.resource)
4992    }
4993}
4994
4995#[cfg(target_os = "fuchsia")]
4996impl From<IrqResourceSynchronousProxy> for zx::NullableHandle {
4997    fn from(value: IrqResourceSynchronousProxy) -> Self {
4998        value.into_channel().into()
4999    }
5000}
5001
5002#[cfg(target_os = "fuchsia")]
5003impl From<fidl::Channel> for IrqResourceSynchronousProxy {
5004    fn from(value: fidl::Channel) -> Self {
5005        Self::new(value)
5006    }
5007}
5008
5009#[cfg(target_os = "fuchsia")]
5010impl fidl::endpoints::FromClient for IrqResourceSynchronousProxy {
5011    type Protocol = IrqResourceMarker;
5012
5013    fn from_client(value: fidl::endpoints::ClientEnd<IrqResourceMarker>) -> Self {
5014        Self::new(value.into_channel())
5015    }
5016}
5017
5018#[derive(Debug, Clone)]
5019pub struct IrqResourceProxy {
5020    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5021}
5022
5023impl fidl::endpoints::Proxy for IrqResourceProxy {
5024    type Protocol = IrqResourceMarker;
5025
5026    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5027        Self::new(inner)
5028    }
5029
5030    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5031        self.client.into_channel().map_err(|client| Self { client })
5032    }
5033
5034    fn as_channel(&self) -> &::fidl::AsyncChannel {
5035        self.client.as_channel()
5036    }
5037}
5038
5039impl IrqResourceProxy {
5040    /// Create a new Proxy for fuchsia.kernel/IrqResource.
5041    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5042        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5043        Self { client: fidl::client::Client::new(channel, protocol_name) }
5044    }
5045
5046    /// Get a Stream of events from the remote end of the protocol.
5047    ///
5048    /// # Panics
5049    ///
5050    /// Panics if the event stream was already taken.
5051    pub fn take_event_stream(&self) -> IrqResourceEventStream {
5052        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
5053    }
5054
5055    /// Get an IRQ resource handle.
5056    pub fn r#get(
5057        &self,
5058    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5059    {
5060        IrqResourceProxyInterface::r#get(self)
5061    }
5062}
5063
5064impl IrqResourceProxyInterface for IrqResourceProxy {
5065    type GetResponseFut = fidl::client::QueryResponseFut<
5066        fidl::Resource,
5067        fidl::encoding::DefaultFuchsiaResourceDialect,
5068    >;
5069    fn r#get(&self) -> Self::GetResponseFut {
5070        fn _decode(
5071            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5072        ) -> Result<fidl::Resource, fidl::Error> {
5073            let _response = fidl::client::decode_transaction_body::<
5074                IrqResourceGetResponse,
5075                fidl::encoding::DefaultFuchsiaResourceDialect,
5076                0x491be54504b041e9,
5077            >(_buf?)?;
5078            Ok(_response.resource)
5079        }
5080        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5081            (),
5082            0x491be54504b041e9,
5083            fidl::encoding::DynamicFlags::empty(),
5084            _decode,
5085        )
5086    }
5087}
5088
5089pub struct IrqResourceEventStream {
5090    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5091}
5092
5093impl std::marker::Unpin for IrqResourceEventStream {}
5094
5095impl futures::stream::FusedStream for IrqResourceEventStream {
5096    fn is_terminated(&self) -> bool {
5097        self.event_receiver.is_terminated()
5098    }
5099}
5100
5101impl futures::Stream for IrqResourceEventStream {
5102    type Item = Result<IrqResourceEvent, fidl::Error>;
5103
5104    fn poll_next(
5105        mut self: std::pin::Pin<&mut Self>,
5106        cx: &mut std::task::Context<'_>,
5107    ) -> std::task::Poll<Option<Self::Item>> {
5108        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5109            &mut self.event_receiver,
5110            cx
5111        )?) {
5112            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
5113            None => std::task::Poll::Ready(None),
5114        }
5115    }
5116}
5117
5118#[derive(Debug)]
5119pub enum IrqResourceEvent {}
5120
5121impl IrqResourceEvent {
5122    /// Decodes a message buffer as a [`IrqResourceEvent`].
5123    fn decode(
5124        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5125    ) -> Result<IrqResourceEvent, fidl::Error> {
5126        let (bytes, _handles) = buf.split_mut();
5127        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5128        debug_assert_eq!(tx_header.tx_id, 0);
5129        match tx_header.ordinal {
5130            _ => Err(fidl::Error::UnknownOrdinal {
5131                ordinal: tx_header.ordinal,
5132                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5133            }),
5134        }
5135    }
5136}
5137
5138/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
5139pub struct IrqResourceRequestStream {
5140    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5141    is_terminated: bool,
5142}
5143
5144impl std::marker::Unpin for IrqResourceRequestStream {}
5145
5146impl futures::stream::FusedStream for IrqResourceRequestStream {
5147    fn is_terminated(&self) -> bool {
5148        self.is_terminated
5149    }
5150}
5151
5152impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
5153    type Protocol = IrqResourceMarker;
5154    type ControlHandle = IrqResourceControlHandle;
5155
5156    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5157        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5158    }
5159
5160    fn control_handle(&self) -> Self::ControlHandle {
5161        IrqResourceControlHandle { inner: self.inner.clone() }
5162    }
5163
5164    fn into_inner(
5165        self,
5166    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5167    {
5168        (self.inner, self.is_terminated)
5169    }
5170
5171    fn from_inner(
5172        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5173        is_terminated: bool,
5174    ) -> Self {
5175        Self { inner, is_terminated }
5176    }
5177}
5178
5179impl futures::Stream for IrqResourceRequestStream {
5180    type Item = Result<IrqResourceRequest, fidl::Error>;
5181
5182    fn poll_next(
5183        mut self: std::pin::Pin<&mut Self>,
5184        cx: &mut std::task::Context<'_>,
5185    ) -> std::task::Poll<Option<Self::Item>> {
5186        let this = &mut *self;
5187        if this.inner.check_shutdown(cx) {
5188            this.is_terminated = true;
5189            return std::task::Poll::Ready(None);
5190        }
5191        if this.is_terminated {
5192            panic!("polled IrqResourceRequestStream after completion");
5193        }
5194        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5195            |bytes, handles| {
5196                match this.inner.channel().read_etc(cx, bytes, handles) {
5197                    std::task::Poll::Ready(Ok(())) => {}
5198                    std::task::Poll::Pending => return std::task::Poll::Pending,
5199                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5200                        this.is_terminated = true;
5201                        return std::task::Poll::Ready(None);
5202                    }
5203                    std::task::Poll::Ready(Err(e)) => {
5204                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5205                            e.into(),
5206                        ))));
5207                    }
5208                }
5209
5210                // A message has been received from the channel
5211                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5212
5213                std::task::Poll::Ready(Some(match header.ordinal {
5214                    0x491be54504b041e9 => {
5215                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5216                        let mut req = fidl::new_empty!(
5217                            fidl::encoding::EmptyPayload,
5218                            fidl::encoding::DefaultFuchsiaResourceDialect
5219                        );
5220                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5221                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
5222                        Ok(IrqResourceRequest::Get {
5223                            responder: IrqResourceGetResponder {
5224                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5225                                tx_id: header.tx_id,
5226                            },
5227                        })
5228                    }
5229                    _ => Err(fidl::Error::UnknownOrdinal {
5230                        ordinal: header.ordinal,
5231                        protocol_name:
5232                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5233                    }),
5234                }))
5235            },
5236        )
5237    }
5238}
5239
5240/// Protocol for providing an IRQ resource with access to all valid ranges.
5241#[derive(Debug)]
5242pub enum IrqResourceRequest {
5243    /// Get an IRQ resource handle.
5244    Get { responder: IrqResourceGetResponder },
5245}
5246
5247impl IrqResourceRequest {
5248    #[allow(irrefutable_let_patterns)]
5249    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
5250        if let IrqResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5251    }
5252
5253    /// Name of the method defined in FIDL
5254    pub fn method_name(&self) -> &'static str {
5255        match *self {
5256            IrqResourceRequest::Get { .. } => "get",
5257        }
5258    }
5259}
5260
5261#[derive(Debug, Clone)]
5262pub struct IrqResourceControlHandle {
5263    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5264}
5265
5266impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
5267    fn shutdown(&self) {
5268        self.inner.shutdown()
5269    }
5270
5271    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5272        self.inner.shutdown_with_epitaph(status)
5273    }
5274
5275    fn is_closed(&self) -> bool {
5276        self.inner.channel().is_closed()
5277    }
5278    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5279        self.inner.channel().on_closed()
5280    }
5281
5282    #[cfg(target_os = "fuchsia")]
5283    fn signal_peer(
5284        &self,
5285        clear_mask: zx::Signals,
5286        set_mask: zx::Signals,
5287    ) -> Result<(), zx_status::Status> {
5288        use fidl::Peered;
5289        self.inner.channel().signal_peer(clear_mask, set_mask)
5290    }
5291}
5292
5293impl IrqResourceControlHandle {}
5294
5295#[must_use = "FIDL methods require a response to be sent"]
5296#[derive(Debug)]
5297pub struct IrqResourceGetResponder {
5298    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5299    tx_id: u32,
5300}
5301
5302/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5303/// if the responder is dropped without sending a response, so that the client
5304/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5305impl std::ops::Drop for IrqResourceGetResponder {
5306    fn drop(&mut self) {
5307        self.control_handle.shutdown();
5308        // Safety: drops once, never accessed again
5309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5310    }
5311}
5312
5313impl fidl::endpoints::Responder for IrqResourceGetResponder {
5314    type ControlHandle = IrqResourceControlHandle;
5315
5316    fn control_handle(&self) -> &IrqResourceControlHandle {
5317        &self.control_handle
5318    }
5319
5320    fn drop_without_shutdown(mut self) {
5321        // Safety: drops once, never accessed again due to mem::forget
5322        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5323        // Prevent Drop from running (which would shut down the channel)
5324        std::mem::forget(self);
5325    }
5326}
5327
5328impl IrqResourceGetResponder {
5329    /// Sends a response to the FIDL transaction.
5330    ///
5331    /// Sets the channel to shutdown if an error occurs.
5332    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5333        let _result = self.send_raw(resource);
5334        if _result.is_err() {
5335            self.control_handle.shutdown();
5336        }
5337        self.drop_without_shutdown();
5338        _result
5339    }
5340
5341    /// Similar to "send" but does not shutdown the channel if an error occurs.
5342    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5343        let _result = self.send_raw(resource);
5344        self.drop_without_shutdown();
5345        _result
5346    }
5347
5348    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5349        self.control_handle.inner.send::<IrqResourceGetResponse>(
5350            (resource,),
5351            self.tx_id,
5352            0x491be54504b041e9,
5353            fidl::encoding::DynamicFlags::empty(),
5354        )
5355    }
5356}
5357
5358#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5359pub struct MexecResourceMarker;
5360
5361impl fidl::endpoints::ProtocolMarker for MexecResourceMarker {
5362    type Proxy = MexecResourceProxy;
5363    type RequestStream = MexecResourceRequestStream;
5364    #[cfg(target_os = "fuchsia")]
5365    type SynchronousProxy = MexecResourceSynchronousProxy;
5366
5367    const DEBUG_NAME: &'static str = "fuchsia.kernel.MexecResource";
5368}
5369impl fidl::endpoints::DiscoverableProtocolMarker for MexecResourceMarker {}
5370
5371pub trait MexecResourceProxyInterface: Send + Sync {
5372    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5373    fn r#get(&self) -> Self::GetResponseFut;
5374}
5375#[derive(Debug)]
5376#[cfg(target_os = "fuchsia")]
5377pub struct MexecResourceSynchronousProxy {
5378    client: fidl::client::sync::Client,
5379}
5380
5381#[cfg(target_os = "fuchsia")]
5382impl fidl::endpoints::SynchronousProxy for MexecResourceSynchronousProxy {
5383    type Proxy = MexecResourceProxy;
5384    type Protocol = MexecResourceMarker;
5385
5386    fn from_channel(inner: fidl::Channel) -> Self {
5387        Self::new(inner)
5388    }
5389
5390    fn into_channel(self) -> fidl::Channel {
5391        self.client.into_channel()
5392    }
5393
5394    fn as_channel(&self) -> &fidl::Channel {
5395        self.client.as_channel()
5396    }
5397}
5398
5399#[cfg(target_os = "fuchsia")]
5400impl MexecResourceSynchronousProxy {
5401    pub fn new(channel: fidl::Channel) -> Self {
5402        Self { client: fidl::client::sync::Client::new(channel) }
5403    }
5404
5405    pub fn into_channel(self) -> fidl::Channel {
5406        self.client.into_channel()
5407    }
5408
5409    /// Waits until an event arrives and returns it. It is safe for other
5410    /// threads to make concurrent requests while waiting for an event.
5411    pub fn wait_for_event(
5412        &self,
5413        deadline: zx::MonotonicInstant,
5414    ) -> Result<MexecResourceEvent, fidl::Error> {
5415        MexecResourceEvent::decode(self.client.wait_for_event::<MexecResourceMarker>(deadline)?)
5416    }
5417
5418    /// Get an MEXEC resource handle as `resource`.
5419    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5420        let _response = self.client.send_query::<
5421            fidl::encoding::EmptyPayload,
5422            MexecResourceGetResponse,
5423            MexecResourceMarker,
5424        >(
5425            (),
5426            0xff93e6722900f54,
5427            fidl::encoding::DynamicFlags::empty(),
5428            ___deadline,
5429        )?;
5430        Ok(_response.resource)
5431    }
5432}
5433
5434#[cfg(target_os = "fuchsia")]
5435impl From<MexecResourceSynchronousProxy> for zx::NullableHandle {
5436    fn from(value: MexecResourceSynchronousProxy) -> Self {
5437        value.into_channel().into()
5438    }
5439}
5440
5441#[cfg(target_os = "fuchsia")]
5442impl From<fidl::Channel> for MexecResourceSynchronousProxy {
5443    fn from(value: fidl::Channel) -> Self {
5444        Self::new(value)
5445    }
5446}
5447
5448#[cfg(target_os = "fuchsia")]
5449impl fidl::endpoints::FromClient for MexecResourceSynchronousProxy {
5450    type Protocol = MexecResourceMarker;
5451
5452    fn from_client(value: fidl::endpoints::ClientEnd<MexecResourceMarker>) -> Self {
5453        Self::new(value.into_channel())
5454    }
5455}
5456
5457#[derive(Debug, Clone)]
5458pub struct MexecResourceProxy {
5459    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5460}
5461
5462impl fidl::endpoints::Proxy for MexecResourceProxy {
5463    type Protocol = MexecResourceMarker;
5464
5465    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5466        Self::new(inner)
5467    }
5468
5469    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5470        self.client.into_channel().map_err(|client| Self { client })
5471    }
5472
5473    fn as_channel(&self) -> &::fidl::AsyncChannel {
5474        self.client.as_channel()
5475    }
5476}
5477
5478impl MexecResourceProxy {
5479    /// Create a new Proxy for fuchsia.kernel/MexecResource.
5480    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5481        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5482        Self { client: fidl::client::Client::new(channel, protocol_name) }
5483    }
5484
5485    /// Get a Stream of events from the remote end of the protocol.
5486    ///
5487    /// # Panics
5488    ///
5489    /// Panics if the event stream was already taken.
5490    pub fn take_event_stream(&self) -> MexecResourceEventStream {
5491        MexecResourceEventStream { event_receiver: self.client.take_event_receiver() }
5492    }
5493
5494    /// Get an MEXEC resource handle as `resource`.
5495    pub fn r#get(
5496        &self,
5497    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5498    {
5499        MexecResourceProxyInterface::r#get(self)
5500    }
5501}
5502
5503impl MexecResourceProxyInterface for MexecResourceProxy {
5504    type GetResponseFut = fidl::client::QueryResponseFut<
5505        fidl::Resource,
5506        fidl::encoding::DefaultFuchsiaResourceDialect,
5507    >;
5508    fn r#get(&self) -> Self::GetResponseFut {
5509        fn _decode(
5510            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5511        ) -> Result<fidl::Resource, fidl::Error> {
5512            let _response = fidl::client::decode_transaction_body::<
5513                MexecResourceGetResponse,
5514                fidl::encoding::DefaultFuchsiaResourceDialect,
5515                0xff93e6722900f54,
5516            >(_buf?)?;
5517            Ok(_response.resource)
5518        }
5519        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5520            (),
5521            0xff93e6722900f54,
5522            fidl::encoding::DynamicFlags::empty(),
5523            _decode,
5524        )
5525    }
5526}
5527
5528pub struct MexecResourceEventStream {
5529    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5530}
5531
5532impl std::marker::Unpin for MexecResourceEventStream {}
5533
5534impl futures::stream::FusedStream for MexecResourceEventStream {
5535    fn is_terminated(&self) -> bool {
5536        self.event_receiver.is_terminated()
5537    }
5538}
5539
5540impl futures::Stream for MexecResourceEventStream {
5541    type Item = Result<MexecResourceEvent, fidl::Error>;
5542
5543    fn poll_next(
5544        mut self: std::pin::Pin<&mut Self>,
5545        cx: &mut std::task::Context<'_>,
5546    ) -> std::task::Poll<Option<Self::Item>> {
5547        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5548            &mut self.event_receiver,
5549            cx
5550        )?) {
5551            Some(buf) => std::task::Poll::Ready(Some(MexecResourceEvent::decode(buf))),
5552            None => std::task::Poll::Ready(None),
5553        }
5554    }
5555}
5556
5557#[derive(Debug)]
5558pub enum MexecResourceEvent {}
5559
5560impl MexecResourceEvent {
5561    /// Decodes a message buffer as a [`MexecResourceEvent`].
5562    fn decode(
5563        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5564    ) -> Result<MexecResourceEvent, fidl::Error> {
5565        let (bytes, _handles) = buf.split_mut();
5566        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5567        debug_assert_eq!(tx_header.tx_id, 0);
5568        match tx_header.ordinal {
5569            _ => Err(fidl::Error::UnknownOrdinal {
5570                ordinal: tx_header.ordinal,
5571                protocol_name: <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5572            }),
5573        }
5574    }
5575}
5576
5577/// A Stream of incoming requests for fuchsia.kernel/MexecResource.
5578pub struct MexecResourceRequestStream {
5579    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5580    is_terminated: bool,
5581}
5582
5583impl std::marker::Unpin for MexecResourceRequestStream {}
5584
5585impl futures::stream::FusedStream for MexecResourceRequestStream {
5586    fn is_terminated(&self) -> bool {
5587        self.is_terminated
5588    }
5589}
5590
5591impl fidl::endpoints::RequestStream for MexecResourceRequestStream {
5592    type Protocol = MexecResourceMarker;
5593    type ControlHandle = MexecResourceControlHandle;
5594
5595    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5596        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5597    }
5598
5599    fn control_handle(&self) -> Self::ControlHandle {
5600        MexecResourceControlHandle { inner: self.inner.clone() }
5601    }
5602
5603    fn into_inner(
5604        self,
5605    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5606    {
5607        (self.inner, self.is_terminated)
5608    }
5609
5610    fn from_inner(
5611        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5612        is_terminated: bool,
5613    ) -> Self {
5614        Self { inner, is_terminated }
5615    }
5616}
5617
5618impl futures::Stream for MexecResourceRequestStream {
5619    type Item = Result<MexecResourceRequest, fidl::Error>;
5620
5621    fn poll_next(
5622        mut self: std::pin::Pin<&mut Self>,
5623        cx: &mut std::task::Context<'_>,
5624    ) -> std::task::Poll<Option<Self::Item>> {
5625        let this = &mut *self;
5626        if this.inner.check_shutdown(cx) {
5627            this.is_terminated = true;
5628            return std::task::Poll::Ready(None);
5629        }
5630        if this.is_terminated {
5631            panic!("polled MexecResourceRequestStream after completion");
5632        }
5633        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5634            |bytes, handles| {
5635                match this.inner.channel().read_etc(cx, bytes, handles) {
5636                    std::task::Poll::Ready(Ok(())) => {}
5637                    std::task::Poll::Pending => return std::task::Poll::Pending,
5638                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5639                        this.is_terminated = true;
5640                        return std::task::Poll::Ready(None);
5641                    }
5642                    std::task::Poll::Ready(Err(e)) => {
5643                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5644                            e.into(),
5645                        ))));
5646                    }
5647                }
5648
5649                // A message has been received from the channel
5650                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5651
5652                std::task::Poll::Ready(Some(match header.ordinal {
5653                    0xff93e6722900f54 => {
5654                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5655                        let mut req = fidl::new_empty!(
5656                            fidl::encoding::EmptyPayload,
5657                            fidl::encoding::DefaultFuchsiaResourceDialect
5658                        );
5659                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5660                        let control_handle =
5661                            MexecResourceControlHandle { inner: this.inner.clone() };
5662                        Ok(MexecResourceRequest::Get {
5663                            responder: MexecResourceGetResponder {
5664                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5665                                tx_id: header.tx_id,
5666                            },
5667                        })
5668                    }
5669                    _ => Err(fidl::Error::UnknownOrdinal {
5670                        ordinal: header.ordinal,
5671                        protocol_name:
5672                            <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5673                    }),
5674                }))
5675            },
5676        )
5677    }
5678}
5679
5680/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
5681/// `ZX_RSRC_SYSTEM_MEXEC_BASE`.
5682#[derive(Debug)]
5683pub enum MexecResourceRequest {
5684    /// Get an MEXEC resource handle as `resource`.
5685    Get { responder: MexecResourceGetResponder },
5686}
5687
5688impl MexecResourceRequest {
5689    #[allow(irrefutable_let_patterns)]
5690    pub fn into_get(self) -> Option<(MexecResourceGetResponder)> {
5691        if let MexecResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5692    }
5693
5694    /// Name of the method defined in FIDL
5695    pub fn method_name(&self) -> &'static str {
5696        match *self {
5697            MexecResourceRequest::Get { .. } => "get",
5698        }
5699    }
5700}
5701
5702#[derive(Debug, Clone)]
5703pub struct MexecResourceControlHandle {
5704    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5705}
5706
5707impl fidl::endpoints::ControlHandle for MexecResourceControlHandle {
5708    fn shutdown(&self) {
5709        self.inner.shutdown()
5710    }
5711
5712    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5713        self.inner.shutdown_with_epitaph(status)
5714    }
5715
5716    fn is_closed(&self) -> bool {
5717        self.inner.channel().is_closed()
5718    }
5719    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5720        self.inner.channel().on_closed()
5721    }
5722
5723    #[cfg(target_os = "fuchsia")]
5724    fn signal_peer(
5725        &self,
5726        clear_mask: zx::Signals,
5727        set_mask: zx::Signals,
5728    ) -> Result<(), zx_status::Status> {
5729        use fidl::Peered;
5730        self.inner.channel().signal_peer(clear_mask, set_mask)
5731    }
5732}
5733
5734impl MexecResourceControlHandle {}
5735
5736#[must_use = "FIDL methods require a response to be sent"]
5737#[derive(Debug)]
5738pub struct MexecResourceGetResponder {
5739    control_handle: std::mem::ManuallyDrop<MexecResourceControlHandle>,
5740    tx_id: u32,
5741}
5742
5743/// Set the the channel to be shutdown (see [`MexecResourceControlHandle::shutdown`])
5744/// if the responder is dropped without sending a response, so that the client
5745/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5746impl std::ops::Drop for MexecResourceGetResponder {
5747    fn drop(&mut self) {
5748        self.control_handle.shutdown();
5749        // Safety: drops once, never accessed again
5750        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5751    }
5752}
5753
5754impl fidl::endpoints::Responder for MexecResourceGetResponder {
5755    type ControlHandle = MexecResourceControlHandle;
5756
5757    fn control_handle(&self) -> &MexecResourceControlHandle {
5758        &self.control_handle
5759    }
5760
5761    fn drop_without_shutdown(mut self) {
5762        // Safety: drops once, never accessed again due to mem::forget
5763        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5764        // Prevent Drop from running (which would shut down the channel)
5765        std::mem::forget(self);
5766    }
5767}
5768
5769impl MexecResourceGetResponder {
5770    /// Sends a response to the FIDL transaction.
5771    ///
5772    /// Sets the channel to shutdown if an error occurs.
5773    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5774        let _result = self.send_raw(resource);
5775        if _result.is_err() {
5776            self.control_handle.shutdown();
5777        }
5778        self.drop_without_shutdown();
5779        _result
5780    }
5781
5782    /// Similar to "send" but does not shutdown the channel if an error occurs.
5783    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5784        let _result = self.send_raw(resource);
5785        self.drop_without_shutdown();
5786        _result
5787    }
5788
5789    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5790        self.control_handle.inner.send::<MexecResourceGetResponse>(
5791            (resource,),
5792            self.tx_id,
5793            0xff93e6722900f54,
5794            fidl::encoding::DynamicFlags::empty(),
5795        )
5796    }
5797}
5798
5799#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5800pub struct MmioResourceMarker;
5801
5802impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5803    type Proxy = MmioResourceProxy;
5804    type RequestStream = MmioResourceRequestStream;
5805    #[cfg(target_os = "fuchsia")]
5806    type SynchronousProxy = MmioResourceSynchronousProxy;
5807
5808    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5809}
5810impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5811
5812pub trait MmioResourceProxyInterface: Send + Sync {
5813    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5814    fn r#get(&self) -> Self::GetResponseFut;
5815}
5816#[derive(Debug)]
5817#[cfg(target_os = "fuchsia")]
5818pub struct MmioResourceSynchronousProxy {
5819    client: fidl::client::sync::Client,
5820}
5821
5822#[cfg(target_os = "fuchsia")]
5823impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5824    type Proxy = MmioResourceProxy;
5825    type Protocol = MmioResourceMarker;
5826
5827    fn from_channel(inner: fidl::Channel) -> Self {
5828        Self::new(inner)
5829    }
5830
5831    fn into_channel(self) -> fidl::Channel {
5832        self.client.into_channel()
5833    }
5834
5835    fn as_channel(&self) -> &fidl::Channel {
5836        self.client.as_channel()
5837    }
5838}
5839
5840#[cfg(target_os = "fuchsia")]
5841impl MmioResourceSynchronousProxy {
5842    pub fn new(channel: fidl::Channel) -> Self {
5843        Self { client: fidl::client::sync::Client::new(channel) }
5844    }
5845
5846    pub fn into_channel(self) -> fidl::Channel {
5847        self.client.into_channel()
5848    }
5849
5850    /// Waits until an event arrives and returns it. It is safe for other
5851    /// threads to make concurrent requests while waiting for an event.
5852    pub fn wait_for_event(
5853        &self,
5854        deadline: zx::MonotonicInstant,
5855    ) -> Result<MmioResourceEvent, fidl::Error> {
5856        MmioResourceEvent::decode(self.client.wait_for_event::<MmioResourceMarker>(deadline)?)
5857    }
5858
5859    /// Get an MMIO resource handle.
5860    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5861        let _response = self.client.send_query::<
5862            fidl::encoding::EmptyPayload,
5863            MmioResourceGetResponse,
5864            MmioResourceMarker,
5865        >(
5866            (),
5867            0x66747b9c5a6dfe7b,
5868            fidl::encoding::DynamicFlags::empty(),
5869            ___deadline,
5870        )?;
5871        Ok(_response.resource)
5872    }
5873}
5874
5875#[cfg(target_os = "fuchsia")]
5876impl From<MmioResourceSynchronousProxy> for zx::NullableHandle {
5877    fn from(value: MmioResourceSynchronousProxy) -> Self {
5878        value.into_channel().into()
5879    }
5880}
5881
5882#[cfg(target_os = "fuchsia")]
5883impl From<fidl::Channel> for MmioResourceSynchronousProxy {
5884    fn from(value: fidl::Channel) -> Self {
5885        Self::new(value)
5886    }
5887}
5888
5889#[cfg(target_os = "fuchsia")]
5890impl fidl::endpoints::FromClient for MmioResourceSynchronousProxy {
5891    type Protocol = MmioResourceMarker;
5892
5893    fn from_client(value: fidl::endpoints::ClientEnd<MmioResourceMarker>) -> Self {
5894        Self::new(value.into_channel())
5895    }
5896}
5897
5898#[derive(Debug, Clone)]
5899pub struct MmioResourceProxy {
5900    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5901}
5902
5903impl fidl::endpoints::Proxy for MmioResourceProxy {
5904    type Protocol = MmioResourceMarker;
5905
5906    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5907        Self::new(inner)
5908    }
5909
5910    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5911        self.client.into_channel().map_err(|client| Self { client })
5912    }
5913
5914    fn as_channel(&self) -> &::fidl::AsyncChannel {
5915        self.client.as_channel()
5916    }
5917}
5918
5919impl MmioResourceProxy {
5920    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5921    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5922        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5923        Self { client: fidl::client::Client::new(channel, protocol_name) }
5924    }
5925
5926    /// Get a Stream of events from the remote end of the protocol.
5927    ///
5928    /// # Panics
5929    ///
5930    /// Panics if the event stream was already taken.
5931    pub fn take_event_stream(&self) -> MmioResourceEventStream {
5932        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
5933    }
5934
5935    /// Get an MMIO resource handle.
5936    pub fn r#get(
5937        &self,
5938    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5939    {
5940        MmioResourceProxyInterface::r#get(self)
5941    }
5942}
5943
5944impl MmioResourceProxyInterface for MmioResourceProxy {
5945    type GetResponseFut = fidl::client::QueryResponseFut<
5946        fidl::Resource,
5947        fidl::encoding::DefaultFuchsiaResourceDialect,
5948    >;
5949    fn r#get(&self) -> Self::GetResponseFut {
5950        fn _decode(
5951            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5952        ) -> Result<fidl::Resource, fidl::Error> {
5953            let _response = fidl::client::decode_transaction_body::<
5954                MmioResourceGetResponse,
5955                fidl::encoding::DefaultFuchsiaResourceDialect,
5956                0x66747b9c5a6dfe7b,
5957            >(_buf?)?;
5958            Ok(_response.resource)
5959        }
5960        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5961            (),
5962            0x66747b9c5a6dfe7b,
5963            fidl::encoding::DynamicFlags::empty(),
5964            _decode,
5965        )
5966    }
5967}
5968
5969pub struct MmioResourceEventStream {
5970    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5971}
5972
5973impl std::marker::Unpin for MmioResourceEventStream {}
5974
5975impl futures::stream::FusedStream for MmioResourceEventStream {
5976    fn is_terminated(&self) -> bool {
5977        self.event_receiver.is_terminated()
5978    }
5979}
5980
5981impl futures::Stream for MmioResourceEventStream {
5982    type Item = Result<MmioResourceEvent, fidl::Error>;
5983
5984    fn poll_next(
5985        mut self: std::pin::Pin<&mut Self>,
5986        cx: &mut std::task::Context<'_>,
5987    ) -> std::task::Poll<Option<Self::Item>> {
5988        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5989            &mut self.event_receiver,
5990            cx
5991        )?) {
5992            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
5993            None => std::task::Poll::Ready(None),
5994        }
5995    }
5996}
5997
5998#[derive(Debug)]
5999pub enum MmioResourceEvent {}
6000
6001impl MmioResourceEvent {
6002    /// Decodes a message buffer as a [`MmioResourceEvent`].
6003    fn decode(
6004        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6005    ) -> Result<MmioResourceEvent, fidl::Error> {
6006        let (bytes, _handles) = buf.split_mut();
6007        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6008        debug_assert_eq!(tx_header.tx_id, 0);
6009        match tx_header.ordinal {
6010            _ => Err(fidl::Error::UnknownOrdinal {
6011                ordinal: tx_header.ordinal,
6012                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6013            }),
6014        }
6015    }
6016}
6017
6018/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
6019pub struct MmioResourceRequestStream {
6020    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6021    is_terminated: bool,
6022}
6023
6024impl std::marker::Unpin for MmioResourceRequestStream {}
6025
6026impl futures::stream::FusedStream for MmioResourceRequestStream {
6027    fn is_terminated(&self) -> bool {
6028        self.is_terminated
6029    }
6030}
6031
6032impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
6033    type Protocol = MmioResourceMarker;
6034    type ControlHandle = MmioResourceControlHandle;
6035
6036    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6037        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6038    }
6039
6040    fn control_handle(&self) -> Self::ControlHandle {
6041        MmioResourceControlHandle { inner: self.inner.clone() }
6042    }
6043
6044    fn into_inner(
6045        self,
6046    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6047    {
6048        (self.inner, self.is_terminated)
6049    }
6050
6051    fn from_inner(
6052        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6053        is_terminated: bool,
6054    ) -> Self {
6055        Self { inner, is_terminated }
6056    }
6057}
6058
6059impl futures::Stream for MmioResourceRequestStream {
6060    type Item = Result<MmioResourceRequest, fidl::Error>;
6061
6062    fn poll_next(
6063        mut self: std::pin::Pin<&mut Self>,
6064        cx: &mut std::task::Context<'_>,
6065    ) -> std::task::Poll<Option<Self::Item>> {
6066        let this = &mut *self;
6067        if this.inner.check_shutdown(cx) {
6068            this.is_terminated = true;
6069            return std::task::Poll::Ready(None);
6070        }
6071        if this.is_terminated {
6072            panic!("polled MmioResourceRequestStream after completion");
6073        }
6074        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6075            |bytes, handles| {
6076                match this.inner.channel().read_etc(cx, bytes, handles) {
6077                    std::task::Poll::Ready(Ok(())) => {}
6078                    std::task::Poll::Pending => return std::task::Poll::Pending,
6079                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6080                        this.is_terminated = true;
6081                        return std::task::Poll::Ready(None);
6082                    }
6083                    std::task::Poll::Ready(Err(e)) => {
6084                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6085                            e.into(),
6086                        ))));
6087                    }
6088                }
6089
6090                // A message has been received from the channel
6091                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6092
6093                std::task::Poll::Ready(Some(match header.ordinal {
6094                    0x66747b9c5a6dfe7b => {
6095                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6096                        let mut req = fidl::new_empty!(
6097                            fidl::encoding::EmptyPayload,
6098                            fidl::encoding::DefaultFuchsiaResourceDialect
6099                        );
6100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6101                        let control_handle =
6102                            MmioResourceControlHandle { inner: this.inner.clone() };
6103                        Ok(MmioResourceRequest::Get {
6104                            responder: MmioResourceGetResponder {
6105                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6106                                tx_id: header.tx_id,
6107                            },
6108                        })
6109                    }
6110                    _ => Err(fidl::Error::UnknownOrdinal {
6111                        ordinal: header.ordinal,
6112                        protocol_name:
6113                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6114                    }),
6115                }))
6116            },
6117        )
6118    }
6119}
6120
6121/// Protocol for providing an MMIO resource with access to all valid ranges.
6122#[derive(Debug)]
6123pub enum MmioResourceRequest {
6124    /// Get an MMIO resource handle.
6125    Get { responder: MmioResourceGetResponder },
6126}
6127
6128impl MmioResourceRequest {
6129    #[allow(irrefutable_let_patterns)]
6130    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
6131        if let MmioResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6132    }
6133
6134    /// Name of the method defined in FIDL
6135    pub fn method_name(&self) -> &'static str {
6136        match *self {
6137            MmioResourceRequest::Get { .. } => "get",
6138        }
6139    }
6140}
6141
6142#[derive(Debug, Clone)]
6143pub struct MmioResourceControlHandle {
6144    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6145}
6146
6147impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
6148    fn shutdown(&self) {
6149        self.inner.shutdown()
6150    }
6151
6152    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6153        self.inner.shutdown_with_epitaph(status)
6154    }
6155
6156    fn is_closed(&self) -> bool {
6157        self.inner.channel().is_closed()
6158    }
6159    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6160        self.inner.channel().on_closed()
6161    }
6162
6163    #[cfg(target_os = "fuchsia")]
6164    fn signal_peer(
6165        &self,
6166        clear_mask: zx::Signals,
6167        set_mask: zx::Signals,
6168    ) -> Result<(), zx_status::Status> {
6169        use fidl::Peered;
6170        self.inner.channel().signal_peer(clear_mask, set_mask)
6171    }
6172}
6173
6174impl MmioResourceControlHandle {}
6175
6176#[must_use = "FIDL methods require a response to be sent"]
6177#[derive(Debug)]
6178pub struct MmioResourceGetResponder {
6179    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
6180    tx_id: u32,
6181}
6182
6183/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
6184/// if the responder is dropped without sending a response, so that the client
6185/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6186impl std::ops::Drop for MmioResourceGetResponder {
6187    fn drop(&mut self) {
6188        self.control_handle.shutdown();
6189        // Safety: drops once, never accessed again
6190        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6191    }
6192}
6193
6194impl fidl::endpoints::Responder for MmioResourceGetResponder {
6195    type ControlHandle = MmioResourceControlHandle;
6196
6197    fn control_handle(&self) -> &MmioResourceControlHandle {
6198        &self.control_handle
6199    }
6200
6201    fn drop_without_shutdown(mut self) {
6202        // Safety: drops once, never accessed again due to mem::forget
6203        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6204        // Prevent Drop from running (which would shut down the channel)
6205        std::mem::forget(self);
6206    }
6207}
6208
6209impl MmioResourceGetResponder {
6210    /// Sends a response to the FIDL transaction.
6211    ///
6212    /// Sets the channel to shutdown if an error occurs.
6213    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6214        let _result = self.send_raw(resource);
6215        if _result.is_err() {
6216            self.control_handle.shutdown();
6217        }
6218        self.drop_without_shutdown();
6219        _result
6220    }
6221
6222    /// Similar to "send" but does not shutdown the channel if an error occurs.
6223    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6224        let _result = self.send_raw(resource);
6225        self.drop_without_shutdown();
6226        _result
6227    }
6228
6229    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6230        self.control_handle.inner.send::<MmioResourceGetResponse>(
6231            (resource,),
6232            self.tx_id,
6233            0x66747b9c5a6dfe7b,
6234            fidl::encoding::DynamicFlags::empty(),
6235        )
6236    }
6237}
6238
6239#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6240pub struct MsiResourceMarker;
6241
6242impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
6243    type Proxy = MsiResourceProxy;
6244    type RequestStream = MsiResourceRequestStream;
6245    #[cfg(target_os = "fuchsia")]
6246    type SynchronousProxy = MsiResourceSynchronousProxy;
6247
6248    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
6249}
6250impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
6251
6252pub trait MsiResourceProxyInterface: Send + Sync {
6253    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6254    fn r#get(&self) -> Self::GetResponseFut;
6255}
6256#[derive(Debug)]
6257#[cfg(target_os = "fuchsia")]
6258pub struct MsiResourceSynchronousProxy {
6259    client: fidl::client::sync::Client,
6260}
6261
6262#[cfg(target_os = "fuchsia")]
6263impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
6264    type Proxy = MsiResourceProxy;
6265    type Protocol = MsiResourceMarker;
6266
6267    fn from_channel(inner: fidl::Channel) -> Self {
6268        Self::new(inner)
6269    }
6270
6271    fn into_channel(self) -> fidl::Channel {
6272        self.client.into_channel()
6273    }
6274
6275    fn as_channel(&self) -> &fidl::Channel {
6276        self.client.as_channel()
6277    }
6278}
6279
6280#[cfg(target_os = "fuchsia")]
6281impl MsiResourceSynchronousProxy {
6282    pub fn new(channel: fidl::Channel) -> Self {
6283        Self { client: fidl::client::sync::Client::new(channel) }
6284    }
6285
6286    pub fn into_channel(self) -> fidl::Channel {
6287        self.client.into_channel()
6288    }
6289
6290    /// Waits until an event arrives and returns it. It is safe for other
6291    /// threads to make concurrent requests while waiting for an event.
6292    pub fn wait_for_event(
6293        &self,
6294        deadline: zx::MonotonicInstant,
6295    ) -> Result<MsiResourceEvent, fidl::Error> {
6296        MsiResourceEvent::decode(self.client.wait_for_event::<MsiResourceMarker>(deadline)?)
6297    }
6298
6299    /// Get an msi resource handle.
6300    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6301        let _response = self
6302            .client
6303            .send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse, MsiResourceMarker>(
6304                (),
6305                0x360a97e47e8c4f1f,
6306                fidl::encoding::DynamicFlags::empty(),
6307                ___deadline,
6308            )?;
6309        Ok(_response.resource)
6310    }
6311}
6312
6313#[cfg(target_os = "fuchsia")]
6314impl From<MsiResourceSynchronousProxy> for zx::NullableHandle {
6315    fn from(value: MsiResourceSynchronousProxy) -> Self {
6316        value.into_channel().into()
6317    }
6318}
6319
6320#[cfg(target_os = "fuchsia")]
6321impl From<fidl::Channel> for MsiResourceSynchronousProxy {
6322    fn from(value: fidl::Channel) -> Self {
6323        Self::new(value)
6324    }
6325}
6326
6327#[cfg(target_os = "fuchsia")]
6328impl fidl::endpoints::FromClient for MsiResourceSynchronousProxy {
6329    type Protocol = MsiResourceMarker;
6330
6331    fn from_client(value: fidl::endpoints::ClientEnd<MsiResourceMarker>) -> Self {
6332        Self::new(value.into_channel())
6333    }
6334}
6335
6336#[derive(Debug, Clone)]
6337pub struct MsiResourceProxy {
6338    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6339}
6340
6341impl fidl::endpoints::Proxy for MsiResourceProxy {
6342    type Protocol = MsiResourceMarker;
6343
6344    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6345        Self::new(inner)
6346    }
6347
6348    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6349        self.client.into_channel().map_err(|client| Self { client })
6350    }
6351
6352    fn as_channel(&self) -> &::fidl::AsyncChannel {
6353        self.client.as_channel()
6354    }
6355}
6356
6357impl MsiResourceProxy {
6358    /// Create a new Proxy for fuchsia.kernel/MsiResource.
6359    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6360        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6361        Self { client: fidl::client::Client::new(channel, protocol_name) }
6362    }
6363
6364    /// Get a Stream of events from the remote end of the protocol.
6365    ///
6366    /// # Panics
6367    ///
6368    /// Panics if the event stream was already taken.
6369    pub fn take_event_stream(&self) -> MsiResourceEventStream {
6370        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
6371    }
6372
6373    /// Get an msi resource handle.
6374    pub fn r#get(
6375        &self,
6376    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6377    {
6378        MsiResourceProxyInterface::r#get(self)
6379    }
6380}
6381
6382impl MsiResourceProxyInterface for MsiResourceProxy {
6383    type GetResponseFut = fidl::client::QueryResponseFut<
6384        fidl::Resource,
6385        fidl::encoding::DefaultFuchsiaResourceDialect,
6386    >;
6387    fn r#get(&self) -> Self::GetResponseFut {
6388        fn _decode(
6389            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6390        ) -> Result<fidl::Resource, fidl::Error> {
6391            let _response = fidl::client::decode_transaction_body::<
6392                MsiResourceGetResponse,
6393                fidl::encoding::DefaultFuchsiaResourceDialect,
6394                0x360a97e47e8c4f1f,
6395            >(_buf?)?;
6396            Ok(_response.resource)
6397        }
6398        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6399            (),
6400            0x360a97e47e8c4f1f,
6401            fidl::encoding::DynamicFlags::empty(),
6402            _decode,
6403        )
6404    }
6405}
6406
6407pub struct MsiResourceEventStream {
6408    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6409}
6410
6411impl std::marker::Unpin for MsiResourceEventStream {}
6412
6413impl futures::stream::FusedStream for MsiResourceEventStream {
6414    fn is_terminated(&self) -> bool {
6415        self.event_receiver.is_terminated()
6416    }
6417}
6418
6419impl futures::Stream for MsiResourceEventStream {
6420    type Item = Result<MsiResourceEvent, fidl::Error>;
6421
6422    fn poll_next(
6423        mut self: std::pin::Pin<&mut Self>,
6424        cx: &mut std::task::Context<'_>,
6425    ) -> std::task::Poll<Option<Self::Item>> {
6426        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6427            &mut self.event_receiver,
6428            cx
6429        )?) {
6430            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6431            None => std::task::Poll::Ready(None),
6432        }
6433    }
6434}
6435
6436#[derive(Debug)]
6437pub enum MsiResourceEvent {}
6438
6439impl MsiResourceEvent {
6440    /// Decodes a message buffer as a [`MsiResourceEvent`].
6441    fn decode(
6442        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6443    ) -> Result<MsiResourceEvent, fidl::Error> {
6444        let (bytes, _handles) = buf.split_mut();
6445        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6446        debug_assert_eq!(tx_header.tx_id, 0);
6447        match tx_header.ordinal {
6448            _ => Err(fidl::Error::UnknownOrdinal {
6449                ordinal: tx_header.ordinal,
6450                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6451            }),
6452        }
6453    }
6454}
6455
6456/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6457pub struct MsiResourceRequestStream {
6458    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6459    is_terminated: bool,
6460}
6461
6462impl std::marker::Unpin for MsiResourceRequestStream {}
6463
6464impl futures::stream::FusedStream for MsiResourceRequestStream {
6465    fn is_terminated(&self) -> bool {
6466        self.is_terminated
6467    }
6468}
6469
6470impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6471    type Protocol = MsiResourceMarker;
6472    type ControlHandle = MsiResourceControlHandle;
6473
6474    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6475        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6476    }
6477
6478    fn control_handle(&self) -> Self::ControlHandle {
6479        MsiResourceControlHandle { inner: self.inner.clone() }
6480    }
6481
6482    fn into_inner(
6483        self,
6484    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6485    {
6486        (self.inner, self.is_terminated)
6487    }
6488
6489    fn from_inner(
6490        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6491        is_terminated: bool,
6492    ) -> Self {
6493        Self { inner, is_terminated }
6494    }
6495}
6496
6497impl futures::Stream for MsiResourceRequestStream {
6498    type Item = Result<MsiResourceRequest, 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        let this = &mut *self;
6505        if this.inner.check_shutdown(cx) {
6506            this.is_terminated = true;
6507            return std::task::Poll::Ready(None);
6508        }
6509        if this.is_terminated {
6510            panic!("polled MsiResourceRequestStream after completion");
6511        }
6512        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6513            |bytes, handles| {
6514                match this.inner.channel().read_etc(cx, bytes, handles) {
6515                    std::task::Poll::Ready(Ok(())) => {}
6516                    std::task::Poll::Pending => return std::task::Poll::Pending,
6517                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6518                        this.is_terminated = true;
6519                        return std::task::Poll::Ready(None);
6520                    }
6521                    std::task::Poll::Ready(Err(e)) => {
6522                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6523                            e.into(),
6524                        ))));
6525                    }
6526                }
6527
6528                // A message has been received from the channel
6529                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6530
6531                std::task::Poll::Ready(Some(match header.ordinal {
6532                    0x360a97e47e8c4f1f => {
6533                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6534                        let mut req = fidl::new_empty!(
6535                            fidl::encoding::EmptyPayload,
6536                            fidl::encoding::DefaultFuchsiaResourceDialect
6537                        );
6538                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6539                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6540                        Ok(MsiResourceRequest::Get {
6541                            responder: MsiResourceGetResponder {
6542                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6543                                tx_id: header.tx_id,
6544                            },
6545                        })
6546                    }
6547                    _ => Err(fidl::Error::UnknownOrdinal {
6548                        ordinal: header.ordinal,
6549                        protocol_name:
6550                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6551                    }),
6552                }))
6553            },
6554        )
6555    }
6556}
6557
6558/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6559/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6560#[derive(Debug)]
6561pub enum MsiResourceRequest {
6562    /// Get an msi resource handle.
6563    Get { responder: MsiResourceGetResponder },
6564}
6565
6566impl MsiResourceRequest {
6567    #[allow(irrefutable_let_patterns)]
6568    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6569        if let MsiResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6570    }
6571
6572    /// Name of the method defined in FIDL
6573    pub fn method_name(&self) -> &'static str {
6574        match *self {
6575            MsiResourceRequest::Get { .. } => "get",
6576        }
6577    }
6578}
6579
6580#[derive(Debug, Clone)]
6581pub struct MsiResourceControlHandle {
6582    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6583}
6584
6585impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6586    fn shutdown(&self) {
6587        self.inner.shutdown()
6588    }
6589
6590    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6591        self.inner.shutdown_with_epitaph(status)
6592    }
6593
6594    fn is_closed(&self) -> bool {
6595        self.inner.channel().is_closed()
6596    }
6597    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6598        self.inner.channel().on_closed()
6599    }
6600
6601    #[cfg(target_os = "fuchsia")]
6602    fn signal_peer(
6603        &self,
6604        clear_mask: zx::Signals,
6605        set_mask: zx::Signals,
6606    ) -> Result<(), zx_status::Status> {
6607        use fidl::Peered;
6608        self.inner.channel().signal_peer(clear_mask, set_mask)
6609    }
6610}
6611
6612impl MsiResourceControlHandle {}
6613
6614#[must_use = "FIDL methods require a response to be sent"]
6615#[derive(Debug)]
6616pub struct MsiResourceGetResponder {
6617    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6618    tx_id: u32,
6619}
6620
6621/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6622/// if the responder is dropped without sending a response, so that the client
6623/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6624impl std::ops::Drop for MsiResourceGetResponder {
6625    fn drop(&mut self) {
6626        self.control_handle.shutdown();
6627        // Safety: drops once, never accessed again
6628        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6629    }
6630}
6631
6632impl fidl::endpoints::Responder for MsiResourceGetResponder {
6633    type ControlHandle = MsiResourceControlHandle;
6634
6635    fn control_handle(&self) -> &MsiResourceControlHandle {
6636        &self.control_handle
6637    }
6638
6639    fn drop_without_shutdown(mut self) {
6640        // Safety: drops once, never accessed again due to mem::forget
6641        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6642        // Prevent Drop from running (which would shut down the channel)
6643        std::mem::forget(self);
6644    }
6645}
6646
6647impl MsiResourceGetResponder {
6648    /// Sends a response to the FIDL transaction.
6649    ///
6650    /// Sets the channel to shutdown if an error occurs.
6651    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6652        let _result = self.send_raw(resource);
6653        if _result.is_err() {
6654            self.control_handle.shutdown();
6655        }
6656        self.drop_without_shutdown();
6657        _result
6658    }
6659
6660    /// Similar to "send" but does not shutdown the channel if an error occurs.
6661    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6662        let _result = self.send_raw(resource);
6663        self.drop_without_shutdown();
6664        _result
6665    }
6666
6667    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6668        self.control_handle.inner.send::<MsiResourceGetResponse>(
6669            (resource,),
6670            self.tx_id,
6671            0x360a97e47e8c4f1f,
6672            fidl::encoding::DynamicFlags::empty(),
6673        )
6674    }
6675}
6676
6677#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6678pub struct PowerResourceMarker;
6679
6680impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6681    type Proxy = PowerResourceProxy;
6682    type RequestStream = PowerResourceRequestStream;
6683    #[cfg(target_os = "fuchsia")]
6684    type SynchronousProxy = PowerResourceSynchronousProxy;
6685
6686    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6687}
6688impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6689
6690pub trait PowerResourceProxyInterface: Send + Sync {
6691    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6692    fn r#get(&self) -> Self::GetResponseFut;
6693}
6694#[derive(Debug)]
6695#[cfg(target_os = "fuchsia")]
6696pub struct PowerResourceSynchronousProxy {
6697    client: fidl::client::sync::Client,
6698}
6699
6700#[cfg(target_os = "fuchsia")]
6701impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6702    type Proxy = PowerResourceProxy;
6703    type Protocol = PowerResourceMarker;
6704
6705    fn from_channel(inner: fidl::Channel) -> Self {
6706        Self::new(inner)
6707    }
6708
6709    fn into_channel(self) -> fidl::Channel {
6710        self.client.into_channel()
6711    }
6712
6713    fn as_channel(&self) -> &fidl::Channel {
6714        self.client.as_channel()
6715    }
6716}
6717
6718#[cfg(target_os = "fuchsia")]
6719impl PowerResourceSynchronousProxy {
6720    pub fn new(channel: fidl::Channel) -> Self {
6721        Self { client: fidl::client::sync::Client::new(channel) }
6722    }
6723
6724    pub fn into_channel(self) -> fidl::Channel {
6725        self.client.into_channel()
6726    }
6727
6728    /// Waits until an event arrives and returns it. It is safe for other
6729    /// threads to make concurrent requests while waiting for an event.
6730    pub fn wait_for_event(
6731        &self,
6732        deadline: zx::MonotonicInstant,
6733    ) -> Result<PowerResourceEvent, fidl::Error> {
6734        PowerResourceEvent::decode(self.client.wait_for_event::<PowerResourceMarker>(deadline)?)
6735    }
6736
6737    /// Get a power resource handle.
6738    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6739        let _response = self.client.send_query::<
6740            fidl::encoding::EmptyPayload,
6741            PowerResourceGetResponse,
6742            PowerResourceMarker,
6743        >(
6744            (),
6745            0x2b8df8ca24d1e866,
6746            fidl::encoding::DynamicFlags::empty(),
6747            ___deadline,
6748        )?;
6749        Ok(_response.resource)
6750    }
6751}
6752
6753#[cfg(target_os = "fuchsia")]
6754impl From<PowerResourceSynchronousProxy> for zx::NullableHandle {
6755    fn from(value: PowerResourceSynchronousProxy) -> Self {
6756        value.into_channel().into()
6757    }
6758}
6759
6760#[cfg(target_os = "fuchsia")]
6761impl From<fidl::Channel> for PowerResourceSynchronousProxy {
6762    fn from(value: fidl::Channel) -> Self {
6763        Self::new(value)
6764    }
6765}
6766
6767#[cfg(target_os = "fuchsia")]
6768impl fidl::endpoints::FromClient for PowerResourceSynchronousProxy {
6769    type Protocol = PowerResourceMarker;
6770
6771    fn from_client(value: fidl::endpoints::ClientEnd<PowerResourceMarker>) -> Self {
6772        Self::new(value.into_channel())
6773    }
6774}
6775
6776#[derive(Debug, Clone)]
6777pub struct PowerResourceProxy {
6778    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6779}
6780
6781impl fidl::endpoints::Proxy for PowerResourceProxy {
6782    type Protocol = PowerResourceMarker;
6783
6784    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6785        Self::new(inner)
6786    }
6787
6788    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6789        self.client.into_channel().map_err(|client| Self { client })
6790    }
6791
6792    fn as_channel(&self) -> &::fidl::AsyncChannel {
6793        self.client.as_channel()
6794    }
6795}
6796
6797impl PowerResourceProxy {
6798    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6799    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6800        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6801        Self { client: fidl::client::Client::new(channel, protocol_name) }
6802    }
6803
6804    /// Get a Stream of events from the remote end of the protocol.
6805    ///
6806    /// # Panics
6807    ///
6808    /// Panics if the event stream was already taken.
6809    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6810        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6811    }
6812
6813    /// Get a power resource handle.
6814    pub fn r#get(
6815        &self,
6816    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6817    {
6818        PowerResourceProxyInterface::r#get(self)
6819    }
6820}
6821
6822impl PowerResourceProxyInterface for PowerResourceProxy {
6823    type GetResponseFut = fidl::client::QueryResponseFut<
6824        fidl::Resource,
6825        fidl::encoding::DefaultFuchsiaResourceDialect,
6826    >;
6827    fn r#get(&self) -> Self::GetResponseFut {
6828        fn _decode(
6829            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6830        ) -> Result<fidl::Resource, fidl::Error> {
6831            let _response = fidl::client::decode_transaction_body::<
6832                PowerResourceGetResponse,
6833                fidl::encoding::DefaultFuchsiaResourceDialect,
6834                0x2b8df8ca24d1e866,
6835            >(_buf?)?;
6836            Ok(_response.resource)
6837        }
6838        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6839            (),
6840            0x2b8df8ca24d1e866,
6841            fidl::encoding::DynamicFlags::empty(),
6842            _decode,
6843        )
6844    }
6845}
6846
6847pub struct PowerResourceEventStream {
6848    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6849}
6850
6851impl std::marker::Unpin for PowerResourceEventStream {}
6852
6853impl futures::stream::FusedStream for PowerResourceEventStream {
6854    fn is_terminated(&self) -> bool {
6855        self.event_receiver.is_terminated()
6856    }
6857}
6858
6859impl futures::Stream for PowerResourceEventStream {
6860    type Item = Result<PowerResourceEvent, fidl::Error>;
6861
6862    fn poll_next(
6863        mut self: std::pin::Pin<&mut Self>,
6864        cx: &mut std::task::Context<'_>,
6865    ) -> std::task::Poll<Option<Self::Item>> {
6866        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6867            &mut self.event_receiver,
6868            cx
6869        )?) {
6870            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6871            None => std::task::Poll::Ready(None),
6872        }
6873    }
6874}
6875
6876#[derive(Debug)]
6877pub enum PowerResourceEvent {}
6878
6879impl PowerResourceEvent {
6880    /// Decodes a message buffer as a [`PowerResourceEvent`].
6881    fn decode(
6882        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6883    ) -> Result<PowerResourceEvent, fidl::Error> {
6884        let (bytes, _handles) = buf.split_mut();
6885        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6886        debug_assert_eq!(tx_header.tx_id, 0);
6887        match tx_header.ordinal {
6888            _ => Err(fidl::Error::UnknownOrdinal {
6889                ordinal: tx_header.ordinal,
6890                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6891            }),
6892        }
6893    }
6894}
6895
6896/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6897pub struct PowerResourceRequestStream {
6898    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6899    is_terminated: bool,
6900}
6901
6902impl std::marker::Unpin for PowerResourceRequestStream {}
6903
6904impl futures::stream::FusedStream for PowerResourceRequestStream {
6905    fn is_terminated(&self) -> bool {
6906        self.is_terminated
6907    }
6908}
6909
6910impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6911    type Protocol = PowerResourceMarker;
6912    type ControlHandle = PowerResourceControlHandle;
6913
6914    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6915        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6916    }
6917
6918    fn control_handle(&self) -> Self::ControlHandle {
6919        PowerResourceControlHandle { inner: self.inner.clone() }
6920    }
6921
6922    fn into_inner(
6923        self,
6924    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6925    {
6926        (self.inner, self.is_terminated)
6927    }
6928
6929    fn from_inner(
6930        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6931        is_terminated: bool,
6932    ) -> Self {
6933        Self { inner, is_terminated }
6934    }
6935}
6936
6937impl futures::Stream for PowerResourceRequestStream {
6938    type Item = Result<PowerResourceRequest, fidl::Error>;
6939
6940    fn poll_next(
6941        mut self: std::pin::Pin<&mut Self>,
6942        cx: &mut std::task::Context<'_>,
6943    ) -> std::task::Poll<Option<Self::Item>> {
6944        let this = &mut *self;
6945        if this.inner.check_shutdown(cx) {
6946            this.is_terminated = true;
6947            return std::task::Poll::Ready(None);
6948        }
6949        if this.is_terminated {
6950            panic!("polled PowerResourceRequestStream after completion");
6951        }
6952        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6953            |bytes, handles| {
6954                match this.inner.channel().read_etc(cx, bytes, handles) {
6955                    std::task::Poll::Ready(Ok(())) => {}
6956                    std::task::Poll::Pending => return std::task::Poll::Pending,
6957                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6958                        this.is_terminated = true;
6959                        return std::task::Poll::Ready(None);
6960                    }
6961                    std::task::Poll::Ready(Err(e)) => {
6962                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6963                            e.into(),
6964                        ))));
6965                    }
6966                }
6967
6968                // A message has been received from the channel
6969                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6970
6971                std::task::Poll::Ready(Some(match header.ordinal {
6972                    0x2b8df8ca24d1e866 => {
6973                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6974                        let mut req = fidl::new_empty!(
6975                            fidl::encoding::EmptyPayload,
6976                            fidl::encoding::DefaultFuchsiaResourceDialect
6977                        );
6978                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6979                        let control_handle =
6980                            PowerResourceControlHandle { inner: this.inner.clone() };
6981                        Ok(PowerResourceRequest::Get {
6982                            responder: PowerResourceGetResponder {
6983                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6984                                tx_id: header.tx_id,
6985                            },
6986                        })
6987                    }
6988                    _ => Err(fidl::Error::UnknownOrdinal {
6989                        ordinal: header.ordinal,
6990                        protocol_name:
6991                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6992                    }),
6993                }))
6994            },
6995        )
6996    }
6997}
6998
6999/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7000/// `ZX_RSRC_SYSTEM_POWER_BASE`.
7001#[derive(Debug)]
7002pub enum PowerResourceRequest {
7003    /// Get a power resource handle.
7004    Get { responder: PowerResourceGetResponder },
7005}
7006
7007impl PowerResourceRequest {
7008    #[allow(irrefutable_let_patterns)]
7009    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
7010        if let PowerResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7011    }
7012
7013    /// Name of the method defined in FIDL
7014    pub fn method_name(&self) -> &'static str {
7015        match *self {
7016            PowerResourceRequest::Get { .. } => "get",
7017        }
7018    }
7019}
7020
7021#[derive(Debug, Clone)]
7022pub struct PowerResourceControlHandle {
7023    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7024}
7025
7026impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
7027    fn shutdown(&self) {
7028        self.inner.shutdown()
7029    }
7030
7031    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7032        self.inner.shutdown_with_epitaph(status)
7033    }
7034
7035    fn is_closed(&self) -> bool {
7036        self.inner.channel().is_closed()
7037    }
7038    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7039        self.inner.channel().on_closed()
7040    }
7041
7042    #[cfg(target_os = "fuchsia")]
7043    fn signal_peer(
7044        &self,
7045        clear_mask: zx::Signals,
7046        set_mask: zx::Signals,
7047    ) -> Result<(), zx_status::Status> {
7048        use fidl::Peered;
7049        self.inner.channel().signal_peer(clear_mask, set_mask)
7050    }
7051}
7052
7053impl PowerResourceControlHandle {}
7054
7055#[must_use = "FIDL methods require a response to be sent"]
7056#[derive(Debug)]
7057pub struct PowerResourceGetResponder {
7058    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
7059    tx_id: u32,
7060}
7061
7062/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
7063/// if the responder is dropped without sending a response, so that the client
7064/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7065impl std::ops::Drop for PowerResourceGetResponder {
7066    fn drop(&mut self) {
7067        self.control_handle.shutdown();
7068        // Safety: drops once, never accessed again
7069        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7070    }
7071}
7072
7073impl fidl::endpoints::Responder for PowerResourceGetResponder {
7074    type ControlHandle = PowerResourceControlHandle;
7075
7076    fn control_handle(&self) -> &PowerResourceControlHandle {
7077        &self.control_handle
7078    }
7079
7080    fn drop_without_shutdown(mut self) {
7081        // Safety: drops once, never accessed again due to mem::forget
7082        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7083        // Prevent Drop from running (which would shut down the channel)
7084        std::mem::forget(self);
7085    }
7086}
7087
7088impl PowerResourceGetResponder {
7089    /// Sends a response to the FIDL transaction.
7090    ///
7091    /// Sets the channel to shutdown if an error occurs.
7092    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7093        let _result = self.send_raw(resource);
7094        if _result.is_err() {
7095            self.control_handle.shutdown();
7096        }
7097        self.drop_without_shutdown();
7098        _result
7099    }
7100
7101    /// Similar to "send" but does not shutdown the channel if an error occurs.
7102    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7103        let _result = self.send_raw(resource);
7104        self.drop_without_shutdown();
7105        _result
7106    }
7107
7108    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7109        self.control_handle.inner.send::<PowerResourceGetResponse>(
7110            (resource,),
7111            self.tx_id,
7112            0x2b8df8ca24d1e866,
7113            fidl::encoding::DynamicFlags::empty(),
7114        )
7115    }
7116}
7117
7118#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7119pub struct ProfileResourceMarker;
7120
7121impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
7122    type Proxy = ProfileResourceProxy;
7123    type RequestStream = ProfileResourceRequestStream;
7124    #[cfg(target_os = "fuchsia")]
7125    type SynchronousProxy = ProfileResourceSynchronousProxy;
7126
7127    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
7128}
7129impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
7130
7131pub trait ProfileResourceProxyInterface: Send + Sync {
7132    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
7133    fn r#get(&self) -> Self::GetResponseFut;
7134}
7135#[derive(Debug)]
7136#[cfg(target_os = "fuchsia")]
7137pub struct ProfileResourceSynchronousProxy {
7138    client: fidl::client::sync::Client,
7139}
7140
7141#[cfg(target_os = "fuchsia")]
7142impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
7143    type Proxy = ProfileResourceProxy;
7144    type Protocol = ProfileResourceMarker;
7145
7146    fn from_channel(inner: fidl::Channel) -> Self {
7147        Self::new(inner)
7148    }
7149
7150    fn into_channel(self) -> fidl::Channel {
7151        self.client.into_channel()
7152    }
7153
7154    fn as_channel(&self) -> &fidl::Channel {
7155        self.client.as_channel()
7156    }
7157}
7158
7159#[cfg(target_os = "fuchsia")]
7160impl ProfileResourceSynchronousProxy {
7161    pub fn new(channel: fidl::Channel) -> Self {
7162        Self { client: fidl::client::sync::Client::new(channel) }
7163    }
7164
7165    pub fn into_channel(self) -> fidl::Channel {
7166        self.client.into_channel()
7167    }
7168
7169    /// Waits until an event arrives and returns it. It is safe for other
7170    /// threads to make concurrent requests while waiting for an event.
7171    pub fn wait_for_event(
7172        &self,
7173        deadline: zx::MonotonicInstant,
7174    ) -> Result<ProfileResourceEvent, fidl::Error> {
7175        ProfileResourceEvent::decode(self.client.wait_for_event::<ProfileResourceMarker>(deadline)?)
7176    }
7177
7178    /// Get a profile resource handle.
7179    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
7180        let _response = self.client.send_query::<
7181            fidl::encoding::EmptyPayload,
7182            ProfileResourceGetResponse,
7183            ProfileResourceMarker,
7184        >(
7185            (),
7186            0x3003a0c14de1fa86,
7187            fidl::encoding::DynamicFlags::empty(),
7188            ___deadline,
7189        )?;
7190        Ok(_response.resource)
7191    }
7192}
7193
7194#[cfg(target_os = "fuchsia")]
7195impl From<ProfileResourceSynchronousProxy> for zx::NullableHandle {
7196    fn from(value: ProfileResourceSynchronousProxy) -> Self {
7197        value.into_channel().into()
7198    }
7199}
7200
7201#[cfg(target_os = "fuchsia")]
7202impl From<fidl::Channel> for ProfileResourceSynchronousProxy {
7203    fn from(value: fidl::Channel) -> Self {
7204        Self::new(value)
7205    }
7206}
7207
7208#[cfg(target_os = "fuchsia")]
7209impl fidl::endpoints::FromClient for ProfileResourceSynchronousProxy {
7210    type Protocol = ProfileResourceMarker;
7211
7212    fn from_client(value: fidl::endpoints::ClientEnd<ProfileResourceMarker>) -> Self {
7213        Self::new(value.into_channel())
7214    }
7215}
7216
7217#[derive(Debug, Clone)]
7218pub struct ProfileResourceProxy {
7219    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7220}
7221
7222impl fidl::endpoints::Proxy for ProfileResourceProxy {
7223    type Protocol = ProfileResourceMarker;
7224
7225    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7226        Self::new(inner)
7227    }
7228
7229    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7230        self.client.into_channel().map_err(|client| Self { client })
7231    }
7232
7233    fn as_channel(&self) -> &::fidl::AsyncChannel {
7234        self.client.as_channel()
7235    }
7236}
7237
7238impl ProfileResourceProxy {
7239    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
7240    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7241        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7242        Self { client: fidl::client::Client::new(channel, protocol_name) }
7243    }
7244
7245    /// Get a Stream of events from the remote end of the protocol.
7246    ///
7247    /// # Panics
7248    ///
7249    /// Panics if the event stream was already taken.
7250    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
7251        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
7252    }
7253
7254    /// Get a profile resource handle.
7255    pub fn r#get(
7256        &self,
7257    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
7258    {
7259        ProfileResourceProxyInterface::r#get(self)
7260    }
7261}
7262
7263impl ProfileResourceProxyInterface for ProfileResourceProxy {
7264    type GetResponseFut = fidl::client::QueryResponseFut<
7265        fidl::Resource,
7266        fidl::encoding::DefaultFuchsiaResourceDialect,
7267    >;
7268    fn r#get(&self) -> Self::GetResponseFut {
7269        fn _decode(
7270            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7271        ) -> Result<fidl::Resource, fidl::Error> {
7272            let _response = fidl::client::decode_transaction_body::<
7273                ProfileResourceGetResponse,
7274                fidl::encoding::DefaultFuchsiaResourceDialect,
7275                0x3003a0c14de1fa86,
7276            >(_buf?)?;
7277            Ok(_response.resource)
7278        }
7279        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
7280            (),
7281            0x3003a0c14de1fa86,
7282            fidl::encoding::DynamicFlags::empty(),
7283            _decode,
7284        )
7285    }
7286}
7287
7288pub struct ProfileResourceEventStream {
7289    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7290}
7291
7292impl std::marker::Unpin for ProfileResourceEventStream {}
7293
7294impl futures::stream::FusedStream for ProfileResourceEventStream {
7295    fn is_terminated(&self) -> bool {
7296        self.event_receiver.is_terminated()
7297    }
7298}
7299
7300impl futures::Stream for ProfileResourceEventStream {
7301    type Item = Result<ProfileResourceEvent, fidl::Error>;
7302
7303    fn poll_next(
7304        mut self: std::pin::Pin<&mut Self>,
7305        cx: &mut std::task::Context<'_>,
7306    ) -> std::task::Poll<Option<Self::Item>> {
7307        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7308            &mut self.event_receiver,
7309            cx
7310        )?) {
7311            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
7312            None => std::task::Poll::Ready(None),
7313        }
7314    }
7315}
7316
7317#[derive(Debug)]
7318pub enum ProfileResourceEvent {}
7319
7320impl ProfileResourceEvent {
7321    /// Decodes a message buffer as a [`ProfileResourceEvent`].
7322    fn decode(
7323        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7324    ) -> Result<ProfileResourceEvent, fidl::Error> {
7325        let (bytes, _handles) = buf.split_mut();
7326        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7327        debug_assert_eq!(tx_header.tx_id, 0);
7328        match tx_header.ordinal {
7329            _ => Err(fidl::Error::UnknownOrdinal {
7330                ordinal: tx_header.ordinal,
7331                protocol_name:
7332                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7333            }),
7334        }
7335    }
7336}
7337
7338/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
7339pub struct ProfileResourceRequestStream {
7340    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7341    is_terminated: bool,
7342}
7343
7344impl std::marker::Unpin for ProfileResourceRequestStream {}
7345
7346impl futures::stream::FusedStream for ProfileResourceRequestStream {
7347    fn is_terminated(&self) -> bool {
7348        self.is_terminated
7349    }
7350}
7351
7352impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
7353    type Protocol = ProfileResourceMarker;
7354    type ControlHandle = ProfileResourceControlHandle;
7355
7356    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7357        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7358    }
7359
7360    fn control_handle(&self) -> Self::ControlHandle {
7361        ProfileResourceControlHandle { inner: self.inner.clone() }
7362    }
7363
7364    fn into_inner(
7365        self,
7366    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7367    {
7368        (self.inner, self.is_terminated)
7369    }
7370
7371    fn from_inner(
7372        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7373        is_terminated: bool,
7374    ) -> Self {
7375        Self { inner, is_terminated }
7376    }
7377}
7378
7379impl futures::Stream for ProfileResourceRequestStream {
7380    type Item = Result<ProfileResourceRequest, fidl::Error>;
7381
7382    fn poll_next(
7383        mut self: std::pin::Pin<&mut Self>,
7384        cx: &mut std::task::Context<'_>,
7385    ) -> std::task::Poll<Option<Self::Item>> {
7386        let this = &mut *self;
7387        if this.inner.check_shutdown(cx) {
7388            this.is_terminated = true;
7389            return std::task::Poll::Ready(None);
7390        }
7391        if this.is_terminated {
7392            panic!("polled ProfileResourceRequestStream after completion");
7393        }
7394        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7395            |bytes, handles| {
7396                match this.inner.channel().read_etc(cx, bytes, handles) {
7397                    std::task::Poll::Ready(Ok(())) => {}
7398                    std::task::Poll::Pending => return std::task::Poll::Pending,
7399                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7400                        this.is_terminated = true;
7401                        return std::task::Poll::Ready(None);
7402                    }
7403                    std::task::Poll::Ready(Err(e)) => {
7404                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7405                            e.into(),
7406                        ))));
7407                    }
7408                }
7409
7410                // A message has been received from the channel
7411                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7412
7413                std::task::Poll::Ready(Some(match header.ordinal {
7414                    0x3003a0c14de1fa86 => {
7415                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7416                        let mut req = fidl::new_empty!(
7417                            fidl::encoding::EmptyPayload,
7418                            fidl::encoding::DefaultFuchsiaResourceDialect
7419                        );
7420                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7421                        let control_handle =
7422                            ProfileResourceControlHandle { inner: this.inner.clone() };
7423                        Ok(ProfileResourceRequest::Get {
7424                            responder: ProfileResourceGetResponder {
7425                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7426                                tx_id: header.tx_id,
7427                            },
7428                        })
7429                    }
7430                    _ => Err(fidl::Error::UnknownOrdinal {
7431                        ordinal: header.ordinal,
7432                        protocol_name:
7433                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7434                    }),
7435                }))
7436            },
7437        )
7438    }
7439}
7440
7441/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7442/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7443#[derive(Debug)]
7444pub enum ProfileResourceRequest {
7445    /// Get a profile resource handle.
7446    Get { responder: ProfileResourceGetResponder },
7447}
7448
7449impl ProfileResourceRequest {
7450    #[allow(irrefutable_let_patterns)]
7451    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7452        if let ProfileResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7453    }
7454
7455    /// Name of the method defined in FIDL
7456    pub fn method_name(&self) -> &'static str {
7457        match *self {
7458            ProfileResourceRequest::Get { .. } => "get",
7459        }
7460    }
7461}
7462
7463#[derive(Debug, Clone)]
7464pub struct ProfileResourceControlHandle {
7465    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7466}
7467
7468impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7469    fn shutdown(&self) {
7470        self.inner.shutdown()
7471    }
7472
7473    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7474        self.inner.shutdown_with_epitaph(status)
7475    }
7476
7477    fn is_closed(&self) -> bool {
7478        self.inner.channel().is_closed()
7479    }
7480    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7481        self.inner.channel().on_closed()
7482    }
7483
7484    #[cfg(target_os = "fuchsia")]
7485    fn signal_peer(
7486        &self,
7487        clear_mask: zx::Signals,
7488        set_mask: zx::Signals,
7489    ) -> Result<(), zx_status::Status> {
7490        use fidl::Peered;
7491        self.inner.channel().signal_peer(clear_mask, set_mask)
7492    }
7493}
7494
7495impl ProfileResourceControlHandle {}
7496
7497#[must_use = "FIDL methods require a response to be sent"]
7498#[derive(Debug)]
7499pub struct ProfileResourceGetResponder {
7500    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7501    tx_id: u32,
7502}
7503
7504/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7505/// if the responder is dropped without sending a response, so that the client
7506/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7507impl std::ops::Drop for ProfileResourceGetResponder {
7508    fn drop(&mut self) {
7509        self.control_handle.shutdown();
7510        // Safety: drops once, never accessed again
7511        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7512    }
7513}
7514
7515impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7516    type ControlHandle = ProfileResourceControlHandle;
7517
7518    fn control_handle(&self) -> &ProfileResourceControlHandle {
7519        &self.control_handle
7520    }
7521
7522    fn drop_without_shutdown(mut self) {
7523        // Safety: drops once, never accessed again due to mem::forget
7524        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7525        // Prevent Drop from running (which would shut down the channel)
7526        std::mem::forget(self);
7527    }
7528}
7529
7530impl ProfileResourceGetResponder {
7531    /// Sends a response to the FIDL transaction.
7532    ///
7533    /// Sets the channel to shutdown if an error occurs.
7534    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7535        let _result = self.send_raw(resource);
7536        if _result.is_err() {
7537            self.control_handle.shutdown();
7538        }
7539        self.drop_without_shutdown();
7540        _result
7541    }
7542
7543    /// Similar to "send" but does not shutdown the channel if an error occurs.
7544    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7545        let _result = self.send_raw(resource);
7546        self.drop_without_shutdown();
7547        _result
7548    }
7549
7550    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7551        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7552            (resource,),
7553            self.tx_id,
7554            0x3003a0c14de1fa86,
7555            fidl::encoding::DynamicFlags::empty(),
7556        )
7557    }
7558}
7559
7560#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7561pub struct RootJobMarker;
7562
7563impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7564    type Proxy = RootJobProxy;
7565    type RequestStream = RootJobRequestStream;
7566    #[cfg(target_os = "fuchsia")]
7567    type SynchronousProxy = RootJobSynchronousProxy;
7568
7569    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7570}
7571impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7572
7573pub trait RootJobProxyInterface: Send + Sync {
7574    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7575    fn r#get(&self) -> Self::GetResponseFut;
7576}
7577#[derive(Debug)]
7578#[cfg(target_os = "fuchsia")]
7579pub struct RootJobSynchronousProxy {
7580    client: fidl::client::sync::Client,
7581}
7582
7583#[cfg(target_os = "fuchsia")]
7584impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7585    type Proxy = RootJobProxy;
7586    type Protocol = RootJobMarker;
7587
7588    fn from_channel(inner: fidl::Channel) -> Self {
7589        Self::new(inner)
7590    }
7591
7592    fn into_channel(self) -> fidl::Channel {
7593        self.client.into_channel()
7594    }
7595
7596    fn as_channel(&self) -> &fidl::Channel {
7597        self.client.as_channel()
7598    }
7599}
7600
7601#[cfg(target_os = "fuchsia")]
7602impl RootJobSynchronousProxy {
7603    pub fn new(channel: fidl::Channel) -> Self {
7604        Self { client: fidl::client::sync::Client::new(channel) }
7605    }
7606
7607    pub fn into_channel(self) -> fidl::Channel {
7608        self.client.into_channel()
7609    }
7610
7611    /// Waits until an event arrives and returns it. It is safe for other
7612    /// threads to make concurrent requests while waiting for an event.
7613    pub fn wait_for_event(
7614        &self,
7615        deadline: zx::MonotonicInstant,
7616    ) -> Result<RootJobEvent, fidl::Error> {
7617        RootJobEvent::decode(self.client.wait_for_event::<RootJobMarker>(deadline)?)
7618    }
7619
7620    /// Get the root `job`.
7621    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7622        let _response = self
7623            .client
7624            .send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse, RootJobMarker>(
7625                (),
7626                0x73acb63f93d53eac,
7627                fidl::encoding::DynamicFlags::empty(),
7628                ___deadline,
7629            )?;
7630        Ok(_response.job)
7631    }
7632}
7633
7634#[cfg(target_os = "fuchsia")]
7635impl From<RootJobSynchronousProxy> for zx::NullableHandle {
7636    fn from(value: RootJobSynchronousProxy) -> Self {
7637        value.into_channel().into()
7638    }
7639}
7640
7641#[cfg(target_os = "fuchsia")]
7642impl From<fidl::Channel> for RootJobSynchronousProxy {
7643    fn from(value: fidl::Channel) -> Self {
7644        Self::new(value)
7645    }
7646}
7647
7648#[cfg(target_os = "fuchsia")]
7649impl fidl::endpoints::FromClient for RootJobSynchronousProxy {
7650    type Protocol = RootJobMarker;
7651
7652    fn from_client(value: fidl::endpoints::ClientEnd<RootJobMarker>) -> Self {
7653        Self::new(value.into_channel())
7654    }
7655}
7656
7657#[derive(Debug, Clone)]
7658pub struct RootJobProxy {
7659    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7660}
7661
7662impl fidl::endpoints::Proxy for RootJobProxy {
7663    type Protocol = RootJobMarker;
7664
7665    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7666        Self::new(inner)
7667    }
7668
7669    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7670        self.client.into_channel().map_err(|client| Self { client })
7671    }
7672
7673    fn as_channel(&self) -> &::fidl::AsyncChannel {
7674        self.client.as_channel()
7675    }
7676}
7677
7678impl RootJobProxy {
7679    /// Create a new Proxy for fuchsia.kernel/RootJob.
7680    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7681        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7682        Self { client: fidl::client::Client::new(channel, protocol_name) }
7683    }
7684
7685    /// Get a Stream of events from the remote end of the protocol.
7686    ///
7687    /// # Panics
7688    ///
7689    /// Panics if the event stream was already taken.
7690    pub fn take_event_stream(&self) -> RootJobEventStream {
7691        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7692    }
7693
7694    /// Get the root `job`.
7695    pub fn r#get(
7696        &self,
7697    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7698    {
7699        RootJobProxyInterface::r#get(self)
7700    }
7701}
7702
7703impl RootJobProxyInterface for RootJobProxy {
7704    type GetResponseFut =
7705        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7706    fn r#get(&self) -> Self::GetResponseFut {
7707        fn _decode(
7708            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7709        ) -> Result<fidl::Job, fidl::Error> {
7710            let _response = fidl::client::decode_transaction_body::<
7711                RootJobGetResponse,
7712                fidl::encoding::DefaultFuchsiaResourceDialect,
7713                0x73acb63f93d53eac,
7714            >(_buf?)?;
7715            Ok(_response.job)
7716        }
7717        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7718            (),
7719            0x73acb63f93d53eac,
7720            fidl::encoding::DynamicFlags::empty(),
7721            _decode,
7722        )
7723    }
7724}
7725
7726pub struct RootJobEventStream {
7727    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7728}
7729
7730impl std::marker::Unpin for RootJobEventStream {}
7731
7732impl futures::stream::FusedStream for RootJobEventStream {
7733    fn is_terminated(&self) -> bool {
7734        self.event_receiver.is_terminated()
7735    }
7736}
7737
7738impl futures::Stream for RootJobEventStream {
7739    type Item = Result<RootJobEvent, fidl::Error>;
7740
7741    fn poll_next(
7742        mut self: std::pin::Pin<&mut Self>,
7743        cx: &mut std::task::Context<'_>,
7744    ) -> std::task::Poll<Option<Self::Item>> {
7745        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7746            &mut self.event_receiver,
7747            cx
7748        )?) {
7749            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7750            None => std::task::Poll::Ready(None),
7751        }
7752    }
7753}
7754
7755#[derive(Debug)]
7756pub enum RootJobEvent {}
7757
7758impl RootJobEvent {
7759    /// Decodes a message buffer as a [`RootJobEvent`].
7760    fn decode(
7761        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7762    ) -> Result<RootJobEvent, fidl::Error> {
7763        let (bytes, _handles) = buf.split_mut();
7764        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7765        debug_assert_eq!(tx_header.tx_id, 0);
7766        match tx_header.ordinal {
7767            _ => Err(fidl::Error::UnknownOrdinal {
7768                ordinal: tx_header.ordinal,
7769                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7770            }),
7771        }
7772    }
7773}
7774
7775/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7776pub struct RootJobRequestStream {
7777    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7778    is_terminated: bool,
7779}
7780
7781impl std::marker::Unpin for RootJobRequestStream {}
7782
7783impl futures::stream::FusedStream for RootJobRequestStream {
7784    fn is_terminated(&self) -> bool {
7785        self.is_terminated
7786    }
7787}
7788
7789impl fidl::endpoints::RequestStream for RootJobRequestStream {
7790    type Protocol = RootJobMarker;
7791    type ControlHandle = RootJobControlHandle;
7792
7793    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7794        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7795    }
7796
7797    fn control_handle(&self) -> Self::ControlHandle {
7798        RootJobControlHandle { inner: self.inner.clone() }
7799    }
7800
7801    fn into_inner(
7802        self,
7803    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7804    {
7805        (self.inner, self.is_terminated)
7806    }
7807
7808    fn from_inner(
7809        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7810        is_terminated: bool,
7811    ) -> Self {
7812        Self { inner, is_terminated }
7813    }
7814}
7815
7816impl futures::Stream for RootJobRequestStream {
7817    type Item = Result<RootJobRequest, fidl::Error>;
7818
7819    fn poll_next(
7820        mut self: std::pin::Pin<&mut Self>,
7821        cx: &mut std::task::Context<'_>,
7822    ) -> std::task::Poll<Option<Self::Item>> {
7823        let this = &mut *self;
7824        if this.inner.check_shutdown(cx) {
7825            this.is_terminated = true;
7826            return std::task::Poll::Ready(None);
7827        }
7828        if this.is_terminated {
7829            panic!("polled RootJobRequestStream after completion");
7830        }
7831        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7832            |bytes, handles| {
7833                match this.inner.channel().read_etc(cx, bytes, handles) {
7834                    std::task::Poll::Ready(Ok(())) => {}
7835                    std::task::Poll::Pending => return std::task::Poll::Pending,
7836                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7837                        this.is_terminated = true;
7838                        return std::task::Poll::Ready(None);
7839                    }
7840                    std::task::Poll::Ready(Err(e)) => {
7841                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7842                            e.into(),
7843                        ))));
7844                    }
7845                }
7846
7847                // A message has been received from the channel
7848                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7849
7850                std::task::Poll::Ready(Some(match header.ordinal {
7851                    0x73acb63f93d53eac => {
7852                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7853                        let mut req = fidl::new_empty!(
7854                            fidl::encoding::EmptyPayload,
7855                            fidl::encoding::DefaultFuchsiaResourceDialect
7856                        );
7857                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7858                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7859                        Ok(RootJobRequest::Get {
7860                            responder: RootJobGetResponder {
7861                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7862                                tx_id: header.tx_id,
7863                            },
7864                        })
7865                    }
7866                    _ => Err(fidl::Error::UnknownOrdinal {
7867                        ordinal: header.ordinal,
7868                        protocol_name:
7869                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7870                    }),
7871                }))
7872            },
7873        )
7874    }
7875}
7876
7877/// Protocol for providing the root job.
7878///
7879/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7880#[derive(Debug)]
7881pub enum RootJobRequest {
7882    /// Get the root `job`.
7883    Get { responder: RootJobGetResponder },
7884}
7885
7886impl RootJobRequest {
7887    #[allow(irrefutable_let_patterns)]
7888    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7889        if let RootJobRequest::Get { responder } = self { Some((responder)) } else { None }
7890    }
7891
7892    /// Name of the method defined in FIDL
7893    pub fn method_name(&self) -> &'static str {
7894        match *self {
7895            RootJobRequest::Get { .. } => "get",
7896        }
7897    }
7898}
7899
7900#[derive(Debug, Clone)]
7901pub struct RootJobControlHandle {
7902    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7903}
7904
7905impl fidl::endpoints::ControlHandle for RootJobControlHandle {
7906    fn shutdown(&self) {
7907        self.inner.shutdown()
7908    }
7909
7910    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7911        self.inner.shutdown_with_epitaph(status)
7912    }
7913
7914    fn is_closed(&self) -> bool {
7915        self.inner.channel().is_closed()
7916    }
7917    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7918        self.inner.channel().on_closed()
7919    }
7920
7921    #[cfg(target_os = "fuchsia")]
7922    fn signal_peer(
7923        &self,
7924        clear_mask: zx::Signals,
7925        set_mask: zx::Signals,
7926    ) -> Result<(), zx_status::Status> {
7927        use fidl::Peered;
7928        self.inner.channel().signal_peer(clear_mask, set_mask)
7929    }
7930}
7931
7932impl RootJobControlHandle {}
7933
7934#[must_use = "FIDL methods require a response to be sent"]
7935#[derive(Debug)]
7936pub struct RootJobGetResponder {
7937    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
7938    tx_id: u32,
7939}
7940
7941/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
7942/// if the responder is dropped without sending a response, so that the client
7943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7944impl std::ops::Drop for RootJobGetResponder {
7945    fn drop(&mut self) {
7946        self.control_handle.shutdown();
7947        // Safety: drops once, never accessed again
7948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7949    }
7950}
7951
7952impl fidl::endpoints::Responder for RootJobGetResponder {
7953    type ControlHandle = RootJobControlHandle;
7954
7955    fn control_handle(&self) -> &RootJobControlHandle {
7956        &self.control_handle
7957    }
7958
7959    fn drop_without_shutdown(mut self) {
7960        // Safety: drops once, never accessed again due to mem::forget
7961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7962        // Prevent Drop from running (which would shut down the channel)
7963        std::mem::forget(self);
7964    }
7965}
7966
7967impl RootJobGetResponder {
7968    /// Sends a response to the FIDL transaction.
7969    ///
7970    /// Sets the channel to shutdown if an error occurs.
7971    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7972        let _result = self.send_raw(job);
7973        if _result.is_err() {
7974            self.control_handle.shutdown();
7975        }
7976        self.drop_without_shutdown();
7977        _result
7978    }
7979
7980    /// Similar to "send" but does not shutdown the channel if an error occurs.
7981    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7982        let _result = self.send_raw(job);
7983        self.drop_without_shutdown();
7984        _result
7985    }
7986
7987    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7988        self.control_handle.inner.send::<RootJobGetResponse>(
7989            (job,),
7990            self.tx_id,
7991            0x73acb63f93d53eac,
7992            fidl::encoding::DynamicFlags::empty(),
7993        )
7994    }
7995}
7996
7997#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7998pub struct RootJobForInspectMarker;
7999
8000impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
8001    type Proxy = RootJobForInspectProxy;
8002    type RequestStream = RootJobForInspectRequestStream;
8003    #[cfg(target_os = "fuchsia")]
8004    type SynchronousProxy = RootJobForInspectSynchronousProxy;
8005
8006    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
8007}
8008impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
8009
8010pub trait RootJobForInspectProxyInterface: Send + Sync {
8011    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
8012    fn r#get(&self) -> Self::GetResponseFut;
8013}
8014#[derive(Debug)]
8015#[cfg(target_os = "fuchsia")]
8016pub struct RootJobForInspectSynchronousProxy {
8017    client: fidl::client::sync::Client,
8018}
8019
8020#[cfg(target_os = "fuchsia")]
8021impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
8022    type Proxy = RootJobForInspectProxy;
8023    type Protocol = RootJobForInspectMarker;
8024
8025    fn from_channel(inner: fidl::Channel) -> Self {
8026        Self::new(inner)
8027    }
8028
8029    fn into_channel(self) -> fidl::Channel {
8030        self.client.into_channel()
8031    }
8032
8033    fn as_channel(&self) -> &fidl::Channel {
8034        self.client.as_channel()
8035    }
8036}
8037
8038#[cfg(target_os = "fuchsia")]
8039impl RootJobForInspectSynchronousProxy {
8040    pub fn new(channel: fidl::Channel) -> Self {
8041        Self { client: fidl::client::sync::Client::new(channel) }
8042    }
8043
8044    pub fn into_channel(self) -> fidl::Channel {
8045        self.client.into_channel()
8046    }
8047
8048    /// Waits until an event arrives and returns it. It is safe for other
8049    /// threads to make concurrent requests while waiting for an event.
8050    pub fn wait_for_event(
8051        &self,
8052        deadline: zx::MonotonicInstant,
8053    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8054        RootJobForInspectEvent::decode(
8055            self.client.wait_for_event::<RootJobForInspectMarker>(deadline)?,
8056        )
8057    }
8058
8059    /// Get the root `job`.
8060    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
8061        let _response = self.client.send_query::<
8062            fidl::encoding::EmptyPayload,
8063            RootJobGetResponse,
8064            RootJobForInspectMarker,
8065        >(
8066            (),
8067            0x73acb63f93d53eac,
8068            fidl::encoding::DynamicFlags::empty(),
8069            ___deadline,
8070        )?;
8071        Ok(_response.job)
8072    }
8073}
8074
8075#[cfg(target_os = "fuchsia")]
8076impl From<RootJobForInspectSynchronousProxy> for zx::NullableHandle {
8077    fn from(value: RootJobForInspectSynchronousProxy) -> Self {
8078        value.into_channel().into()
8079    }
8080}
8081
8082#[cfg(target_os = "fuchsia")]
8083impl From<fidl::Channel> for RootJobForInspectSynchronousProxy {
8084    fn from(value: fidl::Channel) -> Self {
8085        Self::new(value)
8086    }
8087}
8088
8089#[cfg(target_os = "fuchsia")]
8090impl fidl::endpoints::FromClient for RootJobForInspectSynchronousProxy {
8091    type Protocol = RootJobForInspectMarker;
8092
8093    fn from_client(value: fidl::endpoints::ClientEnd<RootJobForInspectMarker>) -> Self {
8094        Self::new(value.into_channel())
8095    }
8096}
8097
8098#[derive(Debug, Clone)]
8099pub struct RootJobForInspectProxy {
8100    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8101}
8102
8103impl fidl::endpoints::Proxy for RootJobForInspectProxy {
8104    type Protocol = RootJobForInspectMarker;
8105
8106    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8107        Self::new(inner)
8108    }
8109
8110    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8111        self.client.into_channel().map_err(|client| Self { client })
8112    }
8113
8114    fn as_channel(&self) -> &::fidl::AsyncChannel {
8115        self.client.as_channel()
8116    }
8117}
8118
8119impl RootJobForInspectProxy {
8120    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
8121    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8122        let protocol_name =
8123            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8124        Self { client: fidl::client::Client::new(channel, protocol_name) }
8125    }
8126
8127    /// Get a Stream of events from the remote end of the protocol.
8128    ///
8129    /// # Panics
8130    ///
8131    /// Panics if the event stream was already taken.
8132    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
8133        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
8134    }
8135
8136    /// Get the root `job`.
8137    pub fn r#get(
8138        &self,
8139    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
8140    {
8141        RootJobForInspectProxyInterface::r#get(self)
8142    }
8143}
8144
8145impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
8146    type GetResponseFut =
8147        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
8148    fn r#get(&self) -> Self::GetResponseFut {
8149        fn _decode(
8150            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8151        ) -> Result<fidl::Job, fidl::Error> {
8152            let _response = fidl::client::decode_transaction_body::<
8153                RootJobGetResponse,
8154                fidl::encoding::DefaultFuchsiaResourceDialect,
8155                0x73acb63f93d53eac,
8156            >(_buf?)?;
8157            Ok(_response.job)
8158        }
8159        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
8160            (),
8161            0x73acb63f93d53eac,
8162            fidl::encoding::DynamicFlags::empty(),
8163            _decode,
8164        )
8165    }
8166}
8167
8168pub struct RootJobForInspectEventStream {
8169    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8170}
8171
8172impl std::marker::Unpin for RootJobForInspectEventStream {}
8173
8174impl futures::stream::FusedStream for RootJobForInspectEventStream {
8175    fn is_terminated(&self) -> bool {
8176        self.event_receiver.is_terminated()
8177    }
8178}
8179
8180impl futures::Stream for RootJobForInspectEventStream {
8181    type Item = Result<RootJobForInspectEvent, fidl::Error>;
8182
8183    fn poll_next(
8184        mut self: std::pin::Pin<&mut Self>,
8185        cx: &mut std::task::Context<'_>,
8186    ) -> std::task::Poll<Option<Self::Item>> {
8187        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8188            &mut self.event_receiver,
8189            cx
8190        )?) {
8191            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
8192            None => std::task::Poll::Ready(None),
8193        }
8194    }
8195}
8196
8197#[derive(Debug)]
8198pub enum RootJobForInspectEvent {}
8199
8200impl RootJobForInspectEvent {
8201    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
8202    fn decode(
8203        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8204    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8205        let (bytes, _handles) = buf.split_mut();
8206        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8207        debug_assert_eq!(tx_header.tx_id, 0);
8208        match tx_header.ordinal {
8209            _ => Err(fidl::Error::UnknownOrdinal {
8210                ordinal: tx_header.ordinal,
8211                protocol_name:
8212                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8213            }),
8214        }
8215    }
8216}
8217
8218/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
8219pub struct RootJobForInspectRequestStream {
8220    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8221    is_terminated: bool,
8222}
8223
8224impl std::marker::Unpin for RootJobForInspectRequestStream {}
8225
8226impl futures::stream::FusedStream for RootJobForInspectRequestStream {
8227    fn is_terminated(&self) -> bool {
8228        self.is_terminated
8229    }
8230}
8231
8232impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
8233    type Protocol = RootJobForInspectMarker;
8234    type ControlHandle = RootJobForInspectControlHandle;
8235
8236    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8237        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8238    }
8239
8240    fn control_handle(&self) -> Self::ControlHandle {
8241        RootJobForInspectControlHandle { inner: self.inner.clone() }
8242    }
8243
8244    fn into_inner(
8245        self,
8246    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8247    {
8248        (self.inner, self.is_terminated)
8249    }
8250
8251    fn from_inner(
8252        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8253        is_terminated: bool,
8254    ) -> Self {
8255        Self { inner, is_terminated }
8256    }
8257}
8258
8259impl futures::Stream for RootJobForInspectRequestStream {
8260    type Item = Result<RootJobForInspectRequest, fidl::Error>;
8261
8262    fn poll_next(
8263        mut self: std::pin::Pin<&mut Self>,
8264        cx: &mut std::task::Context<'_>,
8265    ) -> std::task::Poll<Option<Self::Item>> {
8266        let this = &mut *self;
8267        if this.inner.check_shutdown(cx) {
8268            this.is_terminated = true;
8269            return std::task::Poll::Ready(None);
8270        }
8271        if this.is_terminated {
8272            panic!("polled RootJobForInspectRequestStream after completion");
8273        }
8274        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8275            |bytes, handles| {
8276                match this.inner.channel().read_etc(cx, bytes, handles) {
8277                    std::task::Poll::Ready(Ok(())) => {}
8278                    std::task::Poll::Pending => return std::task::Poll::Pending,
8279                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8280                        this.is_terminated = true;
8281                        return std::task::Poll::Ready(None);
8282                    }
8283                    std::task::Poll::Ready(Err(e)) => {
8284                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8285                            e.into(),
8286                        ))));
8287                    }
8288                }
8289
8290                // A message has been received from the channel
8291                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8292
8293                std::task::Poll::Ready(Some(match header.ordinal {
8294                    0x73acb63f93d53eac => {
8295                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8296                        let mut req = fidl::new_empty!(
8297                            fidl::encoding::EmptyPayload,
8298                            fidl::encoding::DefaultFuchsiaResourceDialect
8299                        );
8300                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8301                        let control_handle =
8302                            RootJobForInspectControlHandle { inner: this.inner.clone() };
8303                        Ok(RootJobForInspectRequest::Get {
8304                            responder: RootJobForInspectGetResponder {
8305                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8306                                tx_id: header.tx_id,
8307                            },
8308                        })
8309                    }
8310                    _ => Err(fidl::Error::UnknownOrdinal {
8311                        ordinal: header.ordinal,
8312                        protocol_name:
8313                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8314                    }),
8315                }))
8316            },
8317        )
8318    }
8319}
8320
8321/// Protocol for providing the root job with restricted rights, specifically:
8322/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
8323#[derive(Debug)]
8324pub enum RootJobForInspectRequest {
8325    /// Get the root `job`.
8326    Get { responder: RootJobForInspectGetResponder },
8327}
8328
8329impl RootJobForInspectRequest {
8330    #[allow(irrefutable_let_patterns)]
8331    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
8332        if let RootJobForInspectRequest::Get { responder } = self {
8333            Some((responder))
8334        } else {
8335            None
8336        }
8337    }
8338
8339    /// Name of the method defined in FIDL
8340    pub fn method_name(&self) -> &'static str {
8341        match *self {
8342            RootJobForInspectRequest::Get { .. } => "get",
8343        }
8344    }
8345}
8346
8347#[derive(Debug, Clone)]
8348pub struct RootJobForInspectControlHandle {
8349    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8350}
8351
8352impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
8353    fn shutdown(&self) {
8354        self.inner.shutdown()
8355    }
8356
8357    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8358        self.inner.shutdown_with_epitaph(status)
8359    }
8360
8361    fn is_closed(&self) -> bool {
8362        self.inner.channel().is_closed()
8363    }
8364    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8365        self.inner.channel().on_closed()
8366    }
8367
8368    #[cfg(target_os = "fuchsia")]
8369    fn signal_peer(
8370        &self,
8371        clear_mask: zx::Signals,
8372        set_mask: zx::Signals,
8373    ) -> Result<(), zx_status::Status> {
8374        use fidl::Peered;
8375        self.inner.channel().signal_peer(clear_mask, set_mask)
8376    }
8377}
8378
8379impl RootJobForInspectControlHandle {}
8380
8381#[must_use = "FIDL methods require a response to be sent"]
8382#[derive(Debug)]
8383pub struct RootJobForInspectGetResponder {
8384    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
8385    tx_id: u32,
8386}
8387
8388/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
8389/// if the responder is dropped without sending a response, so that the client
8390/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8391impl std::ops::Drop for RootJobForInspectGetResponder {
8392    fn drop(&mut self) {
8393        self.control_handle.shutdown();
8394        // Safety: drops once, never accessed again
8395        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8396    }
8397}
8398
8399impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
8400    type ControlHandle = RootJobForInspectControlHandle;
8401
8402    fn control_handle(&self) -> &RootJobForInspectControlHandle {
8403        &self.control_handle
8404    }
8405
8406    fn drop_without_shutdown(mut self) {
8407        // Safety: drops once, never accessed again due to mem::forget
8408        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8409        // Prevent Drop from running (which would shut down the channel)
8410        std::mem::forget(self);
8411    }
8412}
8413
8414impl RootJobForInspectGetResponder {
8415    /// Sends a response to the FIDL transaction.
8416    ///
8417    /// Sets the channel to shutdown if an error occurs.
8418    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8419        let _result = self.send_raw(job);
8420        if _result.is_err() {
8421            self.control_handle.shutdown();
8422        }
8423        self.drop_without_shutdown();
8424        _result
8425    }
8426
8427    /// Similar to "send" but does not shutdown the channel if an error occurs.
8428    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8429        let _result = self.send_raw(job);
8430        self.drop_without_shutdown();
8431        _result
8432    }
8433
8434    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8435        self.control_handle.inner.send::<RootJobGetResponse>(
8436            (job,),
8437            self.tx_id,
8438            0x73acb63f93d53eac,
8439            fidl::encoding::DynamicFlags::empty(),
8440        )
8441    }
8442}
8443
8444#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8445pub struct SamplingResourceMarker;
8446
8447impl fidl::endpoints::ProtocolMarker for SamplingResourceMarker {
8448    type Proxy = SamplingResourceProxy;
8449    type RequestStream = SamplingResourceRequestStream;
8450    #[cfg(target_os = "fuchsia")]
8451    type SynchronousProxy = SamplingResourceSynchronousProxy;
8452
8453    const DEBUG_NAME: &'static str = "fuchsia.kernel.SamplingResource";
8454}
8455impl fidl::endpoints::DiscoverableProtocolMarker for SamplingResourceMarker {}
8456
8457pub trait SamplingResourceProxyInterface: Send + Sync {
8458    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8459    fn r#get(&self) -> Self::GetResponseFut;
8460}
8461#[derive(Debug)]
8462#[cfg(target_os = "fuchsia")]
8463pub struct SamplingResourceSynchronousProxy {
8464    client: fidl::client::sync::Client,
8465}
8466
8467#[cfg(target_os = "fuchsia")]
8468impl fidl::endpoints::SynchronousProxy for SamplingResourceSynchronousProxy {
8469    type Proxy = SamplingResourceProxy;
8470    type Protocol = SamplingResourceMarker;
8471
8472    fn from_channel(inner: fidl::Channel) -> Self {
8473        Self::new(inner)
8474    }
8475
8476    fn into_channel(self) -> fidl::Channel {
8477        self.client.into_channel()
8478    }
8479
8480    fn as_channel(&self) -> &fidl::Channel {
8481        self.client.as_channel()
8482    }
8483}
8484
8485#[cfg(target_os = "fuchsia")]
8486impl SamplingResourceSynchronousProxy {
8487    pub fn new(channel: fidl::Channel) -> Self {
8488        Self { client: fidl::client::sync::Client::new(channel) }
8489    }
8490
8491    pub fn into_channel(self) -> fidl::Channel {
8492        self.client.into_channel()
8493    }
8494
8495    /// Waits until an event arrives and returns it. It is safe for other
8496    /// threads to make concurrent requests while waiting for an event.
8497    pub fn wait_for_event(
8498        &self,
8499        deadline: zx::MonotonicInstant,
8500    ) -> Result<SamplingResourceEvent, fidl::Error> {
8501        SamplingResourceEvent::decode(
8502            self.client.wait_for_event::<SamplingResourceMarker>(deadline)?,
8503        )
8504    }
8505
8506    /// Get a sampling resource handle.
8507    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8508        let _response = self.client.send_query::<
8509            fidl::encoding::EmptyPayload,
8510            SamplingResourceGetResponse,
8511            SamplingResourceMarker,
8512        >(
8513            (),
8514            0x51c41ab037e99824,
8515            fidl::encoding::DynamicFlags::empty(),
8516            ___deadline,
8517        )?;
8518        Ok(_response.resource)
8519    }
8520}
8521
8522#[cfg(target_os = "fuchsia")]
8523impl From<SamplingResourceSynchronousProxy> for zx::NullableHandle {
8524    fn from(value: SamplingResourceSynchronousProxy) -> Self {
8525        value.into_channel().into()
8526    }
8527}
8528
8529#[cfg(target_os = "fuchsia")]
8530impl From<fidl::Channel> for SamplingResourceSynchronousProxy {
8531    fn from(value: fidl::Channel) -> Self {
8532        Self::new(value)
8533    }
8534}
8535
8536#[cfg(target_os = "fuchsia")]
8537impl fidl::endpoints::FromClient for SamplingResourceSynchronousProxy {
8538    type Protocol = SamplingResourceMarker;
8539
8540    fn from_client(value: fidl::endpoints::ClientEnd<SamplingResourceMarker>) -> Self {
8541        Self::new(value.into_channel())
8542    }
8543}
8544
8545#[derive(Debug, Clone)]
8546pub struct SamplingResourceProxy {
8547    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8548}
8549
8550impl fidl::endpoints::Proxy for SamplingResourceProxy {
8551    type Protocol = SamplingResourceMarker;
8552
8553    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8554        Self::new(inner)
8555    }
8556
8557    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8558        self.client.into_channel().map_err(|client| Self { client })
8559    }
8560
8561    fn as_channel(&self) -> &::fidl::AsyncChannel {
8562        self.client.as_channel()
8563    }
8564}
8565
8566impl SamplingResourceProxy {
8567    /// Create a new Proxy for fuchsia.kernel/SamplingResource.
8568    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8569        let protocol_name = <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8570        Self { client: fidl::client::Client::new(channel, protocol_name) }
8571    }
8572
8573    /// Get a Stream of events from the remote end of the protocol.
8574    ///
8575    /// # Panics
8576    ///
8577    /// Panics if the event stream was already taken.
8578    pub fn take_event_stream(&self) -> SamplingResourceEventStream {
8579        SamplingResourceEventStream { event_receiver: self.client.take_event_receiver() }
8580    }
8581
8582    /// Get a sampling resource handle.
8583    pub fn r#get(
8584        &self,
8585    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8586    {
8587        SamplingResourceProxyInterface::r#get(self)
8588    }
8589}
8590
8591impl SamplingResourceProxyInterface for SamplingResourceProxy {
8592    type GetResponseFut = fidl::client::QueryResponseFut<
8593        fidl::Resource,
8594        fidl::encoding::DefaultFuchsiaResourceDialect,
8595    >;
8596    fn r#get(&self) -> Self::GetResponseFut {
8597        fn _decode(
8598            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8599        ) -> Result<fidl::Resource, fidl::Error> {
8600            let _response = fidl::client::decode_transaction_body::<
8601                SamplingResourceGetResponse,
8602                fidl::encoding::DefaultFuchsiaResourceDialect,
8603                0x51c41ab037e99824,
8604            >(_buf?)?;
8605            Ok(_response.resource)
8606        }
8607        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8608            (),
8609            0x51c41ab037e99824,
8610            fidl::encoding::DynamicFlags::empty(),
8611            _decode,
8612        )
8613    }
8614}
8615
8616pub struct SamplingResourceEventStream {
8617    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8618}
8619
8620impl std::marker::Unpin for SamplingResourceEventStream {}
8621
8622impl futures::stream::FusedStream for SamplingResourceEventStream {
8623    fn is_terminated(&self) -> bool {
8624        self.event_receiver.is_terminated()
8625    }
8626}
8627
8628impl futures::Stream for SamplingResourceEventStream {
8629    type Item = Result<SamplingResourceEvent, fidl::Error>;
8630
8631    fn poll_next(
8632        mut self: std::pin::Pin<&mut Self>,
8633        cx: &mut std::task::Context<'_>,
8634    ) -> std::task::Poll<Option<Self::Item>> {
8635        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8636            &mut self.event_receiver,
8637            cx
8638        )?) {
8639            Some(buf) => std::task::Poll::Ready(Some(SamplingResourceEvent::decode(buf))),
8640            None => std::task::Poll::Ready(None),
8641        }
8642    }
8643}
8644
8645#[derive(Debug)]
8646pub enum SamplingResourceEvent {}
8647
8648impl SamplingResourceEvent {
8649    /// Decodes a message buffer as a [`SamplingResourceEvent`].
8650    fn decode(
8651        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8652    ) -> Result<SamplingResourceEvent, fidl::Error> {
8653        let (bytes, _handles) = buf.split_mut();
8654        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8655        debug_assert_eq!(tx_header.tx_id, 0);
8656        match tx_header.ordinal {
8657            _ => Err(fidl::Error::UnknownOrdinal {
8658                ordinal: tx_header.ordinal,
8659                protocol_name:
8660                    <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8661            }),
8662        }
8663    }
8664}
8665
8666/// A Stream of incoming requests for fuchsia.kernel/SamplingResource.
8667pub struct SamplingResourceRequestStream {
8668    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8669    is_terminated: bool,
8670}
8671
8672impl std::marker::Unpin for SamplingResourceRequestStream {}
8673
8674impl futures::stream::FusedStream for SamplingResourceRequestStream {
8675    fn is_terminated(&self) -> bool {
8676        self.is_terminated
8677    }
8678}
8679
8680impl fidl::endpoints::RequestStream for SamplingResourceRequestStream {
8681    type Protocol = SamplingResourceMarker;
8682    type ControlHandle = SamplingResourceControlHandle;
8683
8684    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8685        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8686    }
8687
8688    fn control_handle(&self) -> Self::ControlHandle {
8689        SamplingResourceControlHandle { inner: self.inner.clone() }
8690    }
8691
8692    fn into_inner(
8693        self,
8694    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8695    {
8696        (self.inner, self.is_terminated)
8697    }
8698
8699    fn from_inner(
8700        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8701        is_terminated: bool,
8702    ) -> Self {
8703        Self { inner, is_terminated }
8704    }
8705}
8706
8707impl futures::Stream for SamplingResourceRequestStream {
8708    type Item = Result<SamplingResourceRequest, fidl::Error>;
8709
8710    fn poll_next(
8711        mut self: std::pin::Pin<&mut Self>,
8712        cx: &mut std::task::Context<'_>,
8713    ) -> std::task::Poll<Option<Self::Item>> {
8714        let this = &mut *self;
8715        if this.inner.check_shutdown(cx) {
8716            this.is_terminated = true;
8717            return std::task::Poll::Ready(None);
8718        }
8719        if this.is_terminated {
8720            panic!("polled SamplingResourceRequestStream after completion");
8721        }
8722        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8723            |bytes, handles| {
8724                match this.inner.channel().read_etc(cx, bytes, handles) {
8725                    std::task::Poll::Ready(Ok(())) => {}
8726                    std::task::Poll::Pending => return std::task::Poll::Pending,
8727                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8728                        this.is_terminated = true;
8729                        return std::task::Poll::Ready(None);
8730                    }
8731                    std::task::Poll::Ready(Err(e)) => {
8732                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8733                            e.into(),
8734                        ))));
8735                    }
8736                }
8737
8738                // A message has been received from the channel
8739                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8740
8741                std::task::Poll::Ready(Some(match header.ordinal {
8742                    0x51c41ab037e99824 => {
8743                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8744                        let mut req = fidl::new_empty!(
8745                            fidl::encoding::EmptyPayload,
8746                            fidl::encoding::DefaultFuchsiaResourceDialect
8747                        );
8748                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8749                        let control_handle =
8750                            SamplingResourceControlHandle { inner: this.inner.clone() };
8751                        Ok(SamplingResourceRequest::Get {
8752                            responder: SamplingResourceGetResponder {
8753                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8754                                tx_id: header.tx_id,
8755                            },
8756                        })
8757                    }
8758                    _ => Err(fidl::Error::UnknownOrdinal {
8759                        ordinal: header.ordinal,
8760                        protocol_name:
8761                            <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8762                    }),
8763                }))
8764            },
8765        )
8766    }
8767}
8768
8769/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
8770/// `ZX_RSRC_SYSTEM_SAMPLING_BASE`.
8771#[derive(Debug)]
8772pub enum SamplingResourceRequest {
8773    /// Get a sampling resource handle.
8774    Get { responder: SamplingResourceGetResponder },
8775}
8776
8777impl SamplingResourceRequest {
8778    #[allow(irrefutable_let_patterns)]
8779    pub fn into_get(self) -> Option<(SamplingResourceGetResponder)> {
8780        if let SamplingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
8781    }
8782
8783    /// Name of the method defined in FIDL
8784    pub fn method_name(&self) -> &'static str {
8785        match *self {
8786            SamplingResourceRequest::Get { .. } => "get",
8787        }
8788    }
8789}
8790
8791#[derive(Debug, Clone)]
8792pub struct SamplingResourceControlHandle {
8793    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8794}
8795
8796impl fidl::endpoints::ControlHandle for SamplingResourceControlHandle {
8797    fn shutdown(&self) {
8798        self.inner.shutdown()
8799    }
8800
8801    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8802        self.inner.shutdown_with_epitaph(status)
8803    }
8804
8805    fn is_closed(&self) -> bool {
8806        self.inner.channel().is_closed()
8807    }
8808    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8809        self.inner.channel().on_closed()
8810    }
8811
8812    #[cfg(target_os = "fuchsia")]
8813    fn signal_peer(
8814        &self,
8815        clear_mask: zx::Signals,
8816        set_mask: zx::Signals,
8817    ) -> Result<(), zx_status::Status> {
8818        use fidl::Peered;
8819        self.inner.channel().signal_peer(clear_mask, set_mask)
8820    }
8821}
8822
8823impl SamplingResourceControlHandle {}
8824
8825#[must_use = "FIDL methods require a response to be sent"]
8826#[derive(Debug)]
8827pub struct SamplingResourceGetResponder {
8828    control_handle: std::mem::ManuallyDrop<SamplingResourceControlHandle>,
8829    tx_id: u32,
8830}
8831
8832/// Set the the channel to be shutdown (see [`SamplingResourceControlHandle::shutdown`])
8833/// if the responder is dropped without sending a response, so that the client
8834/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8835impl std::ops::Drop for SamplingResourceGetResponder {
8836    fn drop(&mut self) {
8837        self.control_handle.shutdown();
8838        // Safety: drops once, never accessed again
8839        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8840    }
8841}
8842
8843impl fidl::endpoints::Responder for SamplingResourceGetResponder {
8844    type ControlHandle = SamplingResourceControlHandle;
8845
8846    fn control_handle(&self) -> &SamplingResourceControlHandle {
8847        &self.control_handle
8848    }
8849
8850    fn drop_without_shutdown(mut self) {
8851        // Safety: drops once, never accessed again due to mem::forget
8852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8853        // Prevent Drop from running (which would shut down the channel)
8854        std::mem::forget(self);
8855    }
8856}
8857
8858impl SamplingResourceGetResponder {
8859    /// Sends a response to the FIDL transaction.
8860    ///
8861    /// Sets the channel to shutdown if an error occurs.
8862    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8863        let _result = self.send_raw(resource);
8864        if _result.is_err() {
8865            self.control_handle.shutdown();
8866        }
8867        self.drop_without_shutdown();
8868        _result
8869    }
8870
8871    /// Similar to "send" but does not shutdown the channel if an error occurs.
8872    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8873        let _result = self.send_raw(resource);
8874        self.drop_without_shutdown();
8875        _result
8876    }
8877
8878    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8879        self.control_handle.inner.send::<SamplingResourceGetResponse>(
8880            (resource,),
8881            self.tx_id,
8882            0x51c41ab037e99824,
8883            fidl::encoding::DynamicFlags::empty(),
8884        )
8885    }
8886}
8887
8888#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8889pub struct SmcResourceMarker;
8890
8891impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
8892    type Proxy = SmcResourceProxy;
8893    type RequestStream = SmcResourceRequestStream;
8894    #[cfg(target_os = "fuchsia")]
8895    type SynchronousProxy = SmcResourceSynchronousProxy;
8896
8897    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
8898}
8899impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
8900
8901pub trait SmcResourceProxyInterface: Send + Sync {
8902    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8903    fn r#get(&self) -> Self::GetResponseFut;
8904}
8905#[derive(Debug)]
8906#[cfg(target_os = "fuchsia")]
8907pub struct SmcResourceSynchronousProxy {
8908    client: fidl::client::sync::Client,
8909}
8910
8911#[cfg(target_os = "fuchsia")]
8912impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
8913    type Proxy = SmcResourceProxy;
8914    type Protocol = SmcResourceMarker;
8915
8916    fn from_channel(inner: fidl::Channel) -> Self {
8917        Self::new(inner)
8918    }
8919
8920    fn into_channel(self) -> fidl::Channel {
8921        self.client.into_channel()
8922    }
8923
8924    fn as_channel(&self) -> &fidl::Channel {
8925        self.client.as_channel()
8926    }
8927}
8928
8929#[cfg(target_os = "fuchsia")]
8930impl SmcResourceSynchronousProxy {
8931    pub fn new(channel: fidl::Channel) -> Self {
8932        Self { client: fidl::client::sync::Client::new(channel) }
8933    }
8934
8935    pub fn into_channel(self) -> fidl::Channel {
8936        self.client.into_channel()
8937    }
8938
8939    /// Waits until an event arrives and returns it. It is safe for other
8940    /// threads to make concurrent requests while waiting for an event.
8941    pub fn wait_for_event(
8942        &self,
8943        deadline: zx::MonotonicInstant,
8944    ) -> Result<SmcResourceEvent, fidl::Error> {
8945        SmcResourceEvent::decode(self.client.wait_for_event::<SmcResourceMarker>(deadline)?)
8946    }
8947
8948    /// Get an SMC resource handle.
8949    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8950        let _response = self
8951            .client
8952            .send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse, SmcResourceMarker>(
8953                (),
8954                0x392cbd495b84ede7,
8955                fidl::encoding::DynamicFlags::empty(),
8956                ___deadline,
8957            )?;
8958        Ok(_response.resource)
8959    }
8960}
8961
8962#[cfg(target_os = "fuchsia")]
8963impl From<SmcResourceSynchronousProxy> for zx::NullableHandle {
8964    fn from(value: SmcResourceSynchronousProxy) -> Self {
8965        value.into_channel().into()
8966    }
8967}
8968
8969#[cfg(target_os = "fuchsia")]
8970impl From<fidl::Channel> for SmcResourceSynchronousProxy {
8971    fn from(value: fidl::Channel) -> Self {
8972        Self::new(value)
8973    }
8974}
8975
8976#[cfg(target_os = "fuchsia")]
8977impl fidl::endpoints::FromClient for SmcResourceSynchronousProxy {
8978    type Protocol = SmcResourceMarker;
8979
8980    fn from_client(value: fidl::endpoints::ClientEnd<SmcResourceMarker>) -> Self {
8981        Self::new(value.into_channel())
8982    }
8983}
8984
8985#[derive(Debug, Clone)]
8986pub struct SmcResourceProxy {
8987    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8988}
8989
8990impl fidl::endpoints::Proxy for SmcResourceProxy {
8991    type Protocol = SmcResourceMarker;
8992
8993    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8994        Self::new(inner)
8995    }
8996
8997    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8998        self.client.into_channel().map_err(|client| Self { client })
8999    }
9000
9001    fn as_channel(&self) -> &::fidl::AsyncChannel {
9002        self.client.as_channel()
9003    }
9004}
9005
9006impl SmcResourceProxy {
9007    /// Create a new Proxy for fuchsia.kernel/SmcResource.
9008    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9009        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9010        Self { client: fidl::client::Client::new(channel, protocol_name) }
9011    }
9012
9013    /// Get a Stream of events from the remote end of the protocol.
9014    ///
9015    /// # Panics
9016    ///
9017    /// Panics if the event stream was already taken.
9018    pub fn take_event_stream(&self) -> SmcResourceEventStream {
9019        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
9020    }
9021
9022    /// Get an SMC resource handle.
9023    pub fn r#get(
9024        &self,
9025    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9026    {
9027        SmcResourceProxyInterface::r#get(self)
9028    }
9029}
9030
9031impl SmcResourceProxyInterface for SmcResourceProxy {
9032    type GetResponseFut = fidl::client::QueryResponseFut<
9033        fidl::Resource,
9034        fidl::encoding::DefaultFuchsiaResourceDialect,
9035    >;
9036    fn r#get(&self) -> Self::GetResponseFut {
9037        fn _decode(
9038            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9039        ) -> Result<fidl::Resource, fidl::Error> {
9040            let _response = fidl::client::decode_transaction_body::<
9041                SmcResourceGetResponse,
9042                fidl::encoding::DefaultFuchsiaResourceDialect,
9043                0x392cbd495b84ede7,
9044            >(_buf?)?;
9045            Ok(_response.resource)
9046        }
9047        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9048            (),
9049            0x392cbd495b84ede7,
9050            fidl::encoding::DynamicFlags::empty(),
9051            _decode,
9052        )
9053    }
9054}
9055
9056pub struct SmcResourceEventStream {
9057    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9058}
9059
9060impl std::marker::Unpin for SmcResourceEventStream {}
9061
9062impl futures::stream::FusedStream for SmcResourceEventStream {
9063    fn is_terminated(&self) -> bool {
9064        self.event_receiver.is_terminated()
9065    }
9066}
9067
9068impl futures::Stream for SmcResourceEventStream {
9069    type Item = Result<SmcResourceEvent, fidl::Error>;
9070
9071    fn poll_next(
9072        mut self: std::pin::Pin<&mut Self>,
9073        cx: &mut std::task::Context<'_>,
9074    ) -> std::task::Poll<Option<Self::Item>> {
9075        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9076            &mut self.event_receiver,
9077            cx
9078        )?) {
9079            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
9080            None => std::task::Poll::Ready(None),
9081        }
9082    }
9083}
9084
9085#[derive(Debug)]
9086pub enum SmcResourceEvent {}
9087
9088impl SmcResourceEvent {
9089    /// Decodes a message buffer as a [`SmcResourceEvent`].
9090    fn decode(
9091        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9092    ) -> Result<SmcResourceEvent, fidl::Error> {
9093        let (bytes, _handles) = buf.split_mut();
9094        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9095        debug_assert_eq!(tx_header.tx_id, 0);
9096        match tx_header.ordinal {
9097            _ => Err(fidl::Error::UnknownOrdinal {
9098                ordinal: tx_header.ordinal,
9099                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9100            }),
9101        }
9102    }
9103}
9104
9105/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
9106pub struct SmcResourceRequestStream {
9107    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9108    is_terminated: bool,
9109}
9110
9111impl std::marker::Unpin for SmcResourceRequestStream {}
9112
9113impl futures::stream::FusedStream for SmcResourceRequestStream {
9114    fn is_terminated(&self) -> bool {
9115        self.is_terminated
9116    }
9117}
9118
9119impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
9120    type Protocol = SmcResourceMarker;
9121    type ControlHandle = SmcResourceControlHandle;
9122
9123    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9124        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9125    }
9126
9127    fn control_handle(&self) -> Self::ControlHandle {
9128        SmcResourceControlHandle { inner: self.inner.clone() }
9129    }
9130
9131    fn into_inner(
9132        self,
9133    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9134    {
9135        (self.inner, self.is_terminated)
9136    }
9137
9138    fn from_inner(
9139        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9140        is_terminated: bool,
9141    ) -> Self {
9142        Self { inner, is_terminated }
9143    }
9144}
9145
9146impl futures::Stream for SmcResourceRequestStream {
9147    type Item = Result<SmcResourceRequest, fidl::Error>;
9148
9149    fn poll_next(
9150        mut self: std::pin::Pin<&mut Self>,
9151        cx: &mut std::task::Context<'_>,
9152    ) -> std::task::Poll<Option<Self::Item>> {
9153        let this = &mut *self;
9154        if this.inner.check_shutdown(cx) {
9155            this.is_terminated = true;
9156            return std::task::Poll::Ready(None);
9157        }
9158        if this.is_terminated {
9159            panic!("polled SmcResourceRequestStream after completion");
9160        }
9161        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9162            |bytes, handles| {
9163                match this.inner.channel().read_etc(cx, bytes, handles) {
9164                    std::task::Poll::Ready(Ok(())) => {}
9165                    std::task::Poll::Pending => return std::task::Poll::Pending,
9166                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9167                        this.is_terminated = true;
9168                        return std::task::Poll::Ready(None);
9169                    }
9170                    std::task::Poll::Ready(Err(e)) => {
9171                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9172                            e.into(),
9173                        ))));
9174                    }
9175                }
9176
9177                // A message has been received from the channel
9178                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9179
9180                std::task::Poll::Ready(Some(match header.ordinal {
9181                    0x392cbd495b84ede7 => {
9182                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9183                        let mut req = fidl::new_empty!(
9184                            fidl::encoding::EmptyPayload,
9185                            fidl::encoding::DefaultFuchsiaResourceDialect
9186                        );
9187                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9188                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
9189                        Ok(SmcResourceRequest::Get {
9190                            responder: SmcResourceGetResponder {
9191                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9192                                tx_id: header.tx_id,
9193                            },
9194                        })
9195                    }
9196                    _ => Err(fidl::Error::UnknownOrdinal {
9197                        ordinal: header.ordinal,
9198                        protocol_name:
9199                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9200                    }),
9201                }))
9202            },
9203        )
9204    }
9205}
9206
9207/// Protocol for providing an SMC resource with access to all valid ranges.
9208#[derive(Debug)]
9209pub enum SmcResourceRequest {
9210    /// Get an SMC resource handle.
9211    Get { responder: SmcResourceGetResponder },
9212}
9213
9214impl SmcResourceRequest {
9215    #[allow(irrefutable_let_patterns)]
9216    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
9217        if let SmcResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9218    }
9219
9220    /// Name of the method defined in FIDL
9221    pub fn method_name(&self) -> &'static str {
9222        match *self {
9223            SmcResourceRequest::Get { .. } => "get",
9224        }
9225    }
9226}
9227
9228#[derive(Debug, Clone)]
9229pub struct SmcResourceControlHandle {
9230    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9231}
9232
9233impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
9234    fn shutdown(&self) {
9235        self.inner.shutdown()
9236    }
9237
9238    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9239        self.inner.shutdown_with_epitaph(status)
9240    }
9241
9242    fn is_closed(&self) -> bool {
9243        self.inner.channel().is_closed()
9244    }
9245    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9246        self.inner.channel().on_closed()
9247    }
9248
9249    #[cfg(target_os = "fuchsia")]
9250    fn signal_peer(
9251        &self,
9252        clear_mask: zx::Signals,
9253        set_mask: zx::Signals,
9254    ) -> Result<(), zx_status::Status> {
9255        use fidl::Peered;
9256        self.inner.channel().signal_peer(clear_mask, set_mask)
9257    }
9258}
9259
9260impl SmcResourceControlHandle {}
9261
9262#[must_use = "FIDL methods require a response to be sent"]
9263#[derive(Debug)]
9264pub struct SmcResourceGetResponder {
9265    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
9266    tx_id: u32,
9267}
9268
9269/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
9270/// if the responder is dropped without sending a response, so that the client
9271/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9272impl std::ops::Drop for SmcResourceGetResponder {
9273    fn drop(&mut self) {
9274        self.control_handle.shutdown();
9275        // Safety: drops once, never accessed again
9276        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9277    }
9278}
9279
9280impl fidl::endpoints::Responder for SmcResourceGetResponder {
9281    type ControlHandle = SmcResourceControlHandle;
9282
9283    fn control_handle(&self) -> &SmcResourceControlHandle {
9284        &self.control_handle
9285    }
9286
9287    fn drop_without_shutdown(mut self) {
9288        // Safety: drops once, never accessed again due to mem::forget
9289        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9290        // Prevent Drop from running (which would shut down the channel)
9291        std::mem::forget(self);
9292    }
9293}
9294
9295impl SmcResourceGetResponder {
9296    /// Sends a response to the FIDL transaction.
9297    ///
9298    /// Sets the channel to shutdown if an error occurs.
9299    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9300        let _result = self.send_raw(resource);
9301        if _result.is_err() {
9302            self.control_handle.shutdown();
9303        }
9304        self.drop_without_shutdown();
9305        _result
9306    }
9307
9308    /// Similar to "send" but does not shutdown the channel if an error occurs.
9309    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9310        let _result = self.send_raw(resource);
9311        self.drop_without_shutdown();
9312        _result
9313    }
9314
9315    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9316        self.control_handle.inner.send::<SmcResourceGetResponse>(
9317            (resource,),
9318            self.tx_id,
9319            0x392cbd495b84ede7,
9320            fidl::encoding::DynamicFlags::empty(),
9321        )
9322    }
9323}
9324
9325#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9326pub struct StallResourceMarker;
9327
9328impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
9329    type Proxy = StallResourceProxy;
9330    type RequestStream = StallResourceRequestStream;
9331    #[cfg(target_os = "fuchsia")]
9332    type SynchronousProxy = StallResourceSynchronousProxy;
9333
9334    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
9335}
9336impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
9337
9338pub trait StallResourceProxyInterface: Send + Sync {
9339    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
9340    fn r#get(&self) -> Self::GetResponseFut;
9341}
9342#[derive(Debug)]
9343#[cfg(target_os = "fuchsia")]
9344pub struct StallResourceSynchronousProxy {
9345    client: fidl::client::sync::Client,
9346}
9347
9348#[cfg(target_os = "fuchsia")]
9349impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
9350    type Proxy = StallResourceProxy;
9351    type Protocol = StallResourceMarker;
9352
9353    fn from_channel(inner: fidl::Channel) -> Self {
9354        Self::new(inner)
9355    }
9356
9357    fn into_channel(self) -> fidl::Channel {
9358        self.client.into_channel()
9359    }
9360
9361    fn as_channel(&self) -> &fidl::Channel {
9362        self.client.as_channel()
9363    }
9364}
9365
9366#[cfg(target_os = "fuchsia")]
9367impl StallResourceSynchronousProxy {
9368    pub fn new(channel: fidl::Channel) -> Self {
9369        Self { client: fidl::client::sync::Client::new(channel) }
9370    }
9371
9372    pub fn into_channel(self) -> fidl::Channel {
9373        self.client.into_channel()
9374    }
9375
9376    /// Waits until an event arrives and returns it. It is safe for other
9377    /// threads to make concurrent requests while waiting for an event.
9378    pub fn wait_for_event(
9379        &self,
9380        deadline: zx::MonotonicInstant,
9381    ) -> Result<StallResourceEvent, fidl::Error> {
9382        StallResourceEvent::decode(self.client.wait_for_event::<StallResourceMarker>(deadline)?)
9383    }
9384
9385    /// Get a stall resource handle.
9386    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
9387        let _response = self.client.send_query::<
9388            fidl::encoding::EmptyPayload,
9389            StallResourceGetResponse,
9390            StallResourceMarker,
9391        >(
9392            (),
9393            0x5edf4c8629a9781a,
9394            fidl::encoding::DynamicFlags::empty(),
9395            ___deadline,
9396        )?;
9397        Ok(_response.resource)
9398    }
9399}
9400
9401#[cfg(target_os = "fuchsia")]
9402impl From<StallResourceSynchronousProxy> for zx::NullableHandle {
9403    fn from(value: StallResourceSynchronousProxy) -> Self {
9404        value.into_channel().into()
9405    }
9406}
9407
9408#[cfg(target_os = "fuchsia")]
9409impl From<fidl::Channel> for StallResourceSynchronousProxy {
9410    fn from(value: fidl::Channel) -> Self {
9411        Self::new(value)
9412    }
9413}
9414
9415#[cfg(target_os = "fuchsia")]
9416impl fidl::endpoints::FromClient for StallResourceSynchronousProxy {
9417    type Protocol = StallResourceMarker;
9418
9419    fn from_client(value: fidl::endpoints::ClientEnd<StallResourceMarker>) -> Self {
9420        Self::new(value.into_channel())
9421    }
9422}
9423
9424#[derive(Debug, Clone)]
9425pub struct StallResourceProxy {
9426    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9427}
9428
9429impl fidl::endpoints::Proxy for StallResourceProxy {
9430    type Protocol = StallResourceMarker;
9431
9432    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9433        Self::new(inner)
9434    }
9435
9436    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9437        self.client.into_channel().map_err(|client| Self { client })
9438    }
9439
9440    fn as_channel(&self) -> &::fidl::AsyncChannel {
9441        self.client.as_channel()
9442    }
9443}
9444
9445impl StallResourceProxy {
9446    /// Create a new Proxy for fuchsia.kernel/StallResource.
9447    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9448        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9449        Self { client: fidl::client::Client::new(channel, protocol_name) }
9450    }
9451
9452    /// Get a Stream of events from the remote end of the protocol.
9453    ///
9454    /// # Panics
9455    ///
9456    /// Panics if the event stream was already taken.
9457    pub fn take_event_stream(&self) -> StallResourceEventStream {
9458        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
9459    }
9460
9461    /// Get a stall resource handle.
9462    pub fn r#get(
9463        &self,
9464    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9465    {
9466        StallResourceProxyInterface::r#get(self)
9467    }
9468}
9469
9470impl StallResourceProxyInterface for StallResourceProxy {
9471    type GetResponseFut = fidl::client::QueryResponseFut<
9472        fidl::Resource,
9473        fidl::encoding::DefaultFuchsiaResourceDialect,
9474    >;
9475    fn r#get(&self) -> Self::GetResponseFut {
9476        fn _decode(
9477            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9478        ) -> Result<fidl::Resource, fidl::Error> {
9479            let _response = fidl::client::decode_transaction_body::<
9480                StallResourceGetResponse,
9481                fidl::encoding::DefaultFuchsiaResourceDialect,
9482                0x5edf4c8629a9781a,
9483            >(_buf?)?;
9484            Ok(_response.resource)
9485        }
9486        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9487            (),
9488            0x5edf4c8629a9781a,
9489            fidl::encoding::DynamicFlags::empty(),
9490            _decode,
9491        )
9492    }
9493}
9494
9495pub struct StallResourceEventStream {
9496    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9497}
9498
9499impl std::marker::Unpin for StallResourceEventStream {}
9500
9501impl futures::stream::FusedStream for StallResourceEventStream {
9502    fn is_terminated(&self) -> bool {
9503        self.event_receiver.is_terminated()
9504    }
9505}
9506
9507impl futures::Stream for StallResourceEventStream {
9508    type Item = Result<StallResourceEvent, fidl::Error>;
9509
9510    fn poll_next(
9511        mut self: std::pin::Pin<&mut Self>,
9512        cx: &mut std::task::Context<'_>,
9513    ) -> std::task::Poll<Option<Self::Item>> {
9514        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9515            &mut self.event_receiver,
9516            cx
9517        )?) {
9518            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
9519            None => std::task::Poll::Ready(None),
9520        }
9521    }
9522}
9523
9524#[derive(Debug)]
9525pub enum StallResourceEvent {}
9526
9527impl StallResourceEvent {
9528    /// Decodes a message buffer as a [`StallResourceEvent`].
9529    fn decode(
9530        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9531    ) -> Result<StallResourceEvent, fidl::Error> {
9532        let (bytes, _handles) = buf.split_mut();
9533        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9534        debug_assert_eq!(tx_header.tx_id, 0);
9535        match tx_header.ordinal {
9536            _ => Err(fidl::Error::UnknownOrdinal {
9537                ordinal: tx_header.ordinal,
9538                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9539            }),
9540        }
9541    }
9542}
9543
9544/// A Stream of incoming requests for fuchsia.kernel/StallResource.
9545pub struct StallResourceRequestStream {
9546    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9547    is_terminated: bool,
9548}
9549
9550impl std::marker::Unpin for StallResourceRequestStream {}
9551
9552impl futures::stream::FusedStream for StallResourceRequestStream {
9553    fn is_terminated(&self) -> bool {
9554        self.is_terminated
9555    }
9556}
9557
9558impl fidl::endpoints::RequestStream for StallResourceRequestStream {
9559    type Protocol = StallResourceMarker;
9560    type ControlHandle = StallResourceControlHandle;
9561
9562    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9563        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9564    }
9565
9566    fn control_handle(&self) -> Self::ControlHandle {
9567        StallResourceControlHandle { inner: self.inner.clone() }
9568    }
9569
9570    fn into_inner(
9571        self,
9572    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9573    {
9574        (self.inner, self.is_terminated)
9575    }
9576
9577    fn from_inner(
9578        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9579        is_terminated: bool,
9580    ) -> Self {
9581        Self { inner, is_terminated }
9582    }
9583}
9584
9585impl futures::Stream for StallResourceRequestStream {
9586    type Item = Result<StallResourceRequest, fidl::Error>;
9587
9588    fn poll_next(
9589        mut self: std::pin::Pin<&mut Self>,
9590        cx: &mut std::task::Context<'_>,
9591    ) -> std::task::Poll<Option<Self::Item>> {
9592        let this = &mut *self;
9593        if this.inner.check_shutdown(cx) {
9594            this.is_terminated = true;
9595            return std::task::Poll::Ready(None);
9596        }
9597        if this.is_terminated {
9598            panic!("polled StallResourceRequestStream after completion");
9599        }
9600        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9601            |bytes, handles| {
9602                match this.inner.channel().read_etc(cx, bytes, handles) {
9603                    std::task::Poll::Ready(Ok(())) => {}
9604                    std::task::Poll::Pending => return std::task::Poll::Pending,
9605                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9606                        this.is_terminated = true;
9607                        return std::task::Poll::Ready(None);
9608                    }
9609                    std::task::Poll::Ready(Err(e)) => {
9610                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9611                            e.into(),
9612                        ))));
9613                    }
9614                }
9615
9616                // A message has been received from the channel
9617                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9618
9619                std::task::Poll::Ready(Some(match header.ordinal {
9620                    0x5edf4c8629a9781a => {
9621                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9622                        let mut req = fidl::new_empty!(
9623                            fidl::encoding::EmptyPayload,
9624                            fidl::encoding::DefaultFuchsiaResourceDialect
9625                        );
9626                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9627                        let control_handle =
9628                            StallResourceControlHandle { inner: this.inner.clone() };
9629                        Ok(StallResourceRequest::Get {
9630                            responder: StallResourceGetResponder {
9631                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9632                                tx_id: header.tx_id,
9633                            },
9634                        })
9635                    }
9636                    _ => Err(fidl::Error::UnknownOrdinal {
9637                        ordinal: header.ordinal,
9638                        protocol_name:
9639                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9640                    }),
9641                }))
9642            },
9643        )
9644    }
9645}
9646
9647/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
9648/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
9649/// be notified of stalls.
9650#[derive(Debug)]
9651pub enum StallResourceRequest {
9652    /// Get a stall resource handle.
9653    Get { responder: StallResourceGetResponder },
9654}
9655
9656impl StallResourceRequest {
9657    #[allow(irrefutable_let_patterns)]
9658    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
9659        if let StallResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9660    }
9661
9662    /// Name of the method defined in FIDL
9663    pub fn method_name(&self) -> &'static str {
9664        match *self {
9665            StallResourceRequest::Get { .. } => "get",
9666        }
9667    }
9668}
9669
9670#[derive(Debug, Clone)]
9671pub struct StallResourceControlHandle {
9672    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9673}
9674
9675impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
9676    fn shutdown(&self) {
9677        self.inner.shutdown()
9678    }
9679
9680    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9681        self.inner.shutdown_with_epitaph(status)
9682    }
9683
9684    fn is_closed(&self) -> bool {
9685        self.inner.channel().is_closed()
9686    }
9687    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9688        self.inner.channel().on_closed()
9689    }
9690
9691    #[cfg(target_os = "fuchsia")]
9692    fn signal_peer(
9693        &self,
9694        clear_mask: zx::Signals,
9695        set_mask: zx::Signals,
9696    ) -> Result<(), zx_status::Status> {
9697        use fidl::Peered;
9698        self.inner.channel().signal_peer(clear_mask, set_mask)
9699    }
9700}
9701
9702impl StallResourceControlHandle {}
9703
9704#[must_use = "FIDL methods require a response to be sent"]
9705#[derive(Debug)]
9706pub struct StallResourceGetResponder {
9707    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
9708    tx_id: u32,
9709}
9710
9711/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
9712/// if the responder is dropped without sending a response, so that the client
9713/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9714impl std::ops::Drop for StallResourceGetResponder {
9715    fn drop(&mut self) {
9716        self.control_handle.shutdown();
9717        // Safety: drops once, never accessed again
9718        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9719    }
9720}
9721
9722impl fidl::endpoints::Responder for StallResourceGetResponder {
9723    type ControlHandle = StallResourceControlHandle;
9724
9725    fn control_handle(&self) -> &StallResourceControlHandle {
9726        &self.control_handle
9727    }
9728
9729    fn drop_without_shutdown(mut self) {
9730        // Safety: drops once, never accessed again due to mem::forget
9731        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9732        // Prevent Drop from running (which would shut down the channel)
9733        std::mem::forget(self);
9734    }
9735}
9736
9737impl StallResourceGetResponder {
9738    /// Sends a response to the FIDL transaction.
9739    ///
9740    /// Sets the channel to shutdown if an error occurs.
9741    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9742        let _result = self.send_raw(resource);
9743        if _result.is_err() {
9744            self.control_handle.shutdown();
9745        }
9746        self.drop_without_shutdown();
9747        _result
9748    }
9749
9750    /// Similar to "send" but does not shutdown the channel if an error occurs.
9751    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9752        let _result = self.send_raw(resource);
9753        self.drop_without_shutdown();
9754        _result
9755    }
9756
9757    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9758        self.control_handle.inner.send::<StallResourceGetResponse>(
9759            (resource,),
9760            self.tx_id,
9761            0x5edf4c8629a9781a,
9762            fidl::encoding::DynamicFlags::empty(),
9763        )
9764    }
9765}
9766
9767#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9768pub struct StatsMarker;
9769
9770impl fidl::endpoints::ProtocolMarker for StatsMarker {
9771    type Proxy = StatsProxy;
9772    type RequestStream = StatsRequestStream;
9773    #[cfg(target_os = "fuchsia")]
9774    type SynchronousProxy = StatsSynchronousProxy;
9775
9776    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
9777}
9778impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
9779
9780pub trait StatsProxyInterface: Send + Sync {
9781    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
9782        + Send;
9783    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
9784    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
9785        + Send;
9786    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
9787    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
9788        + Send;
9789    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
9790    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
9791    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
9792    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
9793    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
9794}
9795#[derive(Debug)]
9796#[cfg(target_os = "fuchsia")]
9797pub struct StatsSynchronousProxy {
9798    client: fidl::client::sync::Client,
9799}
9800
9801#[cfg(target_os = "fuchsia")]
9802impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
9803    type Proxy = StatsProxy;
9804    type Protocol = StatsMarker;
9805
9806    fn from_channel(inner: fidl::Channel) -> Self {
9807        Self::new(inner)
9808    }
9809
9810    fn into_channel(self) -> fidl::Channel {
9811        self.client.into_channel()
9812    }
9813
9814    fn as_channel(&self) -> &fidl::Channel {
9815        self.client.as_channel()
9816    }
9817}
9818
9819#[cfg(target_os = "fuchsia")]
9820impl StatsSynchronousProxy {
9821    pub fn new(channel: fidl::Channel) -> Self {
9822        Self { client: fidl::client::sync::Client::new(channel) }
9823    }
9824
9825    pub fn into_channel(self) -> fidl::Channel {
9826        self.client.into_channel()
9827    }
9828
9829    /// Waits until an event arrives and returns it. It is safe for other
9830    /// threads to make concurrent requests while waiting for an event.
9831    pub fn wait_for_event(
9832        &self,
9833        deadline: zx::MonotonicInstant,
9834    ) -> Result<StatsEvent, fidl::Error> {
9835        StatsEvent::decode(self.client.wait_for_event::<StatsMarker>(deadline)?)
9836    }
9837
9838    pub fn r#get_memory_stats(
9839        &self,
9840        ___deadline: zx::MonotonicInstant,
9841    ) -> Result<MemoryStats, fidl::Error> {
9842        let _response = self
9843            .client
9844            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse, StatsMarker>(
9845                (),
9846                0x686677932ae41074,
9847                fidl::encoding::DynamicFlags::empty(),
9848                ___deadline,
9849            )?;
9850        Ok(_response.stats)
9851    }
9852
9853    pub fn r#get_memory_stats_extended(
9854        &self,
9855        ___deadline: zx::MonotonicInstant,
9856    ) -> Result<MemoryStatsExtended, fidl::Error> {
9857        let _response = self.client.send_query::<
9858            fidl::encoding::EmptyPayload,
9859            StatsGetMemoryStatsExtendedResponse,
9860            StatsMarker,
9861        >(
9862            (),
9863            0x60faa0f8aa38c29f,
9864            fidl::encoding::DynamicFlags::empty(),
9865            ___deadline,
9866        )?;
9867        Ok(_response.stats)
9868    }
9869
9870    pub fn r#get_memory_stats_compression(
9871        &self,
9872        ___deadline: zx::MonotonicInstant,
9873    ) -> Result<MemoryStatsCompression, fidl::Error> {
9874        let _response = self
9875            .client
9876            .send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression, StatsMarker>(
9877                (),
9878                0x544a09995befb531,
9879                fidl::encoding::DynamicFlags::empty(),
9880                ___deadline,
9881            )?;
9882        Ok(_response)
9883    }
9884
9885    pub fn r#get_cpu_stats(
9886        &self,
9887        ___deadline: zx::MonotonicInstant,
9888    ) -> Result<CpuStats, fidl::Error> {
9889        let _response = self
9890            .client
9891            .send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse, StatsMarker>(
9892                (),
9893                0x470e2684ca1ca19e,
9894                fidl::encoding::DynamicFlags::empty(),
9895                ___deadline,
9896            )?;
9897        Ok(_response.stats)
9898    }
9899
9900    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9901    /// duration.
9902    ///
9903    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9904    /// PerCpuStats) over a time duration.
9905    pub fn r#get_cpu_load(
9906        &self,
9907        mut duration: i64,
9908        ___deadline: zx::MonotonicInstant,
9909    ) -> Result<Vec<f32>, fidl::Error> {
9910        let _response = self
9911            .client
9912            .send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse, StatsMarker>(
9913                (duration,),
9914                0x4c8f0f05e7034666,
9915                fidl::encoding::DynamicFlags::empty(),
9916                ___deadline,
9917            )?;
9918        Ok(_response.per_cpu_load)
9919    }
9920}
9921
9922#[cfg(target_os = "fuchsia")]
9923impl From<StatsSynchronousProxy> for zx::NullableHandle {
9924    fn from(value: StatsSynchronousProxy) -> Self {
9925        value.into_channel().into()
9926    }
9927}
9928
9929#[cfg(target_os = "fuchsia")]
9930impl From<fidl::Channel> for StatsSynchronousProxy {
9931    fn from(value: fidl::Channel) -> Self {
9932        Self::new(value)
9933    }
9934}
9935
9936#[cfg(target_os = "fuchsia")]
9937impl fidl::endpoints::FromClient for StatsSynchronousProxy {
9938    type Protocol = StatsMarker;
9939
9940    fn from_client(value: fidl::endpoints::ClientEnd<StatsMarker>) -> Self {
9941        Self::new(value.into_channel())
9942    }
9943}
9944
9945#[derive(Debug, Clone)]
9946pub struct StatsProxy {
9947    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9948}
9949
9950impl fidl::endpoints::Proxy for StatsProxy {
9951    type Protocol = StatsMarker;
9952
9953    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9954        Self::new(inner)
9955    }
9956
9957    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9958        self.client.into_channel().map_err(|client| Self { client })
9959    }
9960
9961    fn as_channel(&self) -> &::fidl::AsyncChannel {
9962        self.client.as_channel()
9963    }
9964}
9965
9966impl StatsProxy {
9967    /// Create a new Proxy for fuchsia.kernel/Stats.
9968    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9969        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9970        Self { client: fidl::client::Client::new(channel, protocol_name) }
9971    }
9972
9973    /// Get a Stream of events from the remote end of the protocol.
9974    ///
9975    /// # Panics
9976    ///
9977    /// Panics if the event stream was already taken.
9978    pub fn take_event_stream(&self) -> StatsEventStream {
9979        StatsEventStream { event_receiver: self.client.take_event_receiver() }
9980    }
9981
9982    pub fn r#get_memory_stats(
9983        &self,
9984    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9985    {
9986        StatsProxyInterface::r#get_memory_stats(self)
9987    }
9988
9989    pub fn r#get_memory_stats_extended(
9990        &self,
9991    ) -> fidl::client::QueryResponseFut<
9992        MemoryStatsExtended,
9993        fidl::encoding::DefaultFuchsiaResourceDialect,
9994    > {
9995        StatsProxyInterface::r#get_memory_stats_extended(self)
9996    }
9997
9998    pub fn r#get_memory_stats_compression(
9999        &self,
10000    ) -> fidl::client::QueryResponseFut<
10001        MemoryStatsCompression,
10002        fidl::encoding::DefaultFuchsiaResourceDialect,
10003    > {
10004        StatsProxyInterface::r#get_memory_stats_compression(self)
10005    }
10006
10007    pub fn r#get_cpu_stats(
10008        &self,
10009    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
10010    {
10011        StatsProxyInterface::r#get_cpu_stats(self)
10012    }
10013
10014    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10015    /// duration.
10016    ///
10017    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10018    /// PerCpuStats) over a time duration.
10019    pub fn r#get_cpu_load(
10020        &self,
10021        mut duration: i64,
10022    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
10023    {
10024        StatsProxyInterface::r#get_cpu_load(self, duration)
10025    }
10026}
10027
10028impl StatsProxyInterface for StatsProxy {
10029    type GetMemoryStatsResponseFut =
10030        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
10031    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
10032        fn _decode(
10033            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10034        ) -> Result<MemoryStats, fidl::Error> {
10035            let _response = fidl::client::decode_transaction_body::<
10036                StatsGetMemoryStatsResponse,
10037                fidl::encoding::DefaultFuchsiaResourceDialect,
10038                0x686677932ae41074,
10039            >(_buf?)?;
10040            Ok(_response.stats)
10041        }
10042        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
10043            (),
10044            0x686677932ae41074,
10045            fidl::encoding::DynamicFlags::empty(),
10046            _decode,
10047        )
10048    }
10049
10050    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
10051        MemoryStatsExtended,
10052        fidl::encoding::DefaultFuchsiaResourceDialect,
10053    >;
10054    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
10055        fn _decode(
10056            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10057        ) -> Result<MemoryStatsExtended, fidl::Error> {
10058            let _response = fidl::client::decode_transaction_body::<
10059                StatsGetMemoryStatsExtendedResponse,
10060                fidl::encoding::DefaultFuchsiaResourceDialect,
10061                0x60faa0f8aa38c29f,
10062            >(_buf?)?;
10063            Ok(_response.stats)
10064        }
10065        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
10066            (),
10067            0x60faa0f8aa38c29f,
10068            fidl::encoding::DynamicFlags::empty(),
10069            _decode,
10070        )
10071    }
10072
10073    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
10074        MemoryStatsCompression,
10075        fidl::encoding::DefaultFuchsiaResourceDialect,
10076    >;
10077    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
10078        fn _decode(
10079            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10080        ) -> Result<MemoryStatsCompression, fidl::Error> {
10081            let _response = fidl::client::decode_transaction_body::<
10082                MemoryStatsCompression,
10083                fidl::encoding::DefaultFuchsiaResourceDialect,
10084                0x544a09995befb531,
10085            >(_buf?)?;
10086            Ok(_response)
10087        }
10088        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
10089            (),
10090            0x544a09995befb531,
10091            fidl::encoding::DynamicFlags::empty(),
10092            _decode,
10093        )
10094    }
10095
10096    type GetCpuStatsResponseFut =
10097        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
10098    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
10099        fn _decode(
10100            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10101        ) -> Result<CpuStats, fidl::Error> {
10102            let _response = fidl::client::decode_transaction_body::<
10103                StatsGetCpuStatsResponse,
10104                fidl::encoding::DefaultFuchsiaResourceDialect,
10105                0x470e2684ca1ca19e,
10106            >(_buf?)?;
10107            Ok(_response.stats)
10108        }
10109        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
10110            (),
10111            0x470e2684ca1ca19e,
10112            fidl::encoding::DynamicFlags::empty(),
10113            _decode,
10114        )
10115    }
10116
10117    type GetCpuLoadResponseFut =
10118        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
10119    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
10120        fn _decode(
10121            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10122        ) -> Result<Vec<f32>, fidl::Error> {
10123            let _response = fidl::client::decode_transaction_body::<
10124                StatsGetCpuLoadResponse,
10125                fidl::encoding::DefaultFuchsiaResourceDialect,
10126                0x4c8f0f05e7034666,
10127            >(_buf?)?;
10128            Ok(_response.per_cpu_load)
10129        }
10130        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
10131            (duration,),
10132            0x4c8f0f05e7034666,
10133            fidl::encoding::DynamicFlags::empty(),
10134            _decode,
10135        )
10136    }
10137}
10138
10139pub struct StatsEventStream {
10140    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10141}
10142
10143impl std::marker::Unpin for StatsEventStream {}
10144
10145impl futures::stream::FusedStream for StatsEventStream {
10146    fn is_terminated(&self) -> bool {
10147        self.event_receiver.is_terminated()
10148    }
10149}
10150
10151impl futures::Stream for StatsEventStream {
10152    type Item = Result<StatsEvent, fidl::Error>;
10153
10154    fn poll_next(
10155        mut self: std::pin::Pin<&mut Self>,
10156        cx: &mut std::task::Context<'_>,
10157    ) -> std::task::Poll<Option<Self::Item>> {
10158        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10159            &mut self.event_receiver,
10160            cx
10161        )?) {
10162            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
10163            None => std::task::Poll::Ready(None),
10164        }
10165    }
10166}
10167
10168#[derive(Debug)]
10169pub enum StatsEvent {}
10170
10171impl StatsEvent {
10172    /// Decodes a message buffer as a [`StatsEvent`].
10173    fn decode(
10174        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10175    ) -> Result<StatsEvent, fidl::Error> {
10176        let (bytes, _handles) = buf.split_mut();
10177        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10178        debug_assert_eq!(tx_header.tx_id, 0);
10179        match tx_header.ordinal {
10180            _ => Err(fidl::Error::UnknownOrdinal {
10181                ordinal: tx_header.ordinal,
10182                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10183            }),
10184        }
10185    }
10186}
10187
10188/// A Stream of incoming requests for fuchsia.kernel/Stats.
10189pub struct StatsRequestStream {
10190    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10191    is_terminated: bool,
10192}
10193
10194impl std::marker::Unpin for StatsRequestStream {}
10195
10196impl futures::stream::FusedStream for StatsRequestStream {
10197    fn is_terminated(&self) -> bool {
10198        self.is_terminated
10199    }
10200}
10201
10202impl fidl::endpoints::RequestStream for StatsRequestStream {
10203    type Protocol = StatsMarker;
10204    type ControlHandle = StatsControlHandle;
10205
10206    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10207        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10208    }
10209
10210    fn control_handle(&self) -> Self::ControlHandle {
10211        StatsControlHandle { inner: self.inner.clone() }
10212    }
10213
10214    fn into_inner(
10215        self,
10216    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10217    {
10218        (self.inner, self.is_terminated)
10219    }
10220
10221    fn from_inner(
10222        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10223        is_terminated: bool,
10224    ) -> Self {
10225        Self { inner, is_terminated }
10226    }
10227}
10228
10229impl futures::Stream for StatsRequestStream {
10230    type Item = Result<StatsRequest, fidl::Error>;
10231
10232    fn poll_next(
10233        mut self: std::pin::Pin<&mut Self>,
10234        cx: &mut std::task::Context<'_>,
10235    ) -> std::task::Poll<Option<Self::Item>> {
10236        let this = &mut *self;
10237        if this.inner.check_shutdown(cx) {
10238            this.is_terminated = true;
10239            return std::task::Poll::Ready(None);
10240        }
10241        if this.is_terminated {
10242            panic!("polled StatsRequestStream after completion");
10243        }
10244        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10245            |bytes, handles| {
10246                match this.inner.channel().read_etc(cx, bytes, handles) {
10247                    std::task::Poll::Ready(Ok(())) => {}
10248                    std::task::Poll::Pending => return std::task::Poll::Pending,
10249                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10250                        this.is_terminated = true;
10251                        return std::task::Poll::Ready(None);
10252                    }
10253                    std::task::Poll::Ready(Err(e)) => {
10254                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10255                            e.into(),
10256                        ))));
10257                    }
10258                }
10259
10260                // A message has been received from the channel
10261                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10262
10263                std::task::Poll::Ready(Some(match header.ordinal {
10264                    0x686677932ae41074 => {
10265                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10266                        let mut req = fidl::new_empty!(
10267                            fidl::encoding::EmptyPayload,
10268                            fidl::encoding::DefaultFuchsiaResourceDialect
10269                        );
10270                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10271                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10272                        Ok(StatsRequest::GetMemoryStats {
10273                            responder: StatsGetMemoryStatsResponder {
10274                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10275                                tx_id: header.tx_id,
10276                            },
10277                        })
10278                    }
10279                    0x60faa0f8aa38c29f => {
10280                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10281                        let mut req = fidl::new_empty!(
10282                            fidl::encoding::EmptyPayload,
10283                            fidl::encoding::DefaultFuchsiaResourceDialect
10284                        );
10285                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10286                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10287                        Ok(StatsRequest::GetMemoryStatsExtended {
10288                            responder: StatsGetMemoryStatsExtendedResponder {
10289                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10290                                tx_id: header.tx_id,
10291                            },
10292                        })
10293                    }
10294                    0x544a09995befb531 => {
10295                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10296                        let mut req = fidl::new_empty!(
10297                            fidl::encoding::EmptyPayload,
10298                            fidl::encoding::DefaultFuchsiaResourceDialect
10299                        );
10300                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10301                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10302                        Ok(StatsRequest::GetMemoryStatsCompression {
10303                            responder: StatsGetMemoryStatsCompressionResponder {
10304                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10305                                tx_id: header.tx_id,
10306                            },
10307                        })
10308                    }
10309                    0x470e2684ca1ca19e => {
10310                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10311                        let mut req = fidl::new_empty!(
10312                            fidl::encoding::EmptyPayload,
10313                            fidl::encoding::DefaultFuchsiaResourceDialect
10314                        );
10315                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10316                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10317                        Ok(StatsRequest::GetCpuStats {
10318                            responder: StatsGetCpuStatsResponder {
10319                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10320                                tx_id: header.tx_id,
10321                            },
10322                        })
10323                    }
10324                    0x4c8f0f05e7034666 => {
10325                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10326                        let mut req = fidl::new_empty!(
10327                            StatsGetCpuLoadRequest,
10328                            fidl::encoding::DefaultFuchsiaResourceDialect
10329                        );
10330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
10331                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10332                        Ok(StatsRequest::GetCpuLoad {
10333                            duration: req.duration,
10334
10335                            responder: StatsGetCpuLoadResponder {
10336                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10337                                tx_id: header.tx_id,
10338                            },
10339                        })
10340                    }
10341                    _ => Err(fidl::Error::UnknownOrdinal {
10342                        ordinal: header.ordinal,
10343                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10344                    }),
10345                }))
10346            },
10347        )
10348    }
10349}
10350
10351/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
10352/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
10353/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
10354/// just want stats should use this service instead. If for some reason the protocol fails to
10355/// retrieve stats, which will be an un-recoverable error, it will close the channel.
10356#[derive(Debug)]
10357pub enum StatsRequest {
10358    GetMemoryStats {
10359        responder: StatsGetMemoryStatsResponder,
10360    },
10361    GetMemoryStatsExtended {
10362        responder: StatsGetMemoryStatsExtendedResponder,
10363    },
10364    GetMemoryStatsCompression {
10365        responder: StatsGetMemoryStatsCompressionResponder,
10366    },
10367    GetCpuStats {
10368        responder: StatsGetCpuStatsResponder,
10369    },
10370    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10371    /// duration.
10372    ///
10373    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10374    /// PerCpuStats) over a time duration.
10375    GetCpuLoad {
10376        duration: i64,
10377        responder: StatsGetCpuLoadResponder,
10378    },
10379}
10380
10381impl StatsRequest {
10382    #[allow(irrefutable_let_patterns)]
10383    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
10384        if let StatsRequest::GetMemoryStats { responder } = self { Some((responder)) } else { None }
10385    }
10386
10387    #[allow(irrefutable_let_patterns)]
10388    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
10389        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
10390            Some((responder))
10391        } else {
10392            None
10393        }
10394    }
10395
10396    #[allow(irrefutable_let_patterns)]
10397    pub fn into_get_memory_stats_compression(
10398        self,
10399    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
10400        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
10401            Some((responder))
10402        } else {
10403            None
10404        }
10405    }
10406
10407    #[allow(irrefutable_let_patterns)]
10408    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
10409        if let StatsRequest::GetCpuStats { responder } = self { Some((responder)) } else { None }
10410    }
10411
10412    #[allow(irrefutable_let_patterns)]
10413    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
10414        if let StatsRequest::GetCpuLoad { duration, responder } = self {
10415            Some((duration, responder))
10416        } else {
10417            None
10418        }
10419    }
10420
10421    /// Name of the method defined in FIDL
10422    pub fn method_name(&self) -> &'static str {
10423        match *self {
10424            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
10425            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
10426            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
10427            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
10428            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
10429        }
10430    }
10431}
10432
10433#[derive(Debug, Clone)]
10434pub struct StatsControlHandle {
10435    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10436}
10437
10438impl fidl::endpoints::ControlHandle for StatsControlHandle {
10439    fn shutdown(&self) {
10440        self.inner.shutdown()
10441    }
10442
10443    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10444        self.inner.shutdown_with_epitaph(status)
10445    }
10446
10447    fn is_closed(&self) -> bool {
10448        self.inner.channel().is_closed()
10449    }
10450    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10451        self.inner.channel().on_closed()
10452    }
10453
10454    #[cfg(target_os = "fuchsia")]
10455    fn signal_peer(
10456        &self,
10457        clear_mask: zx::Signals,
10458        set_mask: zx::Signals,
10459    ) -> Result<(), zx_status::Status> {
10460        use fidl::Peered;
10461        self.inner.channel().signal_peer(clear_mask, set_mask)
10462    }
10463}
10464
10465impl StatsControlHandle {}
10466
10467#[must_use = "FIDL methods require a response to be sent"]
10468#[derive(Debug)]
10469pub struct StatsGetMemoryStatsResponder {
10470    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10471    tx_id: u32,
10472}
10473
10474/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10475/// if the responder is dropped without sending a response, so that the client
10476/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10477impl std::ops::Drop for StatsGetMemoryStatsResponder {
10478    fn drop(&mut self) {
10479        self.control_handle.shutdown();
10480        // Safety: drops once, never accessed again
10481        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10482    }
10483}
10484
10485impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
10486    type ControlHandle = StatsControlHandle;
10487
10488    fn control_handle(&self) -> &StatsControlHandle {
10489        &self.control_handle
10490    }
10491
10492    fn drop_without_shutdown(mut self) {
10493        // Safety: drops once, never accessed again due to mem::forget
10494        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10495        // Prevent Drop from running (which would shut down the channel)
10496        std::mem::forget(self);
10497    }
10498}
10499
10500impl StatsGetMemoryStatsResponder {
10501    /// Sends a response to the FIDL transaction.
10502    ///
10503    /// Sets the channel to shutdown if an error occurs.
10504    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10505        let _result = self.send_raw(stats);
10506        if _result.is_err() {
10507            self.control_handle.shutdown();
10508        }
10509        self.drop_without_shutdown();
10510        _result
10511    }
10512
10513    /// Similar to "send" but does not shutdown the channel if an error occurs.
10514    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10515        let _result = self.send_raw(stats);
10516        self.drop_without_shutdown();
10517        _result
10518    }
10519
10520    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10521        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
10522            (stats,),
10523            self.tx_id,
10524            0x686677932ae41074,
10525            fidl::encoding::DynamicFlags::empty(),
10526        )
10527    }
10528}
10529
10530#[must_use = "FIDL methods require a response to be sent"]
10531#[derive(Debug)]
10532pub struct StatsGetMemoryStatsExtendedResponder {
10533    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10534    tx_id: u32,
10535}
10536
10537/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10538/// if the responder is dropped without sending a response, so that the client
10539/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10540impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
10541    fn drop(&mut self) {
10542        self.control_handle.shutdown();
10543        // Safety: drops once, never accessed again
10544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10545    }
10546}
10547
10548impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
10549    type ControlHandle = StatsControlHandle;
10550
10551    fn control_handle(&self) -> &StatsControlHandle {
10552        &self.control_handle
10553    }
10554
10555    fn drop_without_shutdown(mut self) {
10556        // Safety: drops once, never accessed again due to mem::forget
10557        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10558        // Prevent Drop from running (which would shut down the channel)
10559        std::mem::forget(self);
10560    }
10561}
10562
10563impl StatsGetMemoryStatsExtendedResponder {
10564    /// Sends a response to the FIDL transaction.
10565    ///
10566    /// Sets the channel to shutdown if an error occurs.
10567    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10568        let _result = self.send_raw(stats);
10569        if _result.is_err() {
10570            self.control_handle.shutdown();
10571        }
10572        self.drop_without_shutdown();
10573        _result
10574    }
10575
10576    /// Similar to "send" but does not shutdown the channel if an error occurs.
10577    pub fn send_no_shutdown_on_err(
10578        self,
10579        mut stats: &MemoryStatsExtended,
10580    ) -> Result<(), fidl::Error> {
10581        let _result = self.send_raw(stats);
10582        self.drop_without_shutdown();
10583        _result
10584    }
10585
10586    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10587        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
10588            (stats,),
10589            self.tx_id,
10590            0x60faa0f8aa38c29f,
10591            fidl::encoding::DynamicFlags::empty(),
10592        )
10593    }
10594}
10595
10596#[must_use = "FIDL methods require a response to be sent"]
10597#[derive(Debug)]
10598pub struct StatsGetMemoryStatsCompressionResponder {
10599    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10600    tx_id: u32,
10601}
10602
10603/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10604/// if the responder is dropped without sending a response, so that the client
10605/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10606impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
10607    fn drop(&mut self) {
10608        self.control_handle.shutdown();
10609        // Safety: drops once, never accessed again
10610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10611    }
10612}
10613
10614impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
10615    type ControlHandle = StatsControlHandle;
10616
10617    fn control_handle(&self) -> &StatsControlHandle {
10618        &self.control_handle
10619    }
10620
10621    fn drop_without_shutdown(mut self) {
10622        // Safety: drops once, never accessed again due to mem::forget
10623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10624        // Prevent Drop from running (which would shut down the channel)
10625        std::mem::forget(self);
10626    }
10627}
10628
10629impl StatsGetMemoryStatsCompressionResponder {
10630    /// Sends a response to the FIDL transaction.
10631    ///
10632    /// Sets the channel to shutdown if an error occurs.
10633    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10634        let _result = self.send_raw(payload);
10635        if _result.is_err() {
10636            self.control_handle.shutdown();
10637        }
10638        self.drop_without_shutdown();
10639        _result
10640    }
10641
10642    /// Similar to "send" but does not shutdown the channel if an error occurs.
10643    pub fn send_no_shutdown_on_err(
10644        self,
10645        mut payload: &MemoryStatsCompression,
10646    ) -> Result<(), fidl::Error> {
10647        let _result = self.send_raw(payload);
10648        self.drop_without_shutdown();
10649        _result
10650    }
10651
10652    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10653        self.control_handle.inner.send::<MemoryStatsCompression>(
10654            payload,
10655            self.tx_id,
10656            0x544a09995befb531,
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 StatsGetCpuStatsResponder {
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 StatsGetCpuStatsResponder {
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 StatsGetCpuStatsResponder {
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 StatsGetCpuStatsResponder {
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: &CpuStats) -> 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(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10710        let _result = self.send_raw(stats);
10711        self.drop_without_shutdown();
10712        _result
10713    }
10714
10715    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10716        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
10717            (stats,),
10718            self.tx_id,
10719            0x470e2684ca1ca19e,
10720            fidl::encoding::DynamicFlags::empty(),
10721        )
10722    }
10723}
10724
10725#[must_use = "FIDL methods require a response to be sent"]
10726#[derive(Debug)]
10727pub struct StatsGetCpuLoadResponder {
10728    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10729    tx_id: u32,
10730}
10731
10732/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10733/// if the responder is dropped without sending a response, so that the client
10734/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10735impl std::ops::Drop for StatsGetCpuLoadResponder {
10736    fn drop(&mut self) {
10737        self.control_handle.shutdown();
10738        // Safety: drops once, never accessed again
10739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10740    }
10741}
10742
10743impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
10744    type ControlHandle = StatsControlHandle;
10745
10746    fn control_handle(&self) -> &StatsControlHandle {
10747        &self.control_handle
10748    }
10749
10750    fn drop_without_shutdown(mut self) {
10751        // Safety: drops once, never accessed again due to mem::forget
10752        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10753        // Prevent Drop from running (which would shut down the channel)
10754        std::mem::forget(self);
10755    }
10756}
10757
10758impl StatsGetCpuLoadResponder {
10759    /// Sends a response to the FIDL transaction.
10760    ///
10761    /// Sets the channel to shutdown if an error occurs.
10762    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10763        let _result = self.send_raw(per_cpu_load);
10764        if _result.is_err() {
10765            self.control_handle.shutdown();
10766        }
10767        self.drop_without_shutdown();
10768        _result
10769    }
10770
10771    /// Similar to "send" but does not shutdown the channel if an error occurs.
10772    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10773        let _result = self.send_raw(per_cpu_load);
10774        self.drop_without_shutdown();
10775        _result
10776    }
10777
10778    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10779        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
10780            (per_cpu_load,),
10781            self.tx_id,
10782            0x4c8f0f05e7034666,
10783            fidl::encoding::DynamicFlags::empty(),
10784        )
10785    }
10786}
10787
10788#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10789pub struct TracingResourceMarker;
10790
10791impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
10792    type Proxy = TracingResourceProxy;
10793    type RequestStream = TracingResourceRequestStream;
10794    #[cfg(target_os = "fuchsia")]
10795    type SynchronousProxy = TracingResourceSynchronousProxy;
10796
10797    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
10798}
10799impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
10800
10801pub trait TracingResourceProxyInterface: Send + Sync {
10802    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10803    fn r#get(&self) -> Self::GetResponseFut;
10804}
10805#[derive(Debug)]
10806#[cfg(target_os = "fuchsia")]
10807pub struct TracingResourceSynchronousProxy {
10808    client: fidl::client::sync::Client,
10809}
10810
10811#[cfg(target_os = "fuchsia")]
10812impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
10813    type Proxy = TracingResourceProxy;
10814    type Protocol = TracingResourceMarker;
10815
10816    fn from_channel(inner: fidl::Channel) -> Self {
10817        Self::new(inner)
10818    }
10819
10820    fn into_channel(self) -> fidl::Channel {
10821        self.client.into_channel()
10822    }
10823
10824    fn as_channel(&self) -> &fidl::Channel {
10825        self.client.as_channel()
10826    }
10827}
10828
10829#[cfg(target_os = "fuchsia")]
10830impl TracingResourceSynchronousProxy {
10831    pub fn new(channel: fidl::Channel) -> Self {
10832        Self { client: fidl::client::sync::Client::new(channel) }
10833    }
10834
10835    pub fn into_channel(self) -> fidl::Channel {
10836        self.client.into_channel()
10837    }
10838
10839    /// Waits until an event arrives and returns it. It is safe for other
10840    /// threads to make concurrent requests while waiting for an event.
10841    pub fn wait_for_event(
10842        &self,
10843        deadline: zx::MonotonicInstant,
10844    ) -> Result<TracingResourceEvent, fidl::Error> {
10845        TracingResourceEvent::decode(self.client.wait_for_event::<TracingResourceMarker>(deadline)?)
10846    }
10847
10848    /// Get a tracing resource handle.
10849    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10850        let _response = self.client.send_query::<
10851            fidl::encoding::EmptyPayload,
10852            TracingResourceGetResponse,
10853            TracingResourceMarker,
10854        >(
10855            (),
10856            0x299bc179aa54c6aa,
10857            fidl::encoding::DynamicFlags::empty(),
10858            ___deadline,
10859        )?;
10860        Ok(_response.resource)
10861    }
10862}
10863
10864#[cfg(target_os = "fuchsia")]
10865impl From<TracingResourceSynchronousProxy> for zx::NullableHandle {
10866    fn from(value: TracingResourceSynchronousProxy) -> Self {
10867        value.into_channel().into()
10868    }
10869}
10870
10871#[cfg(target_os = "fuchsia")]
10872impl From<fidl::Channel> for TracingResourceSynchronousProxy {
10873    fn from(value: fidl::Channel) -> Self {
10874        Self::new(value)
10875    }
10876}
10877
10878#[cfg(target_os = "fuchsia")]
10879impl fidl::endpoints::FromClient for TracingResourceSynchronousProxy {
10880    type Protocol = TracingResourceMarker;
10881
10882    fn from_client(value: fidl::endpoints::ClientEnd<TracingResourceMarker>) -> Self {
10883        Self::new(value.into_channel())
10884    }
10885}
10886
10887#[derive(Debug, Clone)]
10888pub struct TracingResourceProxy {
10889    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10890}
10891
10892impl fidl::endpoints::Proxy for TracingResourceProxy {
10893    type Protocol = TracingResourceMarker;
10894
10895    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10896        Self::new(inner)
10897    }
10898
10899    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10900        self.client.into_channel().map_err(|client| Self { client })
10901    }
10902
10903    fn as_channel(&self) -> &::fidl::AsyncChannel {
10904        self.client.as_channel()
10905    }
10906}
10907
10908impl TracingResourceProxy {
10909    /// Create a new Proxy for fuchsia.kernel/TracingResource.
10910    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10911        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10912        Self { client: fidl::client::Client::new(channel, protocol_name) }
10913    }
10914
10915    /// Get a Stream of events from the remote end of the protocol.
10916    ///
10917    /// # Panics
10918    ///
10919    /// Panics if the event stream was already taken.
10920    pub fn take_event_stream(&self) -> TracingResourceEventStream {
10921        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
10922    }
10923
10924    /// Get a tracing resource handle.
10925    pub fn r#get(
10926        &self,
10927    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10928    {
10929        TracingResourceProxyInterface::r#get(self)
10930    }
10931}
10932
10933impl TracingResourceProxyInterface for TracingResourceProxy {
10934    type GetResponseFut = fidl::client::QueryResponseFut<
10935        fidl::Resource,
10936        fidl::encoding::DefaultFuchsiaResourceDialect,
10937    >;
10938    fn r#get(&self) -> Self::GetResponseFut {
10939        fn _decode(
10940            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10941        ) -> Result<fidl::Resource, fidl::Error> {
10942            let _response = fidl::client::decode_transaction_body::<
10943                TracingResourceGetResponse,
10944                fidl::encoding::DefaultFuchsiaResourceDialect,
10945                0x299bc179aa54c6aa,
10946            >(_buf?)?;
10947            Ok(_response.resource)
10948        }
10949        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10950            (),
10951            0x299bc179aa54c6aa,
10952            fidl::encoding::DynamicFlags::empty(),
10953            _decode,
10954        )
10955    }
10956}
10957
10958pub struct TracingResourceEventStream {
10959    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10960}
10961
10962impl std::marker::Unpin for TracingResourceEventStream {}
10963
10964impl futures::stream::FusedStream for TracingResourceEventStream {
10965    fn is_terminated(&self) -> bool {
10966        self.event_receiver.is_terminated()
10967    }
10968}
10969
10970impl futures::Stream for TracingResourceEventStream {
10971    type Item = Result<TracingResourceEvent, fidl::Error>;
10972
10973    fn poll_next(
10974        mut self: std::pin::Pin<&mut Self>,
10975        cx: &mut std::task::Context<'_>,
10976    ) -> std::task::Poll<Option<Self::Item>> {
10977        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10978            &mut self.event_receiver,
10979            cx
10980        )?) {
10981            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
10982            None => std::task::Poll::Ready(None),
10983        }
10984    }
10985}
10986
10987#[derive(Debug)]
10988pub enum TracingResourceEvent {}
10989
10990impl TracingResourceEvent {
10991    /// Decodes a message buffer as a [`TracingResourceEvent`].
10992    fn decode(
10993        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10994    ) -> Result<TracingResourceEvent, fidl::Error> {
10995        let (bytes, _handles) = buf.split_mut();
10996        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10997        debug_assert_eq!(tx_header.tx_id, 0);
10998        match tx_header.ordinal {
10999            _ => Err(fidl::Error::UnknownOrdinal {
11000                ordinal: tx_header.ordinal,
11001                protocol_name:
11002                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11003            }),
11004        }
11005    }
11006}
11007
11008/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
11009pub struct TracingResourceRequestStream {
11010    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11011    is_terminated: bool,
11012}
11013
11014impl std::marker::Unpin for TracingResourceRequestStream {}
11015
11016impl futures::stream::FusedStream for TracingResourceRequestStream {
11017    fn is_terminated(&self) -> bool {
11018        self.is_terminated
11019    }
11020}
11021
11022impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
11023    type Protocol = TracingResourceMarker;
11024    type ControlHandle = TracingResourceControlHandle;
11025
11026    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11027        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11028    }
11029
11030    fn control_handle(&self) -> Self::ControlHandle {
11031        TracingResourceControlHandle { inner: self.inner.clone() }
11032    }
11033
11034    fn into_inner(
11035        self,
11036    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11037    {
11038        (self.inner, self.is_terminated)
11039    }
11040
11041    fn from_inner(
11042        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11043        is_terminated: bool,
11044    ) -> Self {
11045        Self { inner, is_terminated }
11046    }
11047}
11048
11049impl futures::Stream for TracingResourceRequestStream {
11050    type Item = Result<TracingResourceRequest, fidl::Error>;
11051
11052    fn poll_next(
11053        mut self: std::pin::Pin<&mut Self>,
11054        cx: &mut std::task::Context<'_>,
11055    ) -> std::task::Poll<Option<Self::Item>> {
11056        let this = &mut *self;
11057        if this.inner.check_shutdown(cx) {
11058            this.is_terminated = true;
11059            return std::task::Poll::Ready(None);
11060        }
11061        if this.is_terminated {
11062            panic!("polled TracingResourceRequestStream after completion");
11063        }
11064        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11065            |bytes, handles| {
11066                match this.inner.channel().read_etc(cx, bytes, handles) {
11067                    std::task::Poll::Ready(Ok(())) => {}
11068                    std::task::Poll::Pending => return std::task::Poll::Pending,
11069                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11070                        this.is_terminated = true;
11071                        return std::task::Poll::Ready(None);
11072                    }
11073                    std::task::Poll::Ready(Err(e)) => {
11074                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11075                            e.into(),
11076                        ))));
11077                    }
11078                }
11079
11080                // A message has been received from the channel
11081                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11082
11083                std::task::Poll::Ready(Some(match header.ordinal {
11084                    0x299bc179aa54c6aa => {
11085                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11086                        let mut req = fidl::new_empty!(
11087                            fidl::encoding::EmptyPayload,
11088                            fidl::encoding::DefaultFuchsiaResourceDialect
11089                        );
11090                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11091                        let control_handle =
11092                            TracingResourceControlHandle { inner: this.inner.clone() };
11093                        Ok(TracingResourceRequest::Get {
11094                            responder: TracingResourceGetResponder {
11095                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11096                                tx_id: header.tx_id,
11097                            },
11098                        })
11099                    }
11100                    _ => Err(fidl::Error::UnknownOrdinal {
11101                        ordinal: header.ordinal,
11102                        protocol_name:
11103                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11104                    }),
11105                }))
11106            },
11107        )
11108    }
11109}
11110
11111/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11112/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
11113#[derive(Debug)]
11114pub enum TracingResourceRequest {
11115    /// Get a tracing resource handle.
11116    Get { responder: TracingResourceGetResponder },
11117}
11118
11119impl TracingResourceRequest {
11120    #[allow(irrefutable_let_patterns)]
11121    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
11122        if let TracingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11123    }
11124
11125    /// Name of the method defined in FIDL
11126    pub fn method_name(&self) -> &'static str {
11127        match *self {
11128            TracingResourceRequest::Get { .. } => "get",
11129        }
11130    }
11131}
11132
11133#[derive(Debug, Clone)]
11134pub struct TracingResourceControlHandle {
11135    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11136}
11137
11138impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
11139    fn shutdown(&self) {
11140        self.inner.shutdown()
11141    }
11142
11143    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11144        self.inner.shutdown_with_epitaph(status)
11145    }
11146
11147    fn is_closed(&self) -> bool {
11148        self.inner.channel().is_closed()
11149    }
11150    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11151        self.inner.channel().on_closed()
11152    }
11153
11154    #[cfg(target_os = "fuchsia")]
11155    fn signal_peer(
11156        &self,
11157        clear_mask: zx::Signals,
11158        set_mask: zx::Signals,
11159    ) -> Result<(), zx_status::Status> {
11160        use fidl::Peered;
11161        self.inner.channel().signal_peer(clear_mask, set_mask)
11162    }
11163}
11164
11165impl TracingResourceControlHandle {}
11166
11167#[must_use = "FIDL methods require a response to be sent"]
11168#[derive(Debug)]
11169pub struct TracingResourceGetResponder {
11170    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
11171    tx_id: u32,
11172}
11173
11174/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
11175/// if the responder is dropped without sending a response, so that the client
11176/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11177impl std::ops::Drop for TracingResourceGetResponder {
11178    fn drop(&mut self) {
11179        self.control_handle.shutdown();
11180        // Safety: drops once, never accessed again
11181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11182    }
11183}
11184
11185impl fidl::endpoints::Responder for TracingResourceGetResponder {
11186    type ControlHandle = TracingResourceControlHandle;
11187
11188    fn control_handle(&self) -> &TracingResourceControlHandle {
11189        &self.control_handle
11190    }
11191
11192    fn drop_without_shutdown(mut self) {
11193        // Safety: drops once, never accessed again due to mem::forget
11194        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11195        // Prevent Drop from running (which would shut down the channel)
11196        std::mem::forget(self);
11197    }
11198}
11199
11200impl TracingResourceGetResponder {
11201    /// Sends a response to the FIDL transaction.
11202    ///
11203    /// Sets the channel to shutdown if an error occurs.
11204    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11205        let _result = self.send_raw(resource);
11206        if _result.is_err() {
11207            self.control_handle.shutdown();
11208        }
11209        self.drop_without_shutdown();
11210        _result
11211    }
11212
11213    /// Similar to "send" but does not shutdown the channel if an error occurs.
11214    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11215        let _result = self.send_raw(resource);
11216        self.drop_without_shutdown();
11217        _result
11218    }
11219
11220    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11221        self.control_handle.inner.send::<TracingResourceGetResponse>(
11222            (resource,),
11223            self.tx_id,
11224            0x299bc179aa54c6aa,
11225            fidl::encoding::DynamicFlags::empty(),
11226        )
11227    }
11228}
11229
11230#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11231pub struct VmexResourceMarker;
11232
11233impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
11234    type Proxy = VmexResourceProxy;
11235    type RequestStream = VmexResourceRequestStream;
11236    #[cfg(target_os = "fuchsia")]
11237    type SynchronousProxy = VmexResourceSynchronousProxy;
11238
11239    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
11240}
11241impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
11242
11243pub trait VmexResourceProxyInterface: Send + Sync {
11244    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
11245    fn r#get(&self) -> Self::GetResponseFut;
11246}
11247#[derive(Debug)]
11248#[cfg(target_os = "fuchsia")]
11249pub struct VmexResourceSynchronousProxy {
11250    client: fidl::client::sync::Client,
11251}
11252
11253#[cfg(target_os = "fuchsia")]
11254impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
11255    type Proxy = VmexResourceProxy;
11256    type Protocol = VmexResourceMarker;
11257
11258    fn from_channel(inner: fidl::Channel) -> Self {
11259        Self::new(inner)
11260    }
11261
11262    fn into_channel(self) -> fidl::Channel {
11263        self.client.into_channel()
11264    }
11265
11266    fn as_channel(&self) -> &fidl::Channel {
11267        self.client.as_channel()
11268    }
11269}
11270
11271#[cfg(target_os = "fuchsia")]
11272impl VmexResourceSynchronousProxy {
11273    pub fn new(channel: fidl::Channel) -> Self {
11274        Self { client: fidl::client::sync::Client::new(channel) }
11275    }
11276
11277    pub fn into_channel(self) -> fidl::Channel {
11278        self.client.into_channel()
11279    }
11280
11281    /// Waits until an event arrives and returns it. It is safe for other
11282    /// threads to make concurrent requests while waiting for an event.
11283    pub fn wait_for_event(
11284        &self,
11285        deadline: zx::MonotonicInstant,
11286    ) -> Result<VmexResourceEvent, fidl::Error> {
11287        VmexResourceEvent::decode(self.client.wait_for_event::<VmexResourceMarker>(deadline)?)
11288    }
11289
11290    /// Get a VMEX resource handle.
11291    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
11292        let _response = self.client.send_query::<
11293            fidl::encoding::EmptyPayload,
11294            VmexResourceGetResponse,
11295            VmexResourceMarker,
11296        >(
11297            (),
11298            0x33db32deed650699,
11299            fidl::encoding::DynamicFlags::empty(),
11300            ___deadline,
11301        )?;
11302        Ok(_response.resource)
11303    }
11304}
11305
11306#[cfg(target_os = "fuchsia")]
11307impl From<VmexResourceSynchronousProxy> for zx::NullableHandle {
11308    fn from(value: VmexResourceSynchronousProxy) -> Self {
11309        value.into_channel().into()
11310    }
11311}
11312
11313#[cfg(target_os = "fuchsia")]
11314impl From<fidl::Channel> for VmexResourceSynchronousProxy {
11315    fn from(value: fidl::Channel) -> Self {
11316        Self::new(value)
11317    }
11318}
11319
11320#[cfg(target_os = "fuchsia")]
11321impl fidl::endpoints::FromClient for VmexResourceSynchronousProxy {
11322    type Protocol = VmexResourceMarker;
11323
11324    fn from_client(value: fidl::endpoints::ClientEnd<VmexResourceMarker>) -> Self {
11325        Self::new(value.into_channel())
11326    }
11327}
11328
11329#[derive(Debug, Clone)]
11330pub struct VmexResourceProxy {
11331    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11332}
11333
11334impl fidl::endpoints::Proxy for VmexResourceProxy {
11335    type Protocol = VmexResourceMarker;
11336
11337    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11338        Self::new(inner)
11339    }
11340
11341    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11342        self.client.into_channel().map_err(|client| Self { client })
11343    }
11344
11345    fn as_channel(&self) -> &::fidl::AsyncChannel {
11346        self.client.as_channel()
11347    }
11348}
11349
11350impl VmexResourceProxy {
11351    /// Create a new Proxy for fuchsia.kernel/VmexResource.
11352    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11353        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11354        Self { client: fidl::client::Client::new(channel, protocol_name) }
11355    }
11356
11357    /// Get a Stream of events from the remote end of the protocol.
11358    ///
11359    /// # Panics
11360    ///
11361    /// Panics if the event stream was already taken.
11362    pub fn take_event_stream(&self) -> VmexResourceEventStream {
11363        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
11364    }
11365
11366    /// Get a VMEX resource handle.
11367    pub fn r#get(
11368        &self,
11369    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
11370    {
11371        VmexResourceProxyInterface::r#get(self)
11372    }
11373}
11374
11375impl VmexResourceProxyInterface for VmexResourceProxy {
11376    type GetResponseFut = fidl::client::QueryResponseFut<
11377        fidl::Resource,
11378        fidl::encoding::DefaultFuchsiaResourceDialect,
11379    >;
11380    fn r#get(&self) -> Self::GetResponseFut {
11381        fn _decode(
11382            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11383        ) -> Result<fidl::Resource, fidl::Error> {
11384            let _response = fidl::client::decode_transaction_body::<
11385                VmexResourceGetResponse,
11386                fidl::encoding::DefaultFuchsiaResourceDialect,
11387                0x33db32deed650699,
11388            >(_buf?)?;
11389            Ok(_response.resource)
11390        }
11391        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
11392            (),
11393            0x33db32deed650699,
11394            fidl::encoding::DynamicFlags::empty(),
11395            _decode,
11396        )
11397    }
11398}
11399
11400pub struct VmexResourceEventStream {
11401    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11402}
11403
11404impl std::marker::Unpin for VmexResourceEventStream {}
11405
11406impl futures::stream::FusedStream for VmexResourceEventStream {
11407    fn is_terminated(&self) -> bool {
11408        self.event_receiver.is_terminated()
11409    }
11410}
11411
11412impl futures::Stream for VmexResourceEventStream {
11413    type Item = Result<VmexResourceEvent, fidl::Error>;
11414
11415    fn poll_next(
11416        mut self: std::pin::Pin<&mut Self>,
11417        cx: &mut std::task::Context<'_>,
11418    ) -> std::task::Poll<Option<Self::Item>> {
11419        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11420            &mut self.event_receiver,
11421            cx
11422        )?) {
11423            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
11424            None => std::task::Poll::Ready(None),
11425        }
11426    }
11427}
11428
11429#[derive(Debug)]
11430pub enum VmexResourceEvent {}
11431
11432impl VmexResourceEvent {
11433    /// Decodes a message buffer as a [`VmexResourceEvent`].
11434    fn decode(
11435        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11436    ) -> Result<VmexResourceEvent, fidl::Error> {
11437        let (bytes, _handles) = buf.split_mut();
11438        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11439        debug_assert_eq!(tx_header.tx_id, 0);
11440        match tx_header.ordinal {
11441            _ => Err(fidl::Error::UnknownOrdinal {
11442                ordinal: tx_header.ordinal,
11443                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11444            }),
11445        }
11446    }
11447}
11448
11449/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
11450pub struct VmexResourceRequestStream {
11451    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11452    is_terminated: bool,
11453}
11454
11455impl std::marker::Unpin for VmexResourceRequestStream {}
11456
11457impl futures::stream::FusedStream for VmexResourceRequestStream {
11458    fn is_terminated(&self) -> bool {
11459        self.is_terminated
11460    }
11461}
11462
11463impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
11464    type Protocol = VmexResourceMarker;
11465    type ControlHandle = VmexResourceControlHandle;
11466
11467    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11468        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11469    }
11470
11471    fn control_handle(&self) -> Self::ControlHandle {
11472        VmexResourceControlHandle { inner: self.inner.clone() }
11473    }
11474
11475    fn into_inner(
11476        self,
11477    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11478    {
11479        (self.inner, self.is_terminated)
11480    }
11481
11482    fn from_inner(
11483        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11484        is_terminated: bool,
11485    ) -> Self {
11486        Self { inner, is_terminated }
11487    }
11488}
11489
11490impl futures::Stream for VmexResourceRequestStream {
11491    type Item = Result<VmexResourceRequest, fidl::Error>;
11492
11493    fn poll_next(
11494        mut self: std::pin::Pin<&mut Self>,
11495        cx: &mut std::task::Context<'_>,
11496    ) -> std::task::Poll<Option<Self::Item>> {
11497        let this = &mut *self;
11498        if this.inner.check_shutdown(cx) {
11499            this.is_terminated = true;
11500            return std::task::Poll::Ready(None);
11501        }
11502        if this.is_terminated {
11503            panic!("polled VmexResourceRequestStream after completion");
11504        }
11505        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11506            |bytes, handles| {
11507                match this.inner.channel().read_etc(cx, bytes, handles) {
11508                    std::task::Poll::Ready(Ok(())) => {}
11509                    std::task::Poll::Pending => return std::task::Poll::Pending,
11510                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11511                        this.is_terminated = true;
11512                        return std::task::Poll::Ready(None);
11513                    }
11514                    std::task::Poll::Ready(Err(e)) => {
11515                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11516                            e.into(),
11517                        ))));
11518                    }
11519                }
11520
11521                // A message has been received from the channel
11522                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11523
11524                std::task::Poll::Ready(Some(match header.ordinal {
11525                    0x33db32deed650699 => {
11526                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11527                        let mut req = fidl::new_empty!(
11528                            fidl::encoding::EmptyPayload,
11529                            fidl::encoding::DefaultFuchsiaResourceDialect
11530                        );
11531                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11532                        let control_handle =
11533                            VmexResourceControlHandle { inner: this.inner.clone() };
11534                        Ok(VmexResourceRequest::Get {
11535                            responder: VmexResourceGetResponder {
11536                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11537                                tx_id: header.tx_id,
11538                            },
11539                        })
11540                    }
11541                    _ => Err(fidl::Error::UnknownOrdinal {
11542                        ordinal: header.ordinal,
11543                        protocol_name:
11544                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11545                    }),
11546                }))
11547            },
11548        )
11549    }
11550}
11551
11552/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11553/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
11554/// executable.
11555#[derive(Debug)]
11556pub enum VmexResourceRequest {
11557    /// Get a VMEX resource handle.
11558    Get { responder: VmexResourceGetResponder },
11559}
11560
11561impl VmexResourceRequest {
11562    #[allow(irrefutable_let_patterns)]
11563    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
11564        if let VmexResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11565    }
11566
11567    /// Name of the method defined in FIDL
11568    pub fn method_name(&self) -> &'static str {
11569        match *self {
11570            VmexResourceRequest::Get { .. } => "get",
11571        }
11572    }
11573}
11574
11575#[derive(Debug, Clone)]
11576pub struct VmexResourceControlHandle {
11577    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11578}
11579
11580impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
11581    fn shutdown(&self) {
11582        self.inner.shutdown()
11583    }
11584
11585    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11586        self.inner.shutdown_with_epitaph(status)
11587    }
11588
11589    fn is_closed(&self) -> bool {
11590        self.inner.channel().is_closed()
11591    }
11592    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11593        self.inner.channel().on_closed()
11594    }
11595
11596    #[cfg(target_os = "fuchsia")]
11597    fn signal_peer(
11598        &self,
11599        clear_mask: zx::Signals,
11600        set_mask: zx::Signals,
11601    ) -> Result<(), zx_status::Status> {
11602        use fidl::Peered;
11603        self.inner.channel().signal_peer(clear_mask, set_mask)
11604    }
11605}
11606
11607impl VmexResourceControlHandle {}
11608
11609#[must_use = "FIDL methods require a response to be sent"]
11610#[derive(Debug)]
11611pub struct VmexResourceGetResponder {
11612    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
11613    tx_id: u32,
11614}
11615
11616/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
11617/// if the responder is dropped without sending a response, so that the client
11618/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11619impl std::ops::Drop for VmexResourceGetResponder {
11620    fn drop(&mut self) {
11621        self.control_handle.shutdown();
11622        // Safety: drops once, never accessed again
11623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11624    }
11625}
11626
11627impl fidl::endpoints::Responder for VmexResourceGetResponder {
11628    type ControlHandle = VmexResourceControlHandle;
11629
11630    fn control_handle(&self) -> &VmexResourceControlHandle {
11631        &self.control_handle
11632    }
11633
11634    fn drop_without_shutdown(mut self) {
11635        // Safety: drops once, never accessed again due to mem::forget
11636        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11637        // Prevent Drop from running (which would shut down the channel)
11638        std::mem::forget(self);
11639    }
11640}
11641
11642impl VmexResourceGetResponder {
11643    /// Sends a response to the FIDL transaction.
11644    ///
11645    /// Sets the channel to shutdown if an error occurs.
11646    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11647        let _result = self.send_raw(resource);
11648        if _result.is_err() {
11649            self.control_handle.shutdown();
11650        }
11651        self.drop_without_shutdown();
11652        _result
11653    }
11654
11655    /// Similar to "send" but does not shutdown the channel if an error occurs.
11656    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11657        let _result = self.send_raw(resource);
11658        self.drop_without_shutdown();
11659        _result
11660    }
11661
11662    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11663        self.control_handle.inner.send::<VmexResourceGetResponse>(
11664            (resource,),
11665            self.tx_id,
11666            0x33db32deed650699,
11667            fidl::encoding::DynamicFlags::empty(),
11668        )
11669    }
11670}
11671
11672mod internal {
11673    use super::*;
11674
11675    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
11676        type Borrowed<'a> = &'a mut Self;
11677        fn take_or_borrow<'a>(
11678            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11679        ) -> Self::Borrowed<'a> {
11680            value
11681        }
11682    }
11683
11684    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
11685        type Owned = Self;
11686
11687        #[inline(always)]
11688        fn inline_align(_context: fidl::encoding::Context) -> usize {
11689            8
11690        }
11691
11692        #[inline(always)]
11693        fn inline_size(_context: fidl::encoding::Context) -> usize {
11694            24
11695        }
11696    }
11697
11698    unsafe impl
11699        fidl::encoding::Encode<
11700            CounterGetInspectVmoResponse,
11701            fidl::encoding::DefaultFuchsiaResourceDialect,
11702        > for &mut CounterGetInspectVmoResponse
11703    {
11704        #[inline]
11705        unsafe fn encode(
11706            self,
11707            encoder: &mut fidl::encoding::Encoder<
11708                '_,
11709                fidl::encoding::DefaultFuchsiaResourceDialect,
11710            >,
11711            offset: usize,
11712            _depth: fidl::encoding::Depth,
11713        ) -> fidl::Result<()> {
11714            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11715            // Delegate to tuple encoding.
11716            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11717                (
11718                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
11719                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
11720                ),
11721                encoder, offset, _depth
11722            )
11723        }
11724    }
11725    unsafe impl<
11726        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11727        T1: fidl::encoding::Encode<
11728                fidl_fuchsia_mem::Buffer,
11729                fidl::encoding::DefaultFuchsiaResourceDialect,
11730            >,
11731    >
11732        fidl::encoding::Encode<
11733            CounterGetInspectVmoResponse,
11734            fidl::encoding::DefaultFuchsiaResourceDialect,
11735        > for (T0, T1)
11736    {
11737        #[inline]
11738        unsafe fn encode(
11739            self,
11740            encoder: &mut fidl::encoding::Encoder<
11741                '_,
11742                fidl::encoding::DefaultFuchsiaResourceDialect,
11743            >,
11744            offset: usize,
11745            depth: fidl::encoding::Depth,
11746        ) -> fidl::Result<()> {
11747            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11748            // Zero out padding regions. There's no need to apply masks
11749            // because the unmasked parts will be overwritten by fields.
11750            unsafe {
11751                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11752                (ptr as *mut u64).write_unaligned(0);
11753            }
11754            // Write the fields.
11755            self.0.encode(encoder, offset + 0, depth)?;
11756            self.1.encode(encoder, offset + 8, depth)?;
11757            Ok(())
11758        }
11759    }
11760
11761    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11762        for CounterGetInspectVmoResponse
11763    {
11764        #[inline(always)]
11765        fn new_empty() -> Self {
11766            Self {
11767                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
11768                buffer: fidl::new_empty!(
11769                    fidl_fuchsia_mem::Buffer,
11770                    fidl::encoding::DefaultFuchsiaResourceDialect
11771                ),
11772            }
11773        }
11774
11775        #[inline]
11776        unsafe fn decode(
11777            &mut self,
11778            decoder: &mut fidl::encoding::Decoder<
11779                '_,
11780                fidl::encoding::DefaultFuchsiaResourceDialect,
11781            >,
11782            offset: usize,
11783            _depth: fidl::encoding::Depth,
11784        ) -> fidl::Result<()> {
11785            decoder.debug_check_bounds::<Self>(offset);
11786            // Verify that padding bytes are zero.
11787            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11788            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11789            let mask = 0xffffffff00000000u64;
11790            let maskedval = padval & mask;
11791            if maskedval != 0 {
11792                return Err(fidl::Error::NonZeroPadding {
11793                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11794                });
11795            }
11796            fidl::decode!(
11797                i32,
11798                fidl::encoding::DefaultFuchsiaResourceDialect,
11799                &mut self.status,
11800                decoder,
11801                offset + 0,
11802                _depth
11803            )?;
11804            fidl::decode!(
11805                fidl_fuchsia_mem::Buffer,
11806                fidl::encoding::DefaultFuchsiaResourceDialect,
11807                &mut self.buffer,
11808                decoder,
11809                offset + 8,
11810                _depth
11811            )?;
11812            Ok(())
11813        }
11814    }
11815
11816    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
11817        type Borrowed<'a> = &'a mut Self;
11818        fn take_or_borrow<'a>(
11819            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11820        ) -> Self::Borrowed<'a> {
11821            value
11822        }
11823    }
11824
11825    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
11826        type Owned = Self;
11827
11828        #[inline(always)]
11829        fn inline_align(_context: fidl::encoding::Context) -> usize {
11830            4
11831        }
11832
11833        #[inline(always)]
11834        fn inline_size(_context: fidl::encoding::Context) -> usize {
11835            4
11836        }
11837    }
11838
11839    unsafe impl
11840        fidl::encoding::Encode<
11841            CpuResourceGetResponse,
11842            fidl::encoding::DefaultFuchsiaResourceDialect,
11843        > for &mut CpuResourceGetResponse
11844    {
11845        #[inline]
11846        unsafe fn encode(
11847            self,
11848            encoder: &mut fidl::encoding::Encoder<
11849                '_,
11850                fidl::encoding::DefaultFuchsiaResourceDialect,
11851            >,
11852            offset: usize,
11853            _depth: fidl::encoding::Depth,
11854        ) -> fidl::Result<()> {
11855            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11856            // Delegate to tuple encoding.
11857            fidl::encoding::Encode::<
11858                CpuResourceGetResponse,
11859                fidl::encoding::DefaultFuchsiaResourceDialect,
11860            >::encode(
11861                (<fidl::encoding::HandleType<
11862                    fidl::Resource,
11863                    { fidl::ObjectType::RESOURCE.into_raw() },
11864                    2147483648,
11865                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11866                    &mut self.resource
11867                ),),
11868                encoder,
11869                offset,
11870                _depth,
11871            )
11872        }
11873    }
11874    unsafe impl<
11875        T0: fidl::encoding::Encode<
11876                fidl::encoding::HandleType<
11877                    fidl::Resource,
11878                    { fidl::ObjectType::RESOURCE.into_raw() },
11879                    2147483648,
11880                >,
11881                fidl::encoding::DefaultFuchsiaResourceDialect,
11882            >,
11883    >
11884        fidl::encoding::Encode<
11885            CpuResourceGetResponse,
11886            fidl::encoding::DefaultFuchsiaResourceDialect,
11887        > for (T0,)
11888    {
11889        #[inline]
11890        unsafe fn encode(
11891            self,
11892            encoder: &mut fidl::encoding::Encoder<
11893                '_,
11894                fidl::encoding::DefaultFuchsiaResourceDialect,
11895            >,
11896            offset: usize,
11897            depth: fidl::encoding::Depth,
11898        ) -> fidl::Result<()> {
11899            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11900            // Zero out padding regions. There's no need to apply masks
11901            // because the unmasked parts will be overwritten by fields.
11902            // Write the fields.
11903            self.0.encode(encoder, offset + 0, depth)?;
11904            Ok(())
11905        }
11906    }
11907
11908    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11909        for CpuResourceGetResponse
11910    {
11911        #[inline(always)]
11912        fn new_empty() -> Self {
11913            Self {
11914                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11915            }
11916        }
11917
11918        #[inline]
11919        unsafe fn decode(
11920            &mut self,
11921            decoder: &mut fidl::encoding::Decoder<
11922                '_,
11923                fidl::encoding::DefaultFuchsiaResourceDialect,
11924            >,
11925            offset: usize,
11926            _depth: fidl::encoding::Depth,
11927        ) -> fidl::Result<()> {
11928            decoder.debug_check_bounds::<Self>(offset);
11929            // Verify that padding bytes are zero.
11930            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11931            Ok(())
11932        }
11933    }
11934
11935    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
11936        type Borrowed<'a> = &'a mut Self;
11937        fn take_or_borrow<'a>(
11938            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11939        ) -> Self::Borrowed<'a> {
11940            value
11941        }
11942    }
11943
11944    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
11945        type Owned = Self;
11946
11947        #[inline(always)]
11948        fn inline_align(_context: fidl::encoding::Context) -> usize {
11949            4
11950        }
11951
11952        #[inline(always)]
11953        fn inline_size(_context: fidl::encoding::Context) -> usize {
11954            4
11955        }
11956    }
11957
11958    unsafe impl
11959        fidl::encoding::Encode<
11960            DebugResourceGetResponse,
11961            fidl::encoding::DefaultFuchsiaResourceDialect,
11962        > for &mut DebugResourceGetResponse
11963    {
11964        #[inline]
11965        unsafe fn encode(
11966            self,
11967            encoder: &mut fidl::encoding::Encoder<
11968                '_,
11969                fidl::encoding::DefaultFuchsiaResourceDialect,
11970            >,
11971            offset: usize,
11972            _depth: fidl::encoding::Depth,
11973        ) -> fidl::Result<()> {
11974            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11975            // Delegate to tuple encoding.
11976            fidl::encoding::Encode::<
11977                DebugResourceGetResponse,
11978                fidl::encoding::DefaultFuchsiaResourceDialect,
11979            >::encode(
11980                (<fidl::encoding::HandleType<
11981                    fidl::Resource,
11982                    { fidl::ObjectType::RESOURCE.into_raw() },
11983                    2147483648,
11984                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11985                    &mut self.resource
11986                ),),
11987                encoder,
11988                offset,
11989                _depth,
11990            )
11991        }
11992    }
11993    unsafe impl<
11994        T0: fidl::encoding::Encode<
11995                fidl::encoding::HandleType<
11996                    fidl::Resource,
11997                    { fidl::ObjectType::RESOURCE.into_raw() },
11998                    2147483648,
11999                >,
12000                fidl::encoding::DefaultFuchsiaResourceDialect,
12001            >,
12002    >
12003        fidl::encoding::Encode<
12004            DebugResourceGetResponse,
12005            fidl::encoding::DefaultFuchsiaResourceDialect,
12006        > for (T0,)
12007    {
12008        #[inline]
12009        unsafe fn encode(
12010            self,
12011            encoder: &mut fidl::encoding::Encoder<
12012                '_,
12013                fidl::encoding::DefaultFuchsiaResourceDialect,
12014            >,
12015            offset: usize,
12016            depth: fidl::encoding::Depth,
12017        ) -> fidl::Result<()> {
12018            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
12019            // Zero out padding regions. There's no need to apply masks
12020            // because the unmasked parts will be overwritten by fields.
12021            // Write the fields.
12022            self.0.encode(encoder, offset + 0, depth)?;
12023            Ok(())
12024        }
12025    }
12026
12027    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12028        for DebugResourceGetResponse
12029    {
12030        #[inline(always)]
12031        fn new_empty() -> Self {
12032            Self {
12033                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12034            }
12035        }
12036
12037        #[inline]
12038        unsafe fn decode(
12039            &mut self,
12040            decoder: &mut fidl::encoding::Decoder<
12041                '_,
12042                fidl::encoding::DefaultFuchsiaResourceDialect,
12043            >,
12044            offset: usize,
12045            _depth: fidl::encoding::Depth,
12046        ) -> fidl::Result<()> {
12047            decoder.debug_check_bounds::<Self>(offset);
12048            // Verify that padding bytes are zero.
12049            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12050            Ok(())
12051        }
12052    }
12053
12054    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
12055        type Borrowed<'a> = &'a mut Self;
12056        fn take_or_borrow<'a>(
12057            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12058        ) -> Self::Borrowed<'a> {
12059            value
12060        }
12061    }
12062
12063    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
12064        type Owned = Self;
12065
12066        #[inline(always)]
12067        fn inline_align(_context: fidl::encoding::Context) -> usize {
12068            4
12069        }
12070
12071        #[inline(always)]
12072        fn inline_size(_context: fidl::encoding::Context) -> usize {
12073            4
12074        }
12075    }
12076
12077    unsafe impl
12078        fidl::encoding::Encode<
12079            DebuglogResourceGetResponse,
12080            fidl::encoding::DefaultFuchsiaResourceDialect,
12081        > for &mut DebuglogResourceGetResponse
12082    {
12083        #[inline]
12084        unsafe fn encode(
12085            self,
12086            encoder: &mut fidl::encoding::Encoder<
12087                '_,
12088                fidl::encoding::DefaultFuchsiaResourceDialect,
12089            >,
12090            offset: usize,
12091            _depth: fidl::encoding::Depth,
12092        ) -> fidl::Result<()> {
12093            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
12094            // Delegate to tuple encoding.
12095            fidl::encoding::Encode::<
12096                DebuglogResourceGetResponse,
12097                fidl::encoding::DefaultFuchsiaResourceDialect,
12098            >::encode(
12099                (<fidl::encoding::HandleType<
12100                    fidl::Resource,
12101                    { fidl::ObjectType::RESOURCE.into_raw() },
12102                    2147483648,
12103                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12104                    &mut self.resource
12105                ),),
12106                encoder,
12107                offset,
12108                _depth,
12109            )
12110        }
12111    }
12112    unsafe impl<
12113        T0: fidl::encoding::Encode<
12114                fidl::encoding::HandleType<
12115                    fidl::Resource,
12116                    { fidl::ObjectType::RESOURCE.into_raw() },
12117                    2147483648,
12118                >,
12119                fidl::encoding::DefaultFuchsiaResourceDialect,
12120            >,
12121    >
12122        fidl::encoding::Encode<
12123            DebuglogResourceGetResponse,
12124            fidl::encoding::DefaultFuchsiaResourceDialect,
12125        > for (T0,)
12126    {
12127        #[inline]
12128        unsafe fn encode(
12129            self,
12130            encoder: &mut fidl::encoding::Encoder<
12131                '_,
12132                fidl::encoding::DefaultFuchsiaResourceDialect,
12133            >,
12134            offset: usize,
12135            depth: fidl::encoding::Depth,
12136        ) -> fidl::Result<()> {
12137            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
12138            // Zero out padding regions. There's no need to apply masks
12139            // because the unmasked parts will be overwritten by fields.
12140            // Write the fields.
12141            self.0.encode(encoder, offset + 0, depth)?;
12142            Ok(())
12143        }
12144    }
12145
12146    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12147        for DebuglogResourceGetResponse
12148    {
12149        #[inline(always)]
12150        fn new_empty() -> Self {
12151            Self {
12152                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12153            }
12154        }
12155
12156        #[inline]
12157        unsafe fn decode(
12158            &mut self,
12159            decoder: &mut fidl::encoding::Decoder<
12160                '_,
12161                fidl::encoding::DefaultFuchsiaResourceDialect,
12162            >,
12163            offset: usize,
12164            _depth: fidl::encoding::Depth,
12165        ) -> fidl::Result<()> {
12166            decoder.debug_check_bounds::<Self>(offset);
12167            // Verify that padding bytes are zero.
12168            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12169            Ok(())
12170        }
12171    }
12172
12173    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
12174        type Borrowed<'a> = &'a mut Self;
12175        fn take_or_borrow<'a>(
12176            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12177        ) -> Self::Borrowed<'a> {
12178            value
12179        }
12180    }
12181
12182    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
12183        type Owned = Self;
12184
12185        #[inline(always)]
12186        fn inline_align(_context: fidl::encoding::Context) -> usize {
12187            4
12188        }
12189
12190        #[inline(always)]
12191        fn inline_size(_context: fidl::encoding::Context) -> usize {
12192            4
12193        }
12194    }
12195
12196    unsafe impl
12197        fidl::encoding::Encode<
12198            EnergyInfoResourceGetResponse,
12199            fidl::encoding::DefaultFuchsiaResourceDialect,
12200        > for &mut EnergyInfoResourceGetResponse
12201    {
12202        #[inline]
12203        unsafe fn encode(
12204            self,
12205            encoder: &mut fidl::encoding::Encoder<
12206                '_,
12207                fidl::encoding::DefaultFuchsiaResourceDialect,
12208            >,
12209            offset: usize,
12210            _depth: fidl::encoding::Depth,
12211        ) -> fidl::Result<()> {
12212            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
12213            // Delegate to tuple encoding.
12214            fidl::encoding::Encode::<
12215                EnergyInfoResourceGetResponse,
12216                fidl::encoding::DefaultFuchsiaResourceDialect,
12217            >::encode(
12218                (<fidl::encoding::HandleType<
12219                    fidl::Resource,
12220                    { fidl::ObjectType::RESOURCE.into_raw() },
12221                    2147483648,
12222                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12223                    &mut self.resource
12224                ),),
12225                encoder,
12226                offset,
12227                _depth,
12228            )
12229        }
12230    }
12231    unsafe impl<
12232        T0: fidl::encoding::Encode<
12233                fidl::encoding::HandleType<
12234                    fidl::Resource,
12235                    { fidl::ObjectType::RESOURCE.into_raw() },
12236                    2147483648,
12237                >,
12238                fidl::encoding::DefaultFuchsiaResourceDialect,
12239            >,
12240    >
12241        fidl::encoding::Encode<
12242            EnergyInfoResourceGetResponse,
12243            fidl::encoding::DefaultFuchsiaResourceDialect,
12244        > for (T0,)
12245    {
12246        #[inline]
12247        unsafe fn encode(
12248            self,
12249            encoder: &mut fidl::encoding::Encoder<
12250                '_,
12251                fidl::encoding::DefaultFuchsiaResourceDialect,
12252            >,
12253            offset: usize,
12254            depth: fidl::encoding::Depth,
12255        ) -> fidl::Result<()> {
12256            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
12257            // Zero out padding regions. There's no need to apply masks
12258            // because the unmasked parts will be overwritten by fields.
12259            // Write the fields.
12260            self.0.encode(encoder, offset + 0, depth)?;
12261            Ok(())
12262        }
12263    }
12264
12265    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12266        for EnergyInfoResourceGetResponse
12267    {
12268        #[inline(always)]
12269        fn new_empty() -> Self {
12270            Self {
12271                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12272            }
12273        }
12274
12275        #[inline]
12276        unsafe fn decode(
12277            &mut self,
12278            decoder: &mut fidl::encoding::Decoder<
12279                '_,
12280                fidl::encoding::DefaultFuchsiaResourceDialect,
12281            >,
12282            offset: usize,
12283            _depth: fidl::encoding::Depth,
12284        ) -> fidl::Result<()> {
12285            decoder.debug_check_bounds::<Self>(offset);
12286            // Verify that padding bytes are zero.
12287            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12288            Ok(())
12289        }
12290    }
12291
12292    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
12293        type Borrowed<'a> = &'a mut Self;
12294        fn take_or_borrow<'a>(
12295            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12296        ) -> Self::Borrowed<'a> {
12297            value
12298        }
12299    }
12300
12301    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
12302        type Owned = Self;
12303
12304        #[inline(always)]
12305        fn inline_align(_context: fidl::encoding::Context) -> usize {
12306            4
12307        }
12308
12309        #[inline(always)]
12310        fn inline_size(_context: fidl::encoding::Context) -> usize {
12311            4
12312        }
12313    }
12314
12315    unsafe impl
12316        fidl::encoding::Encode<
12317            HypervisorResourceGetResponse,
12318            fidl::encoding::DefaultFuchsiaResourceDialect,
12319        > for &mut HypervisorResourceGetResponse
12320    {
12321        #[inline]
12322        unsafe fn encode(
12323            self,
12324            encoder: &mut fidl::encoding::Encoder<
12325                '_,
12326                fidl::encoding::DefaultFuchsiaResourceDialect,
12327            >,
12328            offset: usize,
12329            _depth: fidl::encoding::Depth,
12330        ) -> fidl::Result<()> {
12331            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12332            // Delegate to tuple encoding.
12333            fidl::encoding::Encode::<
12334                HypervisorResourceGetResponse,
12335                fidl::encoding::DefaultFuchsiaResourceDialect,
12336            >::encode(
12337                (<fidl::encoding::HandleType<
12338                    fidl::Resource,
12339                    { fidl::ObjectType::RESOURCE.into_raw() },
12340                    2147483648,
12341                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12342                    &mut self.resource
12343                ),),
12344                encoder,
12345                offset,
12346                _depth,
12347            )
12348        }
12349    }
12350    unsafe impl<
12351        T0: fidl::encoding::Encode<
12352                fidl::encoding::HandleType<
12353                    fidl::Resource,
12354                    { fidl::ObjectType::RESOURCE.into_raw() },
12355                    2147483648,
12356                >,
12357                fidl::encoding::DefaultFuchsiaResourceDialect,
12358            >,
12359    >
12360        fidl::encoding::Encode<
12361            HypervisorResourceGetResponse,
12362            fidl::encoding::DefaultFuchsiaResourceDialect,
12363        > for (T0,)
12364    {
12365        #[inline]
12366        unsafe fn encode(
12367            self,
12368            encoder: &mut fidl::encoding::Encoder<
12369                '_,
12370                fidl::encoding::DefaultFuchsiaResourceDialect,
12371            >,
12372            offset: usize,
12373            depth: fidl::encoding::Depth,
12374        ) -> fidl::Result<()> {
12375            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12376            // Zero out padding regions. There's no need to apply masks
12377            // because the unmasked parts will be overwritten by fields.
12378            // Write the fields.
12379            self.0.encode(encoder, offset + 0, depth)?;
12380            Ok(())
12381        }
12382    }
12383
12384    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12385        for HypervisorResourceGetResponse
12386    {
12387        #[inline(always)]
12388        fn new_empty() -> Self {
12389            Self {
12390                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12391            }
12392        }
12393
12394        #[inline]
12395        unsafe fn decode(
12396            &mut self,
12397            decoder: &mut fidl::encoding::Decoder<
12398                '_,
12399                fidl::encoding::DefaultFuchsiaResourceDialect,
12400            >,
12401            offset: usize,
12402            _depth: fidl::encoding::Depth,
12403        ) -> fidl::Result<()> {
12404            decoder.debug_check_bounds::<Self>(offset);
12405            // Verify that padding bytes are zero.
12406            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12407            Ok(())
12408        }
12409    }
12410
12411    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
12412        type Borrowed<'a> = &'a mut Self;
12413        fn take_or_borrow<'a>(
12414            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12415        ) -> Self::Borrowed<'a> {
12416            value
12417        }
12418    }
12419
12420    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
12421        type Owned = Self;
12422
12423        #[inline(always)]
12424        fn inline_align(_context: fidl::encoding::Context) -> usize {
12425            4
12426        }
12427
12428        #[inline(always)]
12429        fn inline_size(_context: fidl::encoding::Context) -> usize {
12430            4
12431        }
12432    }
12433
12434    unsafe impl
12435        fidl::encoding::Encode<
12436            InfoResourceGetResponse,
12437            fidl::encoding::DefaultFuchsiaResourceDialect,
12438        > for &mut InfoResourceGetResponse
12439    {
12440        #[inline]
12441        unsafe fn encode(
12442            self,
12443            encoder: &mut fidl::encoding::Encoder<
12444                '_,
12445                fidl::encoding::DefaultFuchsiaResourceDialect,
12446            >,
12447            offset: usize,
12448            _depth: fidl::encoding::Depth,
12449        ) -> fidl::Result<()> {
12450            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12451            // Delegate to tuple encoding.
12452            fidl::encoding::Encode::<
12453                InfoResourceGetResponse,
12454                fidl::encoding::DefaultFuchsiaResourceDialect,
12455            >::encode(
12456                (<fidl::encoding::HandleType<
12457                    fidl::Resource,
12458                    { fidl::ObjectType::RESOURCE.into_raw() },
12459                    2147483648,
12460                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12461                    &mut self.resource
12462                ),),
12463                encoder,
12464                offset,
12465                _depth,
12466            )
12467        }
12468    }
12469    unsafe impl<
12470        T0: fidl::encoding::Encode<
12471                fidl::encoding::HandleType<
12472                    fidl::Resource,
12473                    { fidl::ObjectType::RESOURCE.into_raw() },
12474                    2147483648,
12475                >,
12476                fidl::encoding::DefaultFuchsiaResourceDialect,
12477            >,
12478    >
12479        fidl::encoding::Encode<
12480            InfoResourceGetResponse,
12481            fidl::encoding::DefaultFuchsiaResourceDialect,
12482        > for (T0,)
12483    {
12484        #[inline]
12485        unsafe fn encode(
12486            self,
12487            encoder: &mut fidl::encoding::Encoder<
12488                '_,
12489                fidl::encoding::DefaultFuchsiaResourceDialect,
12490            >,
12491            offset: usize,
12492            depth: fidl::encoding::Depth,
12493        ) -> fidl::Result<()> {
12494            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12495            // Zero out padding regions. There's no need to apply masks
12496            // because the unmasked parts will be overwritten by fields.
12497            // Write the fields.
12498            self.0.encode(encoder, offset + 0, depth)?;
12499            Ok(())
12500        }
12501    }
12502
12503    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12504        for InfoResourceGetResponse
12505    {
12506        #[inline(always)]
12507        fn new_empty() -> Self {
12508            Self {
12509                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12510            }
12511        }
12512
12513        #[inline]
12514        unsafe fn decode(
12515            &mut self,
12516            decoder: &mut fidl::encoding::Decoder<
12517                '_,
12518                fidl::encoding::DefaultFuchsiaResourceDialect,
12519            >,
12520            offset: usize,
12521            _depth: fidl::encoding::Depth,
12522        ) -> fidl::Result<()> {
12523            decoder.debug_check_bounds::<Self>(offset);
12524            // Verify that padding bytes are zero.
12525            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12526            Ok(())
12527        }
12528    }
12529
12530    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
12531        type Borrowed<'a> = &'a mut Self;
12532        fn take_or_borrow<'a>(
12533            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12534        ) -> Self::Borrowed<'a> {
12535            value
12536        }
12537    }
12538
12539    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
12540        type Owned = Self;
12541
12542        #[inline(always)]
12543        fn inline_align(_context: fidl::encoding::Context) -> usize {
12544            4
12545        }
12546
12547        #[inline(always)]
12548        fn inline_size(_context: fidl::encoding::Context) -> usize {
12549            4
12550        }
12551    }
12552
12553    unsafe impl
12554        fidl::encoding::Encode<
12555            IommuResourceGetResponse,
12556            fidl::encoding::DefaultFuchsiaResourceDialect,
12557        > for &mut IommuResourceGetResponse
12558    {
12559        #[inline]
12560        unsafe fn encode(
12561            self,
12562            encoder: &mut fidl::encoding::Encoder<
12563                '_,
12564                fidl::encoding::DefaultFuchsiaResourceDialect,
12565            >,
12566            offset: usize,
12567            _depth: fidl::encoding::Depth,
12568        ) -> fidl::Result<()> {
12569            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12570            // Delegate to tuple encoding.
12571            fidl::encoding::Encode::<
12572                IommuResourceGetResponse,
12573                fidl::encoding::DefaultFuchsiaResourceDialect,
12574            >::encode(
12575                (<fidl::encoding::HandleType<
12576                    fidl::Resource,
12577                    { fidl::ObjectType::RESOURCE.into_raw() },
12578                    2147483648,
12579                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12580                    &mut self.resource
12581                ),),
12582                encoder,
12583                offset,
12584                _depth,
12585            )
12586        }
12587    }
12588    unsafe impl<
12589        T0: fidl::encoding::Encode<
12590                fidl::encoding::HandleType<
12591                    fidl::Resource,
12592                    { fidl::ObjectType::RESOURCE.into_raw() },
12593                    2147483648,
12594                >,
12595                fidl::encoding::DefaultFuchsiaResourceDialect,
12596            >,
12597    >
12598        fidl::encoding::Encode<
12599            IommuResourceGetResponse,
12600            fidl::encoding::DefaultFuchsiaResourceDialect,
12601        > for (T0,)
12602    {
12603        #[inline]
12604        unsafe fn encode(
12605            self,
12606            encoder: &mut fidl::encoding::Encoder<
12607                '_,
12608                fidl::encoding::DefaultFuchsiaResourceDialect,
12609            >,
12610            offset: usize,
12611            depth: fidl::encoding::Depth,
12612        ) -> fidl::Result<()> {
12613            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12614            // Zero out padding regions. There's no need to apply masks
12615            // because the unmasked parts will be overwritten by fields.
12616            // Write the fields.
12617            self.0.encode(encoder, offset + 0, depth)?;
12618            Ok(())
12619        }
12620    }
12621
12622    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12623        for IommuResourceGetResponse
12624    {
12625        #[inline(always)]
12626        fn new_empty() -> Self {
12627            Self {
12628                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12629            }
12630        }
12631
12632        #[inline]
12633        unsafe fn decode(
12634            &mut self,
12635            decoder: &mut fidl::encoding::Decoder<
12636                '_,
12637                fidl::encoding::DefaultFuchsiaResourceDialect,
12638            >,
12639            offset: usize,
12640            _depth: fidl::encoding::Depth,
12641        ) -> fidl::Result<()> {
12642            decoder.debug_check_bounds::<Self>(offset);
12643            // Verify that padding bytes are zero.
12644            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12645            Ok(())
12646        }
12647    }
12648
12649    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
12650        type Borrowed<'a> = &'a mut Self;
12651        fn take_or_borrow<'a>(
12652            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12653        ) -> Self::Borrowed<'a> {
12654            value
12655        }
12656    }
12657
12658    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
12659        type Owned = Self;
12660
12661        #[inline(always)]
12662        fn inline_align(_context: fidl::encoding::Context) -> usize {
12663            4
12664        }
12665
12666        #[inline(always)]
12667        fn inline_size(_context: fidl::encoding::Context) -> usize {
12668            4
12669        }
12670    }
12671
12672    unsafe impl
12673        fidl::encoding::Encode<
12674            IoportResourceGetResponse,
12675            fidl::encoding::DefaultFuchsiaResourceDialect,
12676        > for &mut IoportResourceGetResponse
12677    {
12678        #[inline]
12679        unsafe fn encode(
12680            self,
12681            encoder: &mut fidl::encoding::Encoder<
12682                '_,
12683                fidl::encoding::DefaultFuchsiaResourceDialect,
12684            >,
12685            offset: usize,
12686            _depth: fidl::encoding::Depth,
12687        ) -> fidl::Result<()> {
12688            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12689            // Delegate to tuple encoding.
12690            fidl::encoding::Encode::<
12691                IoportResourceGetResponse,
12692                fidl::encoding::DefaultFuchsiaResourceDialect,
12693            >::encode(
12694                (<fidl::encoding::HandleType<
12695                    fidl::Resource,
12696                    { fidl::ObjectType::RESOURCE.into_raw() },
12697                    2147483648,
12698                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12699                    &mut self.resource
12700                ),),
12701                encoder,
12702                offset,
12703                _depth,
12704            )
12705        }
12706    }
12707    unsafe impl<
12708        T0: fidl::encoding::Encode<
12709                fidl::encoding::HandleType<
12710                    fidl::Resource,
12711                    { fidl::ObjectType::RESOURCE.into_raw() },
12712                    2147483648,
12713                >,
12714                fidl::encoding::DefaultFuchsiaResourceDialect,
12715            >,
12716    >
12717        fidl::encoding::Encode<
12718            IoportResourceGetResponse,
12719            fidl::encoding::DefaultFuchsiaResourceDialect,
12720        > for (T0,)
12721    {
12722        #[inline]
12723        unsafe fn encode(
12724            self,
12725            encoder: &mut fidl::encoding::Encoder<
12726                '_,
12727                fidl::encoding::DefaultFuchsiaResourceDialect,
12728            >,
12729            offset: usize,
12730            depth: fidl::encoding::Depth,
12731        ) -> fidl::Result<()> {
12732            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12733            // Zero out padding regions. There's no need to apply masks
12734            // because the unmasked parts will be overwritten by fields.
12735            // Write the fields.
12736            self.0.encode(encoder, offset + 0, depth)?;
12737            Ok(())
12738        }
12739    }
12740
12741    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12742        for IoportResourceGetResponse
12743    {
12744        #[inline(always)]
12745        fn new_empty() -> Self {
12746            Self {
12747                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12748            }
12749        }
12750
12751        #[inline]
12752        unsafe fn decode(
12753            &mut self,
12754            decoder: &mut fidl::encoding::Decoder<
12755                '_,
12756                fidl::encoding::DefaultFuchsiaResourceDialect,
12757            >,
12758            offset: usize,
12759            _depth: fidl::encoding::Depth,
12760        ) -> fidl::Result<()> {
12761            decoder.debug_check_bounds::<Self>(offset);
12762            // Verify that padding bytes are zero.
12763            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12764            Ok(())
12765        }
12766    }
12767
12768    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
12769        type Borrowed<'a> = &'a mut Self;
12770        fn take_or_borrow<'a>(
12771            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12772        ) -> Self::Borrowed<'a> {
12773            value
12774        }
12775    }
12776
12777    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
12778        type Owned = Self;
12779
12780        #[inline(always)]
12781        fn inline_align(_context: fidl::encoding::Context) -> usize {
12782            4
12783        }
12784
12785        #[inline(always)]
12786        fn inline_size(_context: fidl::encoding::Context) -> usize {
12787            4
12788        }
12789    }
12790
12791    unsafe impl
12792        fidl::encoding::Encode<
12793            IrqResourceGetResponse,
12794            fidl::encoding::DefaultFuchsiaResourceDialect,
12795        > for &mut IrqResourceGetResponse
12796    {
12797        #[inline]
12798        unsafe fn encode(
12799            self,
12800            encoder: &mut fidl::encoding::Encoder<
12801                '_,
12802                fidl::encoding::DefaultFuchsiaResourceDialect,
12803            >,
12804            offset: usize,
12805            _depth: fidl::encoding::Depth,
12806        ) -> fidl::Result<()> {
12807            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12808            // Delegate to tuple encoding.
12809            fidl::encoding::Encode::<
12810                IrqResourceGetResponse,
12811                fidl::encoding::DefaultFuchsiaResourceDialect,
12812            >::encode(
12813                (<fidl::encoding::HandleType<
12814                    fidl::Resource,
12815                    { fidl::ObjectType::RESOURCE.into_raw() },
12816                    2147483648,
12817                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12818                    &mut self.resource
12819                ),),
12820                encoder,
12821                offset,
12822                _depth,
12823            )
12824        }
12825    }
12826    unsafe impl<
12827        T0: fidl::encoding::Encode<
12828                fidl::encoding::HandleType<
12829                    fidl::Resource,
12830                    { fidl::ObjectType::RESOURCE.into_raw() },
12831                    2147483648,
12832                >,
12833                fidl::encoding::DefaultFuchsiaResourceDialect,
12834            >,
12835    >
12836        fidl::encoding::Encode<
12837            IrqResourceGetResponse,
12838            fidl::encoding::DefaultFuchsiaResourceDialect,
12839        > for (T0,)
12840    {
12841        #[inline]
12842        unsafe fn encode(
12843            self,
12844            encoder: &mut fidl::encoding::Encoder<
12845                '_,
12846                fidl::encoding::DefaultFuchsiaResourceDialect,
12847            >,
12848            offset: usize,
12849            depth: fidl::encoding::Depth,
12850        ) -> fidl::Result<()> {
12851            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12852            // Zero out padding regions. There's no need to apply masks
12853            // because the unmasked parts will be overwritten by fields.
12854            // Write the fields.
12855            self.0.encode(encoder, offset + 0, depth)?;
12856            Ok(())
12857        }
12858    }
12859
12860    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12861        for IrqResourceGetResponse
12862    {
12863        #[inline(always)]
12864        fn new_empty() -> Self {
12865            Self {
12866                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12867            }
12868        }
12869
12870        #[inline]
12871        unsafe fn decode(
12872            &mut self,
12873            decoder: &mut fidl::encoding::Decoder<
12874                '_,
12875                fidl::encoding::DefaultFuchsiaResourceDialect,
12876            >,
12877            offset: usize,
12878            _depth: fidl::encoding::Depth,
12879        ) -> fidl::Result<()> {
12880            decoder.debug_check_bounds::<Self>(offset);
12881            // Verify that padding bytes are zero.
12882            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12883            Ok(())
12884        }
12885    }
12886
12887    impl fidl::encoding::ResourceTypeMarker for MexecResourceGetResponse {
12888        type Borrowed<'a> = &'a mut Self;
12889        fn take_or_borrow<'a>(
12890            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12891        ) -> Self::Borrowed<'a> {
12892            value
12893        }
12894    }
12895
12896    unsafe impl fidl::encoding::TypeMarker for MexecResourceGetResponse {
12897        type Owned = Self;
12898
12899        #[inline(always)]
12900        fn inline_align(_context: fidl::encoding::Context) -> usize {
12901            4
12902        }
12903
12904        #[inline(always)]
12905        fn inline_size(_context: fidl::encoding::Context) -> usize {
12906            4
12907        }
12908    }
12909
12910    unsafe impl
12911        fidl::encoding::Encode<
12912            MexecResourceGetResponse,
12913            fidl::encoding::DefaultFuchsiaResourceDialect,
12914        > for &mut MexecResourceGetResponse
12915    {
12916        #[inline]
12917        unsafe fn encode(
12918            self,
12919            encoder: &mut fidl::encoding::Encoder<
12920                '_,
12921                fidl::encoding::DefaultFuchsiaResourceDialect,
12922            >,
12923            offset: usize,
12924            _depth: fidl::encoding::Depth,
12925        ) -> fidl::Result<()> {
12926            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12927            // Delegate to tuple encoding.
12928            fidl::encoding::Encode::<
12929                MexecResourceGetResponse,
12930                fidl::encoding::DefaultFuchsiaResourceDialect,
12931            >::encode(
12932                (<fidl::encoding::HandleType<
12933                    fidl::Resource,
12934                    { fidl::ObjectType::RESOURCE.into_raw() },
12935                    2147483648,
12936                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12937                    &mut self.resource
12938                ),),
12939                encoder,
12940                offset,
12941                _depth,
12942            )
12943        }
12944    }
12945    unsafe impl<
12946        T0: fidl::encoding::Encode<
12947                fidl::encoding::HandleType<
12948                    fidl::Resource,
12949                    { fidl::ObjectType::RESOURCE.into_raw() },
12950                    2147483648,
12951                >,
12952                fidl::encoding::DefaultFuchsiaResourceDialect,
12953            >,
12954    >
12955        fidl::encoding::Encode<
12956            MexecResourceGetResponse,
12957            fidl::encoding::DefaultFuchsiaResourceDialect,
12958        > for (T0,)
12959    {
12960        #[inline]
12961        unsafe fn encode(
12962            self,
12963            encoder: &mut fidl::encoding::Encoder<
12964                '_,
12965                fidl::encoding::DefaultFuchsiaResourceDialect,
12966            >,
12967            offset: usize,
12968            depth: fidl::encoding::Depth,
12969        ) -> fidl::Result<()> {
12970            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12971            // Zero out padding regions. There's no need to apply masks
12972            // because the unmasked parts will be overwritten by fields.
12973            // Write the fields.
12974            self.0.encode(encoder, offset + 0, depth)?;
12975            Ok(())
12976        }
12977    }
12978
12979    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12980        for MexecResourceGetResponse
12981    {
12982        #[inline(always)]
12983        fn new_empty() -> Self {
12984            Self {
12985                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12986            }
12987        }
12988
12989        #[inline]
12990        unsafe fn decode(
12991            &mut self,
12992            decoder: &mut fidl::encoding::Decoder<
12993                '_,
12994                fidl::encoding::DefaultFuchsiaResourceDialect,
12995            >,
12996            offset: usize,
12997            _depth: fidl::encoding::Depth,
12998        ) -> fidl::Result<()> {
12999            decoder.debug_check_bounds::<Self>(offset);
13000            // Verify that padding bytes are zero.
13001            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13002            Ok(())
13003        }
13004    }
13005
13006    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
13007        type Borrowed<'a> = &'a mut Self;
13008        fn take_or_borrow<'a>(
13009            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13010        ) -> Self::Borrowed<'a> {
13011            value
13012        }
13013    }
13014
13015    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
13016        type Owned = Self;
13017
13018        #[inline(always)]
13019        fn inline_align(_context: fidl::encoding::Context) -> usize {
13020            4
13021        }
13022
13023        #[inline(always)]
13024        fn inline_size(_context: fidl::encoding::Context) -> usize {
13025            4
13026        }
13027    }
13028
13029    unsafe impl
13030        fidl::encoding::Encode<
13031            MmioResourceGetResponse,
13032            fidl::encoding::DefaultFuchsiaResourceDialect,
13033        > for &mut MmioResourceGetResponse
13034    {
13035        #[inline]
13036        unsafe fn encode(
13037            self,
13038            encoder: &mut fidl::encoding::Encoder<
13039                '_,
13040                fidl::encoding::DefaultFuchsiaResourceDialect,
13041            >,
13042            offset: usize,
13043            _depth: fidl::encoding::Depth,
13044        ) -> fidl::Result<()> {
13045            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
13046            // Delegate to tuple encoding.
13047            fidl::encoding::Encode::<
13048                MmioResourceGetResponse,
13049                fidl::encoding::DefaultFuchsiaResourceDialect,
13050            >::encode(
13051                (<fidl::encoding::HandleType<
13052                    fidl::Resource,
13053                    { fidl::ObjectType::RESOURCE.into_raw() },
13054                    2147483648,
13055                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13056                    &mut self.resource
13057                ),),
13058                encoder,
13059                offset,
13060                _depth,
13061            )
13062        }
13063    }
13064    unsafe impl<
13065        T0: fidl::encoding::Encode<
13066                fidl::encoding::HandleType<
13067                    fidl::Resource,
13068                    { fidl::ObjectType::RESOURCE.into_raw() },
13069                    2147483648,
13070                >,
13071                fidl::encoding::DefaultFuchsiaResourceDialect,
13072            >,
13073    >
13074        fidl::encoding::Encode<
13075            MmioResourceGetResponse,
13076            fidl::encoding::DefaultFuchsiaResourceDialect,
13077        > for (T0,)
13078    {
13079        #[inline]
13080        unsafe fn encode(
13081            self,
13082            encoder: &mut fidl::encoding::Encoder<
13083                '_,
13084                fidl::encoding::DefaultFuchsiaResourceDialect,
13085            >,
13086            offset: usize,
13087            depth: fidl::encoding::Depth,
13088        ) -> fidl::Result<()> {
13089            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
13090            // Zero out padding regions. There's no need to apply masks
13091            // because the unmasked parts will be overwritten by fields.
13092            // Write the fields.
13093            self.0.encode(encoder, offset + 0, depth)?;
13094            Ok(())
13095        }
13096    }
13097
13098    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13099        for MmioResourceGetResponse
13100    {
13101        #[inline(always)]
13102        fn new_empty() -> Self {
13103            Self {
13104                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13105            }
13106        }
13107
13108        #[inline]
13109        unsafe fn decode(
13110            &mut self,
13111            decoder: &mut fidl::encoding::Decoder<
13112                '_,
13113                fidl::encoding::DefaultFuchsiaResourceDialect,
13114            >,
13115            offset: usize,
13116            _depth: fidl::encoding::Depth,
13117        ) -> fidl::Result<()> {
13118            decoder.debug_check_bounds::<Self>(offset);
13119            // Verify that padding bytes are zero.
13120            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13121            Ok(())
13122        }
13123    }
13124
13125    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
13126        type Borrowed<'a> = &'a mut Self;
13127        fn take_or_borrow<'a>(
13128            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13129        ) -> Self::Borrowed<'a> {
13130            value
13131        }
13132    }
13133
13134    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
13135        type Owned = Self;
13136
13137        #[inline(always)]
13138        fn inline_align(_context: fidl::encoding::Context) -> usize {
13139            4
13140        }
13141
13142        #[inline(always)]
13143        fn inline_size(_context: fidl::encoding::Context) -> usize {
13144            4
13145        }
13146    }
13147
13148    unsafe impl
13149        fidl::encoding::Encode<
13150            MsiResourceGetResponse,
13151            fidl::encoding::DefaultFuchsiaResourceDialect,
13152        > for &mut MsiResourceGetResponse
13153    {
13154        #[inline]
13155        unsafe fn encode(
13156            self,
13157            encoder: &mut fidl::encoding::Encoder<
13158                '_,
13159                fidl::encoding::DefaultFuchsiaResourceDialect,
13160            >,
13161            offset: usize,
13162            _depth: fidl::encoding::Depth,
13163        ) -> fidl::Result<()> {
13164            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
13165            // Delegate to tuple encoding.
13166            fidl::encoding::Encode::<
13167                MsiResourceGetResponse,
13168                fidl::encoding::DefaultFuchsiaResourceDialect,
13169            >::encode(
13170                (<fidl::encoding::HandleType<
13171                    fidl::Resource,
13172                    { fidl::ObjectType::RESOURCE.into_raw() },
13173                    2147483648,
13174                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13175                    &mut self.resource
13176                ),),
13177                encoder,
13178                offset,
13179                _depth,
13180            )
13181        }
13182    }
13183    unsafe impl<
13184        T0: fidl::encoding::Encode<
13185                fidl::encoding::HandleType<
13186                    fidl::Resource,
13187                    { fidl::ObjectType::RESOURCE.into_raw() },
13188                    2147483648,
13189                >,
13190                fidl::encoding::DefaultFuchsiaResourceDialect,
13191            >,
13192    >
13193        fidl::encoding::Encode<
13194            MsiResourceGetResponse,
13195            fidl::encoding::DefaultFuchsiaResourceDialect,
13196        > for (T0,)
13197    {
13198        #[inline]
13199        unsafe fn encode(
13200            self,
13201            encoder: &mut fidl::encoding::Encoder<
13202                '_,
13203                fidl::encoding::DefaultFuchsiaResourceDialect,
13204            >,
13205            offset: usize,
13206            depth: fidl::encoding::Depth,
13207        ) -> fidl::Result<()> {
13208            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
13209            // Zero out padding regions. There's no need to apply masks
13210            // because the unmasked parts will be overwritten by fields.
13211            // Write the fields.
13212            self.0.encode(encoder, offset + 0, depth)?;
13213            Ok(())
13214        }
13215    }
13216
13217    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13218        for MsiResourceGetResponse
13219    {
13220        #[inline(always)]
13221        fn new_empty() -> Self {
13222            Self {
13223                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13224            }
13225        }
13226
13227        #[inline]
13228        unsafe fn decode(
13229            &mut self,
13230            decoder: &mut fidl::encoding::Decoder<
13231                '_,
13232                fidl::encoding::DefaultFuchsiaResourceDialect,
13233            >,
13234            offset: usize,
13235            _depth: fidl::encoding::Depth,
13236        ) -> fidl::Result<()> {
13237            decoder.debug_check_bounds::<Self>(offset);
13238            // Verify that padding bytes are zero.
13239            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13240            Ok(())
13241        }
13242    }
13243
13244    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
13245        type Borrowed<'a> = &'a mut Self;
13246        fn take_or_borrow<'a>(
13247            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13248        ) -> Self::Borrowed<'a> {
13249            value
13250        }
13251    }
13252
13253    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
13254        type Owned = Self;
13255
13256        #[inline(always)]
13257        fn inline_align(_context: fidl::encoding::Context) -> usize {
13258            4
13259        }
13260
13261        #[inline(always)]
13262        fn inline_size(_context: fidl::encoding::Context) -> usize {
13263            4
13264        }
13265    }
13266
13267    unsafe impl
13268        fidl::encoding::Encode<
13269            PowerResourceGetResponse,
13270            fidl::encoding::DefaultFuchsiaResourceDialect,
13271        > for &mut PowerResourceGetResponse
13272    {
13273        #[inline]
13274        unsafe fn encode(
13275            self,
13276            encoder: &mut fidl::encoding::Encoder<
13277                '_,
13278                fidl::encoding::DefaultFuchsiaResourceDialect,
13279            >,
13280            offset: usize,
13281            _depth: fidl::encoding::Depth,
13282        ) -> fidl::Result<()> {
13283            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
13284            // Delegate to tuple encoding.
13285            fidl::encoding::Encode::<
13286                PowerResourceGetResponse,
13287                fidl::encoding::DefaultFuchsiaResourceDialect,
13288            >::encode(
13289                (<fidl::encoding::HandleType<
13290                    fidl::Resource,
13291                    { fidl::ObjectType::RESOURCE.into_raw() },
13292                    2147483648,
13293                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13294                    &mut self.resource
13295                ),),
13296                encoder,
13297                offset,
13298                _depth,
13299            )
13300        }
13301    }
13302    unsafe impl<
13303        T0: fidl::encoding::Encode<
13304                fidl::encoding::HandleType<
13305                    fidl::Resource,
13306                    { fidl::ObjectType::RESOURCE.into_raw() },
13307                    2147483648,
13308                >,
13309                fidl::encoding::DefaultFuchsiaResourceDialect,
13310            >,
13311    >
13312        fidl::encoding::Encode<
13313            PowerResourceGetResponse,
13314            fidl::encoding::DefaultFuchsiaResourceDialect,
13315        > for (T0,)
13316    {
13317        #[inline]
13318        unsafe fn encode(
13319            self,
13320            encoder: &mut fidl::encoding::Encoder<
13321                '_,
13322                fidl::encoding::DefaultFuchsiaResourceDialect,
13323            >,
13324            offset: usize,
13325            depth: fidl::encoding::Depth,
13326        ) -> fidl::Result<()> {
13327            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
13328            // Zero out padding regions. There's no need to apply masks
13329            // because the unmasked parts will be overwritten by fields.
13330            // Write the fields.
13331            self.0.encode(encoder, offset + 0, depth)?;
13332            Ok(())
13333        }
13334    }
13335
13336    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13337        for PowerResourceGetResponse
13338    {
13339        #[inline(always)]
13340        fn new_empty() -> Self {
13341            Self {
13342                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13343            }
13344        }
13345
13346        #[inline]
13347        unsafe fn decode(
13348            &mut self,
13349            decoder: &mut fidl::encoding::Decoder<
13350                '_,
13351                fidl::encoding::DefaultFuchsiaResourceDialect,
13352            >,
13353            offset: usize,
13354            _depth: fidl::encoding::Depth,
13355        ) -> fidl::Result<()> {
13356            decoder.debug_check_bounds::<Self>(offset);
13357            // Verify that padding bytes are zero.
13358            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13359            Ok(())
13360        }
13361    }
13362
13363    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
13364        type Borrowed<'a> = &'a mut Self;
13365        fn take_or_borrow<'a>(
13366            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13367        ) -> Self::Borrowed<'a> {
13368            value
13369        }
13370    }
13371
13372    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
13373        type Owned = Self;
13374
13375        #[inline(always)]
13376        fn inline_align(_context: fidl::encoding::Context) -> usize {
13377            4
13378        }
13379
13380        #[inline(always)]
13381        fn inline_size(_context: fidl::encoding::Context) -> usize {
13382            4
13383        }
13384    }
13385
13386    unsafe impl
13387        fidl::encoding::Encode<
13388            ProfileResourceGetResponse,
13389            fidl::encoding::DefaultFuchsiaResourceDialect,
13390        > for &mut ProfileResourceGetResponse
13391    {
13392        #[inline]
13393        unsafe fn encode(
13394            self,
13395            encoder: &mut fidl::encoding::Encoder<
13396                '_,
13397                fidl::encoding::DefaultFuchsiaResourceDialect,
13398            >,
13399            offset: usize,
13400            _depth: fidl::encoding::Depth,
13401        ) -> fidl::Result<()> {
13402            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13403            // Delegate to tuple encoding.
13404            fidl::encoding::Encode::<
13405                ProfileResourceGetResponse,
13406                fidl::encoding::DefaultFuchsiaResourceDialect,
13407            >::encode(
13408                (<fidl::encoding::HandleType<
13409                    fidl::Resource,
13410                    { fidl::ObjectType::RESOURCE.into_raw() },
13411                    2147483648,
13412                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13413                    &mut self.resource
13414                ),),
13415                encoder,
13416                offset,
13417                _depth,
13418            )
13419        }
13420    }
13421    unsafe impl<
13422        T0: fidl::encoding::Encode<
13423                fidl::encoding::HandleType<
13424                    fidl::Resource,
13425                    { fidl::ObjectType::RESOURCE.into_raw() },
13426                    2147483648,
13427                >,
13428                fidl::encoding::DefaultFuchsiaResourceDialect,
13429            >,
13430    >
13431        fidl::encoding::Encode<
13432            ProfileResourceGetResponse,
13433            fidl::encoding::DefaultFuchsiaResourceDialect,
13434        > for (T0,)
13435    {
13436        #[inline]
13437        unsafe fn encode(
13438            self,
13439            encoder: &mut fidl::encoding::Encoder<
13440                '_,
13441                fidl::encoding::DefaultFuchsiaResourceDialect,
13442            >,
13443            offset: usize,
13444            depth: fidl::encoding::Depth,
13445        ) -> fidl::Result<()> {
13446            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13447            // Zero out padding regions. There's no need to apply masks
13448            // because the unmasked parts will be overwritten by fields.
13449            // Write the fields.
13450            self.0.encode(encoder, offset + 0, depth)?;
13451            Ok(())
13452        }
13453    }
13454
13455    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13456        for ProfileResourceGetResponse
13457    {
13458        #[inline(always)]
13459        fn new_empty() -> Self {
13460            Self {
13461                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13462            }
13463        }
13464
13465        #[inline]
13466        unsafe fn decode(
13467            &mut self,
13468            decoder: &mut fidl::encoding::Decoder<
13469                '_,
13470                fidl::encoding::DefaultFuchsiaResourceDialect,
13471            >,
13472            offset: usize,
13473            _depth: fidl::encoding::Depth,
13474        ) -> fidl::Result<()> {
13475            decoder.debug_check_bounds::<Self>(offset);
13476            // Verify that padding bytes are zero.
13477            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13478            Ok(())
13479        }
13480    }
13481
13482    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
13483        type Borrowed<'a> = &'a mut Self;
13484        fn take_or_borrow<'a>(
13485            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13486        ) -> Self::Borrowed<'a> {
13487            value
13488        }
13489    }
13490
13491    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
13492        type Owned = Self;
13493
13494        #[inline(always)]
13495        fn inline_align(_context: fidl::encoding::Context) -> usize {
13496            4
13497        }
13498
13499        #[inline(always)]
13500        fn inline_size(_context: fidl::encoding::Context) -> usize {
13501            4
13502        }
13503    }
13504
13505    unsafe impl
13506        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13507        for &mut RootJobGetResponse
13508    {
13509        #[inline]
13510        unsafe fn encode(
13511            self,
13512            encoder: &mut fidl::encoding::Encoder<
13513                '_,
13514                fidl::encoding::DefaultFuchsiaResourceDialect,
13515            >,
13516            offset: usize,
13517            _depth: fidl::encoding::Depth,
13518        ) -> fidl::Result<()> {
13519            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13520            // Delegate to tuple encoding.
13521            fidl::encoding::Encode::<
13522                RootJobGetResponse,
13523                fidl::encoding::DefaultFuchsiaResourceDialect,
13524            >::encode(
13525                (<fidl::encoding::HandleType<
13526                    fidl::Job,
13527                    { fidl::ObjectType::JOB.into_raw() },
13528                    2147483648,
13529                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13530                    &mut self.job
13531                ),),
13532                encoder,
13533                offset,
13534                _depth,
13535            )
13536        }
13537    }
13538    unsafe impl<
13539        T0: fidl::encoding::Encode<
13540                fidl::encoding::HandleType<
13541                    fidl::Job,
13542                    { fidl::ObjectType::JOB.into_raw() },
13543                    2147483648,
13544                >,
13545                fidl::encoding::DefaultFuchsiaResourceDialect,
13546            >,
13547    > fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13548        for (T0,)
13549    {
13550        #[inline]
13551        unsafe fn encode(
13552            self,
13553            encoder: &mut fidl::encoding::Encoder<
13554                '_,
13555                fidl::encoding::DefaultFuchsiaResourceDialect,
13556            >,
13557            offset: usize,
13558            depth: fidl::encoding::Depth,
13559        ) -> fidl::Result<()> {
13560            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13561            // Zero out padding regions. There's no need to apply masks
13562            // because the unmasked parts will be overwritten by fields.
13563            // Write the fields.
13564            self.0.encode(encoder, offset + 0, depth)?;
13565            Ok(())
13566        }
13567    }
13568
13569    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13570        for RootJobGetResponse
13571    {
13572        #[inline(always)]
13573        fn new_empty() -> Self {
13574            Self {
13575                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13576            }
13577        }
13578
13579        #[inline]
13580        unsafe fn decode(
13581            &mut self,
13582            decoder: &mut fidl::encoding::Decoder<
13583                '_,
13584                fidl::encoding::DefaultFuchsiaResourceDialect,
13585            >,
13586            offset: usize,
13587            _depth: fidl::encoding::Depth,
13588        ) -> fidl::Result<()> {
13589            decoder.debug_check_bounds::<Self>(offset);
13590            // Verify that padding bytes are zero.
13591            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
13592            Ok(())
13593        }
13594    }
13595
13596    impl fidl::encoding::ResourceTypeMarker for SamplingResourceGetResponse {
13597        type Borrowed<'a> = &'a mut Self;
13598        fn take_or_borrow<'a>(
13599            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13600        ) -> Self::Borrowed<'a> {
13601            value
13602        }
13603    }
13604
13605    unsafe impl fidl::encoding::TypeMarker for SamplingResourceGetResponse {
13606        type Owned = Self;
13607
13608        #[inline(always)]
13609        fn inline_align(_context: fidl::encoding::Context) -> usize {
13610            4
13611        }
13612
13613        #[inline(always)]
13614        fn inline_size(_context: fidl::encoding::Context) -> usize {
13615            4
13616        }
13617    }
13618
13619    unsafe impl
13620        fidl::encoding::Encode<
13621            SamplingResourceGetResponse,
13622            fidl::encoding::DefaultFuchsiaResourceDialect,
13623        > for &mut SamplingResourceGetResponse
13624    {
13625        #[inline]
13626        unsafe fn encode(
13627            self,
13628            encoder: &mut fidl::encoding::Encoder<
13629                '_,
13630                fidl::encoding::DefaultFuchsiaResourceDialect,
13631            >,
13632            offset: usize,
13633            _depth: fidl::encoding::Depth,
13634        ) -> fidl::Result<()> {
13635            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13636            // Delegate to tuple encoding.
13637            fidl::encoding::Encode::<
13638                SamplingResourceGetResponse,
13639                fidl::encoding::DefaultFuchsiaResourceDialect,
13640            >::encode(
13641                (<fidl::encoding::HandleType<
13642                    fidl::Resource,
13643                    { fidl::ObjectType::RESOURCE.into_raw() },
13644                    2147483648,
13645                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13646                    &mut self.resource
13647                ),),
13648                encoder,
13649                offset,
13650                _depth,
13651            )
13652        }
13653    }
13654    unsafe impl<
13655        T0: fidl::encoding::Encode<
13656                fidl::encoding::HandleType<
13657                    fidl::Resource,
13658                    { fidl::ObjectType::RESOURCE.into_raw() },
13659                    2147483648,
13660                >,
13661                fidl::encoding::DefaultFuchsiaResourceDialect,
13662            >,
13663    >
13664        fidl::encoding::Encode<
13665            SamplingResourceGetResponse,
13666            fidl::encoding::DefaultFuchsiaResourceDialect,
13667        > for (T0,)
13668    {
13669        #[inline]
13670        unsafe fn encode(
13671            self,
13672            encoder: &mut fidl::encoding::Encoder<
13673                '_,
13674                fidl::encoding::DefaultFuchsiaResourceDialect,
13675            >,
13676            offset: usize,
13677            depth: fidl::encoding::Depth,
13678        ) -> fidl::Result<()> {
13679            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13680            // Zero out padding regions. There's no need to apply masks
13681            // because the unmasked parts will be overwritten by fields.
13682            // Write the fields.
13683            self.0.encode(encoder, offset + 0, depth)?;
13684            Ok(())
13685        }
13686    }
13687
13688    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13689        for SamplingResourceGetResponse
13690    {
13691        #[inline(always)]
13692        fn new_empty() -> Self {
13693            Self {
13694                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13695            }
13696        }
13697
13698        #[inline]
13699        unsafe fn decode(
13700            &mut self,
13701            decoder: &mut fidl::encoding::Decoder<
13702                '_,
13703                fidl::encoding::DefaultFuchsiaResourceDialect,
13704            >,
13705            offset: usize,
13706            _depth: fidl::encoding::Depth,
13707        ) -> fidl::Result<()> {
13708            decoder.debug_check_bounds::<Self>(offset);
13709            // Verify that padding bytes are zero.
13710            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13711            Ok(())
13712        }
13713    }
13714
13715    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
13716        type Borrowed<'a> = &'a mut Self;
13717        fn take_or_borrow<'a>(
13718            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13719        ) -> Self::Borrowed<'a> {
13720            value
13721        }
13722    }
13723
13724    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
13725        type Owned = Self;
13726
13727        #[inline(always)]
13728        fn inline_align(_context: fidl::encoding::Context) -> usize {
13729            4
13730        }
13731
13732        #[inline(always)]
13733        fn inline_size(_context: fidl::encoding::Context) -> usize {
13734            4
13735        }
13736    }
13737
13738    unsafe impl
13739        fidl::encoding::Encode<
13740            SmcResourceGetResponse,
13741            fidl::encoding::DefaultFuchsiaResourceDialect,
13742        > for &mut SmcResourceGetResponse
13743    {
13744        #[inline]
13745        unsafe fn encode(
13746            self,
13747            encoder: &mut fidl::encoding::Encoder<
13748                '_,
13749                fidl::encoding::DefaultFuchsiaResourceDialect,
13750            >,
13751            offset: usize,
13752            _depth: fidl::encoding::Depth,
13753        ) -> fidl::Result<()> {
13754            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13755            // Delegate to tuple encoding.
13756            fidl::encoding::Encode::<
13757                SmcResourceGetResponse,
13758                fidl::encoding::DefaultFuchsiaResourceDialect,
13759            >::encode(
13760                (<fidl::encoding::HandleType<
13761                    fidl::Resource,
13762                    { fidl::ObjectType::RESOURCE.into_raw() },
13763                    2147483648,
13764                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13765                    &mut self.resource
13766                ),),
13767                encoder,
13768                offset,
13769                _depth,
13770            )
13771        }
13772    }
13773    unsafe impl<
13774        T0: fidl::encoding::Encode<
13775                fidl::encoding::HandleType<
13776                    fidl::Resource,
13777                    { fidl::ObjectType::RESOURCE.into_raw() },
13778                    2147483648,
13779                >,
13780                fidl::encoding::DefaultFuchsiaResourceDialect,
13781            >,
13782    >
13783        fidl::encoding::Encode<
13784            SmcResourceGetResponse,
13785            fidl::encoding::DefaultFuchsiaResourceDialect,
13786        > for (T0,)
13787    {
13788        #[inline]
13789        unsafe fn encode(
13790            self,
13791            encoder: &mut fidl::encoding::Encoder<
13792                '_,
13793                fidl::encoding::DefaultFuchsiaResourceDialect,
13794            >,
13795            offset: usize,
13796            depth: fidl::encoding::Depth,
13797        ) -> fidl::Result<()> {
13798            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13799            // Zero out padding regions. There's no need to apply masks
13800            // because the unmasked parts will be overwritten by fields.
13801            // Write the fields.
13802            self.0.encode(encoder, offset + 0, depth)?;
13803            Ok(())
13804        }
13805    }
13806
13807    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13808        for SmcResourceGetResponse
13809    {
13810        #[inline(always)]
13811        fn new_empty() -> Self {
13812            Self {
13813                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13814            }
13815        }
13816
13817        #[inline]
13818        unsafe fn decode(
13819            &mut self,
13820            decoder: &mut fidl::encoding::Decoder<
13821                '_,
13822                fidl::encoding::DefaultFuchsiaResourceDialect,
13823            >,
13824            offset: usize,
13825            _depth: fidl::encoding::Depth,
13826        ) -> fidl::Result<()> {
13827            decoder.debug_check_bounds::<Self>(offset);
13828            // Verify that padding bytes are zero.
13829            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13830            Ok(())
13831        }
13832    }
13833
13834    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
13835        type Borrowed<'a> = &'a mut Self;
13836        fn take_or_borrow<'a>(
13837            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13838        ) -> Self::Borrowed<'a> {
13839            value
13840        }
13841    }
13842
13843    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
13844        type Owned = Self;
13845
13846        #[inline(always)]
13847        fn inline_align(_context: fidl::encoding::Context) -> usize {
13848            4
13849        }
13850
13851        #[inline(always)]
13852        fn inline_size(_context: fidl::encoding::Context) -> usize {
13853            4
13854        }
13855    }
13856
13857    unsafe impl
13858        fidl::encoding::Encode<
13859            StallResourceGetResponse,
13860            fidl::encoding::DefaultFuchsiaResourceDialect,
13861        > for &mut StallResourceGetResponse
13862    {
13863        #[inline]
13864        unsafe fn encode(
13865            self,
13866            encoder: &mut fidl::encoding::Encoder<
13867                '_,
13868                fidl::encoding::DefaultFuchsiaResourceDialect,
13869            >,
13870            offset: usize,
13871            _depth: fidl::encoding::Depth,
13872        ) -> fidl::Result<()> {
13873            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13874            // Delegate to tuple encoding.
13875            fidl::encoding::Encode::<
13876                StallResourceGetResponse,
13877                fidl::encoding::DefaultFuchsiaResourceDialect,
13878            >::encode(
13879                (<fidl::encoding::HandleType<
13880                    fidl::Resource,
13881                    { fidl::ObjectType::RESOURCE.into_raw() },
13882                    2147483648,
13883                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13884                    &mut self.resource
13885                ),),
13886                encoder,
13887                offset,
13888                _depth,
13889            )
13890        }
13891    }
13892    unsafe impl<
13893        T0: fidl::encoding::Encode<
13894                fidl::encoding::HandleType<
13895                    fidl::Resource,
13896                    { fidl::ObjectType::RESOURCE.into_raw() },
13897                    2147483648,
13898                >,
13899                fidl::encoding::DefaultFuchsiaResourceDialect,
13900            >,
13901    >
13902        fidl::encoding::Encode<
13903            StallResourceGetResponse,
13904            fidl::encoding::DefaultFuchsiaResourceDialect,
13905        > for (T0,)
13906    {
13907        #[inline]
13908        unsafe fn encode(
13909            self,
13910            encoder: &mut fidl::encoding::Encoder<
13911                '_,
13912                fidl::encoding::DefaultFuchsiaResourceDialect,
13913            >,
13914            offset: usize,
13915            depth: fidl::encoding::Depth,
13916        ) -> fidl::Result<()> {
13917            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13918            // Zero out padding regions. There's no need to apply masks
13919            // because the unmasked parts will be overwritten by fields.
13920            // Write the fields.
13921            self.0.encode(encoder, offset + 0, depth)?;
13922            Ok(())
13923        }
13924    }
13925
13926    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13927        for StallResourceGetResponse
13928    {
13929        #[inline(always)]
13930        fn new_empty() -> Self {
13931            Self {
13932                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13933            }
13934        }
13935
13936        #[inline]
13937        unsafe fn decode(
13938            &mut self,
13939            decoder: &mut fidl::encoding::Decoder<
13940                '_,
13941                fidl::encoding::DefaultFuchsiaResourceDialect,
13942            >,
13943            offset: usize,
13944            _depth: fidl::encoding::Depth,
13945        ) -> fidl::Result<()> {
13946            decoder.debug_check_bounds::<Self>(offset);
13947            // Verify that padding bytes are zero.
13948            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13949            Ok(())
13950        }
13951    }
13952
13953    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
13954        type Borrowed<'a> = &'a mut Self;
13955        fn take_or_borrow<'a>(
13956            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13957        ) -> Self::Borrowed<'a> {
13958            value
13959        }
13960    }
13961
13962    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
13963        type Owned = Self;
13964
13965        #[inline(always)]
13966        fn inline_align(_context: fidl::encoding::Context) -> usize {
13967            4
13968        }
13969
13970        #[inline(always)]
13971        fn inline_size(_context: fidl::encoding::Context) -> usize {
13972            4
13973        }
13974    }
13975
13976    unsafe impl
13977        fidl::encoding::Encode<
13978            TracingResourceGetResponse,
13979            fidl::encoding::DefaultFuchsiaResourceDialect,
13980        > for &mut TracingResourceGetResponse
13981    {
13982        #[inline]
13983        unsafe fn encode(
13984            self,
13985            encoder: &mut fidl::encoding::Encoder<
13986                '_,
13987                fidl::encoding::DefaultFuchsiaResourceDialect,
13988            >,
13989            offset: usize,
13990            _depth: fidl::encoding::Depth,
13991        ) -> fidl::Result<()> {
13992            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13993            // Delegate to tuple encoding.
13994            fidl::encoding::Encode::<
13995                TracingResourceGetResponse,
13996                fidl::encoding::DefaultFuchsiaResourceDialect,
13997            >::encode(
13998                (<fidl::encoding::HandleType<
13999                    fidl::Resource,
14000                    { fidl::ObjectType::RESOURCE.into_raw() },
14001                    2147483648,
14002                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14003                    &mut self.resource
14004                ),),
14005                encoder,
14006                offset,
14007                _depth,
14008            )
14009        }
14010    }
14011    unsafe impl<
14012        T0: fidl::encoding::Encode<
14013                fidl::encoding::HandleType<
14014                    fidl::Resource,
14015                    { fidl::ObjectType::RESOURCE.into_raw() },
14016                    2147483648,
14017                >,
14018                fidl::encoding::DefaultFuchsiaResourceDialect,
14019            >,
14020    >
14021        fidl::encoding::Encode<
14022            TracingResourceGetResponse,
14023            fidl::encoding::DefaultFuchsiaResourceDialect,
14024        > for (T0,)
14025    {
14026        #[inline]
14027        unsafe fn encode(
14028            self,
14029            encoder: &mut fidl::encoding::Encoder<
14030                '_,
14031                fidl::encoding::DefaultFuchsiaResourceDialect,
14032            >,
14033            offset: usize,
14034            depth: fidl::encoding::Depth,
14035        ) -> fidl::Result<()> {
14036            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
14037            // Zero out padding regions. There's no need to apply masks
14038            // because the unmasked parts will be overwritten by fields.
14039            // Write the fields.
14040            self.0.encode(encoder, offset + 0, depth)?;
14041            Ok(())
14042        }
14043    }
14044
14045    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14046        for TracingResourceGetResponse
14047    {
14048        #[inline(always)]
14049        fn new_empty() -> Self {
14050            Self {
14051                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14052            }
14053        }
14054
14055        #[inline]
14056        unsafe fn decode(
14057            &mut self,
14058            decoder: &mut fidl::encoding::Decoder<
14059                '_,
14060                fidl::encoding::DefaultFuchsiaResourceDialect,
14061            >,
14062            offset: usize,
14063            _depth: fidl::encoding::Depth,
14064        ) -> fidl::Result<()> {
14065            decoder.debug_check_bounds::<Self>(offset);
14066            // Verify that padding bytes are zero.
14067            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14068            Ok(())
14069        }
14070    }
14071
14072    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
14073        type Borrowed<'a> = &'a mut Self;
14074        fn take_or_borrow<'a>(
14075            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14076        ) -> Self::Borrowed<'a> {
14077            value
14078        }
14079    }
14080
14081    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
14082        type Owned = Self;
14083
14084        #[inline(always)]
14085        fn inline_align(_context: fidl::encoding::Context) -> usize {
14086            4
14087        }
14088
14089        #[inline(always)]
14090        fn inline_size(_context: fidl::encoding::Context) -> usize {
14091            4
14092        }
14093    }
14094
14095    unsafe impl
14096        fidl::encoding::Encode<
14097            VmexResourceGetResponse,
14098            fidl::encoding::DefaultFuchsiaResourceDialect,
14099        > for &mut VmexResourceGetResponse
14100    {
14101        #[inline]
14102        unsafe fn encode(
14103            self,
14104            encoder: &mut fidl::encoding::Encoder<
14105                '_,
14106                fidl::encoding::DefaultFuchsiaResourceDialect,
14107            >,
14108            offset: usize,
14109            _depth: fidl::encoding::Depth,
14110        ) -> fidl::Result<()> {
14111            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
14112            // Delegate to tuple encoding.
14113            fidl::encoding::Encode::<
14114                VmexResourceGetResponse,
14115                fidl::encoding::DefaultFuchsiaResourceDialect,
14116            >::encode(
14117                (<fidl::encoding::HandleType<
14118                    fidl::Resource,
14119                    { fidl::ObjectType::RESOURCE.into_raw() },
14120                    2147483648,
14121                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14122                    &mut self.resource
14123                ),),
14124                encoder,
14125                offset,
14126                _depth,
14127            )
14128        }
14129    }
14130    unsafe impl<
14131        T0: fidl::encoding::Encode<
14132                fidl::encoding::HandleType<
14133                    fidl::Resource,
14134                    { fidl::ObjectType::RESOURCE.into_raw() },
14135                    2147483648,
14136                >,
14137                fidl::encoding::DefaultFuchsiaResourceDialect,
14138            >,
14139    >
14140        fidl::encoding::Encode<
14141            VmexResourceGetResponse,
14142            fidl::encoding::DefaultFuchsiaResourceDialect,
14143        > for (T0,)
14144    {
14145        #[inline]
14146        unsafe fn encode(
14147            self,
14148            encoder: &mut fidl::encoding::Encoder<
14149                '_,
14150                fidl::encoding::DefaultFuchsiaResourceDialect,
14151            >,
14152            offset: usize,
14153            depth: fidl::encoding::Depth,
14154        ) -> fidl::Result<()> {
14155            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
14156            // Zero out padding regions. There's no need to apply masks
14157            // because the unmasked parts will be overwritten by fields.
14158            // Write the fields.
14159            self.0.encode(encoder, offset + 0, depth)?;
14160            Ok(())
14161        }
14162    }
14163
14164    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14165        for VmexResourceGetResponse
14166    {
14167        #[inline(always)]
14168        fn new_empty() -> Self {
14169            Self {
14170                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14171            }
14172        }
14173
14174        #[inline]
14175        unsafe fn decode(
14176            &mut self,
14177            decoder: &mut fidl::encoding::Decoder<
14178                '_,
14179                fidl::encoding::DefaultFuchsiaResourceDialect,
14180            >,
14181            offset: usize,
14182            _depth: fidl::encoding::Depth,
14183        ) -> fidl::Result<()> {
14184            decoder.debug_check_bounds::<Self>(offset);
14185            // Verify that padding bytes are zero.
14186            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14187            Ok(())
14188        }
14189    }
14190}