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        let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
231        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
232    }
233
234    pub fn into_channel(self) -> fidl::Channel {
235        self.client.into_channel()
236    }
237
238    /// Waits until an event arrives and returns it. It is safe for other
239    /// threads to make concurrent requests while waiting for an event.
240    pub fn wait_for_event(
241        &self,
242        deadline: zx::MonotonicInstant,
243    ) -> Result<CounterEvent, fidl::Error> {
244        CounterEvent::decode(self.client.wait_for_event(deadline)?)
245    }
246
247    /// Retrives a VMO containining summarized kcounter data. The vmo returned
248    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
249    pub fn r#get_inspect_vmo(
250        &self,
251        ___deadline: zx::MonotonicInstant,
252    ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
253        let _response =
254            self.client.send_query::<fidl::encoding::EmptyPayload, CounterGetInspectVmoResponse>(
255                (),
256                0x6ea9b2e6b2791b81,
257                fidl::encoding::DynamicFlags::empty(),
258                ___deadline,
259            )?;
260        Ok((_response.status, _response.buffer))
261    }
262
263    /// Request that the previously-returned VMO buffer's data be updated. The
264    /// data may not be updated if it was already recently updated (updates are
265    /// limited to an unspecified rate, but approximately every few seconds).
266    pub fn r#update_inspect_vmo(
267        &self,
268        ___deadline: zx::MonotonicInstant,
269    ) -> Result<i32, fidl::Error> {
270        let _response = self
271            .client
272            .send_query::<fidl::encoding::EmptyPayload, CounterUpdateInspectVmoResponse>(
273                (),
274                0x1d25eb7995a0539f,
275                fidl::encoding::DynamicFlags::empty(),
276                ___deadline,
277            )?;
278        Ok(_response.status)
279    }
280}
281
282#[cfg(target_os = "fuchsia")]
283impl From<CounterSynchronousProxy> for zx::Handle {
284    fn from(value: CounterSynchronousProxy) -> Self {
285        value.into_channel().into()
286    }
287}
288
289#[cfg(target_os = "fuchsia")]
290impl From<fidl::Channel> for CounterSynchronousProxy {
291    fn from(value: fidl::Channel) -> Self {
292        Self::new(value)
293    }
294}
295
296#[cfg(target_os = "fuchsia")]
297impl fidl::endpoints::FromClient for CounterSynchronousProxy {
298    type Protocol = CounterMarker;
299
300    fn from_client(value: fidl::endpoints::ClientEnd<CounterMarker>) -> Self {
301        Self::new(value.into_channel())
302    }
303}
304
305#[derive(Debug, Clone)]
306pub struct CounterProxy {
307    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
308}
309
310impl fidl::endpoints::Proxy for CounterProxy {
311    type Protocol = CounterMarker;
312
313    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
314        Self::new(inner)
315    }
316
317    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
318        self.client.into_channel().map_err(|client| Self { client })
319    }
320
321    fn as_channel(&self) -> &::fidl::AsyncChannel {
322        self.client.as_channel()
323    }
324}
325
326impl CounterProxy {
327    /// Create a new Proxy for fuchsia.kernel/Counter.
328    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
329        let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
330        Self { client: fidl::client::Client::new(channel, protocol_name) }
331    }
332
333    /// Get a Stream of events from the remote end of the protocol.
334    ///
335    /// # Panics
336    ///
337    /// Panics if the event stream was already taken.
338    pub fn take_event_stream(&self) -> CounterEventStream {
339        CounterEventStream { event_receiver: self.client.take_event_receiver() }
340    }
341
342    /// Retrives a VMO containining summarized kcounter data. The vmo returned
343    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
344    pub fn r#get_inspect_vmo(
345        &self,
346    ) -> fidl::client::QueryResponseFut<
347        (i32, fidl_fuchsia_mem::Buffer),
348        fidl::encoding::DefaultFuchsiaResourceDialect,
349    > {
350        CounterProxyInterface::r#get_inspect_vmo(self)
351    }
352
353    /// Request that the previously-returned VMO buffer's data be updated. The
354    /// data may not be updated if it was already recently updated (updates are
355    /// limited to an unspecified rate, but approximately every few seconds).
356    pub fn r#update_inspect_vmo(
357        &self,
358    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
359        CounterProxyInterface::r#update_inspect_vmo(self)
360    }
361}
362
363impl CounterProxyInterface for CounterProxy {
364    type GetInspectVmoResponseFut = fidl::client::QueryResponseFut<
365        (i32, fidl_fuchsia_mem::Buffer),
366        fidl::encoding::DefaultFuchsiaResourceDialect,
367    >;
368    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut {
369        fn _decode(
370            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
371        ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
372            let _response = fidl::client::decode_transaction_body::<
373                CounterGetInspectVmoResponse,
374                fidl::encoding::DefaultFuchsiaResourceDialect,
375                0x6ea9b2e6b2791b81,
376            >(_buf?)?;
377            Ok((_response.status, _response.buffer))
378        }
379        self.client
380            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, fidl_fuchsia_mem::Buffer)>(
381                (),
382                0x6ea9b2e6b2791b81,
383                fidl::encoding::DynamicFlags::empty(),
384                _decode,
385            )
386    }
387
388    type UpdateInspectVmoResponseFut =
389        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
390    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut {
391        fn _decode(
392            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
393        ) -> Result<i32, fidl::Error> {
394            let _response = fidl::client::decode_transaction_body::<
395                CounterUpdateInspectVmoResponse,
396                fidl::encoding::DefaultFuchsiaResourceDialect,
397                0x1d25eb7995a0539f,
398            >(_buf?)?;
399            Ok(_response.status)
400        }
401        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
402            (),
403            0x1d25eb7995a0539f,
404            fidl::encoding::DynamicFlags::empty(),
405            _decode,
406        )
407    }
408}
409
410pub struct CounterEventStream {
411    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
412}
413
414impl std::marker::Unpin for CounterEventStream {}
415
416impl futures::stream::FusedStream for CounterEventStream {
417    fn is_terminated(&self) -> bool {
418        self.event_receiver.is_terminated()
419    }
420}
421
422impl futures::Stream for CounterEventStream {
423    type Item = Result<CounterEvent, fidl::Error>;
424
425    fn poll_next(
426        mut self: std::pin::Pin<&mut Self>,
427        cx: &mut std::task::Context<'_>,
428    ) -> std::task::Poll<Option<Self::Item>> {
429        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
430            &mut self.event_receiver,
431            cx
432        )?) {
433            Some(buf) => std::task::Poll::Ready(Some(CounterEvent::decode(buf))),
434            None => std::task::Poll::Ready(None),
435        }
436    }
437}
438
439#[derive(Debug)]
440pub enum CounterEvent {}
441
442impl CounterEvent {
443    /// Decodes a message buffer as a [`CounterEvent`].
444    fn decode(
445        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
446    ) -> Result<CounterEvent, fidl::Error> {
447        let (bytes, _handles) = buf.split_mut();
448        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
449        debug_assert_eq!(tx_header.tx_id, 0);
450        match tx_header.ordinal {
451            _ => Err(fidl::Error::UnknownOrdinal {
452                ordinal: tx_header.ordinal,
453                protocol_name: <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
454            }),
455        }
456    }
457}
458
459/// A Stream of incoming requests for fuchsia.kernel/Counter.
460pub struct CounterRequestStream {
461    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
462    is_terminated: bool,
463}
464
465impl std::marker::Unpin for CounterRequestStream {}
466
467impl futures::stream::FusedStream for CounterRequestStream {
468    fn is_terminated(&self) -> bool {
469        self.is_terminated
470    }
471}
472
473impl fidl::endpoints::RequestStream for CounterRequestStream {
474    type Protocol = CounterMarker;
475    type ControlHandle = CounterControlHandle;
476
477    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
478        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
479    }
480
481    fn control_handle(&self) -> Self::ControlHandle {
482        CounterControlHandle { inner: self.inner.clone() }
483    }
484
485    fn into_inner(
486        self,
487    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
488    {
489        (self.inner, self.is_terminated)
490    }
491
492    fn from_inner(
493        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
494        is_terminated: bool,
495    ) -> Self {
496        Self { inner, is_terminated }
497    }
498}
499
500impl futures::Stream for CounterRequestStream {
501    type Item = Result<CounterRequest, fidl::Error>;
502
503    fn poll_next(
504        mut self: std::pin::Pin<&mut Self>,
505        cx: &mut std::task::Context<'_>,
506    ) -> std::task::Poll<Option<Self::Item>> {
507        let this = &mut *self;
508        if this.inner.check_shutdown(cx) {
509            this.is_terminated = true;
510            return std::task::Poll::Ready(None);
511        }
512        if this.is_terminated {
513            panic!("polled CounterRequestStream after completion");
514        }
515        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
516            |bytes, handles| {
517                match this.inner.channel().read_etc(cx, bytes, handles) {
518                    std::task::Poll::Ready(Ok(())) => {}
519                    std::task::Poll::Pending => return std::task::Poll::Pending,
520                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
521                        this.is_terminated = true;
522                        return std::task::Poll::Ready(None);
523                    }
524                    std::task::Poll::Ready(Err(e)) => {
525                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
526                            e.into(),
527                        ))));
528                    }
529                }
530
531                // A message has been received from the channel
532                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
533
534                std::task::Poll::Ready(Some(match header.ordinal {
535                    0x6ea9b2e6b2791b81 => {
536                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
537                        let mut req = fidl::new_empty!(
538                            fidl::encoding::EmptyPayload,
539                            fidl::encoding::DefaultFuchsiaResourceDialect
540                        );
541                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
542                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
543                        Ok(CounterRequest::GetInspectVmo {
544                            responder: CounterGetInspectVmoResponder {
545                                control_handle: std::mem::ManuallyDrop::new(control_handle),
546                                tx_id: header.tx_id,
547                            },
548                        })
549                    }
550                    0x1d25eb7995a0539f => {
551                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
552                        let mut req = fidl::new_empty!(
553                            fidl::encoding::EmptyPayload,
554                            fidl::encoding::DefaultFuchsiaResourceDialect
555                        );
556                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
557                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
558                        Ok(CounterRequest::UpdateInspectVmo {
559                            responder: CounterUpdateInspectVmoResponder {
560                                control_handle: std::mem::ManuallyDrop::new(control_handle),
561                                tx_id: header.tx_id,
562                            },
563                        })
564                    }
565                    _ => Err(fidl::Error::UnknownOrdinal {
566                        ordinal: header.ordinal,
567                        protocol_name:
568                            <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
569                    }),
570                }))
571            },
572        )
573    }
574}
575
576/// Protocol for retrieving kcounter information.
577#[derive(Debug)]
578pub enum CounterRequest {
579    /// Retrives a VMO containining summarized kcounter data. The vmo returned
580    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
581    GetInspectVmo { responder: CounterGetInspectVmoResponder },
582    /// Request that the previously-returned VMO buffer's data be updated. The
583    /// data may not be updated if it was already recently updated (updates are
584    /// limited to an unspecified rate, but approximately every few seconds).
585    UpdateInspectVmo { responder: CounterUpdateInspectVmoResponder },
586}
587
588impl CounterRequest {
589    #[allow(irrefutable_let_patterns)]
590    pub fn into_get_inspect_vmo(self) -> Option<(CounterGetInspectVmoResponder)> {
591        if let CounterRequest::GetInspectVmo { responder } = self {
592            Some((responder))
593        } else {
594            None
595        }
596    }
597
598    #[allow(irrefutable_let_patterns)]
599    pub fn into_update_inspect_vmo(self) -> Option<(CounterUpdateInspectVmoResponder)> {
600        if let CounterRequest::UpdateInspectVmo { responder } = self {
601            Some((responder))
602        } else {
603            None
604        }
605    }
606
607    /// Name of the method defined in FIDL
608    pub fn method_name(&self) -> &'static str {
609        match *self {
610            CounterRequest::GetInspectVmo { .. } => "get_inspect_vmo",
611            CounterRequest::UpdateInspectVmo { .. } => "update_inspect_vmo",
612        }
613    }
614}
615
616#[derive(Debug, Clone)]
617pub struct CounterControlHandle {
618    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
619}
620
621impl fidl::endpoints::ControlHandle for CounterControlHandle {
622    fn shutdown(&self) {
623        self.inner.shutdown()
624    }
625    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
626        self.inner.shutdown_with_epitaph(status)
627    }
628
629    fn is_closed(&self) -> bool {
630        self.inner.channel().is_closed()
631    }
632    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
633        self.inner.channel().on_closed()
634    }
635
636    #[cfg(target_os = "fuchsia")]
637    fn signal_peer(
638        &self,
639        clear_mask: zx::Signals,
640        set_mask: zx::Signals,
641    ) -> Result<(), zx_status::Status> {
642        use fidl::Peered;
643        self.inner.channel().signal_peer(clear_mask, set_mask)
644    }
645}
646
647impl CounterControlHandle {}
648
649#[must_use = "FIDL methods require a response to be sent"]
650#[derive(Debug)]
651pub struct CounterGetInspectVmoResponder {
652    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
653    tx_id: u32,
654}
655
656/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
657/// if the responder is dropped without sending a response, so that the client
658/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
659impl std::ops::Drop for CounterGetInspectVmoResponder {
660    fn drop(&mut self) {
661        self.control_handle.shutdown();
662        // Safety: drops once, never accessed again
663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
664    }
665}
666
667impl fidl::endpoints::Responder for CounterGetInspectVmoResponder {
668    type ControlHandle = CounterControlHandle;
669
670    fn control_handle(&self) -> &CounterControlHandle {
671        &self.control_handle
672    }
673
674    fn drop_without_shutdown(mut self) {
675        // Safety: drops once, never accessed again due to mem::forget
676        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
677        // Prevent Drop from running (which would shut down the channel)
678        std::mem::forget(self);
679    }
680}
681
682impl CounterGetInspectVmoResponder {
683    /// Sends a response to the FIDL transaction.
684    ///
685    /// Sets the channel to shutdown if an error occurs.
686    pub fn send(
687        self,
688        mut status: i32,
689        mut buffer: fidl_fuchsia_mem::Buffer,
690    ) -> Result<(), fidl::Error> {
691        let _result = self.send_raw(status, buffer);
692        if _result.is_err() {
693            self.control_handle.shutdown();
694        }
695        self.drop_without_shutdown();
696        _result
697    }
698
699    /// Similar to "send" but does not shutdown the channel if an error occurs.
700    pub fn send_no_shutdown_on_err(
701        self,
702        mut status: i32,
703        mut buffer: fidl_fuchsia_mem::Buffer,
704    ) -> Result<(), fidl::Error> {
705        let _result = self.send_raw(status, buffer);
706        self.drop_without_shutdown();
707        _result
708    }
709
710    fn send_raw(
711        &self,
712        mut status: i32,
713        mut buffer: fidl_fuchsia_mem::Buffer,
714    ) -> Result<(), fidl::Error> {
715        self.control_handle.inner.send::<CounterGetInspectVmoResponse>(
716            (status, &mut buffer),
717            self.tx_id,
718            0x6ea9b2e6b2791b81,
719            fidl::encoding::DynamicFlags::empty(),
720        )
721    }
722}
723
724#[must_use = "FIDL methods require a response to be sent"]
725#[derive(Debug)]
726pub struct CounterUpdateInspectVmoResponder {
727    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
728    tx_id: u32,
729}
730
731/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
732/// if the responder is dropped without sending a response, so that the client
733/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
734impl std::ops::Drop for CounterUpdateInspectVmoResponder {
735    fn drop(&mut self) {
736        self.control_handle.shutdown();
737        // Safety: drops once, never accessed again
738        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
739    }
740}
741
742impl fidl::endpoints::Responder for CounterUpdateInspectVmoResponder {
743    type ControlHandle = CounterControlHandle;
744
745    fn control_handle(&self) -> &CounterControlHandle {
746        &self.control_handle
747    }
748
749    fn drop_without_shutdown(mut self) {
750        // Safety: drops once, never accessed again due to mem::forget
751        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
752        // Prevent Drop from running (which would shut down the channel)
753        std::mem::forget(self);
754    }
755}
756
757impl CounterUpdateInspectVmoResponder {
758    /// Sends a response to the FIDL transaction.
759    ///
760    /// Sets the channel to shutdown if an error occurs.
761    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
762        let _result = self.send_raw(status);
763        if _result.is_err() {
764            self.control_handle.shutdown();
765        }
766        self.drop_without_shutdown();
767        _result
768    }
769
770    /// Similar to "send" but does not shutdown the channel if an error occurs.
771    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
772        let _result = self.send_raw(status);
773        self.drop_without_shutdown();
774        _result
775    }
776
777    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
778        self.control_handle.inner.send::<CounterUpdateInspectVmoResponse>(
779            (status,),
780            self.tx_id,
781            0x1d25eb7995a0539f,
782            fidl::encoding::DynamicFlags::empty(),
783        )
784    }
785}
786
787#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
788pub struct CpuResourceMarker;
789
790impl fidl::endpoints::ProtocolMarker for CpuResourceMarker {
791    type Proxy = CpuResourceProxy;
792    type RequestStream = CpuResourceRequestStream;
793    #[cfg(target_os = "fuchsia")]
794    type SynchronousProxy = CpuResourceSynchronousProxy;
795
796    const DEBUG_NAME: &'static str = "fuchsia.kernel.CpuResource";
797}
798impl fidl::endpoints::DiscoverableProtocolMarker for CpuResourceMarker {}
799
800pub trait CpuResourceProxyInterface: Send + Sync {
801    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
802    fn r#get(&self) -> Self::GetResponseFut;
803}
804#[derive(Debug)]
805#[cfg(target_os = "fuchsia")]
806pub struct CpuResourceSynchronousProxy {
807    client: fidl::client::sync::Client,
808}
809
810#[cfg(target_os = "fuchsia")]
811impl fidl::endpoints::SynchronousProxy for CpuResourceSynchronousProxy {
812    type Proxy = CpuResourceProxy;
813    type Protocol = CpuResourceMarker;
814
815    fn from_channel(inner: fidl::Channel) -> Self {
816        Self::new(inner)
817    }
818
819    fn into_channel(self) -> fidl::Channel {
820        self.client.into_channel()
821    }
822
823    fn as_channel(&self) -> &fidl::Channel {
824        self.client.as_channel()
825    }
826}
827
828#[cfg(target_os = "fuchsia")]
829impl CpuResourceSynchronousProxy {
830    pub fn new(channel: fidl::Channel) -> Self {
831        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
832        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
833    }
834
835    pub fn into_channel(self) -> fidl::Channel {
836        self.client.into_channel()
837    }
838
839    /// Waits until an event arrives and returns it. It is safe for other
840    /// threads to make concurrent requests while waiting for an event.
841    pub fn wait_for_event(
842        &self,
843        deadline: zx::MonotonicInstant,
844    ) -> Result<CpuResourceEvent, fidl::Error> {
845        CpuResourceEvent::decode(self.client.wait_for_event(deadline)?)
846    }
847
848    /// Get a CPU resource handle.
849    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
850        let _response =
851            self.client.send_query::<fidl::encoding::EmptyPayload, CpuResourceGetResponse>(
852                (),
853                0x41e1103acf4215e4,
854                fidl::encoding::DynamicFlags::empty(),
855                ___deadline,
856            )?;
857        Ok(_response.resource)
858    }
859}
860
861#[cfg(target_os = "fuchsia")]
862impl From<CpuResourceSynchronousProxy> for zx::Handle {
863    fn from(value: CpuResourceSynchronousProxy) -> Self {
864        value.into_channel().into()
865    }
866}
867
868#[cfg(target_os = "fuchsia")]
869impl From<fidl::Channel> for CpuResourceSynchronousProxy {
870    fn from(value: fidl::Channel) -> Self {
871        Self::new(value)
872    }
873}
874
875#[cfg(target_os = "fuchsia")]
876impl fidl::endpoints::FromClient for CpuResourceSynchronousProxy {
877    type Protocol = CpuResourceMarker;
878
879    fn from_client(value: fidl::endpoints::ClientEnd<CpuResourceMarker>) -> Self {
880        Self::new(value.into_channel())
881    }
882}
883
884#[derive(Debug, Clone)]
885pub struct CpuResourceProxy {
886    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
887}
888
889impl fidl::endpoints::Proxy for CpuResourceProxy {
890    type Protocol = CpuResourceMarker;
891
892    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
893        Self::new(inner)
894    }
895
896    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
897        self.client.into_channel().map_err(|client| Self { client })
898    }
899
900    fn as_channel(&self) -> &::fidl::AsyncChannel {
901        self.client.as_channel()
902    }
903}
904
905impl CpuResourceProxy {
906    /// Create a new Proxy for fuchsia.kernel/CpuResource.
907    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
908        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
909        Self { client: fidl::client::Client::new(channel, protocol_name) }
910    }
911
912    /// Get a Stream of events from the remote end of the protocol.
913    ///
914    /// # Panics
915    ///
916    /// Panics if the event stream was already taken.
917    pub fn take_event_stream(&self) -> CpuResourceEventStream {
918        CpuResourceEventStream { event_receiver: self.client.take_event_receiver() }
919    }
920
921    /// Get a CPU resource handle.
922    pub fn r#get(
923        &self,
924    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
925    {
926        CpuResourceProxyInterface::r#get(self)
927    }
928}
929
930impl CpuResourceProxyInterface for CpuResourceProxy {
931    type GetResponseFut = fidl::client::QueryResponseFut<
932        fidl::Resource,
933        fidl::encoding::DefaultFuchsiaResourceDialect,
934    >;
935    fn r#get(&self) -> Self::GetResponseFut {
936        fn _decode(
937            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
938        ) -> Result<fidl::Resource, fidl::Error> {
939            let _response = fidl::client::decode_transaction_body::<
940                CpuResourceGetResponse,
941                fidl::encoding::DefaultFuchsiaResourceDialect,
942                0x41e1103acf4215e4,
943            >(_buf?)?;
944            Ok(_response.resource)
945        }
946        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
947            (),
948            0x41e1103acf4215e4,
949            fidl::encoding::DynamicFlags::empty(),
950            _decode,
951        )
952    }
953}
954
955pub struct CpuResourceEventStream {
956    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
957}
958
959impl std::marker::Unpin for CpuResourceEventStream {}
960
961impl futures::stream::FusedStream for CpuResourceEventStream {
962    fn is_terminated(&self) -> bool {
963        self.event_receiver.is_terminated()
964    }
965}
966
967impl futures::Stream for CpuResourceEventStream {
968    type Item = Result<CpuResourceEvent, fidl::Error>;
969
970    fn poll_next(
971        mut self: std::pin::Pin<&mut Self>,
972        cx: &mut std::task::Context<'_>,
973    ) -> std::task::Poll<Option<Self::Item>> {
974        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
975            &mut self.event_receiver,
976            cx
977        )?) {
978            Some(buf) => std::task::Poll::Ready(Some(CpuResourceEvent::decode(buf))),
979            None => std::task::Poll::Ready(None),
980        }
981    }
982}
983
984#[derive(Debug)]
985pub enum CpuResourceEvent {}
986
987impl CpuResourceEvent {
988    /// Decodes a message buffer as a [`CpuResourceEvent`].
989    fn decode(
990        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
991    ) -> Result<CpuResourceEvent, fidl::Error> {
992        let (bytes, _handles) = buf.split_mut();
993        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
994        debug_assert_eq!(tx_header.tx_id, 0);
995        match tx_header.ordinal {
996            _ => Err(fidl::Error::UnknownOrdinal {
997                ordinal: tx_header.ordinal,
998                protocol_name: <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
999            }),
1000        }
1001    }
1002}
1003
1004/// A Stream of incoming requests for fuchsia.kernel/CpuResource.
1005pub struct CpuResourceRequestStream {
1006    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1007    is_terminated: bool,
1008}
1009
1010impl std::marker::Unpin for CpuResourceRequestStream {}
1011
1012impl futures::stream::FusedStream for CpuResourceRequestStream {
1013    fn is_terminated(&self) -> bool {
1014        self.is_terminated
1015    }
1016}
1017
1018impl fidl::endpoints::RequestStream for CpuResourceRequestStream {
1019    type Protocol = CpuResourceMarker;
1020    type ControlHandle = CpuResourceControlHandle;
1021
1022    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1023        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1024    }
1025
1026    fn control_handle(&self) -> Self::ControlHandle {
1027        CpuResourceControlHandle { inner: self.inner.clone() }
1028    }
1029
1030    fn into_inner(
1031        self,
1032    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1033    {
1034        (self.inner, self.is_terminated)
1035    }
1036
1037    fn from_inner(
1038        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1039        is_terminated: bool,
1040    ) -> Self {
1041        Self { inner, is_terminated }
1042    }
1043}
1044
1045impl futures::Stream for CpuResourceRequestStream {
1046    type Item = Result<CpuResourceRequest, fidl::Error>;
1047
1048    fn poll_next(
1049        mut self: std::pin::Pin<&mut Self>,
1050        cx: &mut std::task::Context<'_>,
1051    ) -> std::task::Poll<Option<Self::Item>> {
1052        let this = &mut *self;
1053        if this.inner.check_shutdown(cx) {
1054            this.is_terminated = true;
1055            return std::task::Poll::Ready(None);
1056        }
1057        if this.is_terminated {
1058            panic!("polled CpuResourceRequestStream after completion");
1059        }
1060        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1061            |bytes, handles| {
1062                match this.inner.channel().read_etc(cx, bytes, handles) {
1063                    std::task::Poll::Ready(Ok(())) => {}
1064                    std::task::Poll::Pending => return std::task::Poll::Pending,
1065                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1066                        this.is_terminated = true;
1067                        return std::task::Poll::Ready(None);
1068                    }
1069                    std::task::Poll::Ready(Err(e)) => {
1070                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1071                            e.into(),
1072                        ))));
1073                    }
1074                }
1075
1076                // A message has been received from the channel
1077                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1078
1079                std::task::Poll::Ready(Some(match header.ordinal {
1080                    0x41e1103acf4215e4 => {
1081                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1082                        let mut req = fidl::new_empty!(
1083                            fidl::encoding::EmptyPayload,
1084                            fidl::encoding::DefaultFuchsiaResourceDialect
1085                        );
1086                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1087                        let control_handle = CpuResourceControlHandle { inner: this.inner.clone() };
1088                        Ok(CpuResourceRequest::Get {
1089                            responder: CpuResourceGetResponder {
1090                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1091                                tx_id: header.tx_id,
1092                            },
1093                        })
1094                    }
1095                    _ => Err(fidl::Error::UnknownOrdinal {
1096                        ordinal: header.ordinal,
1097                        protocol_name:
1098                            <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1099                    }),
1100                }))
1101            },
1102        )
1103    }
1104}
1105
1106/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
1107/// `ZX_RSRC_SYSTEM_CPU_BASE`.
1108#[derive(Debug)]
1109pub enum CpuResourceRequest {
1110    /// Get a CPU resource handle.
1111    Get { responder: CpuResourceGetResponder },
1112}
1113
1114impl CpuResourceRequest {
1115    #[allow(irrefutable_let_patterns)]
1116    pub fn into_get(self) -> Option<(CpuResourceGetResponder)> {
1117        if let CpuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
1118    }
1119
1120    /// Name of the method defined in FIDL
1121    pub fn method_name(&self) -> &'static str {
1122        match *self {
1123            CpuResourceRequest::Get { .. } => "get",
1124        }
1125    }
1126}
1127
1128#[derive(Debug, Clone)]
1129pub struct CpuResourceControlHandle {
1130    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1131}
1132
1133impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1134    fn shutdown(&self) {
1135        self.inner.shutdown()
1136    }
1137    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1138        self.inner.shutdown_with_epitaph(status)
1139    }
1140
1141    fn is_closed(&self) -> bool {
1142        self.inner.channel().is_closed()
1143    }
1144    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1145        self.inner.channel().on_closed()
1146    }
1147
1148    #[cfg(target_os = "fuchsia")]
1149    fn signal_peer(
1150        &self,
1151        clear_mask: zx::Signals,
1152        set_mask: zx::Signals,
1153    ) -> Result<(), zx_status::Status> {
1154        use fidl::Peered;
1155        self.inner.channel().signal_peer(clear_mask, set_mask)
1156    }
1157}
1158
1159impl CpuResourceControlHandle {}
1160
1161#[must_use = "FIDL methods require a response to be sent"]
1162#[derive(Debug)]
1163pub struct CpuResourceGetResponder {
1164    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1165    tx_id: u32,
1166}
1167
1168/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1169/// if the responder is dropped without sending a response, so that the client
1170/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1171impl std::ops::Drop for CpuResourceGetResponder {
1172    fn drop(&mut self) {
1173        self.control_handle.shutdown();
1174        // Safety: drops once, never accessed again
1175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1176    }
1177}
1178
1179impl fidl::endpoints::Responder for CpuResourceGetResponder {
1180    type ControlHandle = CpuResourceControlHandle;
1181
1182    fn control_handle(&self) -> &CpuResourceControlHandle {
1183        &self.control_handle
1184    }
1185
1186    fn drop_without_shutdown(mut self) {
1187        // Safety: drops once, never accessed again due to mem::forget
1188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189        // Prevent Drop from running (which would shut down the channel)
1190        std::mem::forget(self);
1191    }
1192}
1193
1194impl CpuResourceGetResponder {
1195    /// Sends a response to the FIDL transaction.
1196    ///
1197    /// Sets the channel to shutdown if an error occurs.
1198    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1199        let _result = self.send_raw(resource);
1200        if _result.is_err() {
1201            self.control_handle.shutdown();
1202        }
1203        self.drop_without_shutdown();
1204        _result
1205    }
1206
1207    /// Similar to "send" but does not shutdown the channel if an error occurs.
1208    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1209        let _result = self.send_raw(resource);
1210        self.drop_without_shutdown();
1211        _result
1212    }
1213
1214    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1215        self.control_handle.inner.send::<CpuResourceGetResponse>(
1216            (resource,),
1217            self.tx_id,
1218            0x41e1103acf4215e4,
1219            fidl::encoding::DynamicFlags::empty(),
1220        )
1221    }
1222}
1223
1224#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1225pub struct DebugBrokerMarker;
1226
1227impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1228    type Proxy = DebugBrokerProxy;
1229    type RequestStream = DebugBrokerRequestStream;
1230    #[cfg(target_os = "fuchsia")]
1231    type SynchronousProxy = DebugBrokerSynchronousProxy;
1232
1233    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1234}
1235impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1236
1237pub trait DebugBrokerProxyInterface: Send + Sync {
1238    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1239    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1240    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1241    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1242}
1243#[derive(Debug)]
1244#[cfg(target_os = "fuchsia")]
1245pub struct DebugBrokerSynchronousProxy {
1246    client: fidl::client::sync::Client,
1247}
1248
1249#[cfg(target_os = "fuchsia")]
1250impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1251    type Proxy = DebugBrokerProxy;
1252    type Protocol = DebugBrokerMarker;
1253
1254    fn from_channel(inner: fidl::Channel) -> Self {
1255        Self::new(inner)
1256    }
1257
1258    fn into_channel(self) -> fidl::Channel {
1259        self.client.into_channel()
1260    }
1261
1262    fn as_channel(&self) -> &fidl::Channel {
1263        self.client.as_channel()
1264    }
1265}
1266
1267#[cfg(target_os = "fuchsia")]
1268impl DebugBrokerSynchronousProxy {
1269    pub fn new(channel: fidl::Channel) -> Self {
1270        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1271        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1272    }
1273
1274    pub fn into_channel(self) -> fidl::Channel {
1275        self.client.into_channel()
1276    }
1277
1278    /// Waits until an event arrives and returns it. It is safe for other
1279    /// threads to make concurrent requests while waiting for an event.
1280    pub fn wait_for_event(
1281        &self,
1282        deadline: zx::MonotonicInstant,
1283    ) -> Result<DebugBrokerEvent, fidl::Error> {
1284        DebugBrokerEvent::decode(self.client.wait_for_event(deadline)?)
1285    }
1286
1287    /// Pass debug command through to the kernel shell.
1288    /// Look at zx_debug_send_command syscall handling to find valid values.
1289    pub fn r#send_debug_command(
1290        &self,
1291        mut command: &str,
1292        ___deadline: zx::MonotonicInstant,
1293    ) -> Result<i32, fidl::Error> {
1294        let _response = self
1295            .client
1296            .send_query::<DebugBrokerSendDebugCommandRequest, DebugBrokerSendDebugCommandResponse>(
1297                (command,),
1298                0x1ee270f83b5d6ff6,
1299                fidl::encoding::DynamicFlags::empty(),
1300                ___deadline,
1301            )?;
1302        Ok(_response.status)
1303    }
1304
1305    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1306    pub fn r#set_tracing_enabled(
1307        &self,
1308        mut enabled: bool,
1309        ___deadline: zx::MonotonicInstant,
1310    ) -> Result<i32, fidl::Error> {
1311        let _response = self.client.send_query::<
1312            DebugBrokerSetTracingEnabledRequest,
1313            DebugBrokerSetTracingEnabledResponse,
1314        >(
1315            (enabled,),
1316            0x12e368d05329b30e,
1317            fidl::encoding::DynamicFlags::empty(),
1318            ___deadline,
1319        )?;
1320        Ok(_response.status)
1321    }
1322}
1323
1324#[cfg(target_os = "fuchsia")]
1325impl From<DebugBrokerSynchronousProxy> for zx::Handle {
1326    fn from(value: DebugBrokerSynchronousProxy) -> Self {
1327        value.into_channel().into()
1328    }
1329}
1330
1331#[cfg(target_os = "fuchsia")]
1332impl From<fidl::Channel> for DebugBrokerSynchronousProxy {
1333    fn from(value: fidl::Channel) -> Self {
1334        Self::new(value)
1335    }
1336}
1337
1338#[cfg(target_os = "fuchsia")]
1339impl fidl::endpoints::FromClient for DebugBrokerSynchronousProxy {
1340    type Protocol = DebugBrokerMarker;
1341
1342    fn from_client(value: fidl::endpoints::ClientEnd<DebugBrokerMarker>) -> Self {
1343        Self::new(value.into_channel())
1344    }
1345}
1346
1347#[derive(Debug, Clone)]
1348pub struct DebugBrokerProxy {
1349    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1350}
1351
1352impl fidl::endpoints::Proxy for DebugBrokerProxy {
1353    type Protocol = DebugBrokerMarker;
1354
1355    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1356        Self::new(inner)
1357    }
1358
1359    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1360        self.client.into_channel().map_err(|client| Self { client })
1361    }
1362
1363    fn as_channel(&self) -> &::fidl::AsyncChannel {
1364        self.client.as_channel()
1365    }
1366}
1367
1368impl DebugBrokerProxy {
1369    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1370    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1371        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1372        Self { client: fidl::client::Client::new(channel, protocol_name) }
1373    }
1374
1375    /// Get a Stream of events from the remote end of the protocol.
1376    ///
1377    /// # Panics
1378    ///
1379    /// Panics if the event stream was already taken.
1380    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1381        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1382    }
1383
1384    /// Pass debug command through to the kernel shell.
1385    /// Look at zx_debug_send_command syscall handling to find valid values.
1386    pub fn r#send_debug_command(
1387        &self,
1388        mut command: &str,
1389    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1390        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1391    }
1392
1393    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1394    pub fn r#set_tracing_enabled(
1395        &self,
1396        mut enabled: bool,
1397    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1398        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1399    }
1400}
1401
1402impl DebugBrokerProxyInterface for DebugBrokerProxy {
1403    type SendDebugCommandResponseFut =
1404        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1405    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1406        fn _decode(
1407            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1408        ) -> Result<i32, fidl::Error> {
1409            let _response = fidl::client::decode_transaction_body::<
1410                DebugBrokerSendDebugCommandResponse,
1411                fidl::encoding::DefaultFuchsiaResourceDialect,
1412                0x1ee270f83b5d6ff6,
1413            >(_buf?)?;
1414            Ok(_response.status)
1415        }
1416        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1417            (command,),
1418            0x1ee270f83b5d6ff6,
1419            fidl::encoding::DynamicFlags::empty(),
1420            _decode,
1421        )
1422    }
1423
1424    type SetTracingEnabledResponseFut =
1425        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1426    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1427        fn _decode(
1428            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1429        ) -> Result<i32, fidl::Error> {
1430            let _response = fidl::client::decode_transaction_body::<
1431                DebugBrokerSetTracingEnabledResponse,
1432                fidl::encoding::DefaultFuchsiaResourceDialect,
1433                0x12e368d05329b30e,
1434            >(_buf?)?;
1435            Ok(_response.status)
1436        }
1437        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1438            (enabled,),
1439            0x12e368d05329b30e,
1440            fidl::encoding::DynamicFlags::empty(),
1441            _decode,
1442        )
1443    }
1444}
1445
1446pub struct DebugBrokerEventStream {
1447    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1448}
1449
1450impl std::marker::Unpin for DebugBrokerEventStream {}
1451
1452impl futures::stream::FusedStream for DebugBrokerEventStream {
1453    fn is_terminated(&self) -> bool {
1454        self.event_receiver.is_terminated()
1455    }
1456}
1457
1458impl futures::Stream for DebugBrokerEventStream {
1459    type Item = Result<DebugBrokerEvent, fidl::Error>;
1460
1461    fn poll_next(
1462        mut self: std::pin::Pin<&mut Self>,
1463        cx: &mut std::task::Context<'_>,
1464    ) -> std::task::Poll<Option<Self::Item>> {
1465        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1466            &mut self.event_receiver,
1467            cx
1468        )?) {
1469            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1470            None => std::task::Poll::Ready(None),
1471        }
1472    }
1473}
1474
1475#[derive(Debug)]
1476pub enum DebugBrokerEvent {}
1477
1478impl DebugBrokerEvent {
1479    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1480    fn decode(
1481        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1482    ) -> Result<DebugBrokerEvent, fidl::Error> {
1483        let (bytes, _handles) = buf.split_mut();
1484        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1485        debug_assert_eq!(tx_header.tx_id, 0);
1486        match tx_header.ordinal {
1487            _ => Err(fidl::Error::UnknownOrdinal {
1488                ordinal: tx_header.ordinal,
1489                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1490            }),
1491        }
1492    }
1493}
1494
1495/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1496pub struct DebugBrokerRequestStream {
1497    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1498    is_terminated: bool,
1499}
1500
1501impl std::marker::Unpin for DebugBrokerRequestStream {}
1502
1503impl futures::stream::FusedStream for DebugBrokerRequestStream {
1504    fn is_terminated(&self) -> bool {
1505        self.is_terminated
1506    }
1507}
1508
1509impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1510    type Protocol = DebugBrokerMarker;
1511    type ControlHandle = DebugBrokerControlHandle;
1512
1513    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1514        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1515    }
1516
1517    fn control_handle(&self) -> Self::ControlHandle {
1518        DebugBrokerControlHandle { inner: self.inner.clone() }
1519    }
1520
1521    fn into_inner(
1522        self,
1523    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1524    {
1525        (self.inner, self.is_terminated)
1526    }
1527
1528    fn from_inner(
1529        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1530        is_terminated: bool,
1531    ) -> Self {
1532        Self { inner, is_terminated }
1533    }
1534}
1535
1536impl futures::Stream for DebugBrokerRequestStream {
1537    type Item = Result<DebugBrokerRequest, fidl::Error>;
1538
1539    fn poll_next(
1540        mut self: std::pin::Pin<&mut Self>,
1541        cx: &mut std::task::Context<'_>,
1542    ) -> std::task::Poll<Option<Self::Item>> {
1543        let this = &mut *self;
1544        if this.inner.check_shutdown(cx) {
1545            this.is_terminated = true;
1546            return std::task::Poll::Ready(None);
1547        }
1548        if this.is_terminated {
1549            panic!("polled DebugBrokerRequestStream after completion");
1550        }
1551        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1552            |bytes, handles| {
1553                match this.inner.channel().read_etc(cx, bytes, handles) {
1554                    std::task::Poll::Ready(Ok(())) => {}
1555                    std::task::Poll::Pending => return std::task::Poll::Pending,
1556                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1557                        this.is_terminated = true;
1558                        return std::task::Poll::Ready(None);
1559                    }
1560                    std::task::Poll::Ready(Err(e)) => {
1561                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1562                            e.into(),
1563                        ))));
1564                    }
1565                }
1566
1567                // A message has been received from the channel
1568                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1569
1570                std::task::Poll::Ready(Some(match header.ordinal {
1571                    0x1ee270f83b5d6ff6 => {
1572                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1573                        let mut req = fidl::new_empty!(
1574                            DebugBrokerSendDebugCommandRequest,
1575                            fidl::encoding::DefaultFuchsiaResourceDialect
1576                        );
1577                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1578                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1579                        Ok(DebugBrokerRequest::SendDebugCommand {
1580                            command: req.command,
1581
1582                            responder: DebugBrokerSendDebugCommandResponder {
1583                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1584                                tx_id: header.tx_id,
1585                            },
1586                        })
1587                    }
1588                    0x12e368d05329b30e => {
1589                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1590                        let mut req = fidl::new_empty!(
1591                            DebugBrokerSetTracingEnabledRequest,
1592                            fidl::encoding::DefaultFuchsiaResourceDialect
1593                        );
1594                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1595                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1596                        Ok(DebugBrokerRequest::SetTracingEnabled {
1597                            enabled: req.enabled,
1598
1599                            responder: DebugBrokerSetTracingEnabledResponder {
1600                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1601                                tx_id: header.tx_id,
1602                            },
1603                        })
1604                    }
1605                    _ => Err(fidl::Error::UnknownOrdinal {
1606                        ordinal: header.ordinal,
1607                        protocol_name:
1608                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1609                    }),
1610                }))
1611            },
1612        )
1613    }
1614}
1615
1616/// Acts on behalf of the caller to interact with privileged debug system calls.
1617#[derive(Debug)]
1618pub enum DebugBrokerRequest {
1619    /// Pass debug command through to the kernel shell.
1620    /// Look at zx_debug_send_command syscall handling to find valid values.
1621    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1622    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1623    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1624}
1625
1626impl DebugBrokerRequest {
1627    #[allow(irrefutable_let_patterns)]
1628    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1629        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1630            Some((command, responder))
1631        } else {
1632            None
1633        }
1634    }
1635
1636    #[allow(irrefutable_let_patterns)]
1637    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1638        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1639            Some((enabled, responder))
1640        } else {
1641            None
1642        }
1643    }
1644
1645    /// Name of the method defined in FIDL
1646    pub fn method_name(&self) -> &'static str {
1647        match *self {
1648            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1649            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1650        }
1651    }
1652}
1653
1654#[derive(Debug, Clone)]
1655pub struct DebugBrokerControlHandle {
1656    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1657}
1658
1659impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1660    fn shutdown(&self) {
1661        self.inner.shutdown()
1662    }
1663    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1664        self.inner.shutdown_with_epitaph(status)
1665    }
1666
1667    fn is_closed(&self) -> bool {
1668        self.inner.channel().is_closed()
1669    }
1670    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1671        self.inner.channel().on_closed()
1672    }
1673
1674    #[cfg(target_os = "fuchsia")]
1675    fn signal_peer(
1676        &self,
1677        clear_mask: zx::Signals,
1678        set_mask: zx::Signals,
1679    ) -> Result<(), zx_status::Status> {
1680        use fidl::Peered;
1681        self.inner.channel().signal_peer(clear_mask, set_mask)
1682    }
1683}
1684
1685impl DebugBrokerControlHandle {}
1686
1687#[must_use = "FIDL methods require a response to be sent"]
1688#[derive(Debug)]
1689pub struct DebugBrokerSendDebugCommandResponder {
1690    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1691    tx_id: u32,
1692}
1693
1694/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1695/// if the responder is dropped without sending a response, so that the client
1696/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1697impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1698    fn drop(&mut self) {
1699        self.control_handle.shutdown();
1700        // Safety: drops once, never accessed again
1701        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1702    }
1703}
1704
1705impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1706    type ControlHandle = DebugBrokerControlHandle;
1707
1708    fn control_handle(&self) -> &DebugBrokerControlHandle {
1709        &self.control_handle
1710    }
1711
1712    fn drop_without_shutdown(mut self) {
1713        // Safety: drops once, never accessed again due to mem::forget
1714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1715        // Prevent Drop from running (which would shut down the channel)
1716        std::mem::forget(self);
1717    }
1718}
1719
1720impl DebugBrokerSendDebugCommandResponder {
1721    /// Sends a response to the FIDL transaction.
1722    ///
1723    /// Sets the channel to shutdown if an error occurs.
1724    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1725        let _result = self.send_raw(status);
1726        if _result.is_err() {
1727            self.control_handle.shutdown();
1728        }
1729        self.drop_without_shutdown();
1730        _result
1731    }
1732
1733    /// Similar to "send" but does not shutdown the channel if an error occurs.
1734    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1735        let _result = self.send_raw(status);
1736        self.drop_without_shutdown();
1737        _result
1738    }
1739
1740    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1741        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1742            (status,),
1743            self.tx_id,
1744            0x1ee270f83b5d6ff6,
1745            fidl::encoding::DynamicFlags::empty(),
1746        )
1747    }
1748}
1749
1750#[must_use = "FIDL methods require a response to be sent"]
1751#[derive(Debug)]
1752pub struct DebugBrokerSetTracingEnabledResponder {
1753    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1754    tx_id: u32,
1755}
1756
1757/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1758/// if the responder is dropped without sending a response, so that the client
1759/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1760impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1761    fn drop(&mut self) {
1762        self.control_handle.shutdown();
1763        // Safety: drops once, never accessed again
1764        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1765    }
1766}
1767
1768impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1769    type ControlHandle = DebugBrokerControlHandle;
1770
1771    fn control_handle(&self) -> &DebugBrokerControlHandle {
1772        &self.control_handle
1773    }
1774
1775    fn drop_without_shutdown(mut self) {
1776        // Safety: drops once, never accessed again due to mem::forget
1777        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1778        // Prevent Drop from running (which would shut down the channel)
1779        std::mem::forget(self);
1780    }
1781}
1782
1783impl DebugBrokerSetTracingEnabledResponder {
1784    /// Sends a response to the FIDL transaction.
1785    ///
1786    /// Sets the channel to shutdown if an error occurs.
1787    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1788        let _result = self.send_raw(status);
1789        if _result.is_err() {
1790            self.control_handle.shutdown();
1791        }
1792        self.drop_without_shutdown();
1793        _result
1794    }
1795
1796    /// Similar to "send" but does not shutdown the channel if an error occurs.
1797    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1798        let _result = self.send_raw(status);
1799        self.drop_without_shutdown();
1800        _result
1801    }
1802
1803    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1804        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1805            (status,),
1806            self.tx_id,
1807            0x12e368d05329b30e,
1808            fidl::encoding::DynamicFlags::empty(),
1809        )
1810    }
1811}
1812
1813#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1814pub struct DebugResourceMarker;
1815
1816impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1817    type Proxy = DebugResourceProxy;
1818    type RequestStream = DebugResourceRequestStream;
1819    #[cfg(target_os = "fuchsia")]
1820    type SynchronousProxy = DebugResourceSynchronousProxy;
1821
1822    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1823}
1824impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1825
1826pub trait DebugResourceProxyInterface: Send + Sync {
1827    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1828    fn r#get(&self) -> Self::GetResponseFut;
1829}
1830#[derive(Debug)]
1831#[cfg(target_os = "fuchsia")]
1832pub struct DebugResourceSynchronousProxy {
1833    client: fidl::client::sync::Client,
1834}
1835
1836#[cfg(target_os = "fuchsia")]
1837impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1838    type Proxy = DebugResourceProxy;
1839    type Protocol = DebugResourceMarker;
1840
1841    fn from_channel(inner: fidl::Channel) -> Self {
1842        Self::new(inner)
1843    }
1844
1845    fn into_channel(self) -> fidl::Channel {
1846        self.client.into_channel()
1847    }
1848
1849    fn as_channel(&self) -> &fidl::Channel {
1850        self.client.as_channel()
1851    }
1852}
1853
1854#[cfg(target_os = "fuchsia")]
1855impl DebugResourceSynchronousProxy {
1856    pub fn new(channel: fidl::Channel) -> Self {
1857        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1858        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1859    }
1860
1861    pub fn into_channel(self) -> fidl::Channel {
1862        self.client.into_channel()
1863    }
1864
1865    /// Waits until an event arrives and returns it. It is safe for other
1866    /// threads to make concurrent requests while waiting for an event.
1867    pub fn wait_for_event(
1868        &self,
1869        deadline: zx::MonotonicInstant,
1870    ) -> Result<DebugResourceEvent, fidl::Error> {
1871        DebugResourceEvent::decode(self.client.wait_for_event(deadline)?)
1872    }
1873
1874    /// Get a debug resource handle.
1875    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1876        let _response =
1877            self.client.send_query::<fidl::encoding::EmptyPayload, DebugResourceGetResponse>(
1878                (),
1879                0x1d79d77ea12a6474,
1880                fidl::encoding::DynamicFlags::empty(),
1881                ___deadline,
1882            )?;
1883        Ok(_response.resource)
1884    }
1885}
1886
1887#[cfg(target_os = "fuchsia")]
1888impl From<DebugResourceSynchronousProxy> for zx::Handle {
1889    fn from(value: DebugResourceSynchronousProxy) -> Self {
1890        value.into_channel().into()
1891    }
1892}
1893
1894#[cfg(target_os = "fuchsia")]
1895impl From<fidl::Channel> for DebugResourceSynchronousProxy {
1896    fn from(value: fidl::Channel) -> Self {
1897        Self::new(value)
1898    }
1899}
1900
1901#[cfg(target_os = "fuchsia")]
1902impl fidl::endpoints::FromClient for DebugResourceSynchronousProxy {
1903    type Protocol = DebugResourceMarker;
1904
1905    fn from_client(value: fidl::endpoints::ClientEnd<DebugResourceMarker>) -> Self {
1906        Self::new(value.into_channel())
1907    }
1908}
1909
1910#[derive(Debug, Clone)]
1911pub struct DebugResourceProxy {
1912    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1913}
1914
1915impl fidl::endpoints::Proxy for DebugResourceProxy {
1916    type Protocol = DebugResourceMarker;
1917
1918    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1919        Self::new(inner)
1920    }
1921
1922    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1923        self.client.into_channel().map_err(|client| Self { client })
1924    }
1925
1926    fn as_channel(&self) -> &::fidl::AsyncChannel {
1927        self.client.as_channel()
1928    }
1929}
1930
1931impl DebugResourceProxy {
1932    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1933    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1934        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1935        Self { client: fidl::client::Client::new(channel, protocol_name) }
1936    }
1937
1938    /// Get a Stream of events from the remote end of the protocol.
1939    ///
1940    /// # Panics
1941    ///
1942    /// Panics if the event stream was already taken.
1943    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1944        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1945    }
1946
1947    /// Get a debug resource handle.
1948    pub fn r#get(
1949        &self,
1950    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1951    {
1952        DebugResourceProxyInterface::r#get(self)
1953    }
1954}
1955
1956impl DebugResourceProxyInterface for DebugResourceProxy {
1957    type GetResponseFut = fidl::client::QueryResponseFut<
1958        fidl::Resource,
1959        fidl::encoding::DefaultFuchsiaResourceDialect,
1960    >;
1961    fn r#get(&self) -> Self::GetResponseFut {
1962        fn _decode(
1963            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1964        ) -> Result<fidl::Resource, fidl::Error> {
1965            let _response = fidl::client::decode_transaction_body::<
1966                DebugResourceGetResponse,
1967                fidl::encoding::DefaultFuchsiaResourceDialect,
1968                0x1d79d77ea12a6474,
1969            >(_buf?)?;
1970            Ok(_response.resource)
1971        }
1972        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
1973            (),
1974            0x1d79d77ea12a6474,
1975            fidl::encoding::DynamicFlags::empty(),
1976            _decode,
1977        )
1978    }
1979}
1980
1981pub struct DebugResourceEventStream {
1982    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1983}
1984
1985impl std::marker::Unpin for DebugResourceEventStream {}
1986
1987impl futures::stream::FusedStream for DebugResourceEventStream {
1988    fn is_terminated(&self) -> bool {
1989        self.event_receiver.is_terminated()
1990    }
1991}
1992
1993impl futures::Stream for DebugResourceEventStream {
1994    type Item = Result<DebugResourceEvent, fidl::Error>;
1995
1996    fn poll_next(
1997        mut self: std::pin::Pin<&mut Self>,
1998        cx: &mut std::task::Context<'_>,
1999    ) -> std::task::Poll<Option<Self::Item>> {
2000        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2001            &mut self.event_receiver,
2002            cx
2003        )?) {
2004            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
2005            None => std::task::Poll::Ready(None),
2006        }
2007    }
2008}
2009
2010#[derive(Debug)]
2011pub enum DebugResourceEvent {}
2012
2013impl DebugResourceEvent {
2014    /// Decodes a message buffer as a [`DebugResourceEvent`].
2015    fn decode(
2016        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2017    ) -> Result<DebugResourceEvent, fidl::Error> {
2018        let (bytes, _handles) = buf.split_mut();
2019        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2020        debug_assert_eq!(tx_header.tx_id, 0);
2021        match tx_header.ordinal {
2022            _ => Err(fidl::Error::UnknownOrdinal {
2023                ordinal: tx_header.ordinal,
2024                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2025            }),
2026        }
2027    }
2028}
2029
2030/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
2031pub struct DebugResourceRequestStream {
2032    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2033    is_terminated: bool,
2034}
2035
2036impl std::marker::Unpin for DebugResourceRequestStream {}
2037
2038impl futures::stream::FusedStream for DebugResourceRequestStream {
2039    fn is_terminated(&self) -> bool {
2040        self.is_terminated
2041    }
2042}
2043
2044impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
2045    type Protocol = DebugResourceMarker;
2046    type ControlHandle = DebugResourceControlHandle;
2047
2048    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2049        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2050    }
2051
2052    fn control_handle(&self) -> Self::ControlHandle {
2053        DebugResourceControlHandle { inner: self.inner.clone() }
2054    }
2055
2056    fn into_inner(
2057        self,
2058    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2059    {
2060        (self.inner, self.is_terminated)
2061    }
2062
2063    fn from_inner(
2064        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2065        is_terminated: bool,
2066    ) -> Self {
2067        Self { inner, is_terminated }
2068    }
2069}
2070
2071impl futures::Stream for DebugResourceRequestStream {
2072    type Item = Result<DebugResourceRequest, fidl::Error>;
2073
2074    fn poll_next(
2075        mut self: std::pin::Pin<&mut Self>,
2076        cx: &mut std::task::Context<'_>,
2077    ) -> std::task::Poll<Option<Self::Item>> {
2078        let this = &mut *self;
2079        if this.inner.check_shutdown(cx) {
2080            this.is_terminated = true;
2081            return std::task::Poll::Ready(None);
2082        }
2083        if this.is_terminated {
2084            panic!("polled DebugResourceRequestStream after completion");
2085        }
2086        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2087            |bytes, handles| {
2088                match this.inner.channel().read_etc(cx, bytes, handles) {
2089                    std::task::Poll::Ready(Ok(())) => {}
2090                    std::task::Poll::Pending => return std::task::Poll::Pending,
2091                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2092                        this.is_terminated = true;
2093                        return std::task::Poll::Ready(None);
2094                    }
2095                    std::task::Poll::Ready(Err(e)) => {
2096                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2097                            e.into(),
2098                        ))));
2099                    }
2100                }
2101
2102                // A message has been received from the channel
2103                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2104
2105                std::task::Poll::Ready(Some(match header.ordinal {
2106                    0x1d79d77ea12a6474 => {
2107                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2108                        let mut req = fidl::new_empty!(
2109                            fidl::encoding::EmptyPayload,
2110                            fidl::encoding::DefaultFuchsiaResourceDialect
2111                        );
2112                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2113                        let control_handle =
2114                            DebugResourceControlHandle { inner: this.inner.clone() };
2115                        Ok(DebugResourceRequest::Get {
2116                            responder: DebugResourceGetResponder {
2117                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2118                                tx_id: header.tx_id,
2119                            },
2120                        })
2121                    }
2122                    _ => Err(fidl::Error::UnknownOrdinal {
2123                        ordinal: header.ordinal,
2124                        protocol_name:
2125                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2126                    }),
2127                }))
2128            },
2129        )
2130    }
2131}
2132
2133/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2134/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2135#[derive(Debug)]
2136pub enum DebugResourceRequest {
2137    /// Get a debug resource handle.
2138    Get { responder: DebugResourceGetResponder },
2139}
2140
2141impl DebugResourceRequest {
2142    #[allow(irrefutable_let_patterns)]
2143    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2144        if let DebugResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2145    }
2146
2147    /// Name of the method defined in FIDL
2148    pub fn method_name(&self) -> &'static str {
2149        match *self {
2150            DebugResourceRequest::Get { .. } => "get",
2151        }
2152    }
2153}
2154
2155#[derive(Debug, Clone)]
2156pub struct DebugResourceControlHandle {
2157    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2158}
2159
2160impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2161    fn shutdown(&self) {
2162        self.inner.shutdown()
2163    }
2164    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2165        self.inner.shutdown_with_epitaph(status)
2166    }
2167
2168    fn is_closed(&self) -> bool {
2169        self.inner.channel().is_closed()
2170    }
2171    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2172        self.inner.channel().on_closed()
2173    }
2174
2175    #[cfg(target_os = "fuchsia")]
2176    fn signal_peer(
2177        &self,
2178        clear_mask: zx::Signals,
2179        set_mask: zx::Signals,
2180    ) -> Result<(), zx_status::Status> {
2181        use fidl::Peered;
2182        self.inner.channel().signal_peer(clear_mask, set_mask)
2183    }
2184}
2185
2186impl DebugResourceControlHandle {}
2187
2188#[must_use = "FIDL methods require a response to be sent"]
2189#[derive(Debug)]
2190pub struct DebugResourceGetResponder {
2191    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2192    tx_id: u32,
2193}
2194
2195/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2196/// if the responder is dropped without sending a response, so that the client
2197/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2198impl std::ops::Drop for DebugResourceGetResponder {
2199    fn drop(&mut self) {
2200        self.control_handle.shutdown();
2201        // Safety: drops once, never accessed again
2202        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2203    }
2204}
2205
2206impl fidl::endpoints::Responder for DebugResourceGetResponder {
2207    type ControlHandle = DebugResourceControlHandle;
2208
2209    fn control_handle(&self) -> &DebugResourceControlHandle {
2210        &self.control_handle
2211    }
2212
2213    fn drop_without_shutdown(mut self) {
2214        // Safety: drops once, never accessed again due to mem::forget
2215        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2216        // Prevent Drop from running (which would shut down the channel)
2217        std::mem::forget(self);
2218    }
2219}
2220
2221impl DebugResourceGetResponder {
2222    /// Sends a response to the FIDL transaction.
2223    ///
2224    /// Sets the channel to shutdown if an error occurs.
2225    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2226        let _result = self.send_raw(resource);
2227        if _result.is_err() {
2228            self.control_handle.shutdown();
2229        }
2230        self.drop_without_shutdown();
2231        _result
2232    }
2233
2234    /// Similar to "send" but does not shutdown the channel if an error occurs.
2235    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2236        let _result = self.send_raw(resource);
2237        self.drop_without_shutdown();
2238        _result
2239    }
2240
2241    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2242        self.control_handle.inner.send::<DebugResourceGetResponse>(
2243            (resource,),
2244            self.tx_id,
2245            0x1d79d77ea12a6474,
2246            fidl::encoding::DynamicFlags::empty(),
2247        )
2248    }
2249}
2250
2251#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2252pub struct DebuglogResourceMarker;
2253
2254impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2255    type Proxy = DebuglogResourceProxy;
2256    type RequestStream = DebuglogResourceRequestStream;
2257    #[cfg(target_os = "fuchsia")]
2258    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2259
2260    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2261}
2262impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2263
2264pub trait DebuglogResourceProxyInterface: Send + Sync {
2265    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2266    fn r#get(&self) -> Self::GetResponseFut;
2267}
2268#[derive(Debug)]
2269#[cfg(target_os = "fuchsia")]
2270pub struct DebuglogResourceSynchronousProxy {
2271    client: fidl::client::sync::Client,
2272}
2273
2274#[cfg(target_os = "fuchsia")]
2275impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2276    type Proxy = DebuglogResourceProxy;
2277    type Protocol = DebuglogResourceMarker;
2278
2279    fn from_channel(inner: fidl::Channel) -> Self {
2280        Self::new(inner)
2281    }
2282
2283    fn into_channel(self) -> fidl::Channel {
2284        self.client.into_channel()
2285    }
2286
2287    fn as_channel(&self) -> &fidl::Channel {
2288        self.client.as_channel()
2289    }
2290}
2291
2292#[cfg(target_os = "fuchsia")]
2293impl DebuglogResourceSynchronousProxy {
2294    pub fn new(channel: fidl::Channel) -> Self {
2295        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2296        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2297    }
2298
2299    pub fn into_channel(self) -> fidl::Channel {
2300        self.client.into_channel()
2301    }
2302
2303    /// Waits until an event arrives and returns it. It is safe for other
2304    /// threads to make concurrent requests while waiting for an event.
2305    pub fn wait_for_event(
2306        &self,
2307        deadline: zx::MonotonicInstant,
2308    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2309        DebuglogResourceEvent::decode(self.client.wait_for_event(deadline)?)
2310    }
2311
2312    /// Get a debuglog resource handle.
2313    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2314        let _response =
2315            self.client.send_query::<fidl::encoding::EmptyPayload, DebuglogResourceGetResponse>(
2316                (),
2317                0x6e78c1ff74765225,
2318                fidl::encoding::DynamicFlags::empty(),
2319                ___deadline,
2320            )?;
2321        Ok(_response.resource)
2322    }
2323}
2324
2325#[cfg(target_os = "fuchsia")]
2326impl From<DebuglogResourceSynchronousProxy> for zx::Handle {
2327    fn from(value: DebuglogResourceSynchronousProxy) -> Self {
2328        value.into_channel().into()
2329    }
2330}
2331
2332#[cfg(target_os = "fuchsia")]
2333impl From<fidl::Channel> for DebuglogResourceSynchronousProxy {
2334    fn from(value: fidl::Channel) -> Self {
2335        Self::new(value)
2336    }
2337}
2338
2339#[cfg(target_os = "fuchsia")]
2340impl fidl::endpoints::FromClient for DebuglogResourceSynchronousProxy {
2341    type Protocol = DebuglogResourceMarker;
2342
2343    fn from_client(value: fidl::endpoints::ClientEnd<DebuglogResourceMarker>) -> Self {
2344        Self::new(value.into_channel())
2345    }
2346}
2347
2348#[derive(Debug, Clone)]
2349pub struct DebuglogResourceProxy {
2350    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2351}
2352
2353impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2354    type Protocol = DebuglogResourceMarker;
2355
2356    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2357        Self::new(inner)
2358    }
2359
2360    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2361        self.client.into_channel().map_err(|client| Self { client })
2362    }
2363
2364    fn as_channel(&self) -> &::fidl::AsyncChannel {
2365        self.client.as_channel()
2366    }
2367}
2368
2369impl DebuglogResourceProxy {
2370    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2371    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2372        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2373        Self { client: fidl::client::Client::new(channel, protocol_name) }
2374    }
2375
2376    /// Get a Stream of events from the remote end of the protocol.
2377    ///
2378    /// # Panics
2379    ///
2380    /// Panics if the event stream was already taken.
2381    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2382        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2383    }
2384
2385    /// Get a debuglog resource handle.
2386    pub fn r#get(
2387        &self,
2388    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2389    {
2390        DebuglogResourceProxyInterface::r#get(self)
2391    }
2392}
2393
2394impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2395    type GetResponseFut = fidl::client::QueryResponseFut<
2396        fidl::Resource,
2397        fidl::encoding::DefaultFuchsiaResourceDialect,
2398    >;
2399    fn r#get(&self) -> Self::GetResponseFut {
2400        fn _decode(
2401            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2402        ) -> Result<fidl::Resource, fidl::Error> {
2403            let _response = fidl::client::decode_transaction_body::<
2404                DebuglogResourceGetResponse,
2405                fidl::encoding::DefaultFuchsiaResourceDialect,
2406                0x6e78c1ff74765225,
2407            >(_buf?)?;
2408            Ok(_response.resource)
2409        }
2410        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2411            (),
2412            0x6e78c1ff74765225,
2413            fidl::encoding::DynamicFlags::empty(),
2414            _decode,
2415        )
2416    }
2417}
2418
2419pub struct DebuglogResourceEventStream {
2420    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2421}
2422
2423impl std::marker::Unpin for DebuglogResourceEventStream {}
2424
2425impl futures::stream::FusedStream for DebuglogResourceEventStream {
2426    fn is_terminated(&self) -> bool {
2427        self.event_receiver.is_terminated()
2428    }
2429}
2430
2431impl futures::Stream for DebuglogResourceEventStream {
2432    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2433
2434    fn poll_next(
2435        mut self: std::pin::Pin<&mut Self>,
2436        cx: &mut std::task::Context<'_>,
2437    ) -> std::task::Poll<Option<Self::Item>> {
2438        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2439            &mut self.event_receiver,
2440            cx
2441        )?) {
2442            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2443            None => std::task::Poll::Ready(None),
2444        }
2445    }
2446}
2447
2448#[derive(Debug)]
2449pub enum DebuglogResourceEvent {}
2450
2451impl DebuglogResourceEvent {
2452    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2453    fn decode(
2454        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2455    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2456        let (bytes, _handles) = buf.split_mut();
2457        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2458        debug_assert_eq!(tx_header.tx_id, 0);
2459        match tx_header.ordinal {
2460            _ => Err(fidl::Error::UnknownOrdinal {
2461                ordinal: tx_header.ordinal,
2462                protocol_name:
2463                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2464            }),
2465        }
2466    }
2467}
2468
2469/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2470pub struct DebuglogResourceRequestStream {
2471    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2472    is_terminated: bool,
2473}
2474
2475impl std::marker::Unpin for DebuglogResourceRequestStream {}
2476
2477impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2478    fn is_terminated(&self) -> bool {
2479        self.is_terminated
2480    }
2481}
2482
2483impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2484    type Protocol = DebuglogResourceMarker;
2485    type ControlHandle = DebuglogResourceControlHandle;
2486
2487    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2488        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2489    }
2490
2491    fn control_handle(&self) -> Self::ControlHandle {
2492        DebuglogResourceControlHandle { inner: self.inner.clone() }
2493    }
2494
2495    fn into_inner(
2496        self,
2497    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2498    {
2499        (self.inner, self.is_terminated)
2500    }
2501
2502    fn from_inner(
2503        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2504        is_terminated: bool,
2505    ) -> Self {
2506        Self { inner, is_terminated }
2507    }
2508}
2509
2510impl futures::Stream for DebuglogResourceRequestStream {
2511    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2512
2513    fn poll_next(
2514        mut self: std::pin::Pin<&mut Self>,
2515        cx: &mut std::task::Context<'_>,
2516    ) -> std::task::Poll<Option<Self::Item>> {
2517        let this = &mut *self;
2518        if this.inner.check_shutdown(cx) {
2519            this.is_terminated = true;
2520            return std::task::Poll::Ready(None);
2521        }
2522        if this.is_terminated {
2523            panic!("polled DebuglogResourceRequestStream after completion");
2524        }
2525        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2526            |bytes, handles| {
2527                match this.inner.channel().read_etc(cx, bytes, handles) {
2528                    std::task::Poll::Ready(Ok(())) => {}
2529                    std::task::Poll::Pending => return std::task::Poll::Pending,
2530                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2531                        this.is_terminated = true;
2532                        return std::task::Poll::Ready(None);
2533                    }
2534                    std::task::Poll::Ready(Err(e)) => {
2535                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2536                            e.into(),
2537                        ))));
2538                    }
2539                }
2540
2541                // A message has been received from the channel
2542                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2543
2544                std::task::Poll::Ready(Some(match header.ordinal {
2545                    0x6e78c1ff74765225 => {
2546                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2547                        let mut req = fidl::new_empty!(
2548                            fidl::encoding::EmptyPayload,
2549                            fidl::encoding::DefaultFuchsiaResourceDialect
2550                        );
2551                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2552                        let control_handle =
2553                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2554                        Ok(DebuglogResourceRequest::Get {
2555                            responder: DebuglogResourceGetResponder {
2556                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2557                                tx_id: header.tx_id,
2558                            },
2559                        })
2560                    }
2561                    _ => Err(fidl::Error::UnknownOrdinal {
2562                        ordinal: header.ordinal,
2563                        protocol_name:
2564                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2565                    }),
2566                }))
2567            },
2568        )
2569    }
2570}
2571
2572/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2573/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2574#[derive(Debug)]
2575pub enum DebuglogResourceRequest {
2576    /// Get a debuglog resource handle.
2577    Get { responder: DebuglogResourceGetResponder },
2578}
2579
2580impl DebuglogResourceRequest {
2581    #[allow(irrefutable_let_patterns)]
2582    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2583        if let DebuglogResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2584    }
2585
2586    /// Name of the method defined in FIDL
2587    pub fn method_name(&self) -> &'static str {
2588        match *self {
2589            DebuglogResourceRequest::Get { .. } => "get",
2590        }
2591    }
2592}
2593
2594#[derive(Debug, Clone)]
2595pub struct DebuglogResourceControlHandle {
2596    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2597}
2598
2599impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2600    fn shutdown(&self) {
2601        self.inner.shutdown()
2602    }
2603    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2604        self.inner.shutdown_with_epitaph(status)
2605    }
2606
2607    fn is_closed(&self) -> bool {
2608        self.inner.channel().is_closed()
2609    }
2610    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2611        self.inner.channel().on_closed()
2612    }
2613
2614    #[cfg(target_os = "fuchsia")]
2615    fn signal_peer(
2616        &self,
2617        clear_mask: zx::Signals,
2618        set_mask: zx::Signals,
2619    ) -> Result<(), zx_status::Status> {
2620        use fidl::Peered;
2621        self.inner.channel().signal_peer(clear_mask, set_mask)
2622    }
2623}
2624
2625impl DebuglogResourceControlHandle {}
2626
2627#[must_use = "FIDL methods require a response to be sent"]
2628#[derive(Debug)]
2629pub struct DebuglogResourceGetResponder {
2630    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2631    tx_id: u32,
2632}
2633
2634/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2635/// if the responder is dropped without sending a response, so that the client
2636/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2637impl std::ops::Drop for DebuglogResourceGetResponder {
2638    fn drop(&mut self) {
2639        self.control_handle.shutdown();
2640        // Safety: drops once, never accessed again
2641        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2642    }
2643}
2644
2645impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2646    type ControlHandle = DebuglogResourceControlHandle;
2647
2648    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2649        &self.control_handle
2650    }
2651
2652    fn drop_without_shutdown(mut self) {
2653        // Safety: drops once, never accessed again due to mem::forget
2654        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2655        // Prevent Drop from running (which would shut down the channel)
2656        std::mem::forget(self);
2657    }
2658}
2659
2660impl DebuglogResourceGetResponder {
2661    /// Sends a response to the FIDL transaction.
2662    ///
2663    /// Sets the channel to shutdown if an error occurs.
2664    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2665        let _result = self.send_raw(resource);
2666        if _result.is_err() {
2667            self.control_handle.shutdown();
2668        }
2669        self.drop_without_shutdown();
2670        _result
2671    }
2672
2673    /// Similar to "send" but does not shutdown the channel if an error occurs.
2674    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2675        let _result = self.send_raw(resource);
2676        self.drop_without_shutdown();
2677        _result
2678    }
2679
2680    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2681        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2682            (resource,),
2683            self.tx_id,
2684            0x6e78c1ff74765225,
2685            fidl::encoding::DynamicFlags::empty(),
2686        )
2687    }
2688}
2689
2690#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2691pub struct EnergyInfoResourceMarker;
2692
2693impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2694    type Proxy = EnergyInfoResourceProxy;
2695    type RequestStream = EnergyInfoResourceRequestStream;
2696    #[cfg(target_os = "fuchsia")]
2697    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2698
2699    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2700}
2701impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2702
2703pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2704    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2705    fn r#get(&self) -> Self::GetResponseFut;
2706}
2707#[derive(Debug)]
2708#[cfg(target_os = "fuchsia")]
2709pub struct EnergyInfoResourceSynchronousProxy {
2710    client: fidl::client::sync::Client,
2711}
2712
2713#[cfg(target_os = "fuchsia")]
2714impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2715    type Proxy = EnergyInfoResourceProxy;
2716    type Protocol = EnergyInfoResourceMarker;
2717
2718    fn from_channel(inner: fidl::Channel) -> Self {
2719        Self::new(inner)
2720    }
2721
2722    fn into_channel(self) -> fidl::Channel {
2723        self.client.into_channel()
2724    }
2725
2726    fn as_channel(&self) -> &fidl::Channel {
2727        self.client.as_channel()
2728    }
2729}
2730
2731#[cfg(target_os = "fuchsia")]
2732impl EnergyInfoResourceSynchronousProxy {
2733    pub fn new(channel: fidl::Channel) -> Self {
2734        let protocol_name =
2735            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2736        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2737    }
2738
2739    pub fn into_channel(self) -> fidl::Channel {
2740        self.client.into_channel()
2741    }
2742
2743    /// Waits until an event arrives and returns it. It is safe for other
2744    /// threads to make concurrent requests while waiting for an event.
2745    pub fn wait_for_event(
2746        &self,
2747        deadline: zx::MonotonicInstant,
2748    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2749        EnergyInfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
2750    }
2751
2752    /// Get an EnergyInfo resource handle.
2753    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2754        let _response =
2755            self.client.send_query::<fidl::encoding::EmptyPayload, EnergyInfoResourceGetResponse>(
2756                (),
2757                0x5f5cc9f0745f61d0,
2758                fidl::encoding::DynamicFlags::empty(),
2759                ___deadline,
2760            )?;
2761        Ok(_response.resource)
2762    }
2763}
2764
2765#[cfg(target_os = "fuchsia")]
2766impl From<EnergyInfoResourceSynchronousProxy> for zx::Handle {
2767    fn from(value: EnergyInfoResourceSynchronousProxy) -> Self {
2768        value.into_channel().into()
2769    }
2770}
2771
2772#[cfg(target_os = "fuchsia")]
2773impl From<fidl::Channel> for EnergyInfoResourceSynchronousProxy {
2774    fn from(value: fidl::Channel) -> Self {
2775        Self::new(value)
2776    }
2777}
2778
2779#[cfg(target_os = "fuchsia")]
2780impl fidl::endpoints::FromClient for EnergyInfoResourceSynchronousProxy {
2781    type Protocol = EnergyInfoResourceMarker;
2782
2783    fn from_client(value: fidl::endpoints::ClientEnd<EnergyInfoResourceMarker>) -> Self {
2784        Self::new(value.into_channel())
2785    }
2786}
2787
2788#[derive(Debug, Clone)]
2789pub struct EnergyInfoResourceProxy {
2790    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2791}
2792
2793impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2794    type Protocol = EnergyInfoResourceMarker;
2795
2796    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2797        Self::new(inner)
2798    }
2799
2800    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2801        self.client.into_channel().map_err(|client| Self { client })
2802    }
2803
2804    fn as_channel(&self) -> &::fidl::AsyncChannel {
2805        self.client.as_channel()
2806    }
2807}
2808
2809impl EnergyInfoResourceProxy {
2810    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2811    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2812        let protocol_name =
2813            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2814        Self { client: fidl::client::Client::new(channel, protocol_name) }
2815    }
2816
2817    /// Get a Stream of events from the remote end of the protocol.
2818    ///
2819    /// # Panics
2820    ///
2821    /// Panics if the event stream was already taken.
2822    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2823        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2824    }
2825
2826    /// Get an EnergyInfo resource handle.
2827    pub fn r#get(
2828        &self,
2829    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2830    {
2831        EnergyInfoResourceProxyInterface::r#get(self)
2832    }
2833}
2834
2835impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2836    type GetResponseFut = fidl::client::QueryResponseFut<
2837        fidl::Resource,
2838        fidl::encoding::DefaultFuchsiaResourceDialect,
2839    >;
2840    fn r#get(&self) -> Self::GetResponseFut {
2841        fn _decode(
2842            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2843        ) -> Result<fidl::Resource, fidl::Error> {
2844            let _response = fidl::client::decode_transaction_body::<
2845                EnergyInfoResourceGetResponse,
2846                fidl::encoding::DefaultFuchsiaResourceDialect,
2847                0x5f5cc9f0745f61d0,
2848            >(_buf?)?;
2849            Ok(_response.resource)
2850        }
2851        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2852            (),
2853            0x5f5cc9f0745f61d0,
2854            fidl::encoding::DynamicFlags::empty(),
2855            _decode,
2856        )
2857    }
2858}
2859
2860pub struct EnergyInfoResourceEventStream {
2861    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2862}
2863
2864impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2865
2866impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2867    fn is_terminated(&self) -> bool {
2868        self.event_receiver.is_terminated()
2869    }
2870}
2871
2872impl futures::Stream for EnergyInfoResourceEventStream {
2873    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2874
2875    fn poll_next(
2876        mut self: std::pin::Pin<&mut Self>,
2877        cx: &mut std::task::Context<'_>,
2878    ) -> std::task::Poll<Option<Self::Item>> {
2879        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2880            &mut self.event_receiver,
2881            cx
2882        )?) {
2883            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2884            None => std::task::Poll::Ready(None),
2885        }
2886    }
2887}
2888
2889#[derive(Debug)]
2890pub enum EnergyInfoResourceEvent {}
2891
2892impl EnergyInfoResourceEvent {
2893    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2894    fn decode(
2895        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2896    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2897        let (bytes, _handles) = buf.split_mut();
2898        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2899        debug_assert_eq!(tx_header.tx_id, 0);
2900        match tx_header.ordinal {
2901            _ => Err(fidl::Error::UnknownOrdinal {
2902                ordinal: tx_header.ordinal,
2903                protocol_name:
2904                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2905            }),
2906        }
2907    }
2908}
2909
2910/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2911pub struct EnergyInfoResourceRequestStream {
2912    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2913    is_terminated: bool,
2914}
2915
2916impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2917
2918impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2919    fn is_terminated(&self) -> bool {
2920        self.is_terminated
2921    }
2922}
2923
2924impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2925    type Protocol = EnergyInfoResourceMarker;
2926    type ControlHandle = EnergyInfoResourceControlHandle;
2927
2928    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2929        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2930    }
2931
2932    fn control_handle(&self) -> Self::ControlHandle {
2933        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2934    }
2935
2936    fn into_inner(
2937        self,
2938    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2939    {
2940        (self.inner, self.is_terminated)
2941    }
2942
2943    fn from_inner(
2944        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2945        is_terminated: bool,
2946    ) -> Self {
2947        Self { inner, is_terminated }
2948    }
2949}
2950
2951impl futures::Stream for EnergyInfoResourceRequestStream {
2952    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
2953
2954    fn poll_next(
2955        mut self: std::pin::Pin<&mut Self>,
2956        cx: &mut std::task::Context<'_>,
2957    ) -> std::task::Poll<Option<Self::Item>> {
2958        let this = &mut *self;
2959        if this.inner.check_shutdown(cx) {
2960            this.is_terminated = true;
2961            return std::task::Poll::Ready(None);
2962        }
2963        if this.is_terminated {
2964            panic!("polled EnergyInfoResourceRequestStream after completion");
2965        }
2966        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2967            |bytes, handles| {
2968                match this.inner.channel().read_etc(cx, bytes, handles) {
2969                    std::task::Poll::Ready(Ok(())) => {}
2970                    std::task::Poll::Pending => return std::task::Poll::Pending,
2971                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2972                        this.is_terminated = true;
2973                        return std::task::Poll::Ready(None);
2974                    }
2975                    std::task::Poll::Ready(Err(e)) => {
2976                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2977                            e.into(),
2978                        ))));
2979                    }
2980                }
2981
2982                // A message has been received from the channel
2983                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2984
2985                std::task::Poll::Ready(Some(match header.ordinal {
2986                0x5f5cc9f0745f61d0 => {
2987                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2988                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2989                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2990                    let control_handle = EnergyInfoResourceControlHandle {
2991                        inner: this.inner.clone(),
2992                    };
2993                    Ok(EnergyInfoResourceRequest::Get {
2994                        responder: EnergyInfoResourceGetResponder {
2995                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2996                            tx_id: header.tx_id,
2997                        },
2998                    })
2999                }
3000                _ => Err(fidl::Error::UnknownOrdinal {
3001                    ordinal: header.ordinal,
3002                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3003                }),
3004            }))
3005            },
3006        )
3007    }
3008}
3009
3010/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3011/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
3012#[derive(Debug)]
3013pub enum EnergyInfoResourceRequest {
3014    /// Get an EnergyInfo resource handle.
3015    Get { responder: EnergyInfoResourceGetResponder },
3016}
3017
3018impl EnergyInfoResourceRequest {
3019    #[allow(irrefutable_let_patterns)]
3020    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
3021        if let EnergyInfoResourceRequest::Get { responder } = self {
3022            Some((responder))
3023        } else {
3024            None
3025        }
3026    }
3027
3028    /// Name of the method defined in FIDL
3029    pub fn method_name(&self) -> &'static str {
3030        match *self {
3031            EnergyInfoResourceRequest::Get { .. } => "get",
3032        }
3033    }
3034}
3035
3036#[derive(Debug, Clone)]
3037pub struct EnergyInfoResourceControlHandle {
3038    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3039}
3040
3041impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
3042    fn shutdown(&self) {
3043        self.inner.shutdown()
3044    }
3045    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3046        self.inner.shutdown_with_epitaph(status)
3047    }
3048
3049    fn is_closed(&self) -> bool {
3050        self.inner.channel().is_closed()
3051    }
3052    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3053        self.inner.channel().on_closed()
3054    }
3055
3056    #[cfg(target_os = "fuchsia")]
3057    fn signal_peer(
3058        &self,
3059        clear_mask: zx::Signals,
3060        set_mask: zx::Signals,
3061    ) -> Result<(), zx_status::Status> {
3062        use fidl::Peered;
3063        self.inner.channel().signal_peer(clear_mask, set_mask)
3064    }
3065}
3066
3067impl EnergyInfoResourceControlHandle {}
3068
3069#[must_use = "FIDL methods require a response to be sent"]
3070#[derive(Debug)]
3071pub struct EnergyInfoResourceGetResponder {
3072    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
3073    tx_id: u32,
3074}
3075
3076/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
3077/// if the responder is dropped without sending a response, so that the client
3078/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3079impl std::ops::Drop for EnergyInfoResourceGetResponder {
3080    fn drop(&mut self) {
3081        self.control_handle.shutdown();
3082        // Safety: drops once, never accessed again
3083        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3084    }
3085}
3086
3087impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
3088    type ControlHandle = EnergyInfoResourceControlHandle;
3089
3090    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
3091        &self.control_handle
3092    }
3093
3094    fn drop_without_shutdown(mut self) {
3095        // Safety: drops once, never accessed again due to mem::forget
3096        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3097        // Prevent Drop from running (which would shut down the channel)
3098        std::mem::forget(self);
3099    }
3100}
3101
3102impl EnergyInfoResourceGetResponder {
3103    /// Sends a response to the FIDL transaction.
3104    ///
3105    /// Sets the channel to shutdown if an error occurs.
3106    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3107        let _result = self.send_raw(resource);
3108        if _result.is_err() {
3109            self.control_handle.shutdown();
3110        }
3111        self.drop_without_shutdown();
3112        _result
3113    }
3114
3115    /// Similar to "send" but does not shutdown the channel if an error occurs.
3116    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3117        let _result = self.send_raw(resource);
3118        self.drop_without_shutdown();
3119        _result
3120    }
3121
3122    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3123        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
3124            (resource,),
3125            self.tx_id,
3126            0x5f5cc9f0745f61d0,
3127            fidl::encoding::DynamicFlags::empty(),
3128        )
3129    }
3130}
3131
3132#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3133pub struct HypervisorResourceMarker;
3134
3135impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3136    type Proxy = HypervisorResourceProxy;
3137    type RequestStream = HypervisorResourceRequestStream;
3138    #[cfg(target_os = "fuchsia")]
3139    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3140
3141    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3142}
3143impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3144
3145pub trait HypervisorResourceProxyInterface: Send + Sync {
3146    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3147    fn r#get(&self) -> Self::GetResponseFut;
3148}
3149#[derive(Debug)]
3150#[cfg(target_os = "fuchsia")]
3151pub struct HypervisorResourceSynchronousProxy {
3152    client: fidl::client::sync::Client,
3153}
3154
3155#[cfg(target_os = "fuchsia")]
3156impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3157    type Proxy = HypervisorResourceProxy;
3158    type Protocol = HypervisorResourceMarker;
3159
3160    fn from_channel(inner: fidl::Channel) -> Self {
3161        Self::new(inner)
3162    }
3163
3164    fn into_channel(self) -> fidl::Channel {
3165        self.client.into_channel()
3166    }
3167
3168    fn as_channel(&self) -> &fidl::Channel {
3169        self.client.as_channel()
3170    }
3171}
3172
3173#[cfg(target_os = "fuchsia")]
3174impl HypervisorResourceSynchronousProxy {
3175    pub fn new(channel: fidl::Channel) -> Self {
3176        let protocol_name =
3177            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3178        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3179    }
3180
3181    pub fn into_channel(self) -> fidl::Channel {
3182        self.client.into_channel()
3183    }
3184
3185    /// Waits until an event arrives and returns it. It is safe for other
3186    /// threads to make concurrent requests while waiting for an event.
3187    pub fn wait_for_event(
3188        &self,
3189        deadline: zx::MonotonicInstant,
3190    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3191        HypervisorResourceEvent::decode(self.client.wait_for_event(deadline)?)
3192    }
3193
3194    /// Get a hypervisor resource handle.
3195    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3196        let _response =
3197            self.client.send_query::<fidl::encoding::EmptyPayload, HypervisorResourceGetResponse>(
3198                (),
3199                0x1c312131d3b824a2,
3200                fidl::encoding::DynamicFlags::empty(),
3201                ___deadline,
3202            )?;
3203        Ok(_response.resource)
3204    }
3205}
3206
3207#[cfg(target_os = "fuchsia")]
3208impl From<HypervisorResourceSynchronousProxy> for zx::Handle {
3209    fn from(value: HypervisorResourceSynchronousProxy) -> Self {
3210        value.into_channel().into()
3211    }
3212}
3213
3214#[cfg(target_os = "fuchsia")]
3215impl From<fidl::Channel> for HypervisorResourceSynchronousProxy {
3216    fn from(value: fidl::Channel) -> Self {
3217        Self::new(value)
3218    }
3219}
3220
3221#[cfg(target_os = "fuchsia")]
3222impl fidl::endpoints::FromClient for HypervisorResourceSynchronousProxy {
3223    type Protocol = HypervisorResourceMarker;
3224
3225    fn from_client(value: fidl::endpoints::ClientEnd<HypervisorResourceMarker>) -> Self {
3226        Self::new(value.into_channel())
3227    }
3228}
3229
3230#[derive(Debug, Clone)]
3231pub struct HypervisorResourceProxy {
3232    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3233}
3234
3235impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3236    type Protocol = HypervisorResourceMarker;
3237
3238    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3239        Self::new(inner)
3240    }
3241
3242    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3243        self.client.into_channel().map_err(|client| Self { client })
3244    }
3245
3246    fn as_channel(&self) -> &::fidl::AsyncChannel {
3247        self.client.as_channel()
3248    }
3249}
3250
3251impl HypervisorResourceProxy {
3252    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3253    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3254        let protocol_name =
3255            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3256        Self { client: fidl::client::Client::new(channel, protocol_name) }
3257    }
3258
3259    /// Get a Stream of events from the remote end of the protocol.
3260    ///
3261    /// # Panics
3262    ///
3263    /// Panics if the event stream was already taken.
3264    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3265        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3266    }
3267
3268    /// Get a hypervisor resource handle.
3269    pub fn r#get(
3270        &self,
3271    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3272    {
3273        HypervisorResourceProxyInterface::r#get(self)
3274    }
3275}
3276
3277impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3278    type GetResponseFut = fidl::client::QueryResponseFut<
3279        fidl::Resource,
3280        fidl::encoding::DefaultFuchsiaResourceDialect,
3281    >;
3282    fn r#get(&self) -> Self::GetResponseFut {
3283        fn _decode(
3284            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3285        ) -> Result<fidl::Resource, fidl::Error> {
3286            let _response = fidl::client::decode_transaction_body::<
3287                HypervisorResourceGetResponse,
3288                fidl::encoding::DefaultFuchsiaResourceDialect,
3289                0x1c312131d3b824a2,
3290            >(_buf?)?;
3291            Ok(_response.resource)
3292        }
3293        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3294            (),
3295            0x1c312131d3b824a2,
3296            fidl::encoding::DynamicFlags::empty(),
3297            _decode,
3298        )
3299    }
3300}
3301
3302pub struct HypervisorResourceEventStream {
3303    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3304}
3305
3306impl std::marker::Unpin for HypervisorResourceEventStream {}
3307
3308impl futures::stream::FusedStream for HypervisorResourceEventStream {
3309    fn is_terminated(&self) -> bool {
3310        self.event_receiver.is_terminated()
3311    }
3312}
3313
3314impl futures::Stream for HypervisorResourceEventStream {
3315    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3316
3317    fn poll_next(
3318        mut self: std::pin::Pin<&mut Self>,
3319        cx: &mut std::task::Context<'_>,
3320    ) -> std::task::Poll<Option<Self::Item>> {
3321        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3322            &mut self.event_receiver,
3323            cx
3324        )?) {
3325            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3326            None => std::task::Poll::Ready(None),
3327        }
3328    }
3329}
3330
3331#[derive(Debug)]
3332pub enum HypervisorResourceEvent {}
3333
3334impl HypervisorResourceEvent {
3335    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3336    fn decode(
3337        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3338    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3339        let (bytes, _handles) = buf.split_mut();
3340        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3341        debug_assert_eq!(tx_header.tx_id, 0);
3342        match tx_header.ordinal {
3343            _ => Err(fidl::Error::UnknownOrdinal {
3344                ordinal: tx_header.ordinal,
3345                protocol_name:
3346                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3347            }),
3348        }
3349    }
3350}
3351
3352/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3353pub struct HypervisorResourceRequestStream {
3354    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3355    is_terminated: bool,
3356}
3357
3358impl std::marker::Unpin for HypervisorResourceRequestStream {}
3359
3360impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3361    fn is_terminated(&self) -> bool {
3362        self.is_terminated
3363    }
3364}
3365
3366impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3367    type Protocol = HypervisorResourceMarker;
3368    type ControlHandle = HypervisorResourceControlHandle;
3369
3370    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3371        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3372    }
3373
3374    fn control_handle(&self) -> Self::ControlHandle {
3375        HypervisorResourceControlHandle { inner: self.inner.clone() }
3376    }
3377
3378    fn into_inner(
3379        self,
3380    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3381    {
3382        (self.inner, self.is_terminated)
3383    }
3384
3385    fn from_inner(
3386        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3387        is_terminated: bool,
3388    ) -> Self {
3389        Self { inner, is_terminated }
3390    }
3391}
3392
3393impl futures::Stream for HypervisorResourceRequestStream {
3394    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3395
3396    fn poll_next(
3397        mut self: std::pin::Pin<&mut Self>,
3398        cx: &mut std::task::Context<'_>,
3399    ) -> std::task::Poll<Option<Self::Item>> {
3400        let this = &mut *self;
3401        if this.inner.check_shutdown(cx) {
3402            this.is_terminated = true;
3403            return std::task::Poll::Ready(None);
3404        }
3405        if this.is_terminated {
3406            panic!("polled HypervisorResourceRequestStream after completion");
3407        }
3408        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3409            |bytes, handles| {
3410                match this.inner.channel().read_etc(cx, bytes, handles) {
3411                    std::task::Poll::Ready(Ok(())) => {}
3412                    std::task::Poll::Pending => return std::task::Poll::Pending,
3413                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3414                        this.is_terminated = true;
3415                        return std::task::Poll::Ready(None);
3416                    }
3417                    std::task::Poll::Ready(Err(e)) => {
3418                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3419                            e.into(),
3420                        ))));
3421                    }
3422                }
3423
3424                // A message has been received from the channel
3425                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3426
3427                std::task::Poll::Ready(Some(match header.ordinal {
3428                0x1c312131d3b824a2 => {
3429                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3430                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3431                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3432                    let control_handle = HypervisorResourceControlHandle {
3433                        inner: this.inner.clone(),
3434                    };
3435                    Ok(HypervisorResourceRequest::Get {
3436                        responder: HypervisorResourceGetResponder {
3437                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3438                            tx_id: header.tx_id,
3439                        },
3440                    })
3441                }
3442                _ => Err(fidl::Error::UnknownOrdinal {
3443                    ordinal: header.ordinal,
3444                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3445                }),
3446            }))
3447            },
3448        )
3449    }
3450}
3451
3452/// Protocol for providing the hypervisor resource.
3453#[derive(Debug)]
3454pub enum HypervisorResourceRequest {
3455    /// Get a hypervisor resource handle.
3456    Get { responder: HypervisorResourceGetResponder },
3457}
3458
3459impl HypervisorResourceRequest {
3460    #[allow(irrefutable_let_patterns)]
3461    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3462        if let HypervisorResourceRequest::Get { responder } = self {
3463            Some((responder))
3464        } else {
3465            None
3466        }
3467    }
3468
3469    /// Name of the method defined in FIDL
3470    pub fn method_name(&self) -> &'static str {
3471        match *self {
3472            HypervisorResourceRequest::Get { .. } => "get",
3473        }
3474    }
3475}
3476
3477#[derive(Debug, Clone)]
3478pub struct HypervisorResourceControlHandle {
3479    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3480}
3481
3482impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3483    fn shutdown(&self) {
3484        self.inner.shutdown()
3485    }
3486    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3487        self.inner.shutdown_with_epitaph(status)
3488    }
3489
3490    fn is_closed(&self) -> bool {
3491        self.inner.channel().is_closed()
3492    }
3493    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3494        self.inner.channel().on_closed()
3495    }
3496
3497    #[cfg(target_os = "fuchsia")]
3498    fn signal_peer(
3499        &self,
3500        clear_mask: zx::Signals,
3501        set_mask: zx::Signals,
3502    ) -> Result<(), zx_status::Status> {
3503        use fidl::Peered;
3504        self.inner.channel().signal_peer(clear_mask, set_mask)
3505    }
3506}
3507
3508impl HypervisorResourceControlHandle {}
3509
3510#[must_use = "FIDL methods require a response to be sent"]
3511#[derive(Debug)]
3512pub struct HypervisorResourceGetResponder {
3513    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3514    tx_id: u32,
3515}
3516
3517/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3518/// if the responder is dropped without sending a response, so that the client
3519/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3520impl std::ops::Drop for HypervisorResourceGetResponder {
3521    fn drop(&mut self) {
3522        self.control_handle.shutdown();
3523        // Safety: drops once, never accessed again
3524        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3525    }
3526}
3527
3528impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3529    type ControlHandle = HypervisorResourceControlHandle;
3530
3531    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3532        &self.control_handle
3533    }
3534
3535    fn drop_without_shutdown(mut self) {
3536        // Safety: drops once, never accessed again due to mem::forget
3537        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3538        // Prevent Drop from running (which would shut down the channel)
3539        std::mem::forget(self);
3540    }
3541}
3542
3543impl HypervisorResourceGetResponder {
3544    /// Sends a response to the FIDL transaction.
3545    ///
3546    /// Sets the channel to shutdown if an error occurs.
3547    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3548        let _result = self.send_raw(resource);
3549        if _result.is_err() {
3550            self.control_handle.shutdown();
3551        }
3552        self.drop_without_shutdown();
3553        _result
3554    }
3555
3556    /// Similar to "send" but does not shutdown the channel if an error occurs.
3557    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3558        let _result = self.send_raw(resource);
3559        self.drop_without_shutdown();
3560        _result
3561    }
3562
3563    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3564        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3565            (resource,),
3566            self.tx_id,
3567            0x1c312131d3b824a2,
3568            fidl::encoding::DynamicFlags::empty(),
3569        )
3570    }
3571}
3572
3573#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3574pub struct InfoResourceMarker;
3575
3576impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3577    type Proxy = InfoResourceProxy;
3578    type RequestStream = InfoResourceRequestStream;
3579    #[cfg(target_os = "fuchsia")]
3580    type SynchronousProxy = InfoResourceSynchronousProxy;
3581
3582    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3583}
3584impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3585
3586pub trait InfoResourceProxyInterface: Send + Sync {
3587    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3588    fn r#get(&self) -> Self::GetResponseFut;
3589}
3590#[derive(Debug)]
3591#[cfg(target_os = "fuchsia")]
3592pub struct InfoResourceSynchronousProxy {
3593    client: fidl::client::sync::Client,
3594}
3595
3596#[cfg(target_os = "fuchsia")]
3597impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3598    type Proxy = InfoResourceProxy;
3599    type Protocol = InfoResourceMarker;
3600
3601    fn from_channel(inner: fidl::Channel) -> Self {
3602        Self::new(inner)
3603    }
3604
3605    fn into_channel(self) -> fidl::Channel {
3606        self.client.into_channel()
3607    }
3608
3609    fn as_channel(&self) -> &fidl::Channel {
3610        self.client.as_channel()
3611    }
3612}
3613
3614#[cfg(target_os = "fuchsia")]
3615impl InfoResourceSynchronousProxy {
3616    pub fn new(channel: fidl::Channel) -> Self {
3617        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3618        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3619    }
3620
3621    pub fn into_channel(self) -> fidl::Channel {
3622        self.client.into_channel()
3623    }
3624
3625    /// Waits until an event arrives and returns it. It is safe for other
3626    /// threads to make concurrent requests while waiting for an event.
3627    pub fn wait_for_event(
3628        &self,
3629        deadline: zx::MonotonicInstant,
3630    ) -> Result<InfoResourceEvent, fidl::Error> {
3631        InfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
3632    }
3633
3634    /// Get an info resource handle.
3635    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3636        let _response =
3637            self.client.send_query::<fidl::encoding::EmptyPayload, InfoResourceGetResponse>(
3638                (),
3639                0x1de8edcb4abc2067,
3640                fidl::encoding::DynamicFlags::empty(),
3641                ___deadline,
3642            )?;
3643        Ok(_response.resource)
3644    }
3645}
3646
3647#[cfg(target_os = "fuchsia")]
3648impl From<InfoResourceSynchronousProxy> for zx::Handle {
3649    fn from(value: InfoResourceSynchronousProxy) -> Self {
3650        value.into_channel().into()
3651    }
3652}
3653
3654#[cfg(target_os = "fuchsia")]
3655impl From<fidl::Channel> for InfoResourceSynchronousProxy {
3656    fn from(value: fidl::Channel) -> Self {
3657        Self::new(value)
3658    }
3659}
3660
3661#[cfg(target_os = "fuchsia")]
3662impl fidl::endpoints::FromClient for InfoResourceSynchronousProxy {
3663    type Protocol = InfoResourceMarker;
3664
3665    fn from_client(value: fidl::endpoints::ClientEnd<InfoResourceMarker>) -> Self {
3666        Self::new(value.into_channel())
3667    }
3668}
3669
3670#[derive(Debug, Clone)]
3671pub struct InfoResourceProxy {
3672    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3673}
3674
3675impl fidl::endpoints::Proxy for InfoResourceProxy {
3676    type Protocol = InfoResourceMarker;
3677
3678    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3679        Self::new(inner)
3680    }
3681
3682    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3683        self.client.into_channel().map_err(|client| Self { client })
3684    }
3685
3686    fn as_channel(&self) -> &::fidl::AsyncChannel {
3687        self.client.as_channel()
3688    }
3689}
3690
3691impl InfoResourceProxy {
3692    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3693    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3694        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3695        Self { client: fidl::client::Client::new(channel, protocol_name) }
3696    }
3697
3698    /// Get a Stream of events from the remote end of the protocol.
3699    ///
3700    /// # Panics
3701    ///
3702    /// Panics if the event stream was already taken.
3703    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3704        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3705    }
3706
3707    /// Get an info resource handle.
3708    pub fn r#get(
3709        &self,
3710    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3711    {
3712        InfoResourceProxyInterface::r#get(self)
3713    }
3714}
3715
3716impl InfoResourceProxyInterface for InfoResourceProxy {
3717    type GetResponseFut = fidl::client::QueryResponseFut<
3718        fidl::Resource,
3719        fidl::encoding::DefaultFuchsiaResourceDialect,
3720    >;
3721    fn r#get(&self) -> Self::GetResponseFut {
3722        fn _decode(
3723            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3724        ) -> Result<fidl::Resource, fidl::Error> {
3725            let _response = fidl::client::decode_transaction_body::<
3726                InfoResourceGetResponse,
3727                fidl::encoding::DefaultFuchsiaResourceDialect,
3728                0x1de8edcb4abc2067,
3729            >(_buf?)?;
3730            Ok(_response.resource)
3731        }
3732        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3733            (),
3734            0x1de8edcb4abc2067,
3735            fidl::encoding::DynamicFlags::empty(),
3736            _decode,
3737        )
3738    }
3739}
3740
3741pub struct InfoResourceEventStream {
3742    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3743}
3744
3745impl std::marker::Unpin for InfoResourceEventStream {}
3746
3747impl futures::stream::FusedStream for InfoResourceEventStream {
3748    fn is_terminated(&self) -> bool {
3749        self.event_receiver.is_terminated()
3750    }
3751}
3752
3753impl futures::Stream for InfoResourceEventStream {
3754    type Item = Result<InfoResourceEvent, fidl::Error>;
3755
3756    fn poll_next(
3757        mut self: std::pin::Pin<&mut Self>,
3758        cx: &mut std::task::Context<'_>,
3759    ) -> std::task::Poll<Option<Self::Item>> {
3760        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3761            &mut self.event_receiver,
3762            cx
3763        )?) {
3764            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3765            None => std::task::Poll::Ready(None),
3766        }
3767    }
3768}
3769
3770#[derive(Debug)]
3771pub enum InfoResourceEvent {}
3772
3773impl InfoResourceEvent {
3774    /// Decodes a message buffer as a [`InfoResourceEvent`].
3775    fn decode(
3776        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3777    ) -> Result<InfoResourceEvent, fidl::Error> {
3778        let (bytes, _handles) = buf.split_mut();
3779        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3780        debug_assert_eq!(tx_header.tx_id, 0);
3781        match tx_header.ordinal {
3782            _ => Err(fidl::Error::UnknownOrdinal {
3783                ordinal: tx_header.ordinal,
3784                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3785            }),
3786        }
3787    }
3788}
3789
3790/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3791pub struct InfoResourceRequestStream {
3792    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3793    is_terminated: bool,
3794}
3795
3796impl std::marker::Unpin for InfoResourceRequestStream {}
3797
3798impl futures::stream::FusedStream for InfoResourceRequestStream {
3799    fn is_terminated(&self) -> bool {
3800        self.is_terminated
3801    }
3802}
3803
3804impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3805    type Protocol = InfoResourceMarker;
3806    type ControlHandle = InfoResourceControlHandle;
3807
3808    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3809        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3810    }
3811
3812    fn control_handle(&self) -> Self::ControlHandle {
3813        InfoResourceControlHandle { inner: self.inner.clone() }
3814    }
3815
3816    fn into_inner(
3817        self,
3818    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3819    {
3820        (self.inner, self.is_terminated)
3821    }
3822
3823    fn from_inner(
3824        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3825        is_terminated: bool,
3826    ) -> Self {
3827        Self { inner, is_terminated }
3828    }
3829}
3830
3831impl futures::Stream for InfoResourceRequestStream {
3832    type Item = Result<InfoResourceRequest, fidl::Error>;
3833
3834    fn poll_next(
3835        mut self: std::pin::Pin<&mut Self>,
3836        cx: &mut std::task::Context<'_>,
3837    ) -> std::task::Poll<Option<Self::Item>> {
3838        let this = &mut *self;
3839        if this.inner.check_shutdown(cx) {
3840            this.is_terminated = true;
3841            return std::task::Poll::Ready(None);
3842        }
3843        if this.is_terminated {
3844            panic!("polled InfoResourceRequestStream after completion");
3845        }
3846        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3847            |bytes, handles| {
3848                match this.inner.channel().read_etc(cx, bytes, handles) {
3849                    std::task::Poll::Ready(Ok(())) => {}
3850                    std::task::Poll::Pending => return std::task::Poll::Pending,
3851                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3852                        this.is_terminated = true;
3853                        return std::task::Poll::Ready(None);
3854                    }
3855                    std::task::Poll::Ready(Err(e)) => {
3856                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3857                            e.into(),
3858                        ))));
3859                    }
3860                }
3861
3862                // A message has been received from the channel
3863                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3864
3865                std::task::Poll::Ready(Some(match header.ordinal {
3866                    0x1de8edcb4abc2067 => {
3867                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3868                        let mut req = fidl::new_empty!(
3869                            fidl::encoding::EmptyPayload,
3870                            fidl::encoding::DefaultFuchsiaResourceDialect
3871                        );
3872                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3873                        let control_handle =
3874                            InfoResourceControlHandle { inner: this.inner.clone() };
3875                        Ok(InfoResourceRequest::Get {
3876                            responder: InfoResourceGetResponder {
3877                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3878                                tx_id: header.tx_id,
3879                            },
3880                        })
3881                    }
3882                    _ => Err(fidl::Error::UnknownOrdinal {
3883                        ordinal: header.ordinal,
3884                        protocol_name:
3885                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3886                    }),
3887                }))
3888            },
3889        )
3890    }
3891}
3892
3893/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3894/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3895#[derive(Debug)]
3896pub enum InfoResourceRequest {
3897    /// Get an info resource handle.
3898    Get { responder: InfoResourceGetResponder },
3899}
3900
3901impl InfoResourceRequest {
3902    #[allow(irrefutable_let_patterns)]
3903    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3904        if let InfoResourceRequest::Get { responder } = self { Some((responder)) } else { None }
3905    }
3906
3907    /// Name of the method defined in FIDL
3908    pub fn method_name(&self) -> &'static str {
3909        match *self {
3910            InfoResourceRequest::Get { .. } => "get",
3911        }
3912    }
3913}
3914
3915#[derive(Debug, Clone)]
3916pub struct InfoResourceControlHandle {
3917    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3918}
3919
3920impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3921    fn shutdown(&self) {
3922        self.inner.shutdown()
3923    }
3924    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3925        self.inner.shutdown_with_epitaph(status)
3926    }
3927
3928    fn is_closed(&self) -> bool {
3929        self.inner.channel().is_closed()
3930    }
3931    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3932        self.inner.channel().on_closed()
3933    }
3934
3935    #[cfg(target_os = "fuchsia")]
3936    fn signal_peer(
3937        &self,
3938        clear_mask: zx::Signals,
3939        set_mask: zx::Signals,
3940    ) -> Result<(), zx_status::Status> {
3941        use fidl::Peered;
3942        self.inner.channel().signal_peer(clear_mask, set_mask)
3943    }
3944}
3945
3946impl InfoResourceControlHandle {}
3947
3948#[must_use = "FIDL methods require a response to be sent"]
3949#[derive(Debug)]
3950pub struct InfoResourceGetResponder {
3951    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
3952    tx_id: u32,
3953}
3954
3955/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
3956/// if the responder is dropped without sending a response, so that the client
3957/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3958impl std::ops::Drop for InfoResourceGetResponder {
3959    fn drop(&mut self) {
3960        self.control_handle.shutdown();
3961        // Safety: drops once, never accessed again
3962        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3963    }
3964}
3965
3966impl fidl::endpoints::Responder for InfoResourceGetResponder {
3967    type ControlHandle = InfoResourceControlHandle;
3968
3969    fn control_handle(&self) -> &InfoResourceControlHandle {
3970        &self.control_handle
3971    }
3972
3973    fn drop_without_shutdown(mut self) {
3974        // Safety: drops once, never accessed again due to mem::forget
3975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3976        // Prevent Drop from running (which would shut down the channel)
3977        std::mem::forget(self);
3978    }
3979}
3980
3981impl InfoResourceGetResponder {
3982    /// Sends a response to the FIDL transaction.
3983    ///
3984    /// Sets the channel to shutdown if an error occurs.
3985    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3986        let _result = self.send_raw(resource);
3987        if _result.is_err() {
3988            self.control_handle.shutdown();
3989        }
3990        self.drop_without_shutdown();
3991        _result
3992    }
3993
3994    /// Similar to "send" but does not shutdown the channel if an error occurs.
3995    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3996        let _result = self.send_raw(resource);
3997        self.drop_without_shutdown();
3998        _result
3999    }
4000
4001    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4002        self.control_handle.inner.send::<InfoResourceGetResponse>(
4003            (resource,),
4004            self.tx_id,
4005            0x1de8edcb4abc2067,
4006            fidl::encoding::DynamicFlags::empty(),
4007        )
4008    }
4009}
4010
4011#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4012pub struct IommuResourceMarker;
4013
4014impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
4015    type Proxy = IommuResourceProxy;
4016    type RequestStream = IommuResourceRequestStream;
4017    #[cfg(target_os = "fuchsia")]
4018    type SynchronousProxy = IommuResourceSynchronousProxy;
4019
4020    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
4021}
4022impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
4023
4024pub trait IommuResourceProxyInterface: Send + Sync {
4025    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4026    fn r#get(&self) -> Self::GetResponseFut;
4027}
4028#[derive(Debug)]
4029#[cfg(target_os = "fuchsia")]
4030pub struct IommuResourceSynchronousProxy {
4031    client: fidl::client::sync::Client,
4032}
4033
4034#[cfg(target_os = "fuchsia")]
4035impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
4036    type Proxy = IommuResourceProxy;
4037    type Protocol = IommuResourceMarker;
4038
4039    fn from_channel(inner: fidl::Channel) -> Self {
4040        Self::new(inner)
4041    }
4042
4043    fn into_channel(self) -> fidl::Channel {
4044        self.client.into_channel()
4045    }
4046
4047    fn as_channel(&self) -> &fidl::Channel {
4048        self.client.as_channel()
4049    }
4050}
4051
4052#[cfg(target_os = "fuchsia")]
4053impl IommuResourceSynchronousProxy {
4054    pub fn new(channel: fidl::Channel) -> Self {
4055        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4056        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4057    }
4058
4059    pub fn into_channel(self) -> fidl::Channel {
4060        self.client.into_channel()
4061    }
4062
4063    /// Waits until an event arrives and returns it. It is safe for other
4064    /// threads to make concurrent requests while waiting for an event.
4065    pub fn wait_for_event(
4066        &self,
4067        deadline: zx::MonotonicInstant,
4068    ) -> Result<IommuResourceEvent, fidl::Error> {
4069        IommuResourceEvent::decode(self.client.wait_for_event(deadline)?)
4070    }
4071
4072    /// Get an iommu resource handle.
4073    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4074        let _response =
4075            self.client.send_query::<fidl::encoding::EmptyPayload, IommuResourceGetResponse>(
4076                (),
4077                0x5af309b619aa7c5b,
4078                fidl::encoding::DynamicFlags::empty(),
4079                ___deadline,
4080            )?;
4081        Ok(_response.resource)
4082    }
4083}
4084
4085#[cfg(target_os = "fuchsia")]
4086impl From<IommuResourceSynchronousProxy> for zx::Handle {
4087    fn from(value: IommuResourceSynchronousProxy) -> Self {
4088        value.into_channel().into()
4089    }
4090}
4091
4092#[cfg(target_os = "fuchsia")]
4093impl From<fidl::Channel> for IommuResourceSynchronousProxy {
4094    fn from(value: fidl::Channel) -> Self {
4095        Self::new(value)
4096    }
4097}
4098
4099#[cfg(target_os = "fuchsia")]
4100impl fidl::endpoints::FromClient for IommuResourceSynchronousProxy {
4101    type Protocol = IommuResourceMarker;
4102
4103    fn from_client(value: fidl::endpoints::ClientEnd<IommuResourceMarker>) -> Self {
4104        Self::new(value.into_channel())
4105    }
4106}
4107
4108#[derive(Debug, Clone)]
4109pub struct IommuResourceProxy {
4110    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4111}
4112
4113impl fidl::endpoints::Proxy for IommuResourceProxy {
4114    type Protocol = IommuResourceMarker;
4115
4116    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4117        Self::new(inner)
4118    }
4119
4120    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4121        self.client.into_channel().map_err(|client| Self { client })
4122    }
4123
4124    fn as_channel(&self) -> &::fidl::AsyncChannel {
4125        self.client.as_channel()
4126    }
4127}
4128
4129impl IommuResourceProxy {
4130    /// Create a new Proxy for fuchsia.kernel/IommuResource.
4131    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4132        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4133        Self { client: fidl::client::Client::new(channel, protocol_name) }
4134    }
4135
4136    /// Get a Stream of events from the remote end of the protocol.
4137    ///
4138    /// # Panics
4139    ///
4140    /// Panics if the event stream was already taken.
4141    pub fn take_event_stream(&self) -> IommuResourceEventStream {
4142        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
4143    }
4144
4145    /// Get an iommu resource handle.
4146    pub fn r#get(
4147        &self,
4148    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4149    {
4150        IommuResourceProxyInterface::r#get(self)
4151    }
4152}
4153
4154impl IommuResourceProxyInterface for IommuResourceProxy {
4155    type GetResponseFut = fidl::client::QueryResponseFut<
4156        fidl::Resource,
4157        fidl::encoding::DefaultFuchsiaResourceDialect,
4158    >;
4159    fn r#get(&self) -> Self::GetResponseFut {
4160        fn _decode(
4161            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4162        ) -> Result<fidl::Resource, fidl::Error> {
4163            let _response = fidl::client::decode_transaction_body::<
4164                IommuResourceGetResponse,
4165                fidl::encoding::DefaultFuchsiaResourceDialect,
4166                0x5af309b619aa7c5b,
4167            >(_buf?)?;
4168            Ok(_response.resource)
4169        }
4170        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4171            (),
4172            0x5af309b619aa7c5b,
4173            fidl::encoding::DynamicFlags::empty(),
4174            _decode,
4175        )
4176    }
4177}
4178
4179pub struct IommuResourceEventStream {
4180    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4181}
4182
4183impl std::marker::Unpin for IommuResourceEventStream {}
4184
4185impl futures::stream::FusedStream for IommuResourceEventStream {
4186    fn is_terminated(&self) -> bool {
4187        self.event_receiver.is_terminated()
4188    }
4189}
4190
4191impl futures::Stream for IommuResourceEventStream {
4192    type Item = Result<IommuResourceEvent, fidl::Error>;
4193
4194    fn poll_next(
4195        mut self: std::pin::Pin<&mut Self>,
4196        cx: &mut std::task::Context<'_>,
4197    ) -> std::task::Poll<Option<Self::Item>> {
4198        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4199            &mut self.event_receiver,
4200            cx
4201        )?) {
4202            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4203            None => std::task::Poll::Ready(None),
4204        }
4205    }
4206}
4207
4208#[derive(Debug)]
4209pub enum IommuResourceEvent {}
4210
4211impl IommuResourceEvent {
4212    /// Decodes a message buffer as a [`IommuResourceEvent`].
4213    fn decode(
4214        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4215    ) -> Result<IommuResourceEvent, fidl::Error> {
4216        let (bytes, _handles) = buf.split_mut();
4217        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4218        debug_assert_eq!(tx_header.tx_id, 0);
4219        match tx_header.ordinal {
4220            _ => Err(fidl::Error::UnknownOrdinal {
4221                ordinal: tx_header.ordinal,
4222                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4223            }),
4224        }
4225    }
4226}
4227
4228/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4229pub struct IommuResourceRequestStream {
4230    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4231    is_terminated: bool,
4232}
4233
4234impl std::marker::Unpin for IommuResourceRequestStream {}
4235
4236impl futures::stream::FusedStream for IommuResourceRequestStream {
4237    fn is_terminated(&self) -> bool {
4238        self.is_terminated
4239    }
4240}
4241
4242impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4243    type Protocol = IommuResourceMarker;
4244    type ControlHandle = IommuResourceControlHandle;
4245
4246    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4247        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4248    }
4249
4250    fn control_handle(&self) -> Self::ControlHandle {
4251        IommuResourceControlHandle { inner: self.inner.clone() }
4252    }
4253
4254    fn into_inner(
4255        self,
4256    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4257    {
4258        (self.inner, self.is_terminated)
4259    }
4260
4261    fn from_inner(
4262        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4263        is_terminated: bool,
4264    ) -> Self {
4265        Self { inner, is_terminated }
4266    }
4267}
4268
4269impl futures::Stream for IommuResourceRequestStream {
4270    type Item = Result<IommuResourceRequest, fidl::Error>;
4271
4272    fn poll_next(
4273        mut self: std::pin::Pin<&mut Self>,
4274        cx: &mut std::task::Context<'_>,
4275    ) -> std::task::Poll<Option<Self::Item>> {
4276        let this = &mut *self;
4277        if this.inner.check_shutdown(cx) {
4278            this.is_terminated = true;
4279            return std::task::Poll::Ready(None);
4280        }
4281        if this.is_terminated {
4282            panic!("polled IommuResourceRequestStream after completion");
4283        }
4284        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4285            |bytes, handles| {
4286                match this.inner.channel().read_etc(cx, bytes, handles) {
4287                    std::task::Poll::Ready(Ok(())) => {}
4288                    std::task::Poll::Pending => return std::task::Poll::Pending,
4289                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4290                        this.is_terminated = true;
4291                        return std::task::Poll::Ready(None);
4292                    }
4293                    std::task::Poll::Ready(Err(e)) => {
4294                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4295                            e.into(),
4296                        ))));
4297                    }
4298                }
4299
4300                // A message has been received from the channel
4301                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4302
4303                std::task::Poll::Ready(Some(match header.ordinal {
4304                    0x5af309b619aa7c5b => {
4305                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4306                        let mut req = fidl::new_empty!(
4307                            fidl::encoding::EmptyPayload,
4308                            fidl::encoding::DefaultFuchsiaResourceDialect
4309                        );
4310                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4311                        let control_handle =
4312                            IommuResourceControlHandle { inner: this.inner.clone() };
4313                        Ok(IommuResourceRequest::Get {
4314                            responder: IommuResourceGetResponder {
4315                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4316                                tx_id: header.tx_id,
4317                            },
4318                        })
4319                    }
4320                    _ => Err(fidl::Error::UnknownOrdinal {
4321                        ordinal: header.ordinal,
4322                        protocol_name:
4323                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4324                    }),
4325                }))
4326            },
4327        )
4328    }
4329}
4330
4331/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4332/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4333#[derive(Debug)]
4334pub enum IommuResourceRequest {
4335    /// Get an iommu resource handle.
4336    Get { responder: IommuResourceGetResponder },
4337}
4338
4339impl IommuResourceRequest {
4340    #[allow(irrefutable_let_patterns)]
4341    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4342        if let IommuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4343    }
4344
4345    /// Name of the method defined in FIDL
4346    pub fn method_name(&self) -> &'static str {
4347        match *self {
4348            IommuResourceRequest::Get { .. } => "get",
4349        }
4350    }
4351}
4352
4353#[derive(Debug, Clone)]
4354pub struct IommuResourceControlHandle {
4355    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4356}
4357
4358impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4359    fn shutdown(&self) {
4360        self.inner.shutdown()
4361    }
4362    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4363        self.inner.shutdown_with_epitaph(status)
4364    }
4365
4366    fn is_closed(&self) -> bool {
4367        self.inner.channel().is_closed()
4368    }
4369    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4370        self.inner.channel().on_closed()
4371    }
4372
4373    #[cfg(target_os = "fuchsia")]
4374    fn signal_peer(
4375        &self,
4376        clear_mask: zx::Signals,
4377        set_mask: zx::Signals,
4378    ) -> Result<(), zx_status::Status> {
4379        use fidl::Peered;
4380        self.inner.channel().signal_peer(clear_mask, set_mask)
4381    }
4382}
4383
4384impl IommuResourceControlHandle {}
4385
4386#[must_use = "FIDL methods require a response to be sent"]
4387#[derive(Debug)]
4388pub struct IommuResourceGetResponder {
4389    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4390    tx_id: u32,
4391}
4392
4393/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4394/// if the responder is dropped without sending a response, so that the client
4395/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4396impl std::ops::Drop for IommuResourceGetResponder {
4397    fn drop(&mut self) {
4398        self.control_handle.shutdown();
4399        // Safety: drops once, never accessed again
4400        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4401    }
4402}
4403
4404impl fidl::endpoints::Responder for IommuResourceGetResponder {
4405    type ControlHandle = IommuResourceControlHandle;
4406
4407    fn control_handle(&self) -> &IommuResourceControlHandle {
4408        &self.control_handle
4409    }
4410
4411    fn drop_without_shutdown(mut self) {
4412        // Safety: drops once, never accessed again due to mem::forget
4413        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4414        // Prevent Drop from running (which would shut down the channel)
4415        std::mem::forget(self);
4416    }
4417}
4418
4419impl IommuResourceGetResponder {
4420    /// Sends a response to the FIDL transaction.
4421    ///
4422    /// Sets the channel to shutdown if an error occurs.
4423    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4424        let _result = self.send_raw(resource);
4425        if _result.is_err() {
4426            self.control_handle.shutdown();
4427        }
4428        self.drop_without_shutdown();
4429        _result
4430    }
4431
4432    /// Similar to "send" but does not shutdown the channel if an error occurs.
4433    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4434        let _result = self.send_raw(resource);
4435        self.drop_without_shutdown();
4436        _result
4437    }
4438
4439    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4440        self.control_handle.inner.send::<IommuResourceGetResponse>(
4441            (resource,),
4442            self.tx_id,
4443            0x5af309b619aa7c5b,
4444            fidl::encoding::DynamicFlags::empty(),
4445        )
4446    }
4447}
4448
4449#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4450pub struct IoportResourceMarker;
4451
4452impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4453    type Proxy = IoportResourceProxy;
4454    type RequestStream = IoportResourceRequestStream;
4455    #[cfg(target_os = "fuchsia")]
4456    type SynchronousProxy = IoportResourceSynchronousProxy;
4457
4458    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4459}
4460impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4461
4462pub trait IoportResourceProxyInterface: Send + Sync {
4463    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4464    fn r#get(&self) -> Self::GetResponseFut;
4465}
4466#[derive(Debug)]
4467#[cfg(target_os = "fuchsia")]
4468pub struct IoportResourceSynchronousProxy {
4469    client: fidl::client::sync::Client,
4470}
4471
4472#[cfg(target_os = "fuchsia")]
4473impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4474    type Proxy = IoportResourceProxy;
4475    type Protocol = IoportResourceMarker;
4476
4477    fn from_channel(inner: fidl::Channel) -> Self {
4478        Self::new(inner)
4479    }
4480
4481    fn into_channel(self) -> fidl::Channel {
4482        self.client.into_channel()
4483    }
4484
4485    fn as_channel(&self) -> &fidl::Channel {
4486        self.client.as_channel()
4487    }
4488}
4489
4490#[cfg(target_os = "fuchsia")]
4491impl IoportResourceSynchronousProxy {
4492    pub fn new(channel: fidl::Channel) -> Self {
4493        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4494        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4495    }
4496
4497    pub fn into_channel(self) -> fidl::Channel {
4498        self.client.into_channel()
4499    }
4500
4501    /// Waits until an event arrives and returns it. It is safe for other
4502    /// threads to make concurrent requests while waiting for an event.
4503    pub fn wait_for_event(
4504        &self,
4505        deadline: zx::MonotonicInstant,
4506    ) -> Result<IoportResourceEvent, fidl::Error> {
4507        IoportResourceEvent::decode(self.client.wait_for_event(deadline)?)
4508    }
4509
4510    /// Get an IO Port resource handle.
4511    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4512        let _response =
4513            self.client.send_query::<fidl::encoding::EmptyPayload, IoportResourceGetResponse>(
4514                (),
4515                0x4db20876b537c52b,
4516                fidl::encoding::DynamicFlags::empty(),
4517                ___deadline,
4518            )?;
4519        Ok(_response.resource)
4520    }
4521}
4522
4523#[cfg(target_os = "fuchsia")]
4524impl From<IoportResourceSynchronousProxy> for zx::Handle {
4525    fn from(value: IoportResourceSynchronousProxy) -> Self {
4526        value.into_channel().into()
4527    }
4528}
4529
4530#[cfg(target_os = "fuchsia")]
4531impl From<fidl::Channel> for IoportResourceSynchronousProxy {
4532    fn from(value: fidl::Channel) -> Self {
4533        Self::new(value)
4534    }
4535}
4536
4537#[cfg(target_os = "fuchsia")]
4538impl fidl::endpoints::FromClient for IoportResourceSynchronousProxy {
4539    type Protocol = IoportResourceMarker;
4540
4541    fn from_client(value: fidl::endpoints::ClientEnd<IoportResourceMarker>) -> Self {
4542        Self::new(value.into_channel())
4543    }
4544}
4545
4546#[derive(Debug, Clone)]
4547pub struct IoportResourceProxy {
4548    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4549}
4550
4551impl fidl::endpoints::Proxy for IoportResourceProxy {
4552    type Protocol = IoportResourceMarker;
4553
4554    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4555        Self::new(inner)
4556    }
4557
4558    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4559        self.client.into_channel().map_err(|client| Self { client })
4560    }
4561
4562    fn as_channel(&self) -> &::fidl::AsyncChannel {
4563        self.client.as_channel()
4564    }
4565}
4566
4567impl IoportResourceProxy {
4568    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4569    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4570        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4571        Self { client: fidl::client::Client::new(channel, protocol_name) }
4572    }
4573
4574    /// Get a Stream of events from the remote end of the protocol.
4575    ///
4576    /// # Panics
4577    ///
4578    /// Panics if the event stream was already taken.
4579    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4580        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4581    }
4582
4583    /// Get an IO Port resource handle.
4584    pub fn r#get(
4585        &self,
4586    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4587    {
4588        IoportResourceProxyInterface::r#get(self)
4589    }
4590}
4591
4592impl IoportResourceProxyInterface for IoportResourceProxy {
4593    type GetResponseFut = fidl::client::QueryResponseFut<
4594        fidl::Resource,
4595        fidl::encoding::DefaultFuchsiaResourceDialect,
4596    >;
4597    fn r#get(&self) -> Self::GetResponseFut {
4598        fn _decode(
4599            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4600        ) -> Result<fidl::Resource, fidl::Error> {
4601            let _response = fidl::client::decode_transaction_body::<
4602                IoportResourceGetResponse,
4603                fidl::encoding::DefaultFuchsiaResourceDialect,
4604                0x4db20876b537c52b,
4605            >(_buf?)?;
4606            Ok(_response.resource)
4607        }
4608        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4609            (),
4610            0x4db20876b537c52b,
4611            fidl::encoding::DynamicFlags::empty(),
4612            _decode,
4613        )
4614    }
4615}
4616
4617pub struct IoportResourceEventStream {
4618    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4619}
4620
4621impl std::marker::Unpin for IoportResourceEventStream {}
4622
4623impl futures::stream::FusedStream for IoportResourceEventStream {
4624    fn is_terminated(&self) -> bool {
4625        self.event_receiver.is_terminated()
4626    }
4627}
4628
4629impl futures::Stream for IoportResourceEventStream {
4630    type Item = Result<IoportResourceEvent, fidl::Error>;
4631
4632    fn poll_next(
4633        mut self: std::pin::Pin<&mut Self>,
4634        cx: &mut std::task::Context<'_>,
4635    ) -> std::task::Poll<Option<Self::Item>> {
4636        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4637            &mut self.event_receiver,
4638            cx
4639        )?) {
4640            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4641            None => std::task::Poll::Ready(None),
4642        }
4643    }
4644}
4645
4646#[derive(Debug)]
4647pub enum IoportResourceEvent {}
4648
4649impl IoportResourceEvent {
4650    /// Decodes a message buffer as a [`IoportResourceEvent`].
4651    fn decode(
4652        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4653    ) -> Result<IoportResourceEvent, fidl::Error> {
4654        let (bytes, _handles) = buf.split_mut();
4655        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4656        debug_assert_eq!(tx_header.tx_id, 0);
4657        match tx_header.ordinal {
4658            _ => Err(fidl::Error::UnknownOrdinal {
4659                ordinal: tx_header.ordinal,
4660                protocol_name:
4661                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4662            }),
4663        }
4664    }
4665}
4666
4667/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4668pub struct IoportResourceRequestStream {
4669    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4670    is_terminated: bool,
4671}
4672
4673impl std::marker::Unpin for IoportResourceRequestStream {}
4674
4675impl futures::stream::FusedStream for IoportResourceRequestStream {
4676    fn is_terminated(&self) -> bool {
4677        self.is_terminated
4678    }
4679}
4680
4681impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4682    type Protocol = IoportResourceMarker;
4683    type ControlHandle = IoportResourceControlHandle;
4684
4685    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4686        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4687    }
4688
4689    fn control_handle(&self) -> Self::ControlHandle {
4690        IoportResourceControlHandle { inner: self.inner.clone() }
4691    }
4692
4693    fn into_inner(
4694        self,
4695    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4696    {
4697        (self.inner, self.is_terminated)
4698    }
4699
4700    fn from_inner(
4701        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4702        is_terminated: bool,
4703    ) -> Self {
4704        Self { inner, is_terminated }
4705    }
4706}
4707
4708impl futures::Stream for IoportResourceRequestStream {
4709    type Item = Result<IoportResourceRequest, fidl::Error>;
4710
4711    fn poll_next(
4712        mut self: std::pin::Pin<&mut Self>,
4713        cx: &mut std::task::Context<'_>,
4714    ) -> std::task::Poll<Option<Self::Item>> {
4715        let this = &mut *self;
4716        if this.inner.check_shutdown(cx) {
4717            this.is_terminated = true;
4718            return std::task::Poll::Ready(None);
4719        }
4720        if this.is_terminated {
4721            panic!("polled IoportResourceRequestStream after completion");
4722        }
4723        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4724            |bytes, handles| {
4725                match this.inner.channel().read_etc(cx, bytes, handles) {
4726                    std::task::Poll::Ready(Ok(())) => {}
4727                    std::task::Poll::Pending => return std::task::Poll::Pending,
4728                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4729                        this.is_terminated = true;
4730                        return std::task::Poll::Ready(None);
4731                    }
4732                    std::task::Poll::Ready(Err(e)) => {
4733                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4734                            e.into(),
4735                        ))));
4736                    }
4737                }
4738
4739                // A message has been received from the channel
4740                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4741
4742                std::task::Poll::Ready(Some(match header.ordinal {
4743                    0x4db20876b537c52b => {
4744                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4745                        let mut req = fidl::new_empty!(
4746                            fidl::encoding::EmptyPayload,
4747                            fidl::encoding::DefaultFuchsiaResourceDialect
4748                        );
4749                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4750                        let control_handle =
4751                            IoportResourceControlHandle { inner: this.inner.clone() };
4752                        Ok(IoportResourceRequest::Get {
4753                            responder: IoportResourceGetResponder {
4754                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4755                                tx_id: header.tx_id,
4756                            },
4757                        })
4758                    }
4759                    _ => Err(fidl::Error::UnknownOrdinal {
4760                        ordinal: header.ordinal,
4761                        protocol_name:
4762                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4763                    }),
4764                }))
4765            },
4766        )
4767    }
4768}
4769
4770/// Protocol for providing an IO Port resource with access to all valid ranges.
4771#[derive(Debug)]
4772pub enum IoportResourceRequest {
4773    /// Get an IO Port resource handle.
4774    Get { responder: IoportResourceGetResponder },
4775}
4776
4777impl IoportResourceRequest {
4778    #[allow(irrefutable_let_patterns)]
4779    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4780        if let IoportResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4781    }
4782
4783    /// Name of the method defined in FIDL
4784    pub fn method_name(&self) -> &'static str {
4785        match *self {
4786            IoportResourceRequest::Get { .. } => "get",
4787        }
4788    }
4789}
4790
4791#[derive(Debug, Clone)]
4792pub struct IoportResourceControlHandle {
4793    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4794}
4795
4796impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4797    fn shutdown(&self) {
4798        self.inner.shutdown()
4799    }
4800    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4801        self.inner.shutdown_with_epitaph(status)
4802    }
4803
4804    fn is_closed(&self) -> bool {
4805        self.inner.channel().is_closed()
4806    }
4807    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4808        self.inner.channel().on_closed()
4809    }
4810
4811    #[cfg(target_os = "fuchsia")]
4812    fn signal_peer(
4813        &self,
4814        clear_mask: zx::Signals,
4815        set_mask: zx::Signals,
4816    ) -> Result<(), zx_status::Status> {
4817        use fidl::Peered;
4818        self.inner.channel().signal_peer(clear_mask, set_mask)
4819    }
4820}
4821
4822impl IoportResourceControlHandle {}
4823
4824#[must_use = "FIDL methods require a response to be sent"]
4825#[derive(Debug)]
4826pub struct IoportResourceGetResponder {
4827    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4828    tx_id: u32,
4829}
4830
4831/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4832/// if the responder is dropped without sending a response, so that the client
4833/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4834impl std::ops::Drop for IoportResourceGetResponder {
4835    fn drop(&mut self) {
4836        self.control_handle.shutdown();
4837        // Safety: drops once, never accessed again
4838        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4839    }
4840}
4841
4842impl fidl::endpoints::Responder for IoportResourceGetResponder {
4843    type ControlHandle = IoportResourceControlHandle;
4844
4845    fn control_handle(&self) -> &IoportResourceControlHandle {
4846        &self.control_handle
4847    }
4848
4849    fn drop_without_shutdown(mut self) {
4850        // Safety: drops once, never accessed again due to mem::forget
4851        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4852        // Prevent Drop from running (which would shut down the channel)
4853        std::mem::forget(self);
4854    }
4855}
4856
4857impl IoportResourceGetResponder {
4858    /// Sends a response to the FIDL transaction.
4859    ///
4860    /// Sets the channel to shutdown if an error occurs.
4861    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4862        let _result = self.send_raw(resource);
4863        if _result.is_err() {
4864            self.control_handle.shutdown();
4865        }
4866        self.drop_without_shutdown();
4867        _result
4868    }
4869
4870    /// Similar to "send" but does not shutdown the channel if an error occurs.
4871    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4872        let _result = self.send_raw(resource);
4873        self.drop_without_shutdown();
4874        _result
4875    }
4876
4877    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4878        self.control_handle.inner.send::<IoportResourceGetResponse>(
4879            (resource,),
4880            self.tx_id,
4881            0x4db20876b537c52b,
4882            fidl::encoding::DynamicFlags::empty(),
4883        )
4884    }
4885}
4886
4887#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4888pub struct IrqResourceMarker;
4889
4890impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4891    type Proxy = IrqResourceProxy;
4892    type RequestStream = IrqResourceRequestStream;
4893    #[cfg(target_os = "fuchsia")]
4894    type SynchronousProxy = IrqResourceSynchronousProxy;
4895
4896    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4897}
4898impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4899
4900pub trait IrqResourceProxyInterface: Send + Sync {
4901    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4902    fn r#get(&self) -> Self::GetResponseFut;
4903}
4904#[derive(Debug)]
4905#[cfg(target_os = "fuchsia")]
4906pub struct IrqResourceSynchronousProxy {
4907    client: fidl::client::sync::Client,
4908}
4909
4910#[cfg(target_os = "fuchsia")]
4911impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
4912    type Proxy = IrqResourceProxy;
4913    type Protocol = IrqResourceMarker;
4914
4915    fn from_channel(inner: fidl::Channel) -> Self {
4916        Self::new(inner)
4917    }
4918
4919    fn into_channel(self) -> fidl::Channel {
4920        self.client.into_channel()
4921    }
4922
4923    fn as_channel(&self) -> &fidl::Channel {
4924        self.client.as_channel()
4925    }
4926}
4927
4928#[cfg(target_os = "fuchsia")]
4929impl IrqResourceSynchronousProxy {
4930    pub fn new(channel: fidl::Channel) -> Self {
4931        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4932        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4933    }
4934
4935    pub fn into_channel(self) -> fidl::Channel {
4936        self.client.into_channel()
4937    }
4938
4939    /// Waits until an event arrives and returns it. It is safe for other
4940    /// threads to make concurrent requests while waiting for an event.
4941    pub fn wait_for_event(
4942        &self,
4943        deadline: zx::MonotonicInstant,
4944    ) -> Result<IrqResourceEvent, fidl::Error> {
4945        IrqResourceEvent::decode(self.client.wait_for_event(deadline)?)
4946    }
4947
4948    /// Get an IRQ resource handle.
4949    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4950        let _response =
4951            self.client.send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse>(
4952                (),
4953                0x491be54504b041e9,
4954                fidl::encoding::DynamicFlags::empty(),
4955                ___deadline,
4956            )?;
4957        Ok(_response.resource)
4958    }
4959}
4960
4961#[cfg(target_os = "fuchsia")]
4962impl From<IrqResourceSynchronousProxy> for zx::Handle {
4963    fn from(value: IrqResourceSynchronousProxy) -> Self {
4964        value.into_channel().into()
4965    }
4966}
4967
4968#[cfg(target_os = "fuchsia")]
4969impl From<fidl::Channel> for IrqResourceSynchronousProxy {
4970    fn from(value: fidl::Channel) -> Self {
4971        Self::new(value)
4972    }
4973}
4974
4975#[cfg(target_os = "fuchsia")]
4976impl fidl::endpoints::FromClient for IrqResourceSynchronousProxy {
4977    type Protocol = IrqResourceMarker;
4978
4979    fn from_client(value: fidl::endpoints::ClientEnd<IrqResourceMarker>) -> Self {
4980        Self::new(value.into_channel())
4981    }
4982}
4983
4984#[derive(Debug, Clone)]
4985pub struct IrqResourceProxy {
4986    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4987}
4988
4989impl fidl::endpoints::Proxy for IrqResourceProxy {
4990    type Protocol = IrqResourceMarker;
4991
4992    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4993        Self::new(inner)
4994    }
4995
4996    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4997        self.client.into_channel().map_err(|client| Self { client })
4998    }
4999
5000    fn as_channel(&self) -> &::fidl::AsyncChannel {
5001        self.client.as_channel()
5002    }
5003}
5004
5005impl IrqResourceProxy {
5006    /// Create a new Proxy for fuchsia.kernel/IrqResource.
5007    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5008        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5009        Self { client: fidl::client::Client::new(channel, protocol_name) }
5010    }
5011
5012    /// Get a Stream of events from the remote end of the protocol.
5013    ///
5014    /// # Panics
5015    ///
5016    /// Panics if the event stream was already taken.
5017    pub fn take_event_stream(&self) -> IrqResourceEventStream {
5018        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
5019    }
5020
5021    /// Get an IRQ resource handle.
5022    pub fn r#get(
5023        &self,
5024    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5025    {
5026        IrqResourceProxyInterface::r#get(self)
5027    }
5028}
5029
5030impl IrqResourceProxyInterface for IrqResourceProxy {
5031    type GetResponseFut = fidl::client::QueryResponseFut<
5032        fidl::Resource,
5033        fidl::encoding::DefaultFuchsiaResourceDialect,
5034    >;
5035    fn r#get(&self) -> Self::GetResponseFut {
5036        fn _decode(
5037            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5038        ) -> Result<fidl::Resource, fidl::Error> {
5039            let _response = fidl::client::decode_transaction_body::<
5040                IrqResourceGetResponse,
5041                fidl::encoding::DefaultFuchsiaResourceDialect,
5042                0x491be54504b041e9,
5043            >(_buf?)?;
5044            Ok(_response.resource)
5045        }
5046        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5047            (),
5048            0x491be54504b041e9,
5049            fidl::encoding::DynamicFlags::empty(),
5050            _decode,
5051        )
5052    }
5053}
5054
5055pub struct IrqResourceEventStream {
5056    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5057}
5058
5059impl std::marker::Unpin for IrqResourceEventStream {}
5060
5061impl futures::stream::FusedStream for IrqResourceEventStream {
5062    fn is_terminated(&self) -> bool {
5063        self.event_receiver.is_terminated()
5064    }
5065}
5066
5067impl futures::Stream for IrqResourceEventStream {
5068    type Item = Result<IrqResourceEvent, fidl::Error>;
5069
5070    fn poll_next(
5071        mut self: std::pin::Pin<&mut Self>,
5072        cx: &mut std::task::Context<'_>,
5073    ) -> std::task::Poll<Option<Self::Item>> {
5074        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5075            &mut self.event_receiver,
5076            cx
5077        )?) {
5078            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
5079            None => std::task::Poll::Ready(None),
5080        }
5081    }
5082}
5083
5084#[derive(Debug)]
5085pub enum IrqResourceEvent {}
5086
5087impl IrqResourceEvent {
5088    /// Decodes a message buffer as a [`IrqResourceEvent`].
5089    fn decode(
5090        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5091    ) -> Result<IrqResourceEvent, fidl::Error> {
5092        let (bytes, _handles) = buf.split_mut();
5093        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5094        debug_assert_eq!(tx_header.tx_id, 0);
5095        match tx_header.ordinal {
5096            _ => Err(fidl::Error::UnknownOrdinal {
5097                ordinal: tx_header.ordinal,
5098                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5099            }),
5100        }
5101    }
5102}
5103
5104/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
5105pub struct IrqResourceRequestStream {
5106    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5107    is_terminated: bool,
5108}
5109
5110impl std::marker::Unpin for IrqResourceRequestStream {}
5111
5112impl futures::stream::FusedStream for IrqResourceRequestStream {
5113    fn is_terminated(&self) -> bool {
5114        self.is_terminated
5115    }
5116}
5117
5118impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
5119    type Protocol = IrqResourceMarker;
5120    type ControlHandle = IrqResourceControlHandle;
5121
5122    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5123        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5124    }
5125
5126    fn control_handle(&self) -> Self::ControlHandle {
5127        IrqResourceControlHandle { inner: self.inner.clone() }
5128    }
5129
5130    fn into_inner(
5131        self,
5132    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5133    {
5134        (self.inner, self.is_terminated)
5135    }
5136
5137    fn from_inner(
5138        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5139        is_terminated: bool,
5140    ) -> Self {
5141        Self { inner, is_terminated }
5142    }
5143}
5144
5145impl futures::Stream for IrqResourceRequestStream {
5146    type Item = Result<IrqResourceRequest, fidl::Error>;
5147
5148    fn poll_next(
5149        mut self: std::pin::Pin<&mut Self>,
5150        cx: &mut std::task::Context<'_>,
5151    ) -> std::task::Poll<Option<Self::Item>> {
5152        let this = &mut *self;
5153        if this.inner.check_shutdown(cx) {
5154            this.is_terminated = true;
5155            return std::task::Poll::Ready(None);
5156        }
5157        if this.is_terminated {
5158            panic!("polled IrqResourceRequestStream after completion");
5159        }
5160        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5161            |bytes, handles| {
5162                match this.inner.channel().read_etc(cx, bytes, handles) {
5163                    std::task::Poll::Ready(Ok(())) => {}
5164                    std::task::Poll::Pending => return std::task::Poll::Pending,
5165                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5166                        this.is_terminated = true;
5167                        return std::task::Poll::Ready(None);
5168                    }
5169                    std::task::Poll::Ready(Err(e)) => {
5170                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5171                            e.into(),
5172                        ))));
5173                    }
5174                }
5175
5176                // A message has been received from the channel
5177                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5178
5179                std::task::Poll::Ready(Some(match header.ordinal {
5180                    0x491be54504b041e9 => {
5181                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5182                        let mut req = fidl::new_empty!(
5183                            fidl::encoding::EmptyPayload,
5184                            fidl::encoding::DefaultFuchsiaResourceDialect
5185                        );
5186                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5187                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
5188                        Ok(IrqResourceRequest::Get {
5189                            responder: IrqResourceGetResponder {
5190                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5191                                tx_id: header.tx_id,
5192                            },
5193                        })
5194                    }
5195                    _ => Err(fidl::Error::UnknownOrdinal {
5196                        ordinal: header.ordinal,
5197                        protocol_name:
5198                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5199                    }),
5200                }))
5201            },
5202        )
5203    }
5204}
5205
5206/// Protocol for providing an IRQ resource with access to all valid ranges.
5207#[derive(Debug)]
5208pub enum IrqResourceRequest {
5209    /// Get an IRQ resource handle.
5210    Get { responder: IrqResourceGetResponder },
5211}
5212
5213impl IrqResourceRequest {
5214    #[allow(irrefutable_let_patterns)]
5215    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
5216        if let IrqResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5217    }
5218
5219    /// Name of the method defined in FIDL
5220    pub fn method_name(&self) -> &'static str {
5221        match *self {
5222            IrqResourceRequest::Get { .. } => "get",
5223        }
5224    }
5225}
5226
5227#[derive(Debug, Clone)]
5228pub struct IrqResourceControlHandle {
5229    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5230}
5231
5232impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
5233    fn shutdown(&self) {
5234        self.inner.shutdown()
5235    }
5236    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5237        self.inner.shutdown_with_epitaph(status)
5238    }
5239
5240    fn is_closed(&self) -> bool {
5241        self.inner.channel().is_closed()
5242    }
5243    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5244        self.inner.channel().on_closed()
5245    }
5246
5247    #[cfg(target_os = "fuchsia")]
5248    fn signal_peer(
5249        &self,
5250        clear_mask: zx::Signals,
5251        set_mask: zx::Signals,
5252    ) -> Result<(), zx_status::Status> {
5253        use fidl::Peered;
5254        self.inner.channel().signal_peer(clear_mask, set_mask)
5255    }
5256}
5257
5258impl IrqResourceControlHandle {}
5259
5260#[must_use = "FIDL methods require a response to be sent"]
5261#[derive(Debug)]
5262pub struct IrqResourceGetResponder {
5263    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5264    tx_id: u32,
5265}
5266
5267/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5268/// if the responder is dropped without sending a response, so that the client
5269/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5270impl std::ops::Drop for IrqResourceGetResponder {
5271    fn drop(&mut self) {
5272        self.control_handle.shutdown();
5273        // Safety: drops once, never accessed again
5274        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5275    }
5276}
5277
5278impl fidl::endpoints::Responder for IrqResourceGetResponder {
5279    type ControlHandle = IrqResourceControlHandle;
5280
5281    fn control_handle(&self) -> &IrqResourceControlHandle {
5282        &self.control_handle
5283    }
5284
5285    fn drop_without_shutdown(mut self) {
5286        // Safety: drops once, never accessed again due to mem::forget
5287        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5288        // Prevent Drop from running (which would shut down the channel)
5289        std::mem::forget(self);
5290    }
5291}
5292
5293impl IrqResourceGetResponder {
5294    /// Sends a response to the FIDL transaction.
5295    ///
5296    /// Sets the channel to shutdown if an error occurs.
5297    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5298        let _result = self.send_raw(resource);
5299        if _result.is_err() {
5300            self.control_handle.shutdown();
5301        }
5302        self.drop_without_shutdown();
5303        _result
5304    }
5305
5306    /// Similar to "send" but does not shutdown the channel if an error occurs.
5307    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5308        let _result = self.send_raw(resource);
5309        self.drop_without_shutdown();
5310        _result
5311    }
5312
5313    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5314        self.control_handle.inner.send::<IrqResourceGetResponse>(
5315            (resource,),
5316            self.tx_id,
5317            0x491be54504b041e9,
5318            fidl::encoding::DynamicFlags::empty(),
5319        )
5320    }
5321}
5322
5323#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5324pub struct MexecResourceMarker;
5325
5326impl fidl::endpoints::ProtocolMarker for MexecResourceMarker {
5327    type Proxy = MexecResourceProxy;
5328    type RequestStream = MexecResourceRequestStream;
5329    #[cfg(target_os = "fuchsia")]
5330    type SynchronousProxy = MexecResourceSynchronousProxy;
5331
5332    const DEBUG_NAME: &'static str = "fuchsia.kernel.MexecResource";
5333}
5334impl fidl::endpoints::DiscoverableProtocolMarker for MexecResourceMarker {}
5335
5336pub trait MexecResourceProxyInterface: Send + Sync {
5337    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5338    fn r#get(&self) -> Self::GetResponseFut;
5339}
5340#[derive(Debug)]
5341#[cfg(target_os = "fuchsia")]
5342pub struct MexecResourceSynchronousProxy {
5343    client: fidl::client::sync::Client,
5344}
5345
5346#[cfg(target_os = "fuchsia")]
5347impl fidl::endpoints::SynchronousProxy for MexecResourceSynchronousProxy {
5348    type Proxy = MexecResourceProxy;
5349    type Protocol = MexecResourceMarker;
5350
5351    fn from_channel(inner: fidl::Channel) -> Self {
5352        Self::new(inner)
5353    }
5354
5355    fn into_channel(self) -> fidl::Channel {
5356        self.client.into_channel()
5357    }
5358
5359    fn as_channel(&self) -> &fidl::Channel {
5360        self.client.as_channel()
5361    }
5362}
5363
5364#[cfg(target_os = "fuchsia")]
5365impl MexecResourceSynchronousProxy {
5366    pub fn new(channel: fidl::Channel) -> Self {
5367        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5368        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5369    }
5370
5371    pub fn into_channel(self) -> fidl::Channel {
5372        self.client.into_channel()
5373    }
5374
5375    /// Waits until an event arrives and returns it. It is safe for other
5376    /// threads to make concurrent requests while waiting for an event.
5377    pub fn wait_for_event(
5378        &self,
5379        deadline: zx::MonotonicInstant,
5380    ) -> Result<MexecResourceEvent, fidl::Error> {
5381        MexecResourceEvent::decode(self.client.wait_for_event(deadline)?)
5382    }
5383
5384    /// Get an MEXEC resource handle as `resource`.
5385    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5386        let _response =
5387            self.client.send_query::<fidl::encoding::EmptyPayload, MexecResourceGetResponse>(
5388                (),
5389                0xff93e6722900f54,
5390                fidl::encoding::DynamicFlags::empty(),
5391                ___deadline,
5392            )?;
5393        Ok(_response.resource)
5394    }
5395}
5396
5397#[cfg(target_os = "fuchsia")]
5398impl From<MexecResourceSynchronousProxy> for zx::Handle {
5399    fn from(value: MexecResourceSynchronousProxy) -> Self {
5400        value.into_channel().into()
5401    }
5402}
5403
5404#[cfg(target_os = "fuchsia")]
5405impl From<fidl::Channel> for MexecResourceSynchronousProxy {
5406    fn from(value: fidl::Channel) -> Self {
5407        Self::new(value)
5408    }
5409}
5410
5411#[cfg(target_os = "fuchsia")]
5412impl fidl::endpoints::FromClient for MexecResourceSynchronousProxy {
5413    type Protocol = MexecResourceMarker;
5414
5415    fn from_client(value: fidl::endpoints::ClientEnd<MexecResourceMarker>) -> Self {
5416        Self::new(value.into_channel())
5417    }
5418}
5419
5420#[derive(Debug, Clone)]
5421pub struct MexecResourceProxy {
5422    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5423}
5424
5425impl fidl::endpoints::Proxy for MexecResourceProxy {
5426    type Protocol = MexecResourceMarker;
5427
5428    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5429        Self::new(inner)
5430    }
5431
5432    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5433        self.client.into_channel().map_err(|client| Self { client })
5434    }
5435
5436    fn as_channel(&self) -> &::fidl::AsyncChannel {
5437        self.client.as_channel()
5438    }
5439}
5440
5441impl MexecResourceProxy {
5442    /// Create a new Proxy for fuchsia.kernel/MexecResource.
5443    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5444        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5445        Self { client: fidl::client::Client::new(channel, protocol_name) }
5446    }
5447
5448    /// Get a Stream of events from the remote end of the protocol.
5449    ///
5450    /// # Panics
5451    ///
5452    /// Panics if the event stream was already taken.
5453    pub fn take_event_stream(&self) -> MexecResourceEventStream {
5454        MexecResourceEventStream { event_receiver: self.client.take_event_receiver() }
5455    }
5456
5457    /// Get an MEXEC resource handle as `resource`.
5458    pub fn r#get(
5459        &self,
5460    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5461    {
5462        MexecResourceProxyInterface::r#get(self)
5463    }
5464}
5465
5466impl MexecResourceProxyInterface for MexecResourceProxy {
5467    type GetResponseFut = fidl::client::QueryResponseFut<
5468        fidl::Resource,
5469        fidl::encoding::DefaultFuchsiaResourceDialect,
5470    >;
5471    fn r#get(&self) -> Self::GetResponseFut {
5472        fn _decode(
5473            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5474        ) -> Result<fidl::Resource, fidl::Error> {
5475            let _response = fidl::client::decode_transaction_body::<
5476                MexecResourceGetResponse,
5477                fidl::encoding::DefaultFuchsiaResourceDialect,
5478                0xff93e6722900f54,
5479            >(_buf?)?;
5480            Ok(_response.resource)
5481        }
5482        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5483            (),
5484            0xff93e6722900f54,
5485            fidl::encoding::DynamicFlags::empty(),
5486            _decode,
5487        )
5488    }
5489}
5490
5491pub struct MexecResourceEventStream {
5492    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5493}
5494
5495impl std::marker::Unpin for MexecResourceEventStream {}
5496
5497impl futures::stream::FusedStream for MexecResourceEventStream {
5498    fn is_terminated(&self) -> bool {
5499        self.event_receiver.is_terminated()
5500    }
5501}
5502
5503impl futures::Stream for MexecResourceEventStream {
5504    type Item = Result<MexecResourceEvent, fidl::Error>;
5505
5506    fn poll_next(
5507        mut self: std::pin::Pin<&mut Self>,
5508        cx: &mut std::task::Context<'_>,
5509    ) -> std::task::Poll<Option<Self::Item>> {
5510        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5511            &mut self.event_receiver,
5512            cx
5513        )?) {
5514            Some(buf) => std::task::Poll::Ready(Some(MexecResourceEvent::decode(buf))),
5515            None => std::task::Poll::Ready(None),
5516        }
5517    }
5518}
5519
5520#[derive(Debug)]
5521pub enum MexecResourceEvent {}
5522
5523impl MexecResourceEvent {
5524    /// Decodes a message buffer as a [`MexecResourceEvent`].
5525    fn decode(
5526        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5527    ) -> Result<MexecResourceEvent, fidl::Error> {
5528        let (bytes, _handles) = buf.split_mut();
5529        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5530        debug_assert_eq!(tx_header.tx_id, 0);
5531        match tx_header.ordinal {
5532            _ => Err(fidl::Error::UnknownOrdinal {
5533                ordinal: tx_header.ordinal,
5534                protocol_name: <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5535            }),
5536        }
5537    }
5538}
5539
5540/// A Stream of incoming requests for fuchsia.kernel/MexecResource.
5541pub struct MexecResourceRequestStream {
5542    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5543    is_terminated: bool,
5544}
5545
5546impl std::marker::Unpin for MexecResourceRequestStream {}
5547
5548impl futures::stream::FusedStream for MexecResourceRequestStream {
5549    fn is_terminated(&self) -> bool {
5550        self.is_terminated
5551    }
5552}
5553
5554impl fidl::endpoints::RequestStream for MexecResourceRequestStream {
5555    type Protocol = MexecResourceMarker;
5556    type ControlHandle = MexecResourceControlHandle;
5557
5558    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5559        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5560    }
5561
5562    fn control_handle(&self) -> Self::ControlHandle {
5563        MexecResourceControlHandle { inner: self.inner.clone() }
5564    }
5565
5566    fn into_inner(
5567        self,
5568    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5569    {
5570        (self.inner, self.is_terminated)
5571    }
5572
5573    fn from_inner(
5574        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5575        is_terminated: bool,
5576    ) -> Self {
5577        Self { inner, is_terminated }
5578    }
5579}
5580
5581impl futures::Stream for MexecResourceRequestStream {
5582    type Item = Result<MexecResourceRequest, fidl::Error>;
5583
5584    fn poll_next(
5585        mut self: std::pin::Pin<&mut Self>,
5586        cx: &mut std::task::Context<'_>,
5587    ) -> std::task::Poll<Option<Self::Item>> {
5588        let this = &mut *self;
5589        if this.inner.check_shutdown(cx) {
5590            this.is_terminated = true;
5591            return std::task::Poll::Ready(None);
5592        }
5593        if this.is_terminated {
5594            panic!("polled MexecResourceRequestStream after completion");
5595        }
5596        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5597            |bytes, handles| {
5598                match this.inner.channel().read_etc(cx, bytes, handles) {
5599                    std::task::Poll::Ready(Ok(())) => {}
5600                    std::task::Poll::Pending => return std::task::Poll::Pending,
5601                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5602                        this.is_terminated = true;
5603                        return std::task::Poll::Ready(None);
5604                    }
5605                    std::task::Poll::Ready(Err(e)) => {
5606                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5607                            e.into(),
5608                        ))));
5609                    }
5610                }
5611
5612                // A message has been received from the channel
5613                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5614
5615                std::task::Poll::Ready(Some(match header.ordinal {
5616                    0xff93e6722900f54 => {
5617                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5618                        let mut req = fidl::new_empty!(
5619                            fidl::encoding::EmptyPayload,
5620                            fidl::encoding::DefaultFuchsiaResourceDialect
5621                        );
5622                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5623                        let control_handle =
5624                            MexecResourceControlHandle { inner: this.inner.clone() };
5625                        Ok(MexecResourceRequest::Get {
5626                            responder: MexecResourceGetResponder {
5627                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5628                                tx_id: header.tx_id,
5629                            },
5630                        })
5631                    }
5632                    _ => Err(fidl::Error::UnknownOrdinal {
5633                        ordinal: header.ordinal,
5634                        protocol_name:
5635                            <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5636                    }),
5637                }))
5638            },
5639        )
5640    }
5641}
5642
5643/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
5644/// `ZX_RSRC_SYSTEM_MEXEC_BASE`.
5645#[derive(Debug)]
5646pub enum MexecResourceRequest {
5647    /// Get an MEXEC resource handle as `resource`.
5648    Get { responder: MexecResourceGetResponder },
5649}
5650
5651impl MexecResourceRequest {
5652    #[allow(irrefutable_let_patterns)]
5653    pub fn into_get(self) -> Option<(MexecResourceGetResponder)> {
5654        if let MexecResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5655    }
5656
5657    /// Name of the method defined in FIDL
5658    pub fn method_name(&self) -> &'static str {
5659        match *self {
5660            MexecResourceRequest::Get { .. } => "get",
5661        }
5662    }
5663}
5664
5665#[derive(Debug, Clone)]
5666pub struct MexecResourceControlHandle {
5667    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5668}
5669
5670impl fidl::endpoints::ControlHandle for MexecResourceControlHandle {
5671    fn shutdown(&self) {
5672        self.inner.shutdown()
5673    }
5674    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5675        self.inner.shutdown_with_epitaph(status)
5676    }
5677
5678    fn is_closed(&self) -> bool {
5679        self.inner.channel().is_closed()
5680    }
5681    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5682        self.inner.channel().on_closed()
5683    }
5684
5685    #[cfg(target_os = "fuchsia")]
5686    fn signal_peer(
5687        &self,
5688        clear_mask: zx::Signals,
5689        set_mask: zx::Signals,
5690    ) -> Result<(), zx_status::Status> {
5691        use fidl::Peered;
5692        self.inner.channel().signal_peer(clear_mask, set_mask)
5693    }
5694}
5695
5696impl MexecResourceControlHandle {}
5697
5698#[must_use = "FIDL methods require a response to be sent"]
5699#[derive(Debug)]
5700pub struct MexecResourceGetResponder {
5701    control_handle: std::mem::ManuallyDrop<MexecResourceControlHandle>,
5702    tx_id: u32,
5703}
5704
5705/// Set the the channel to be shutdown (see [`MexecResourceControlHandle::shutdown`])
5706/// if the responder is dropped without sending a response, so that the client
5707/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5708impl std::ops::Drop for MexecResourceGetResponder {
5709    fn drop(&mut self) {
5710        self.control_handle.shutdown();
5711        // Safety: drops once, never accessed again
5712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5713    }
5714}
5715
5716impl fidl::endpoints::Responder for MexecResourceGetResponder {
5717    type ControlHandle = MexecResourceControlHandle;
5718
5719    fn control_handle(&self) -> &MexecResourceControlHandle {
5720        &self.control_handle
5721    }
5722
5723    fn drop_without_shutdown(mut self) {
5724        // Safety: drops once, never accessed again due to mem::forget
5725        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5726        // Prevent Drop from running (which would shut down the channel)
5727        std::mem::forget(self);
5728    }
5729}
5730
5731impl MexecResourceGetResponder {
5732    /// Sends a response to the FIDL transaction.
5733    ///
5734    /// Sets the channel to shutdown if an error occurs.
5735    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5736        let _result = self.send_raw(resource);
5737        if _result.is_err() {
5738            self.control_handle.shutdown();
5739        }
5740        self.drop_without_shutdown();
5741        _result
5742    }
5743
5744    /// Similar to "send" but does not shutdown the channel if an error occurs.
5745    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5746        let _result = self.send_raw(resource);
5747        self.drop_without_shutdown();
5748        _result
5749    }
5750
5751    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5752        self.control_handle.inner.send::<MexecResourceGetResponse>(
5753            (resource,),
5754            self.tx_id,
5755            0xff93e6722900f54,
5756            fidl::encoding::DynamicFlags::empty(),
5757        )
5758    }
5759}
5760
5761#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5762pub struct MmioResourceMarker;
5763
5764impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5765    type Proxy = MmioResourceProxy;
5766    type RequestStream = MmioResourceRequestStream;
5767    #[cfg(target_os = "fuchsia")]
5768    type SynchronousProxy = MmioResourceSynchronousProxy;
5769
5770    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5771}
5772impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5773
5774pub trait MmioResourceProxyInterface: Send + Sync {
5775    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5776    fn r#get(&self) -> Self::GetResponseFut;
5777}
5778#[derive(Debug)]
5779#[cfg(target_os = "fuchsia")]
5780pub struct MmioResourceSynchronousProxy {
5781    client: fidl::client::sync::Client,
5782}
5783
5784#[cfg(target_os = "fuchsia")]
5785impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5786    type Proxy = MmioResourceProxy;
5787    type Protocol = MmioResourceMarker;
5788
5789    fn from_channel(inner: fidl::Channel) -> Self {
5790        Self::new(inner)
5791    }
5792
5793    fn into_channel(self) -> fidl::Channel {
5794        self.client.into_channel()
5795    }
5796
5797    fn as_channel(&self) -> &fidl::Channel {
5798        self.client.as_channel()
5799    }
5800}
5801
5802#[cfg(target_os = "fuchsia")]
5803impl MmioResourceSynchronousProxy {
5804    pub fn new(channel: fidl::Channel) -> Self {
5805        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5806        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5807    }
5808
5809    pub fn into_channel(self) -> fidl::Channel {
5810        self.client.into_channel()
5811    }
5812
5813    /// Waits until an event arrives and returns it. It is safe for other
5814    /// threads to make concurrent requests while waiting for an event.
5815    pub fn wait_for_event(
5816        &self,
5817        deadline: zx::MonotonicInstant,
5818    ) -> Result<MmioResourceEvent, fidl::Error> {
5819        MmioResourceEvent::decode(self.client.wait_for_event(deadline)?)
5820    }
5821
5822    /// Get an MMIO resource handle.
5823    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5824        let _response =
5825            self.client.send_query::<fidl::encoding::EmptyPayload, MmioResourceGetResponse>(
5826                (),
5827                0x66747b9c5a6dfe7b,
5828                fidl::encoding::DynamicFlags::empty(),
5829                ___deadline,
5830            )?;
5831        Ok(_response.resource)
5832    }
5833}
5834
5835#[cfg(target_os = "fuchsia")]
5836impl From<MmioResourceSynchronousProxy> for zx::Handle {
5837    fn from(value: MmioResourceSynchronousProxy) -> Self {
5838        value.into_channel().into()
5839    }
5840}
5841
5842#[cfg(target_os = "fuchsia")]
5843impl From<fidl::Channel> for MmioResourceSynchronousProxy {
5844    fn from(value: fidl::Channel) -> Self {
5845        Self::new(value)
5846    }
5847}
5848
5849#[cfg(target_os = "fuchsia")]
5850impl fidl::endpoints::FromClient for MmioResourceSynchronousProxy {
5851    type Protocol = MmioResourceMarker;
5852
5853    fn from_client(value: fidl::endpoints::ClientEnd<MmioResourceMarker>) -> Self {
5854        Self::new(value.into_channel())
5855    }
5856}
5857
5858#[derive(Debug, Clone)]
5859pub struct MmioResourceProxy {
5860    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5861}
5862
5863impl fidl::endpoints::Proxy for MmioResourceProxy {
5864    type Protocol = MmioResourceMarker;
5865
5866    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5867        Self::new(inner)
5868    }
5869
5870    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5871        self.client.into_channel().map_err(|client| Self { client })
5872    }
5873
5874    fn as_channel(&self) -> &::fidl::AsyncChannel {
5875        self.client.as_channel()
5876    }
5877}
5878
5879impl MmioResourceProxy {
5880    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5881    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5882        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5883        Self { client: fidl::client::Client::new(channel, protocol_name) }
5884    }
5885
5886    /// Get a Stream of events from the remote end of the protocol.
5887    ///
5888    /// # Panics
5889    ///
5890    /// Panics if the event stream was already taken.
5891    pub fn take_event_stream(&self) -> MmioResourceEventStream {
5892        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
5893    }
5894
5895    /// Get an MMIO resource handle.
5896    pub fn r#get(
5897        &self,
5898    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5899    {
5900        MmioResourceProxyInterface::r#get(self)
5901    }
5902}
5903
5904impl MmioResourceProxyInterface for MmioResourceProxy {
5905    type GetResponseFut = fidl::client::QueryResponseFut<
5906        fidl::Resource,
5907        fidl::encoding::DefaultFuchsiaResourceDialect,
5908    >;
5909    fn r#get(&self) -> Self::GetResponseFut {
5910        fn _decode(
5911            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5912        ) -> Result<fidl::Resource, fidl::Error> {
5913            let _response = fidl::client::decode_transaction_body::<
5914                MmioResourceGetResponse,
5915                fidl::encoding::DefaultFuchsiaResourceDialect,
5916                0x66747b9c5a6dfe7b,
5917            >(_buf?)?;
5918            Ok(_response.resource)
5919        }
5920        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5921            (),
5922            0x66747b9c5a6dfe7b,
5923            fidl::encoding::DynamicFlags::empty(),
5924            _decode,
5925        )
5926    }
5927}
5928
5929pub struct MmioResourceEventStream {
5930    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5931}
5932
5933impl std::marker::Unpin for MmioResourceEventStream {}
5934
5935impl futures::stream::FusedStream for MmioResourceEventStream {
5936    fn is_terminated(&self) -> bool {
5937        self.event_receiver.is_terminated()
5938    }
5939}
5940
5941impl futures::Stream for MmioResourceEventStream {
5942    type Item = Result<MmioResourceEvent, fidl::Error>;
5943
5944    fn poll_next(
5945        mut self: std::pin::Pin<&mut Self>,
5946        cx: &mut std::task::Context<'_>,
5947    ) -> std::task::Poll<Option<Self::Item>> {
5948        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5949            &mut self.event_receiver,
5950            cx
5951        )?) {
5952            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
5953            None => std::task::Poll::Ready(None),
5954        }
5955    }
5956}
5957
5958#[derive(Debug)]
5959pub enum MmioResourceEvent {}
5960
5961impl MmioResourceEvent {
5962    /// Decodes a message buffer as a [`MmioResourceEvent`].
5963    fn decode(
5964        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5965    ) -> Result<MmioResourceEvent, fidl::Error> {
5966        let (bytes, _handles) = buf.split_mut();
5967        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5968        debug_assert_eq!(tx_header.tx_id, 0);
5969        match tx_header.ordinal {
5970            _ => Err(fidl::Error::UnknownOrdinal {
5971                ordinal: tx_header.ordinal,
5972                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5973            }),
5974        }
5975    }
5976}
5977
5978/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
5979pub struct MmioResourceRequestStream {
5980    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5981    is_terminated: bool,
5982}
5983
5984impl std::marker::Unpin for MmioResourceRequestStream {}
5985
5986impl futures::stream::FusedStream for MmioResourceRequestStream {
5987    fn is_terminated(&self) -> bool {
5988        self.is_terminated
5989    }
5990}
5991
5992impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
5993    type Protocol = MmioResourceMarker;
5994    type ControlHandle = MmioResourceControlHandle;
5995
5996    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5997        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5998    }
5999
6000    fn control_handle(&self) -> Self::ControlHandle {
6001        MmioResourceControlHandle { inner: self.inner.clone() }
6002    }
6003
6004    fn into_inner(
6005        self,
6006    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6007    {
6008        (self.inner, self.is_terminated)
6009    }
6010
6011    fn from_inner(
6012        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6013        is_terminated: bool,
6014    ) -> Self {
6015        Self { inner, is_terminated }
6016    }
6017}
6018
6019impl futures::Stream for MmioResourceRequestStream {
6020    type Item = Result<MmioResourceRequest, fidl::Error>;
6021
6022    fn poll_next(
6023        mut self: std::pin::Pin<&mut Self>,
6024        cx: &mut std::task::Context<'_>,
6025    ) -> std::task::Poll<Option<Self::Item>> {
6026        let this = &mut *self;
6027        if this.inner.check_shutdown(cx) {
6028            this.is_terminated = true;
6029            return std::task::Poll::Ready(None);
6030        }
6031        if this.is_terminated {
6032            panic!("polled MmioResourceRequestStream after completion");
6033        }
6034        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6035            |bytes, handles| {
6036                match this.inner.channel().read_etc(cx, bytes, handles) {
6037                    std::task::Poll::Ready(Ok(())) => {}
6038                    std::task::Poll::Pending => return std::task::Poll::Pending,
6039                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6040                        this.is_terminated = true;
6041                        return std::task::Poll::Ready(None);
6042                    }
6043                    std::task::Poll::Ready(Err(e)) => {
6044                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6045                            e.into(),
6046                        ))));
6047                    }
6048                }
6049
6050                // A message has been received from the channel
6051                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6052
6053                std::task::Poll::Ready(Some(match header.ordinal {
6054                    0x66747b9c5a6dfe7b => {
6055                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6056                        let mut req = fidl::new_empty!(
6057                            fidl::encoding::EmptyPayload,
6058                            fidl::encoding::DefaultFuchsiaResourceDialect
6059                        );
6060                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6061                        let control_handle =
6062                            MmioResourceControlHandle { inner: this.inner.clone() };
6063                        Ok(MmioResourceRequest::Get {
6064                            responder: MmioResourceGetResponder {
6065                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6066                                tx_id: header.tx_id,
6067                            },
6068                        })
6069                    }
6070                    _ => Err(fidl::Error::UnknownOrdinal {
6071                        ordinal: header.ordinal,
6072                        protocol_name:
6073                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6074                    }),
6075                }))
6076            },
6077        )
6078    }
6079}
6080
6081/// Protocol for providing an MMIO resource with access to all valid ranges.
6082#[derive(Debug)]
6083pub enum MmioResourceRequest {
6084    /// Get an MMIO resource handle.
6085    Get { responder: MmioResourceGetResponder },
6086}
6087
6088impl MmioResourceRequest {
6089    #[allow(irrefutable_let_patterns)]
6090    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
6091        if let MmioResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6092    }
6093
6094    /// Name of the method defined in FIDL
6095    pub fn method_name(&self) -> &'static str {
6096        match *self {
6097            MmioResourceRequest::Get { .. } => "get",
6098        }
6099    }
6100}
6101
6102#[derive(Debug, Clone)]
6103pub struct MmioResourceControlHandle {
6104    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6105}
6106
6107impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
6108    fn shutdown(&self) {
6109        self.inner.shutdown()
6110    }
6111    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6112        self.inner.shutdown_with_epitaph(status)
6113    }
6114
6115    fn is_closed(&self) -> bool {
6116        self.inner.channel().is_closed()
6117    }
6118    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6119        self.inner.channel().on_closed()
6120    }
6121
6122    #[cfg(target_os = "fuchsia")]
6123    fn signal_peer(
6124        &self,
6125        clear_mask: zx::Signals,
6126        set_mask: zx::Signals,
6127    ) -> Result<(), zx_status::Status> {
6128        use fidl::Peered;
6129        self.inner.channel().signal_peer(clear_mask, set_mask)
6130    }
6131}
6132
6133impl MmioResourceControlHandle {}
6134
6135#[must_use = "FIDL methods require a response to be sent"]
6136#[derive(Debug)]
6137pub struct MmioResourceGetResponder {
6138    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
6139    tx_id: u32,
6140}
6141
6142/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
6143/// if the responder is dropped without sending a response, so that the client
6144/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6145impl std::ops::Drop for MmioResourceGetResponder {
6146    fn drop(&mut self) {
6147        self.control_handle.shutdown();
6148        // Safety: drops once, never accessed again
6149        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6150    }
6151}
6152
6153impl fidl::endpoints::Responder for MmioResourceGetResponder {
6154    type ControlHandle = MmioResourceControlHandle;
6155
6156    fn control_handle(&self) -> &MmioResourceControlHandle {
6157        &self.control_handle
6158    }
6159
6160    fn drop_without_shutdown(mut self) {
6161        // Safety: drops once, never accessed again due to mem::forget
6162        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6163        // Prevent Drop from running (which would shut down the channel)
6164        std::mem::forget(self);
6165    }
6166}
6167
6168impl MmioResourceGetResponder {
6169    /// Sends a response to the FIDL transaction.
6170    ///
6171    /// Sets the channel to shutdown if an error occurs.
6172    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6173        let _result = self.send_raw(resource);
6174        if _result.is_err() {
6175            self.control_handle.shutdown();
6176        }
6177        self.drop_without_shutdown();
6178        _result
6179    }
6180
6181    /// Similar to "send" but does not shutdown the channel if an error occurs.
6182    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6183        let _result = self.send_raw(resource);
6184        self.drop_without_shutdown();
6185        _result
6186    }
6187
6188    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6189        self.control_handle.inner.send::<MmioResourceGetResponse>(
6190            (resource,),
6191            self.tx_id,
6192            0x66747b9c5a6dfe7b,
6193            fidl::encoding::DynamicFlags::empty(),
6194        )
6195    }
6196}
6197
6198#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6199pub struct MsiResourceMarker;
6200
6201impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
6202    type Proxy = MsiResourceProxy;
6203    type RequestStream = MsiResourceRequestStream;
6204    #[cfg(target_os = "fuchsia")]
6205    type SynchronousProxy = MsiResourceSynchronousProxy;
6206
6207    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
6208}
6209impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
6210
6211pub trait MsiResourceProxyInterface: Send + Sync {
6212    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6213    fn r#get(&self) -> Self::GetResponseFut;
6214}
6215#[derive(Debug)]
6216#[cfg(target_os = "fuchsia")]
6217pub struct MsiResourceSynchronousProxy {
6218    client: fidl::client::sync::Client,
6219}
6220
6221#[cfg(target_os = "fuchsia")]
6222impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
6223    type Proxy = MsiResourceProxy;
6224    type Protocol = MsiResourceMarker;
6225
6226    fn from_channel(inner: fidl::Channel) -> Self {
6227        Self::new(inner)
6228    }
6229
6230    fn into_channel(self) -> fidl::Channel {
6231        self.client.into_channel()
6232    }
6233
6234    fn as_channel(&self) -> &fidl::Channel {
6235        self.client.as_channel()
6236    }
6237}
6238
6239#[cfg(target_os = "fuchsia")]
6240impl MsiResourceSynchronousProxy {
6241    pub fn new(channel: fidl::Channel) -> Self {
6242        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6243        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6244    }
6245
6246    pub fn into_channel(self) -> fidl::Channel {
6247        self.client.into_channel()
6248    }
6249
6250    /// Waits until an event arrives and returns it. It is safe for other
6251    /// threads to make concurrent requests while waiting for an event.
6252    pub fn wait_for_event(
6253        &self,
6254        deadline: zx::MonotonicInstant,
6255    ) -> Result<MsiResourceEvent, fidl::Error> {
6256        MsiResourceEvent::decode(self.client.wait_for_event(deadline)?)
6257    }
6258
6259    /// Get an msi resource handle.
6260    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6261        let _response =
6262            self.client.send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse>(
6263                (),
6264                0x360a97e47e8c4f1f,
6265                fidl::encoding::DynamicFlags::empty(),
6266                ___deadline,
6267            )?;
6268        Ok(_response.resource)
6269    }
6270}
6271
6272#[cfg(target_os = "fuchsia")]
6273impl From<MsiResourceSynchronousProxy> for zx::Handle {
6274    fn from(value: MsiResourceSynchronousProxy) -> Self {
6275        value.into_channel().into()
6276    }
6277}
6278
6279#[cfg(target_os = "fuchsia")]
6280impl From<fidl::Channel> for MsiResourceSynchronousProxy {
6281    fn from(value: fidl::Channel) -> Self {
6282        Self::new(value)
6283    }
6284}
6285
6286#[cfg(target_os = "fuchsia")]
6287impl fidl::endpoints::FromClient for MsiResourceSynchronousProxy {
6288    type Protocol = MsiResourceMarker;
6289
6290    fn from_client(value: fidl::endpoints::ClientEnd<MsiResourceMarker>) -> Self {
6291        Self::new(value.into_channel())
6292    }
6293}
6294
6295#[derive(Debug, Clone)]
6296pub struct MsiResourceProxy {
6297    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6298}
6299
6300impl fidl::endpoints::Proxy for MsiResourceProxy {
6301    type Protocol = MsiResourceMarker;
6302
6303    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6304        Self::new(inner)
6305    }
6306
6307    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6308        self.client.into_channel().map_err(|client| Self { client })
6309    }
6310
6311    fn as_channel(&self) -> &::fidl::AsyncChannel {
6312        self.client.as_channel()
6313    }
6314}
6315
6316impl MsiResourceProxy {
6317    /// Create a new Proxy for fuchsia.kernel/MsiResource.
6318    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6319        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6320        Self { client: fidl::client::Client::new(channel, protocol_name) }
6321    }
6322
6323    /// Get a Stream of events from the remote end of the protocol.
6324    ///
6325    /// # Panics
6326    ///
6327    /// Panics if the event stream was already taken.
6328    pub fn take_event_stream(&self) -> MsiResourceEventStream {
6329        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
6330    }
6331
6332    /// Get an msi resource handle.
6333    pub fn r#get(
6334        &self,
6335    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6336    {
6337        MsiResourceProxyInterface::r#get(self)
6338    }
6339}
6340
6341impl MsiResourceProxyInterface for MsiResourceProxy {
6342    type GetResponseFut = fidl::client::QueryResponseFut<
6343        fidl::Resource,
6344        fidl::encoding::DefaultFuchsiaResourceDialect,
6345    >;
6346    fn r#get(&self) -> Self::GetResponseFut {
6347        fn _decode(
6348            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6349        ) -> Result<fidl::Resource, fidl::Error> {
6350            let _response = fidl::client::decode_transaction_body::<
6351                MsiResourceGetResponse,
6352                fidl::encoding::DefaultFuchsiaResourceDialect,
6353                0x360a97e47e8c4f1f,
6354            >(_buf?)?;
6355            Ok(_response.resource)
6356        }
6357        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6358            (),
6359            0x360a97e47e8c4f1f,
6360            fidl::encoding::DynamicFlags::empty(),
6361            _decode,
6362        )
6363    }
6364}
6365
6366pub struct MsiResourceEventStream {
6367    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6368}
6369
6370impl std::marker::Unpin for MsiResourceEventStream {}
6371
6372impl futures::stream::FusedStream for MsiResourceEventStream {
6373    fn is_terminated(&self) -> bool {
6374        self.event_receiver.is_terminated()
6375    }
6376}
6377
6378impl futures::Stream for MsiResourceEventStream {
6379    type Item = Result<MsiResourceEvent, fidl::Error>;
6380
6381    fn poll_next(
6382        mut self: std::pin::Pin<&mut Self>,
6383        cx: &mut std::task::Context<'_>,
6384    ) -> std::task::Poll<Option<Self::Item>> {
6385        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6386            &mut self.event_receiver,
6387            cx
6388        )?) {
6389            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6390            None => std::task::Poll::Ready(None),
6391        }
6392    }
6393}
6394
6395#[derive(Debug)]
6396pub enum MsiResourceEvent {}
6397
6398impl MsiResourceEvent {
6399    /// Decodes a message buffer as a [`MsiResourceEvent`].
6400    fn decode(
6401        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6402    ) -> Result<MsiResourceEvent, fidl::Error> {
6403        let (bytes, _handles) = buf.split_mut();
6404        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6405        debug_assert_eq!(tx_header.tx_id, 0);
6406        match tx_header.ordinal {
6407            _ => Err(fidl::Error::UnknownOrdinal {
6408                ordinal: tx_header.ordinal,
6409                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6410            }),
6411        }
6412    }
6413}
6414
6415/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6416pub struct MsiResourceRequestStream {
6417    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6418    is_terminated: bool,
6419}
6420
6421impl std::marker::Unpin for MsiResourceRequestStream {}
6422
6423impl futures::stream::FusedStream for MsiResourceRequestStream {
6424    fn is_terminated(&self) -> bool {
6425        self.is_terminated
6426    }
6427}
6428
6429impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6430    type Protocol = MsiResourceMarker;
6431    type ControlHandle = MsiResourceControlHandle;
6432
6433    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6434        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6435    }
6436
6437    fn control_handle(&self) -> Self::ControlHandle {
6438        MsiResourceControlHandle { inner: self.inner.clone() }
6439    }
6440
6441    fn into_inner(
6442        self,
6443    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6444    {
6445        (self.inner, self.is_terminated)
6446    }
6447
6448    fn from_inner(
6449        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6450        is_terminated: bool,
6451    ) -> Self {
6452        Self { inner, is_terminated }
6453    }
6454}
6455
6456impl futures::Stream for MsiResourceRequestStream {
6457    type Item = Result<MsiResourceRequest, fidl::Error>;
6458
6459    fn poll_next(
6460        mut self: std::pin::Pin<&mut Self>,
6461        cx: &mut std::task::Context<'_>,
6462    ) -> std::task::Poll<Option<Self::Item>> {
6463        let this = &mut *self;
6464        if this.inner.check_shutdown(cx) {
6465            this.is_terminated = true;
6466            return std::task::Poll::Ready(None);
6467        }
6468        if this.is_terminated {
6469            panic!("polled MsiResourceRequestStream after completion");
6470        }
6471        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6472            |bytes, handles| {
6473                match this.inner.channel().read_etc(cx, bytes, handles) {
6474                    std::task::Poll::Ready(Ok(())) => {}
6475                    std::task::Poll::Pending => return std::task::Poll::Pending,
6476                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6477                        this.is_terminated = true;
6478                        return std::task::Poll::Ready(None);
6479                    }
6480                    std::task::Poll::Ready(Err(e)) => {
6481                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6482                            e.into(),
6483                        ))));
6484                    }
6485                }
6486
6487                // A message has been received from the channel
6488                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6489
6490                std::task::Poll::Ready(Some(match header.ordinal {
6491                    0x360a97e47e8c4f1f => {
6492                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6493                        let mut req = fidl::new_empty!(
6494                            fidl::encoding::EmptyPayload,
6495                            fidl::encoding::DefaultFuchsiaResourceDialect
6496                        );
6497                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6498                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6499                        Ok(MsiResourceRequest::Get {
6500                            responder: MsiResourceGetResponder {
6501                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6502                                tx_id: header.tx_id,
6503                            },
6504                        })
6505                    }
6506                    _ => Err(fidl::Error::UnknownOrdinal {
6507                        ordinal: header.ordinal,
6508                        protocol_name:
6509                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6510                    }),
6511                }))
6512            },
6513        )
6514    }
6515}
6516
6517/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6518/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6519#[derive(Debug)]
6520pub enum MsiResourceRequest {
6521    /// Get an msi resource handle.
6522    Get { responder: MsiResourceGetResponder },
6523}
6524
6525impl MsiResourceRequest {
6526    #[allow(irrefutable_let_patterns)]
6527    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6528        if let MsiResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6529    }
6530
6531    /// Name of the method defined in FIDL
6532    pub fn method_name(&self) -> &'static str {
6533        match *self {
6534            MsiResourceRequest::Get { .. } => "get",
6535        }
6536    }
6537}
6538
6539#[derive(Debug, Clone)]
6540pub struct MsiResourceControlHandle {
6541    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6542}
6543
6544impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6545    fn shutdown(&self) {
6546        self.inner.shutdown()
6547    }
6548    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6549        self.inner.shutdown_with_epitaph(status)
6550    }
6551
6552    fn is_closed(&self) -> bool {
6553        self.inner.channel().is_closed()
6554    }
6555    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6556        self.inner.channel().on_closed()
6557    }
6558
6559    #[cfg(target_os = "fuchsia")]
6560    fn signal_peer(
6561        &self,
6562        clear_mask: zx::Signals,
6563        set_mask: zx::Signals,
6564    ) -> Result<(), zx_status::Status> {
6565        use fidl::Peered;
6566        self.inner.channel().signal_peer(clear_mask, set_mask)
6567    }
6568}
6569
6570impl MsiResourceControlHandle {}
6571
6572#[must_use = "FIDL methods require a response to be sent"]
6573#[derive(Debug)]
6574pub struct MsiResourceGetResponder {
6575    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6576    tx_id: u32,
6577}
6578
6579/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6580/// if the responder is dropped without sending a response, so that the client
6581/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6582impl std::ops::Drop for MsiResourceGetResponder {
6583    fn drop(&mut self) {
6584        self.control_handle.shutdown();
6585        // Safety: drops once, never accessed again
6586        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6587    }
6588}
6589
6590impl fidl::endpoints::Responder for MsiResourceGetResponder {
6591    type ControlHandle = MsiResourceControlHandle;
6592
6593    fn control_handle(&self) -> &MsiResourceControlHandle {
6594        &self.control_handle
6595    }
6596
6597    fn drop_without_shutdown(mut self) {
6598        // Safety: drops once, never accessed again due to mem::forget
6599        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6600        // Prevent Drop from running (which would shut down the channel)
6601        std::mem::forget(self);
6602    }
6603}
6604
6605impl MsiResourceGetResponder {
6606    /// Sends a response to the FIDL transaction.
6607    ///
6608    /// Sets the channel to shutdown if an error occurs.
6609    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6610        let _result = self.send_raw(resource);
6611        if _result.is_err() {
6612            self.control_handle.shutdown();
6613        }
6614        self.drop_without_shutdown();
6615        _result
6616    }
6617
6618    /// Similar to "send" but does not shutdown the channel if an error occurs.
6619    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6620        let _result = self.send_raw(resource);
6621        self.drop_without_shutdown();
6622        _result
6623    }
6624
6625    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6626        self.control_handle.inner.send::<MsiResourceGetResponse>(
6627            (resource,),
6628            self.tx_id,
6629            0x360a97e47e8c4f1f,
6630            fidl::encoding::DynamicFlags::empty(),
6631        )
6632    }
6633}
6634
6635#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6636pub struct PowerResourceMarker;
6637
6638impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6639    type Proxy = PowerResourceProxy;
6640    type RequestStream = PowerResourceRequestStream;
6641    #[cfg(target_os = "fuchsia")]
6642    type SynchronousProxy = PowerResourceSynchronousProxy;
6643
6644    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6645}
6646impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6647
6648pub trait PowerResourceProxyInterface: Send + Sync {
6649    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6650    fn r#get(&self) -> Self::GetResponseFut;
6651}
6652#[derive(Debug)]
6653#[cfg(target_os = "fuchsia")]
6654pub struct PowerResourceSynchronousProxy {
6655    client: fidl::client::sync::Client,
6656}
6657
6658#[cfg(target_os = "fuchsia")]
6659impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6660    type Proxy = PowerResourceProxy;
6661    type Protocol = PowerResourceMarker;
6662
6663    fn from_channel(inner: fidl::Channel) -> Self {
6664        Self::new(inner)
6665    }
6666
6667    fn into_channel(self) -> fidl::Channel {
6668        self.client.into_channel()
6669    }
6670
6671    fn as_channel(&self) -> &fidl::Channel {
6672        self.client.as_channel()
6673    }
6674}
6675
6676#[cfg(target_os = "fuchsia")]
6677impl PowerResourceSynchronousProxy {
6678    pub fn new(channel: fidl::Channel) -> Self {
6679        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6680        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6681    }
6682
6683    pub fn into_channel(self) -> fidl::Channel {
6684        self.client.into_channel()
6685    }
6686
6687    /// Waits until an event arrives and returns it. It is safe for other
6688    /// threads to make concurrent requests while waiting for an event.
6689    pub fn wait_for_event(
6690        &self,
6691        deadline: zx::MonotonicInstant,
6692    ) -> Result<PowerResourceEvent, fidl::Error> {
6693        PowerResourceEvent::decode(self.client.wait_for_event(deadline)?)
6694    }
6695
6696    /// Get a power resource handle.
6697    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6698        let _response =
6699            self.client.send_query::<fidl::encoding::EmptyPayload, PowerResourceGetResponse>(
6700                (),
6701                0x2b8df8ca24d1e866,
6702                fidl::encoding::DynamicFlags::empty(),
6703                ___deadline,
6704            )?;
6705        Ok(_response.resource)
6706    }
6707}
6708
6709#[cfg(target_os = "fuchsia")]
6710impl From<PowerResourceSynchronousProxy> for zx::Handle {
6711    fn from(value: PowerResourceSynchronousProxy) -> Self {
6712        value.into_channel().into()
6713    }
6714}
6715
6716#[cfg(target_os = "fuchsia")]
6717impl From<fidl::Channel> for PowerResourceSynchronousProxy {
6718    fn from(value: fidl::Channel) -> Self {
6719        Self::new(value)
6720    }
6721}
6722
6723#[cfg(target_os = "fuchsia")]
6724impl fidl::endpoints::FromClient for PowerResourceSynchronousProxy {
6725    type Protocol = PowerResourceMarker;
6726
6727    fn from_client(value: fidl::endpoints::ClientEnd<PowerResourceMarker>) -> Self {
6728        Self::new(value.into_channel())
6729    }
6730}
6731
6732#[derive(Debug, Clone)]
6733pub struct PowerResourceProxy {
6734    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6735}
6736
6737impl fidl::endpoints::Proxy for PowerResourceProxy {
6738    type Protocol = PowerResourceMarker;
6739
6740    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6741        Self::new(inner)
6742    }
6743
6744    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6745        self.client.into_channel().map_err(|client| Self { client })
6746    }
6747
6748    fn as_channel(&self) -> &::fidl::AsyncChannel {
6749        self.client.as_channel()
6750    }
6751}
6752
6753impl PowerResourceProxy {
6754    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6755    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6756        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6757        Self { client: fidl::client::Client::new(channel, protocol_name) }
6758    }
6759
6760    /// Get a Stream of events from the remote end of the protocol.
6761    ///
6762    /// # Panics
6763    ///
6764    /// Panics if the event stream was already taken.
6765    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6766        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6767    }
6768
6769    /// Get a power resource handle.
6770    pub fn r#get(
6771        &self,
6772    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6773    {
6774        PowerResourceProxyInterface::r#get(self)
6775    }
6776}
6777
6778impl PowerResourceProxyInterface for PowerResourceProxy {
6779    type GetResponseFut = fidl::client::QueryResponseFut<
6780        fidl::Resource,
6781        fidl::encoding::DefaultFuchsiaResourceDialect,
6782    >;
6783    fn r#get(&self) -> Self::GetResponseFut {
6784        fn _decode(
6785            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6786        ) -> Result<fidl::Resource, fidl::Error> {
6787            let _response = fidl::client::decode_transaction_body::<
6788                PowerResourceGetResponse,
6789                fidl::encoding::DefaultFuchsiaResourceDialect,
6790                0x2b8df8ca24d1e866,
6791            >(_buf?)?;
6792            Ok(_response.resource)
6793        }
6794        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6795            (),
6796            0x2b8df8ca24d1e866,
6797            fidl::encoding::DynamicFlags::empty(),
6798            _decode,
6799        )
6800    }
6801}
6802
6803pub struct PowerResourceEventStream {
6804    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6805}
6806
6807impl std::marker::Unpin for PowerResourceEventStream {}
6808
6809impl futures::stream::FusedStream for PowerResourceEventStream {
6810    fn is_terminated(&self) -> bool {
6811        self.event_receiver.is_terminated()
6812    }
6813}
6814
6815impl futures::Stream for PowerResourceEventStream {
6816    type Item = Result<PowerResourceEvent, fidl::Error>;
6817
6818    fn poll_next(
6819        mut self: std::pin::Pin<&mut Self>,
6820        cx: &mut std::task::Context<'_>,
6821    ) -> std::task::Poll<Option<Self::Item>> {
6822        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6823            &mut self.event_receiver,
6824            cx
6825        )?) {
6826            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6827            None => std::task::Poll::Ready(None),
6828        }
6829    }
6830}
6831
6832#[derive(Debug)]
6833pub enum PowerResourceEvent {}
6834
6835impl PowerResourceEvent {
6836    /// Decodes a message buffer as a [`PowerResourceEvent`].
6837    fn decode(
6838        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6839    ) -> Result<PowerResourceEvent, fidl::Error> {
6840        let (bytes, _handles) = buf.split_mut();
6841        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6842        debug_assert_eq!(tx_header.tx_id, 0);
6843        match tx_header.ordinal {
6844            _ => Err(fidl::Error::UnknownOrdinal {
6845                ordinal: tx_header.ordinal,
6846                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6847            }),
6848        }
6849    }
6850}
6851
6852/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6853pub struct PowerResourceRequestStream {
6854    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6855    is_terminated: bool,
6856}
6857
6858impl std::marker::Unpin for PowerResourceRequestStream {}
6859
6860impl futures::stream::FusedStream for PowerResourceRequestStream {
6861    fn is_terminated(&self) -> bool {
6862        self.is_terminated
6863    }
6864}
6865
6866impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6867    type Protocol = PowerResourceMarker;
6868    type ControlHandle = PowerResourceControlHandle;
6869
6870    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6871        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6872    }
6873
6874    fn control_handle(&self) -> Self::ControlHandle {
6875        PowerResourceControlHandle { inner: self.inner.clone() }
6876    }
6877
6878    fn into_inner(
6879        self,
6880    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6881    {
6882        (self.inner, self.is_terminated)
6883    }
6884
6885    fn from_inner(
6886        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6887        is_terminated: bool,
6888    ) -> Self {
6889        Self { inner, is_terminated }
6890    }
6891}
6892
6893impl futures::Stream for PowerResourceRequestStream {
6894    type Item = Result<PowerResourceRequest, fidl::Error>;
6895
6896    fn poll_next(
6897        mut self: std::pin::Pin<&mut Self>,
6898        cx: &mut std::task::Context<'_>,
6899    ) -> std::task::Poll<Option<Self::Item>> {
6900        let this = &mut *self;
6901        if this.inner.check_shutdown(cx) {
6902            this.is_terminated = true;
6903            return std::task::Poll::Ready(None);
6904        }
6905        if this.is_terminated {
6906            panic!("polled PowerResourceRequestStream after completion");
6907        }
6908        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6909            |bytes, handles| {
6910                match this.inner.channel().read_etc(cx, bytes, handles) {
6911                    std::task::Poll::Ready(Ok(())) => {}
6912                    std::task::Poll::Pending => return std::task::Poll::Pending,
6913                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6914                        this.is_terminated = true;
6915                        return std::task::Poll::Ready(None);
6916                    }
6917                    std::task::Poll::Ready(Err(e)) => {
6918                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6919                            e.into(),
6920                        ))));
6921                    }
6922                }
6923
6924                // A message has been received from the channel
6925                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6926
6927                std::task::Poll::Ready(Some(match header.ordinal {
6928                    0x2b8df8ca24d1e866 => {
6929                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6930                        let mut req = fidl::new_empty!(
6931                            fidl::encoding::EmptyPayload,
6932                            fidl::encoding::DefaultFuchsiaResourceDialect
6933                        );
6934                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6935                        let control_handle =
6936                            PowerResourceControlHandle { inner: this.inner.clone() };
6937                        Ok(PowerResourceRequest::Get {
6938                            responder: PowerResourceGetResponder {
6939                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6940                                tx_id: header.tx_id,
6941                            },
6942                        })
6943                    }
6944                    _ => Err(fidl::Error::UnknownOrdinal {
6945                        ordinal: header.ordinal,
6946                        protocol_name:
6947                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6948                    }),
6949                }))
6950            },
6951        )
6952    }
6953}
6954
6955/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6956/// `ZX_RSRC_SYSTEM_POWER_BASE`.
6957#[derive(Debug)]
6958pub enum PowerResourceRequest {
6959    /// Get a power resource handle.
6960    Get { responder: PowerResourceGetResponder },
6961}
6962
6963impl PowerResourceRequest {
6964    #[allow(irrefutable_let_patterns)]
6965    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
6966        if let PowerResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6967    }
6968
6969    /// Name of the method defined in FIDL
6970    pub fn method_name(&self) -> &'static str {
6971        match *self {
6972            PowerResourceRequest::Get { .. } => "get",
6973        }
6974    }
6975}
6976
6977#[derive(Debug, Clone)]
6978pub struct PowerResourceControlHandle {
6979    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6980}
6981
6982impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
6983    fn shutdown(&self) {
6984        self.inner.shutdown()
6985    }
6986    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6987        self.inner.shutdown_with_epitaph(status)
6988    }
6989
6990    fn is_closed(&self) -> bool {
6991        self.inner.channel().is_closed()
6992    }
6993    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6994        self.inner.channel().on_closed()
6995    }
6996
6997    #[cfg(target_os = "fuchsia")]
6998    fn signal_peer(
6999        &self,
7000        clear_mask: zx::Signals,
7001        set_mask: zx::Signals,
7002    ) -> Result<(), zx_status::Status> {
7003        use fidl::Peered;
7004        self.inner.channel().signal_peer(clear_mask, set_mask)
7005    }
7006}
7007
7008impl PowerResourceControlHandle {}
7009
7010#[must_use = "FIDL methods require a response to be sent"]
7011#[derive(Debug)]
7012pub struct PowerResourceGetResponder {
7013    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
7014    tx_id: u32,
7015}
7016
7017/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
7018/// if the responder is dropped without sending a response, so that the client
7019/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7020impl std::ops::Drop for PowerResourceGetResponder {
7021    fn drop(&mut self) {
7022        self.control_handle.shutdown();
7023        // Safety: drops once, never accessed again
7024        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7025    }
7026}
7027
7028impl fidl::endpoints::Responder for PowerResourceGetResponder {
7029    type ControlHandle = PowerResourceControlHandle;
7030
7031    fn control_handle(&self) -> &PowerResourceControlHandle {
7032        &self.control_handle
7033    }
7034
7035    fn drop_without_shutdown(mut self) {
7036        // Safety: drops once, never accessed again due to mem::forget
7037        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7038        // Prevent Drop from running (which would shut down the channel)
7039        std::mem::forget(self);
7040    }
7041}
7042
7043impl PowerResourceGetResponder {
7044    /// Sends a response to the FIDL transaction.
7045    ///
7046    /// Sets the channel to shutdown if an error occurs.
7047    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7048        let _result = self.send_raw(resource);
7049        if _result.is_err() {
7050            self.control_handle.shutdown();
7051        }
7052        self.drop_without_shutdown();
7053        _result
7054    }
7055
7056    /// Similar to "send" but does not shutdown the channel if an error occurs.
7057    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7058        let _result = self.send_raw(resource);
7059        self.drop_without_shutdown();
7060        _result
7061    }
7062
7063    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7064        self.control_handle.inner.send::<PowerResourceGetResponse>(
7065            (resource,),
7066            self.tx_id,
7067            0x2b8df8ca24d1e866,
7068            fidl::encoding::DynamicFlags::empty(),
7069        )
7070    }
7071}
7072
7073#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7074pub struct ProfileResourceMarker;
7075
7076impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
7077    type Proxy = ProfileResourceProxy;
7078    type RequestStream = ProfileResourceRequestStream;
7079    #[cfg(target_os = "fuchsia")]
7080    type SynchronousProxy = ProfileResourceSynchronousProxy;
7081
7082    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
7083}
7084impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
7085
7086pub trait ProfileResourceProxyInterface: Send + Sync {
7087    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
7088    fn r#get(&self) -> Self::GetResponseFut;
7089}
7090#[derive(Debug)]
7091#[cfg(target_os = "fuchsia")]
7092pub struct ProfileResourceSynchronousProxy {
7093    client: fidl::client::sync::Client,
7094}
7095
7096#[cfg(target_os = "fuchsia")]
7097impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
7098    type Proxy = ProfileResourceProxy;
7099    type Protocol = ProfileResourceMarker;
7100
7101    fn from_channel(inner: fidl::Channel) -> Self {
7102        Self::new(inner)
7103    }
7104
7105    fn into_channel(self) -> fidl::Channel {
7106        self.client.into_channel()
7107    }
7108
7109    fn as_channel(&self) -> &fidl::Channel {
7110        self.client.as_channel()
7111    }
7112}
7113
7114#[cfg(target_os = "fuchsia")]
7115impl ProfileResourceSynchronousProxy {
7116    pub fn new(channel: fidl::Channel) -> Self {
7117        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7118        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7119    }
7120
7121    pub fn into_channel(self) -> fidl::Channel {
7122        self.client.into_channel()
7123    }
7124
7125    /// Waits until an event arrives and returns it. It is safe for other
7126    /// threads to make concurrent requests while waiting for an event.
7127    pub fn wait_for_event(
7128        &self,
7129        deadline: zx::MonotonicInstant,
7130    ) -> Result<ProfileResourceEvent, fidl::Error> {
7131        ProfileResourceEvent::decode(self.client.wait_for_event(deadline)?)
7132    }
7133
7134    /// Get a profile resource handle.
7135    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
7136        let _response =
7137            self.client.send_query::<fidl::encoding::EmptyPayload, ProfileResourceGetResponse>(
7138                (),
7139                0x3003a0c14de1fa86,
7140                fidl::encoding::DynamicFlags::empty(),
7141                ___deadline,
7142            )?;
7143        Ok(_response.resource)
7144    }
7145}
7146
7147#[cfg(target_os = "fuchsia")]
7148impl From<ProfileResourceSynchronousProxy> for zx::Handle {
7149    fn from(value: ProfileResourceSynchronousProxy) -> Self {
7150        value.into_channel().into()
7151    }
7152}
7153
7154#[cfg(target_os = "fuchsia")]
7155impl From<fidl::Channel> for ProfileResourceSynchronousProxy {
7156    fn from(value: fidl::Channel) -> Self {
7157        Self::new(value)
7158    }
7159}
7160
7161#[cfg(target_os = "fuchsia")]
7162impl fidl::endpoints::FromClient for ProfileResourceSynchronousProxy {
7163    type Protocol = ProfileResourceMarker;
7164
7165    fn from_client(value: fidl::endpoints::ClientEnd<ProfileResourceMarker>) -> Self {
7166        Self::new(value.into_channel())
7167    }
7168}
7169
7170#[derive(Debug, Clone)]
7171pub struct ProfileResourceProxy {
7172    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7173}
7174
7175impl fidl::endpoints::Proxy for ProfileResourceProxy {
7176    type Protocol = ProfileResourceMarker;
7177
7178    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7179        Self::new(inner)
7180    }
7181
7182    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7183        self.client.into_channel().map_err(|client| Self { client })
7184    }
7185
7186    fn as_channel(&self) -> &::fidl::AsyncChannel {
7187        self.client.as_channel()
7188    }
7189}
7190
7191impl ProfileResourceProxy {
7192    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
7193    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7194        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7195        Self { client: fidl::client::Client::new(channel, protocol_name) }
7196    }
7197
7198    /// Get a Stream of events from the remote end of the protocol.
7199    ///
7200    /// # Panics
7201    ///
7202    /// Panics if the event stream was already taken.
7203    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
7204        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
7205    }
7206
7207    /// Get a profile resource handle.
7208    pub fn r#get(
7209        &self,
7210    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
7211    {
7212        ProfileResourceProxyInterface::r#get(self)
7213    }
7214}
7215
7216impl ProfileResourceProxyInterface for ProfileResourceProxy {
7217    type GetResponseFut = fidl::client::QueryResponseFut<
7218        fidl::Resource,
7219        fidl::encoding::DefaultFuchsiaResourceDialect,
7220    >;
7221    fn r#get(&self) -> Self::GetResponseFut {
7222        fn _decode(
7223            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7224        ) -> Result<fidl::Resource, fidl::Error> {
7225            let _response = fidl::client::decode_transaction_body::<
7226                ProfileResourceGetResponse,
7227                fidl::encoding::DefaultFuchsiaResourceDialect,
7228                0x3003a0c14de1fa86,
7229            >(_buf?)?;
7230            Ok(_response.resource)
7231        }
7232        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
7233            (),
7234            0x3003a0c14de1fa86,
7235            fidl::encoding::DynamicFlags::empty(),
7236            _decode,
7237        )
7238    }
7239}
7240
7241pub struct ProfileResourceEventStream {
7242    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7243}
7244
7245impl std::marker::Unpin for ProfileResourceEventStream {}
7246
7247impl futures::stream::FusedStream for ProfileResourceEventStream {
7248    fn is_terminated(&self) -> bool {
7249        self.event_receiver.is_terminated()
7250    }
7251}
7252
7253impl futures::Stream for ProfileResourceEventStream {
7254    type Item = Result<ProfileResourceEvent, fidl::Error>;
7255
7256    fn poll_next(
7257        mut self: std::pin::Pin<&mut Self>,
7258        cx: &mut std::task::Context<'_>,
7259    ) -> std::task::Poll<Option<Self::Item>> {
7260        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7261            &mut self.event_receiver,
7262            cx
7263        )?) {
7264            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
7265            None => std::task::Poll::Ready(None),
7266        }
7267    }
7268}
7269
7270#[derive(Debug)]
7271pub enum ProfileResourceEvent {}
7272
7273impl ProfileResourceEvent {
7274    /// Decodes a message buffer as a [`ProfileResourceEvent`].
7275    fn decode(
7276        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7277    ) -> Result<ProfileResourceEvent, fidl::Error> {
7278        let (bytes, _handles) = buf.split_mut();
7279        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7280        debug_assert_eq!(tx_header.tx_id, 0);
7281        match tx_header.ordinal {
7282            _ => Err(fidl::Error::UnknownOrdinal {
7283                ordinal: tx_header.ordinal,
7284                protocol_name:
7285                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7286            }),
7287        }
7288    }
7289}
7290
7291/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
7292pub struct ProfileResourceRequestStream {
7293    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7294    is_terminated: bool,
7295}
7296
7297impl std::marker::Unpin for ProfileResourceRequestStream {}
7298
7299impl futures::stream::FusedStream for ProfileResourceRequestStream {
7300    fn is_terminated(&self) -> bool {
7301        self.is_terminated
7302    }
7303}
7304
7305impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
7306    type Protocol = ProfileResourceMarker;
7307    type ControlHandle = ProfileResourceControlHandle;
7308
7309    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7310        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7311    }
7312
7313    fn control_handle(&self) -> Self::ControlHandle {
7314        ProfileResourceControlHandle { inner: self.inner.clone() }
7315    }
7316
7317    fn into_inner(
7318        self,
7319    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7320    {
7321        (self.inner, self.is_terminated)
7322    }
7323
7324    fn from_inner(
7325        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7326        is_terminated: bool,
7327    ) -> Self {
7328        Self { inner, is_terminated }
7329    }
7330}
7331
7332impl futures::Stream for ProfileResourceRequestStream {
7333    type Item = Result<ProfileResourceRequest, fidl::Error>;
7334
7335    fn poll_next(
7336        mut self: std::pin::Pin<&mut Self>,
7337        cx: &mut std::task::Context<'_>,
7338    ) -> std::task::Poll<Option<Self::Item>> {
7339        let this = &mut *self;
7340        if this.inner.check_shutdown(cx) {
7341            this.is_terminated = true;
7342            return std::task::Poll::Ready(None);
7343        }
7344        if this.is_terminated {
7345            panic!("polled ProfileResourceRequestStream after completion");
7346        }
7347        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7348            |bytes, handles| {
7349                match this.inner.channel().read_etc(cx, bytes, handles) {
7350                    std::task::Poll::Ready(Ok(())) => {}
7351                    std::task::Poll::Pending => return std::task::Poll::Pending,
7352                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7353                        this.is_terminated = true;
7354                        return std::task::Poll::Ready(None);
7355                    }
7356                    std::task::Poll::Ready(Err(e)) => {
7357                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7358                            e.into(),
7359                        ))));
7360                    }
7361                }
7362
7363                // A message has been received from the channel
7364                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7365
7366                std::task::Poll::Ready(Some(match header.ordinal {
7367                    0x3003a0c14de1fa86 => {
7368                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7369                        let mut req = fidl::new_empty!(
7370                            fidl::encoding::EmptyPayload,
7371                            fidl::encoding::DefaultFuchsiaResourceDialect
7372                        );
7373                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7374                        let control_handle =
7375                            ProfileResourceControlHandle { inner: this.inner.clone() };
7376                        Ok(ProfileResourceRequest::Get {
7377                            responder: ProfileResourceGetResponder {
7378                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7379                                tx_id: header.tx_id,
7380                            },
7381                        })
7382                    }
7383                    _ => Err(fidl::Error::UnknownOrdinal {
7384                        ordinal: header.ordinal,
7385                        protocol_name:
7386                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7387                    }),
7388                }))
7389            },
7390        )
7391    }
7392}
7393
7394/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7395/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7396#[derive(Debug)]
7397pub enum ProfileResourceRequest {
7398    /// Get a profile resource handle.
7399    Get { responder: ProfileResourceGetResponder },
7400}
7401
7402impl ProfileResourceRequest {
7403    #[allow(irrefutable_let_patterns)]
7404    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7405        if let ProfileResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7406    }
7407
7408    /// Name of the method defined in FIDL
7409    pub fn method_name(&self) -> &'static str {
7410        match *self {
7411            ProfileResourceRequest::Get { .. } => "get",
7412        }
7413    }
7414}
7415
7416#[derive(Debug, Clone)]
7417pub struct ProfileResourceControlHandle {
7418    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7419}
7420
7421impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7422    fn shutdown(&self) {
7423        self.inner.shutdown()
7424    }
7425    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7426        self.inner.shutdown_with_epitaph(status)
7427    }
7428
7429    fn is_closed(&self) -> bool {
7430        self.inner.channel().is_closed()
7431    }
7432    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7433        self.inner.channel().on_closed()
7434    }
7435
7436    #[cfg(target_os = "fuchsia")]
7437    fn signal_peer(
7438        &self,
7439        clear_mask: zx::Signals,
7440        set_mask: zx::Signals,
7441    ) -> Result<(), zx_status::Status> {
7442        use fidl::Peered;
7443        self.inner.channel().signal_peer(clear_mask, set_mask)
7444    }
7445}
7446
7447impl ProfileResourceControlHandle {}
7448
7449#[must_use = "FIDL methods require a response to be sent"]
7450#[derive(Debug)]
7451pub struct ProfileResourceGetResponder {
7452    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7453    tx_id: u32,
7454}
7455
7456/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7457/// if the responder is dropped without sending a response, so that the client
7458/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7459impl std::ops::Drop for ProfileResourceGetResponder {
7460    fn drop(&mut self) {
7461        self.control_handle.shutdown();
7462        // Safety: drops once, never accessed again
7463        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7464    }
7465}
7466
7467impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7468    type ControlHandle = ProfileResourceControlHandle;
7469
7470    fn control_handle(&self) -> &ProfileResourceControlHandle {
7471        &self.control_handle
7472    }
7473
7474    fn drop_without_shutdown(mut self) {
7475        // Safety: drops once, never accessed again due to mem::forget
7476        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7477        // Prevent Drop from running (which would shut down the channel)
7478        std::mem::forget(self);
7479    }
7480}
7481
7482impl ProfileResourceGetResponder {
7483    /// Sends a response to the FIDL transaction.
7484    ///
7485    /// Sets the channel to shutdown if an error occurs.
7486    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7487        let _result = self.send_raw(resource);
7488        if _result.is_err() {
7489            self.control_handle.shutdown();
7490        }
7491        self.drop_without_shutdown();
7492        _result
7493    }
7494
7495    /// Similar to "send" but does not shutdown the channel if an error occurs.
7496    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7497        let _result = self.send_raw(resource);
7498        self.drop_without_shutdown();
7499        _result
7500    }
7501
7502    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7503        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7504            (resource,),
7505            self.tx_id,
7506            0x3003a0c14de1fa86,
7507            fidl::encoding::DynamicFlags::empty(),
7508        )
7509    }
7510}
7511
7512#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7513pub struct RootJobMarker;
7514
7515impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7516    type Proxy = RootJobProxy;
7517    type RequestStream = RootJobRequestStream;
7518    #[cfg(target_os = "fuchsia")]
7519    type SynchronousProxy = RootJobSynchronousProxy;
7520
7521    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7522}
7523impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7524
7525pub trait RootJobProxyInterface: Send + Sync {
7526    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7527    fn r#get(&self) -> Self::GetResponseFut;
7528}
7529#[derive(Debug)]
7530#[cfg(target_os = "fuchsia")]
7531pub struct RootJobSynchronousProxy {
7532    client: fidl::client::sync::Client,
7533}
7534
7535#[cfg(target_os = "fuchsia")]
7536impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7537    type Proxy = RootJobProxy;
7538    type Protocol = RootJobMarker;
7539
7540    fn from_channel(inner: fidl::Channel) -> Self {
7541        Self::new(inner)
7542    }
7543
7544    fn into_channel(self) -> fidl::Channel {
7545        self.client.into_channel()
7546    }
7547
7548    fn as_channel(&self) -> &fidl::Channel {
7549        self.client.as_channel()
7550    }
7551}
7552
7553#[cfg(target_os = "fuchsia")]
7554impl RootJobSynchronousProxy {
7555    pub fn new(channel: fidl::Channel) -> Self {
7556        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7557        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7558    }
7559
7560    pub fn into_channel(self) -> fidl::Channel {
7561        self.client.into_channel()
7562    }
7563
7564    /// Waits until an event arrives and returns it. It is safe for other
7565    /// threads to make concurrent requests while waiting for an event.
7566    pub fn wait_for_event(
7567        &self,
7568        deadline: zx::MonotonicInstant,
7569    ) -> Result<RootJobEvent, fidl::Error> {
7570        RootJobEvent::decode(self.client.wait_for_event(deadline)?)
7571    }
7572
7573    /// Get the root `job`.
7574    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7575        let _response =
7576            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
7577                (),
7578                0x73acb63f93d53eac,
7579                fidl::encoding::DynamicFlags::empty(),
7580                ___deadline,
7581            )?;
7582        Ok(_response.job)
7583    }
7584}
7585
7586#[cfg(target_os = "fuchsia")]
7587impl From<RootJobSynchronousProxy> for zx::Handle {
7588    fn from(value: RootJobSynchronousProxy) -> Self {
7589        value.into_channel().into()
7590    }
7591}
7592
7593#[cfg(target_os = "fuchsia")]
7594impl From<fidl::Channel> for RootJobSynchronousProxy {
7595    fn from(value: fidl::Channel) -> Self {
7596        Self::new(value)
7597    }
7598}
7599
7600#[cfg(target_os = "fuchsia")]
7601impl fidl::endpoints::FromClient for RootJobSynchronousProxy {
7602    type Protocol = RootJobMarker;
7603
7604    fn from_client(value: fidl::endpoints::ClientEnd<RootJobMarker>) -> Self {
7605        Self::new(value.into_channel())
7606    }
7607}
7608
7609#[derive(Debug, Clone)]
7610pub struct RootJobProxy {
7611    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7612}
7613
7614impl fidl::endpoints::Proxy for RootJobProxy {
7615    type Protocol = RootJobMarker;
7616
7617    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7618        Self::new(inner)
7619    }
7620
7621    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7622        self.client.into_channel().map_err(|client| Self { client })
7623    }
7624
7625    fn as_channel(&self) -> &::fidl::AsyncChannel {
7626        self.client.as_channel()
7627    }
7628}
7629
7630impl RootJobProxy {
7631    /// Create a new Proxy for fuchsia.kernel/RootJob.
7632    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7633        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7634        Self { client: fidl::client::Client::new(channel, protocol_name) }
7635    }
7636
7637    /// Get a Stream of events from the remote end of the protocol.
7638    ///
7639    /// # Panics
7640    ///
7641    /// Panics if the event stream was already taken.
7642    pub fn take_event_stream(&self) -> RootJobEventStream {
7643        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7644    }
7645
7646    /// Get the root `job`.
7647    pub fn r#get(
7648        &self,
7649    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7650    {
7651        RootJobProxyInterface::r#get(self)
7652    }
7653}
7654
7655impl RootJobProxyInterface for RootJobProxy {
7656    type GetResponseFut =
7657        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7658    fn r#get(&self) -> Self::GetResponseFut {
7659        fn _decode(
7660            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7661        ) -> Result<fidl::Job, fidl::Error> {
7662            let _response = fidl::client::decode_transaction_body::<
7663                RootJobGetResponse,
7664                fidl::encoding::DefaultFuchsiaResourceDialect,
7665                0x73acb63f93d53eac,
7666            >(_buf?)?;
7667            Ok(_response.job)
7668        }
7669        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7670            (),
7671            0x73acb63f93d53eac,
7672            fidl::encoding::DynamicFlags::empty(),
7673            _decode,
7674        )
7675    }
7676}
7677
7678pub struct RootJobEventStream {
7679    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7680}
7681
7682impl std::marker::Unpin for RootJobEventStream {}
7683
7684impl futures::stream::FusedStream for RootJobEventStream {
7685    fn is_terminated(&self) -> bool {
7686        self.event_receiver.is_terminated()
7687    }
7688}
7689
7690impl futures::Stream for RootJobEventStream {
7691    type Item = Result<RootJobEvent, fidl::Error>;
7692
7693    fn poll_next(
7694        mut self: std::pin::Pin<&mut Self>,
7695        cx: &mut std::task::Context<'_>,
7696    ) -> std::task::Poll<Option<Self::Item>> {
7697        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7698            &mut self.event_receiver,
7699            cx
7700        )?) {
7701            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7702            None => std::task::Poll::Ready(None),
7703        }
7704    }
7705}
7706
7707#[derive(Debug)]
7708pub enum RootJobEvent {}
7709
7710impl RootJobEvent {
7711    /// Decodes a message buffer as a [`RootJobEvent`].
7712    fn decode(
7713        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7714    ) -> Result<RootJobEvent, fidl::Error> {
7715        let (bytes, _handles) = buf.split_mut();
7716        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7717        debug_assert_eq!(tx_header.tx_id, 0);
7718        match tx_header.ordinal {
7719            _ => Err(fidl::Error::UnknownOrdinal {
7720                ordinal: tx_header.ordinal,
7721                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7722            }),
7723        }
7724    }
7725}
7726
7727/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7728pub struct RootJobRequestStream {
7729    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7730    is_terminated: bool,
7731}
7732
7733impl std::marker::Unpin for RootJobRequestStream {}
7734
7735impl futures::stream::FusedStream for RootJobRequestStream {
7736    fn is_terminated(&self) -> bool {
7737        self.is_terminated
7738    }
7739}
7740
7741impl fidl::endpoints::RequestStream for RootJobRequestStream {
7742    type Protocol = RootJobMarker;
7743    type ControlHandle = RootJobControlHandle;
7744
7745    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7746        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7747    }
7748
7749    fn control_handle(&self) -> Self::ControlHandle {
7750        RootJobControlHandle { inner: self.inner.clone() }
7751    }
7752
7753    fn into_inner(
7754        self,
7755    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7756    {
7757        (self.inner, self.is_terminated)
7758    }
7759
7760    fn from_inner(
7761        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7762        is_terminated: bool,
7763    ) -> Self {
7764        Self { inner, is_terminated }
7765    }
7766}
7767
7768impl futures::Stream for RootJobRequestStream {
7769    type Item = Result<RootJobRequest, fidl::Error>;
7770
7771    fn poll_next(
7772        mut self: std::pin::Pin<&mut Self>,
7773        cx: &mut std::task::Context<'_>,
7774    ) -> std::task::Poll<Option<Self::Item>> {
7775        let this = &mut *self;
7776        if this.inner.check_shutdown(cx) {
7777            this.is_terminated = true;
7778            return std::task::Poll::Ready(None);
7779        }
7780        if this.is_terminated {
7781            panic!("polled RootJobRequestStream after completion");
7782        }
7783        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7784            |bytes, handles| {
7785                match this.inner.channel().read_etc(cx, bytes, handles) {
7786                    std::task::Poll::Ready(Ok(())) => {}
7787                    std::task::Poll::Pending => return std::task::Poll::Pending,
7788                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7789                        this.is_terminated = true;
7790                        return std::task::Poll::Ready(None);
7791                    }
7792                    std::task::Poll::Ready(Err(e)) => {
7793                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7794                            e.into(),
7795                        ))));
7796                    }
7797                }
7798
7799                // A message has been received from the channel
7800                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7801
7802                std::task::Poll::Ready(Some(match header.ordinal {
7803                    0x73acb63f93d53eac => {
7804                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7805                        let mut req = fidl::new_empty!(
7806                            fidl::encoding::EmptyPayload,
7807                            fidl::encoding::DefaultFuchsiaResourceDialect
7808                        );
7809                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7810                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7811                        Ok(RootJobRequest::Get {
7812                            responder: RootJobGetResponder {
7813                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7814                                tx_id: header.tx_id,
7815                            },
7816                        })
7817                    }
7818                    _ => Err(fidl::Error::UnknownOrdinal {
7819                        ordinal: header.ordinal,
7820                        protocol_name:
7821                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7822                    }),
7823                }))
7824            },
7825        )
7826    }
7827}
7828
7829/// Protocol for providing the root job.
7830///
7831/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7832#[derive(Debug)]
7833pub enum RootJobRequest {
7834    /// Get the root `job`.
7835    Get { responder: RootJobGetResponder },
7836}
7837
7838impl RootJobRequest {
7839    #[allow(irrefutable_let_patterns)]
7840    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7841        if let RootJobRequest::Get { responder } = self { Some((responder)) } else { None }
7842    }
7843
7844    /// Name of the method defined in FIDL
7845    pub fn method_name(&self) -> &'static str {
7846        match *self {
7847            RootJobRequest::Get { .. } => "get",
7848        }
7849    }
7850}
7851
7852#[derive(Debug, Clone)]
7853pub struct RootJobControlHandle {
7854    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7855}
7856
7857impl fidl::endpoints::ControlHandle for RootJobControlHandle {
7858    fn shutdown(&self) {
7859        self.inner.shutdown()
7860    }
7861    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7862        self.inner.shutdown_with_epitaph(status)
7863    }
7864
7865    fn is_closed(&self) -> bool {
7866        self.inner.channel().is_closed()
7867    }
7868    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7869        self.inner.channel().on_closed()
7870    }
7871
7872    #[cfg(target_os = "fuchsia")]
7873    fn signal_peer(
7874        &self,
7875        clear_mask: zx::Signals,
7876        set_mask: zx::Signals,
7877    ) -> Result<(), zx_status::Status> {
7878        use fidl::Peered;
7879        self.inner.channel().signal_peer(clear_mask, set_mask)
7880    }
7881}
7882
7883impl RootJobControlHandle {}
7884
7885#[must_use = "FIDL methods require a response to be sent"]
7886#[derive(Debug)]
7887pub struct RootJobGetResponder {
7888    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
7889    tx_id: u32,
7890}
7891
7892/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
7893/// if the responder is dropped without sending a response, so that the client
7894/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7895impl std::ops::Drop for RootJobGetResponder {
7896    fn drop(&mut self) {
7897        self.control_handle.shutdown();
7898        // Safety: drops once, never accessed again
7899        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7900    }
7901}
7902
7903impl fidl::endpoints::Responder for RootJobGetResponder {
7904    type ControlHandle = RootJobControlHandle;
7905
7906    fn control_handle(&self) -> &RootJobControlHandle {
7907        &self.control_handle
7908    }
7909
7910    fn drop_without_shutdown(mut self) {
7911        // Safety: drops once, never accessed again due to mem::forget
7912        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7913        // Prevent Drop from running (which would shut down the channel)
7914        std::mem::forget(self);
7915    }
7916}
7917
7918impl RootJobGetResponder {
7919    /// Sends a response to the FIDL transaction.
7920    ///
7921    /// Sets the channel to shutdown if an error occurs.
7922    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7923        let _result = self.send_raw(job);
7924        if _result.is_err() {
7925            self.control_handle.shutdown();
7926        }
7927        self.drop_without_shutdown();
7928        _result
7929    }
7930
7931    /// Similar to "send" but does not shutdown the channel if an error occurs.
7932    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7933        let _result = self.send_raw(job);
7934        self.drop_without_shutdown();
7935        _result
7936    }
7937
7938    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7939        self.control_handle.inner.send::<RootJobGetResponse>(
7940            (job,),
7941            self.tx_id,
7942            0x73acb63f93d53eac,
7943            fidl::encoding::DynamicFlags::empty(),
7944        )
7945    }
7946}
7947
7948#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7949pub struct RootJobForInspectMarker;
7950
7951impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
7952    type Proxy = RootJobForInspectProxy;
7953    type RequestStream = RootJobForInspectRequestStream;
7954    #[cfg(target_os = "fuchsia")]
7955    type SynchronousProxy = RootJobForInspectSynchronousProxy;
7956
7957    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
7958}
7959impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
7960
7961pub trait RootJobForInspectProxyInterface: Send + Sync {
7962    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7963    fn r#get(&self) -> Self::GetResponseFut;
7964}
7965#[derive(Debug)]
7966#[cfg(target_os = "fuchsia")]
7967pub struct RootJobForInspectSynchronousProxy {
7968    client: fidl::client::sync::Client,
7969}
7970
7971#[cfg(target_os = "fuchsia")]
7972impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
7973    type Proxy = RootJobForInspectProxy;
7974    type Protocol = RootJobForInspectMarker;
7975
7976    fn from_channel(inner: fidl::Channel) -> Self {
7977        Self::new(inner)
7978    }
7979
7980    fn into_channel(self) -> fidl::Channel {
7981        self.client.into_channel()
7982    }
7983
7984    fn as_channel(&self) -> &fidl::Channel {
7985        self.client.as_channel()
7986    }
7987}
7988
7989#[cfg(target_os = "fuchsia")]
7990impl RootJobForInspectSynchronousProxy {
7991    pub fn new(channel: fidl::Channel) -> Self {
7992        let protocol_name =
7993            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7994        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7995    }
7996
7997    pub fn into_channel(self) -> fidl::Channel {
7998        self.client.into_channel()
7999    }
8000
8001    /// Waits until an event arrives and returns it. It is safe for other
8002    /// threads to make concurrent requests while waiting for an event.
8003    pub fn wait_for_event(
8004        &self,
8005        deadline: zx::MonotonicInstant,
8006    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8007        RootJobForInspectEvent::decode(self.client.wait_for_event(deadline)?)
8008    }
8009
8010    /// Get the root `job`.
8011    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
8012        let _response =
8013            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
8014                (),
8015                0x73acb63f93d53eac,
8016                fidl::encoding::DynamicFlags::empty(),
8017                ___deadline,
8018            )?;
8019        Ok(_response.job)
8020    }
8021}
8022
8023#[cfg(target_os = "fuchsia")]
8024impl From<RootJobForInspectSynchronousProxy> for zx::Handle {
8025    fn from(value: RootJobForInspectSynchronousProxy) -> Self {
8026        value.into_channel().into()
8027    }
8028}
8029
8030#[cfg(target_os = "fuchsia")]
8031impl From<fidl::Channel> for RootJobForInspectSynchronousProxy {
8032    fn from(value: fidl::Channel) -> Self {
8033        Self::new(value)
8034    }
8035}
8036
8037#[cfg(target_os = "fuchsia")]
8038impl fidl::endpoints::FromClient for RootJobForInspectSynchronousProxy {
8039    type Protocol = RootJobForInspectMarker;
8040
8041    fn from_client(value: fidl::endpoints::ClientEnd<RootJobForInspectMarker>) -> Self {
8042        Self::new(value.into_channel())
8043    }
8044}
8045
8046#[derive(Debug, Clone)]
8047pub struct RootJobForInspectProxy {
8048    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8049}
8050
8051impl fidl::endpoints::Proxy for RootJobForInspectProxy {
8052    type Protocol = RootJobForInspectMarker;
8053
8054    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8055        Self::new(inner)
8056    }
8057
8058    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8059        self.client.into_channel().map_err(|client| Self { client })
8060    }
8061
8062    fn as_channel(&self) -> &::fidl::AsyncChannel {
8063        self.client.as_channel()
8064    }
8065}
8066
8067impl RootJobForInspectProxy {
8068    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
8069    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8070        let protocol_name =
8071            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8072        Self { client: fidl::client::Client::new(channel, protocol_name) }
8073    }
8074
8075    /// Get a Stream of events from the remote end of the protocol.
8076    ///
8077    /// # Panics
8078    ///
8079    /// Panics if the event stream was already taken.
8080    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
8081        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
8082    }
8083
8084    /// Get the root `job`.
8085    pub fn r#get(
8086        &self,
8087    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
8088    {
8089        RootJobForInspectProxyInterface::r#get(self)
8090    }
8091}
8092
8093impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
8094    type GetResponseFut =
8095        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
8096    fn r#get(&self) -> Self::GetResponseFut {
8097        fn _decode(
8098            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8099        ) -> Result<fidl::Job, fidl::Error> {
8100            let _response = fidl::client::decode_transaction_body::<
8101                RootJobGetResponse,
8102                fidl::encoding::DefaultFuchsiaResourceDialect,
8103                0x73acb63f93d53eac,
8104            >(_buf?)?;
8105            Ok(_response.job)
8106        }
8107        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
8108            (),
8109            0x73acb63f93d53eac,
8110            fidl::encoding::DynamicFlags::empty(),
8111            _decode,
8112        )
8113    }
8114}
8115
8116pub struct RootJobForInspectEventStream {
8117    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8118}
8119
8120impl std::marker::Unpin for RootJobForInspectEventStream {}
8121
8122impl futures::stream::FusedStream for RootJobForInspectEventStream {
8123    fn is_terminated(&self) -> bool {
8124        self.event_receiver.is_terminated()
8125    }
8126}
8127
8128impl futures::Stream for RootJobForInspectEventStream {
8129    type Item = Result<RootJobForInspectEvent, fidl::Error>;
8130
8131    fn poll_next(
8132        mut self: std::pin::Pin<&mut Self>,
8133        cx: &mut std::task::Context<'_>,
8134    ) -> std::task::Poll<Option<Self::Item>> {
8135        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8136            &mut self.event_receiver,
8137            cx
8138        )?) {
8139            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
8140            None => std::task::Poll::Ready(None),
8141        }
8142    }
8143}
8144
8145#[derive(Debug)]
8146pub enum RootJobForInspectEvent {}
8147
8148impl RootJobForInspectEvent {
8149    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
8150    fn decode(
8151        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8152    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8153        let (bytes, _handles) = buf.split_mut();
8154        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8155        debug_assert_eq!(tx_header.tx_id, 0);
8156        match tx_header.ordinal {
8157            _ => Err(fidl::Error::UnknownOrdinal {
8158                ordinal: tx_header.ordinal,
8159                protocol_name:
8160                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8161            }),
8162        }
8163    }
8164}
8165
8166/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
8167pub struct RootJobForInspectRequestStream {
8168    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8169    is_terminated: bool,
8170}
8171
8172impl std::marker::Unpin for RootJobForInspectRequestStream {}
8173
8174impl futures::stream::FusedStream for RootJobForInspectRequestStream {
8175    fn is_terminated(&self) -> bool {
8176        self.is_terminated
8177    }
8178}
8179
8180impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
8181    type Protocol = RootJobForInspectMarker;
8182    type ControlHandle = RootJobForInspectControlHandle;
8183
8184    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8185        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8186    }
8187
8188    fn control_handle(&self) -> Self::ControlHandle {
8189        RootJobForInspectControlHandle { inner: self.inner.clone() }
8190    }
8191
8192    fn into_inner(
8193        self,
8194    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8195    {
8196        (self.inner, self.is_terminated)
8197    }
8198
8199    fn from_inner(
8200        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8201        is_terminated: bool,
8202    ) -> Self {
8203        Self { inner, is_terminated }
8204    }
8205}
8206
8207impl futures::Stream for RootJobForInspectRequestStream {
8208    type Item = Result<RootJobForInspectRequest, fidl::Error>;
8209
8210    fn poll_next(
8211        mut self: std::pin::Pin<&mut Self>,
8212        cx: &mut std::task::Context<'_>,
8213    ) -> std::task::Poll<Option<Self::Item>> {
8214        let this = &mut *self;
8215        if this.inner.check_shutdown(cx) {
8216            this.is_terminated = true;
8217            return std::task::Poll::Ready(None);
8218        }
8219        if this.is_terminated {
8220            panic!("polled RootJobForInspectRequestStream after completion");
8221        }
8222        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8223            |bytes, handles| {
8224                match this.inner.channel().read_etc(cx, bytes, handles) {
8225                    std::task::Poll::Ready(Ok(())) => {}
8226                    std::task::Poll::Pending => return std::task::Poll::Pending,
8227                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8228                        this.is_terminated = true;
8229                        return std::task::Poll::Ready(None);
8230                    }
8231                    std::task::Poll::Ready(Err(e)) => {
8232                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8233                            e.into(),
8234                        ))));
8235                    }
8236                }
8237
8238                // A message has been received from the channel
8239                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8240
8241                std::task::Poll::Ready(Some(match header.ordinal {
8242                    0x73acb63f93d53eac => {
8243                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8244                        let mut req = fidl::new_empty!(
8245                            fidl::encoding::EmptyPayload,
8246                            fidl::encoding::DefaultFuchsiaResourceDialect
8247                        );
8248                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8249                        let control_handle =
8250                            RootJobForInspectControlHandle { inner: this.inner.clone() };
8251                        Ok(RootJobForInspectRequest::Get {
8252                            responder: RootJobForInspectGetResponder {
8253                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8254                                tx_id: header.tx_id,
8255                            },
8256                        })
8257                    }
8258                    _ => Err(fidl::Error::UnknownOrdinal {
8259                        ordinal: header.ordinal,
8260                        protocol_name:
8261                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8262                    }),
8263                }))
8264            },
8265        )
8266    }
8267}
8268
8269/// Protocol for providing the root job with restricted rights, specifically:
8270/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
8271#[derive(Debug)]
8272pub enum RootJobForInspectRequest {
8273    /// Get the root `job`.
8274    Get { responder: RootJobForInspectGetResponder },
8275}
8276
8277impl RootJobForInspectRequest {
8278    #[allow(irrefutable_let_patterns)]
8279    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
8280        if let RootJobForInspectRequest::Get { responder } = self {
8281            Some((responder))
8282        } else {
8283            None
8284        }
8285    }
8286
8287    /// Name of the method defined in FIDL
8288    pub fn method_name(&self) -> &'static str {
8289        match *self {
8290            RootJobForInspectRequest::Get { .. } => "get",
8291        }
8292    }
8293}
8294
8295#[derive(Debug, Clone)]
8296pub struct RootJobForInspectControlHandle {
8297    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8298}
8299
8300impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
8301    fn shutdown(&self) {
8302        self.inner.shutdown()
8303    }
8304    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8305        self.inner.shutdown_with_epitaph(status)
8306    }
8307
8308    fn is_closed(&self) -> bool {
8309        self.inner.channel().is_closed()
8310    }
8311    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8312        self.inner.channel().on_closed()
8313    }
8314
8315    #[cfg(target_os = "fuchsia")]
8316    fn signal_peer(
8317        &self,
8318        clear_mask: zx::Signals,
8319        set_mask: zx::Signals,
8320    ) -> Result<(), zx_status::Status> {
8321        use fidl::Peered;
8322        self.inner.channel().signal_peer(clear_mask, set_mask)
8323    }
8324}
8325
8326impl RootJobForInspectControlHandle {}
8327
8328#[must_use = "FIDL methods require a response to be sent"]
8329#[derive(Debug)]
8330pub struct RootJobForInspectGetResponder {
8331    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
8332    tx_id: u32,
8333}
8334
8335/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
8336/// if the responder is dropped without sending a response, so that the client
8337/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8338impl std::ops::Drop for RootJobForInspectGetResponder {
8339    fn drop(&mut self) {
8340        self.control_handle.shutdown();
8341        // Safety: drops once, never accessed again
8342        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8343    }
8344}
8345
8346impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
8347    type ControlHandle = RootJobForInspectControlHandle;
8348
8349    fn control_handle(&self) -> &RootJobForInspectControlHandle {
8350        &self.control_handle
8351    }
8352
8353    fn drop_without_shutdown(mut self) {
8354        // Safety: drops once, never accessed again due to mem::forget
8355        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8356        // Prevent Drop from running (which would shut down the channel)
8357        std::mem::forget(self);
8358    }
8359}
8360
8361impl RootJobForInspectGetResponder {
8362    /// Sends a response to the FIDL transaction.
8363    ///
8364    /// Sets the channel to shutdown if an error occurs.
8365    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8366        let _result = self.send_raw(job);
8367        if _result.is_err() {
8368            self.control_handle.shutdown();
8369        }
8370        self.drop_without_shutdown();
8371        _result
8372    }
8373
8374    /// Similar to "send" but does not shutdown the channel if an error occurs.
8375    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8376        let _result = self.send_raw(job);
8377        self.drop_without_shutdown();
8378        _result
8379    }
8380
8381    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8382        self.control_handle.inner.send::<RootJobGetResponse>(
8383            (job,),
8384            self.tx_id,
8385            0x73acb63f93d53eac,
8386            fidl::encoding::DynamicFlags::empty(),
8387        )
8388    }
8389}
8390
8391#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8392pub struct SamplingResourceMarker;
8393
8394impl fidl::endpoints::ProtocolMarker for SamplingResourceMarker {
8395    type Proxy = SamplingResourceProxy;
8396    type RequestStream = SamplingResourceRequestStream;
8397    #[cfg(target_os = "fuchsia")]
8398    type SynchronousProxy = SamplingResourceSynchronousProxy;
8399
8400    const DEBUG_NAME: &'static str = "fuchsia.kernel.SamplingResource";
8401}
8402impl fidl::endpoints::DiscoverableProtocolMarker for SamplingResourceMarker {}
8403
8404pub trait SamplingResourceProxyInterface: Send + Sync {
8405    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8406    fn r#get(&self) -> Self::GetResponseFut;
8407}
8408#[derive(Debug)]
8409#[cfg(target_os = "fuchsia")]
8410pub struct SamplingResourceSynchronousProxy {
8411    client: fidl::client::sync::Client,
8412}
8413
8414#[cfg(target_os = "fuchsia")]
8415impl fidl::endpoints::SynchronousProxy for SamplingResourceSynchronousProxy {
8416    type Proxy = SamplingResourceProxy;
8417    type Protocol = SamplingResourceMarker;
8418
8419    fn from_channel(inner: fidl::Channel) -> Self {
8420        Self::new(inner)
8421    }
8422
8423    fn into_channel(self) -> fidl::Channel {
8424        self.client.into_channel()
8425    }
8426
8427    fn as_channel(&self) -> &fidl::Channel {
8428        self.client.as_channel()
8429    }
8430}
8431
8432#[cfg(target_os = "fuchsia")]
8433impl SamplingResourceSynchronousProxy {
8434    pub fn new(channel: fidl::Channel) -> Self {
8435        let protocol_name = <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8436        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8437    }
8438
8439    pub fn into_channel(self) -> fidl::Channel {
8440        self.client.into_channel()
8441    }
8442
8443    /// Waits until an event arrives and returns it. It is safe for other
8444    /// threads to make concurrent requests while waiting for an event.
8445    pub fn wait_for_event(
8446        &self,
8447        deadline: zx::MonotonicInstant,
8448    ) -> Result<SamplingResourceEvent, fidl::Error> {
8449        SamplingResourceEvent::decode(self.client.wait_for_event(deadline)?)
8450    }
8451
8452    /// Get a sampling resource handle.
8453    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8454        let _response =
8455            self.client.send_query::<fidl::encoding::EmptyPayload, SamplingResourceGetResponse>(
8456                (),
8457                0x51c41ab037e99824,
8458                fidl::encoding::DynamicFlags::empty(),
8459                ___deadline,
8460            )?;
8461        Ok(_response.resource)
8462    }
8463}
8464
8465#[cfg(target_os = "fuchsia")]
8466impl From<SamplingResourceSynchronousProxy> for zx::Handle {
8467    fn from(value: SamplingResourceSynchronousProxy) -> Self {
8468        value.into_channel().into()
8469    }
8470}
8471
8472#[cfg(target_os = "fuchsia")]
8473impl From<fidl::Channel> for SamplingResourceSynchronousProxy {
8474    fn from(value: fidl::Channel) -> Self {
8475        Self::new(value)
8476    }
8477}
8478
8479#[cfg(target_os = "fuchsia")]
8480impl fidl::endpoints::FromClient for SamplingResourceSynchronousProxy {
8481    type Protocol = SamplingResourceMarker;
8482
8483    fn from_client(value: fidl::endpoints::ClientEnd<SamplingResourceMarker>) -> Self {
8484        Self::new(value.into_channel())
8485    }
8486}
8487
8488#[derive(Debug, Clone)]
8489pub struct SamplingResourceProxy {
8490    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8491}
8492
8493impl fidl::endpoints::Proxy for SamplingResourceProxy {
8494    type Protocol = SamplingResourceMarker;
8495
8496    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8497        Self::new(inner)
8498    }
8499
8500    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8501        self.client.into_channel().map_err(|client| Self { client })
8502    }
8503
8504    fn as_channel(&self) -> &::fidl::AsyncChannel {
8505        self.client.as_channel()
8506    }
8507}
8508
8509impl SamplingResourceProxy {
8510    /// Create a new Proxy for fuchsia.kernel/SamplingResource.
8511    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8512        let protocol_name = <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8513        Self { client: fidl::client::Client::new(channel, protocol_name) }
8514    }
8515
8516    /// Get a Stream of events from the remote end of the protocol.
8517    ///
8518    /// # Panics
8519    ///
8520    /// Panics if the event stream was already taken.
8521    pub fn take_event_stream(&self) -> SamplingResourceEventStream {
8522        SamplingResourceEventStream { event_receiver: self.client.take_event_receiver() }
8523    }
8524
8525    /// Get a sampling resource handle.
8526    pub fn r#get(
8527        &self,
8528    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8529    {
8530        SamplingResourceProxyInterface::r#get(self)
8531    }
8532}
8533
8534impl SamplingResourceProxyInterface for SamplingResourceProxy {
8535    type GetResponseFut = fidl::client::QueryResponseFut<
8536        fidl::Resource,
8537        fidl::encoding::DefaultFuchsiaResourceDialect,
8538    >;
8539    fn r#get(&self) -> Self::GetResponseFut {
8540        fn _decode(
8541            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8542        ) -> Result<fidl::Resource, fidl::Error> {
8543            let _response = fidl::client::decode_transaction_body::<
8544                SamplingResourceGetResponse,
8545                fidl::encoding::DefaultFuchsiaResourceDialect,
8546                0x51c41ab037e99824,
8547            >(_buf?)?;
8548            Ok(_response.resource)
8549        }
8550        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8551            (),
8552            0x51c41ab037e99824,
8553            fidl::encoding::DynamicFlags::empty(),
8554            _decode,
8555        )
8556    }
8557}
8558
8559pub struct SamplingResourceEventStream {
8560    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8561}
8562
8563impl std::marker::Unpin for SamplingResourceEventStream {}
8564
8565impl futures::stream::FusedStream for SamplingResourceEventStream {
8566    fn is_terminated(&self) -> bool {
8567        self.event_receiver.is_terminated()
8568    }
8569}
8570
8571impl futures::Stream for SamplingResourceEventStream {
8572    type Item = Result<SamplingResourceEvent, fidl::Error>;
8573
8574    fn poll_next(
8575        mut self: std::pin::Pin<&mut Self>,
8576        cx: &mut std::task::Context<'_>,
8577    ) -> std::task::Poll<Option<Self::Item>> {
8578        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8579            &mut self.event_receiver,
8580            cx
8581        )?) {
8582            Some(buf) => std::task::Poll::Ready(Some(SamplingResourceEvent::decode(buf))),
8583            None => std::task::Poll::Ready(None),
8584        }
8585    }
8586}
8587
8588#[derive(Debug)]
8589pub enum SamplingResourceEvent {}
8590
8591impl SamplingResourceEvent {
8592    /// Decodes a message buffer as a [`SamplingResourceEvent`].
8593    fn decode(
8594        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8595    ) -> Result<SamplingResourceEvent, fidl::Error> {
8596        let (bytes, _handles) = buf.split_mut();
8597        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8598        debug_assert_eq!(tx_header.tx_id, 0);
8599        match tx_header.ordinal {
8600            _ => Err(fidl::Error::UnknownOrdinal {
8601                ordinal: tx_header.ordinal,
8602                protocol_name:
8603                    <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8604            }),
8605        }
8606    }
8607}
8608
8609/// A Stream of incoming requests for fuchsia.kernel/SamplingResource.
8610pub struct SamplingResourceRequestStream {
8611    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8612    is_terminated: bool,
8613}
8614
8615impl std::marker::Unpin for SamplingResourceRequestStream {}
8616
8617impl futures::stream::FusedStream for SamplingResourceRequestStream {
8618    fn is_terminated(&self) -> bool {
8619        self.is_terminated
8620    }
8621}
8622
8623impl fidl::endpoints::RequestStream for SamplingResourceRequestStream {
8624    type Protocol = SamplingResourceMarker;
8625    type ControlHandle = SamplingResourceControlHandle;
8626
8627    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8628        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8629    }
8630
8631    fn control_handle(&self) -> Self::ControlHandle {
8632        SamplingResourceControlHandle { inner: self.inner.clone() }
8633    }
8634
8635    fn into_inner(
8636        self,
8637    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8638    {
8639        (self.inner, self.is_terminated)
8640    }
8641
8642    fn from_inner(
8643        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8644        is_terminated: bool,
8645    ) -> Self {
8646        Self { inner, is_terminated }
8647    }
8648}
8649
8650impl futures::Stream for SamplingResourceRequestStream {
8651    type Item = Result<SamplingResourceRequest, fidl::Error>;
8652
8653    fn poll_next(
8654        mut self: std::pin::Pin<&mut Self>,
8655        cx: &mut std::task::Context<'_>,
8656    ) -> std::task::Poll<Option<Self::Item>> {
8657        let this = &mut *self;
8658        if this.inner.check_shutdown(cx) {
8659            this.is_terminated = true;
8660            return std::task::Poll::Ready(None);
8661        }
8662        if this.is_terminated {
8663            panic!("polled SamplingResourceRequestStream after completion");
8664        }
8665        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8666            |bytes, handles| {
8667                match this.inner.channel().read_etc(cx, bytes, handles) {
8668                    std::task::Poll::Ready(Ok(())) => {}
8669                    std::task::Poll::Pending => return std::task::Poll::Pending,
8670                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8671                        this.is_terminated = true;
8672                        return std::task::Poll::Ready(None);
8673                    }
8674                    std::task::Poll::Ready(Err(e)) => {
8675                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8676                            e.into(),
8677                        ))));
8678                    }
8679                }
8680
8681                // A message has been received from the channel
8682                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8683
8684                std::task::Poll::Ready(Some(match header.ordinal {
8685                    0x51c41ab037e99824 => {
8686                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8687                        let mut req = fidl::new_empty!(
8688                            fidl::encoding::EmptyPayload,
8689                            fidl::encoding::DefaultFuchsiaResourceDialect
8690                        );
8691                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8692                        let control_handle =
8693                            SamplingResourceControlHandle { inner: this.inner.clone() };
8694                        Ok(SamplingResourceRequest::Get {
8695                            responder: SamplingResourceGetResponder {
8696                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8697                                tx_id: header.tx_id,
8698                            },
8699                        })
8700                    }
8701                    _ => Err(fidl::Error::UnknownOrdinal {
8702                        ordinal: header.ordinal,
8703                        protocol_name:
8704                            <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8705                    }),
8706                }))
8707            },
8708        )
8709    }
8710}
8711
8712/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
8713/// `ZX_RSRC_SYSTEM_SAMPLING_BASE`.
8714#[derive(Debug)]
8715pub enum SamplingResourceRequest {
8716    /// Get a sampling resource handle.
8717    Get { responder: SamplingResourceGetResponder },
8718}
8719
8720impl SamplingResourceRequest {
8721    #[allow(irrefutable_let_patterns)]
8722    pub fn into_get(self) -> Option<(SamplingResourceGetResponder)> {
8723        if let SamplingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
8724    }
8725
8726    /// Name of the method defined in FIDL
8727    pub fn method_name(&self) -> &'static str {
8728        match *self {
8729            SamplingResourceRequest::Get { .. } => "get",
8730        }
8731    }
8732}
8733
8734#[derive(Debug, Clone)]
8735pub struct SamplingResourceControlHandle {
8736    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8737}
8738
8739impl fidl::endpoints::ControlHandle for SamplingResourceControlHandle {
8740    fn shutdown(&self) {
8741        self.inner.shutdown()
8742    }
8743    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8744        self.inner.shutdown_with_epitaph(status)
8745    }
8746
8747    fn is_closed(&self) -> bool {
8748        self.inner.channel().is_closed()
8749    }
8750    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8751        self.inner.channel().on_closed()
8752    }
8753
8754    #[cfg(target_os = "fuchsia")]
8755    fn signal_peer(
8756        &self,
8757        clear_mask: zx::Signals,
8758        set_mask: zx::Signals,
8759    ) -> Result<(), zx_status::Status> {
8760        use fidl::Peered;
8761        self.inner.channel().signal_peer(clear_mask, set_mask)
8762    }
8763}
8764
8765impl SamplingResourceControlHandle {}
8766
8767#[must_use = "FIDL methods require a response to be sent"]
8768#[derive(Debug)]
8769pub struct SamplingResourceGetResponder {
8770    control_handle: std::mem::ManuallyDrop<SamplingResourceControlHandle>,
8771    tx_id: u32,
8772}
8773
8774/// Set the the channel to be shutdown (see [`SamplingResourceControlHandle::shutdown`])
8775/// if the responder is dropped without sending a response, so that the client
8776/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8777impl std::ops::Drop for SamplingResourceGetResponder {
8778    fn drop(&mut self) {
8779        self.control_handle.shutdown();
8780        // Safety: drops once, never accessed again
8781        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8782    }
8783}
8784
8785impl fidl::endpoints::Responder for SamplingResourceGetResponder {
8786    type ControlHandle = SamplingResourceControlHandle;
8787
8788    fn control_handle(&self) -> &SamplingResourceControlHandle {
8789        &self.control_handle
8790    }
8791
8792    fn drop_without_shutdown(mut self) {
8793        // Safety: drops once, never accessed again due to mem::forget
8794        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8795        // Prevent Drop from running (which would shut down the channel)
8796        std::mem::forget(self);
8797    }
8798}
8799
8800impl SamplingResourceGetResponder {
8801    /// Sends a response to the FIDL transaction.
8802    ///
8803    /// Sets the channel to shutdown if an error occurs.
8804    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8805        let _result = self.send_raw(resource);
8806        if _result.is_err() {
8807            self.control_handle.shutdown();
8808        }
8809        self.drop_without_shutdown();
8810        _result
8811    }
8812
8813    /// Similar to "send" but does not shutdown the channel if an error occurs.
8814    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8815        let _result = self.send_raw(resource);
8816        self.drop_without_shutdown();
8817        _result
8818    }
8819
8820    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8821        self.control_handle.inner.send::<SamplingResourceGetResponse>(
8822            (resource,),
8823            self.tx_id,
8824            0x51c41ab037e99824,
8825            fidl::encoding::DynamicFlags::empty(),
8826        )
8827    }
8828}
8829
8830#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8831pub struct SmcResourceMarker;
8832
8833impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
8834    type Proxy = SmcResourceProxy;
8835    type RequestStream = SmcResourceRequestStream;
8836    #[cfg(target_os = "fuchsia")]
8837    type SynchronousProxy = SmcResourceSynchronousProxy;
8838
8839    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
8840}
8841impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
8842
8843pub trait SmcResourceProxyInterface: Send + Sync {
8844    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8845    fn r#get(&self) -> Self::GetResponseFut;
8846}
8847#[derive(Debug)]
8848#[cfg(target_os = "fuchsia")]
8849pub struct SmcResourceSynchronousProxy {
8850    client: fidl::client::sync::Client,
8851}
8852
8853#[cfg(target_os = "fuchsia")]
8854impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
8855    type Proxy = SmcResourceProxy;
8856    type Protocol = SmcResourceMarker;
8857
8858    fn from_channel(inner: fidl::Channel) -> Self {
8859        Self::new(inner)
8860    }
8861
8862    fn into_channel(self) -> fidl::Channel {
8863        self.client.into_channel()
8864    }
8865
8866    fn as_channel(&self) -> &fidl::Channel {
8867        self.client.as_channel()
8868    }
8869}
8870
8871#[cfg(target_os = "fuchsia")]
8872impl SmcResourceSynchronousProxy {
8873    pub fn new(channel: fidl::Channel) -> Self {
8874        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8875        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8876    }
8877
8878    pub fn into_channel(self) -> fidl::Channel {
8879        self.client.into_channel()
8880    }
8881
8882    /// Waits until an event arrives and returns it. It is safe for other
8883    /// threads to make concurrent requests while waiting for an event.
8884    pub fn wait_for_event(
8885        &self,
8886        deadline: zx::MonotonicInstant,
8887    ) -> Result<SmcResourceEvent, fidl::Error> {
8888        SmcResourceEvent::decode(self.client.wait_for_event(deadline)?)
8889    }
8890
8891    /// Get an SMC resource handle.
8892    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8893        let _response =
8894            self.client.send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse>(
8895                (),
8896                0x392cbd495b84ede7,
8897                fidl::encoding::DynamicFlags::empty(),
8898                ___deadline,
8899            )?;
8900        Ok(_response.resource)
8901    }
8902}
8903
8904#[cfg(target_os = "fuchsia")]
8905impl From<SmcResourceSynchronousProxy> for zx::Handle {
8906    fn from(value: SmcResourceSynchronousProxy) -> Self {
8907        value.into_channel().into()
8908    }
8909}
8910
8911#[cfg(target_os = "fuchsia")]
8912impl From<fidl::Channel> for SmcResourceSynchronousProxy {
8913    fn from(value: fidl::Channel) -> Self {
8914        Self::new(value)
8915    }
8916}
8917
8918#[cfg(target_os = "fuchsia")]
8919impl fidl::endpoints::FromClient for SmcResourceSynchronousProxy {
8920    type Protocol = SmcResourceMarker;
8921
8922    fn from_client(value: fidl::endpoints::ClientEnd<SmcResourceMarker>) -> Self {
8923        Self::new(value.into_channel())
8924    }
8925}
8926
8927#[derive(Debug, Clone)]
8928pub struct SmcResourceProxy {
8929    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8930}
8931
8932impl fidl::endpoints::Proxy for SmcResourceProxy {
8933    type Protocol = SmcResourceMarker;
8934
8935    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8936        Self::new(inner)
8937    }
8938
8939    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8940        self.client.into_channel().map_err(|client| Self { client })
8941    }
8942
8943    fn as_channel(&self) -> &::fidl::AsyncChannel {
8944        self.client.as_channel()
8945    }
8946}
8947
8948impl SmcResourceProxy {
8949    /// Create a new Proxy for fuchsia.kernel/SmcResource.
8950    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8951        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8952        Self { client: fidl::client::Client::new(channel, protocol_name) }
8953    }
8954
8955    /// Get a Stream of events from the remote end of the protocol.
8956    ///
8957    /// # Panics
8958    ///
8959    /// Panics if the event stream was already taken.
8960    pub fn take_event_stream(&self) -> SmcResourceEventStream {
8961        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
8962    }
8963
8964    /// Get an SMC resource handle.
8965    pub fn r#get(
8966        &self,
8967    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8968    {
8969        SmcResourceProxyInterface::r#get(self)
8970    }
8971}
8972
8973impl SmcResourceProxyInterface for SmcResourceProxy {
8974    type GetResponseFut = fidl::client::QueryResponseFut<
8975        fidl::Resource,
8976        fidl::encoding::DefaultFuchsiaResourceDialect,
8977    >;
8978    fn r#get(&self) -> Self::GetResponseFut {
8979        fn _decode(
8980            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8981        ) -> Result<fidl::Resource, fidl::Error> {
8982            let _response = fidl::client::decode_transaction_body::<
8983                SmcResourceGetResponse,
8984                fidl::encoding::DefaultFuchsiaResourceDialect,
8985                0x392cbd495b84ede7,
8986            >(_buf?)?;
8987            Ok(_response.resource)
8988        }
8989        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8990            (),
8991            0x392cbd495b84ede7,
8992            fidl::encoding::DynamicFlags::empty(),
8993            _decode,
8994        )
8995    }
8996}
8997
8998pub struct SmcResourceEventStream {
8999    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9000}
9001
9002impl std::marker::Unpin for SmcResourceEventStream {}
9003
9004impl futures::stream::FusedStream for SmcResourceEventStream {
9005    fn is_terminated(&self) -> bool {
9006        self.event_receiver.is_terminated()
9007    }
9008}
9009
9010impl futures::Stream for SmcResourceEventStream {
9011    type Item = Result<SmcResourceEvent, fidl::Error>;
9012
9013    fn poll_next(
9014        mut self: std::pin::Pin<&mut Self>,
9015        cx: &mut std::task::Context<'_>,
9016    ) -> std::task::Poll<Option<Self::Item>> {
9017        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9018            &mut self.event_receiver,
9019            cx
9020        )?) {
9021            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
9022            None => std::task::Poll::Ready(None),
9023        }
9024    }
9025}
9026
9027#[derive(Debug)]
9028pub enum SmcResourceEvent {}
9029
9030impl SmcResourceEvent {
9031    /// Decodes a message buffer as a [`SmcResourceEvent`].
9032    fn decode(
9033        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9034    ) -> Result<SmcResourceEvent, fidl::Error> {
9035        let (bytes, _handles) = buf.split_mut();
9036        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9037        debug_assert_eq!(tx_header.tx_id, 0);
9038        match tx_header.ordinal {
9039            _ => Err(fidl::Error::UnknownOrdinal {
9040                ordinal: tx_header.ordinal,
9041                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9042            }),
9043        }
9044    }
9045}
9046
9047/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
9048pub struct SmcResourceRequestStream {
9049    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9050    is_terminated: bool,
9051}
9052
9053impl std::marker::Unpin for SmcResourceRequestStream {}
9054
9055impl futures::stream::FusedStream for SmcResourceRequestStream {
9056    fn is_terminated(&self) -> bool {
9057        self.is_terminated
9058    }
9059}
9060
9061impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
9062    type Protocol = SmcResourceMarker;
9063    type ControlHandle = SmcResourceControlHandle;
9064
9065    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9066        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9067    }
9068
9069    fn control_handle(&self) -> Self::ControlHandle {
9070        SmcResourceControlHandle { inner: self.inner.clone() }
9071    }
9072
9073    fn into_inner(
9074        self,
9075    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9076    {
9077        (self.inner, self.is_terminated)
9078    }
9079
9080    fn from_inner(
9081        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9082        is_terminated: bool,
9083    ) -> Self {
9084        Self { inner, is_terminated }
9085    }
9086}
9087
9088impl futures::Stream for SmcResourceRequestStream {
9089    type Item = Result<SmcResourceRequest, fidl::Error>;
9090
9091    fn poll_next(
9092        mut self: std::pin::Pin<&mut Self>,
9093        cx: &mut std::task::Context<'_>,
9094    ) -> std::task::Poll<Option<Self::Item>> {
9095        let this = &mut *self;
9096        if this.inner.check_shutdown(cx) {
9097            this.is_terminated = true;
9098            return std::task::Poll::Ready(None);
9099        }
9100        if this.is_terminated {
9101            panic!("polled SmcResourceRequestStream after completion");
9102        }
9103        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9104            |bytes, handles| {
9105                match this.inner.channel().read_etc(cx, bytes, handles) {
9106                    std::task::Poll::Ready(Ok(())) => {}
9107                    std::task::Poll::Pending => return std::task::Poll::Pending,
9108                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9109                        this.is_terminated = true;
9110                        return std::task::Poll::Ready(None);
9111                    }
9112                    std::task::Poll::Ready(Err(e)) => {
9113                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9114                            e.into(),
9115                        ))));
9116                    }
9117                }
9118
9119                // A message has been received from the channel
9120                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9121
9122                std::task::Poll::Ready(Some(match header.ordinal {
9123                    0x392cbd495b84ede7 => {
9124                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9125                        let mut req = fidl::new_empty!(
9126                            fidl::encoding::EmptyPayload,
9127                            fidl::encoding::DefaultFuchsiaResourceDialect
9128                        );
9129                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9130                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
9131                        Ok(SmcResourceRequest::Get {
9132                            responder: SmcResourceGetResponder {
9133                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9134                                tx_id: header.tx_id,
9135                            },
9136                        })
9137                    }
9138                    _ => Err(fidl::Error::UnknownOrdinal {
9139                        ordinal: header.ordinal,
9140                        protocol_name:
9141                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9142                    }),
9143                }))
9144            },
9145        )
9146    }
9147}
9148
9149/// Protocol for providing an SMC resource with access to all valid ranges.
9150#[derive(Debug)]
9151pub enum SmcResourceRequest {
9152    /// Get an SMC resource handle.
9153    Get { responder: SmcResourceGetResponder },
9154}
9155
9156impl SmcResourceRequest {
9157    #[allow(irrefutable_let_patterns)]
9158    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
9159        if let SmcResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9160    }
9161
9162    /// Name of the method defined in FIDL
9163    pub fn method_name(&self) -> &'static str {
9164        match *self {
9165            SmcResourceRequest::Get { .. } => "get",
9166        }
9167    }
9168}
9169
9170#[derive(Debug, Clone)]
9171pub struct SmcResourceControlHandle {
9172    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9173}
9174
9175impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
9176    fn shutdown(&self) {
9177        self.inner.shutdown()
9178    }
9179    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9180        self.inner.shutdown_with_epitaph(status)
9181    }
9182
9183    fn is_closed(&self) -> bool {
9184        self.inner.channel().is_closed()
9185    }
9186    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9187        self.inner.channel().on_closed()
9188    }
9189
9190    #[cfg(target_os = "fuchsia")]
9191    fn signal_peer(
9192        &self,
9193        clear_mask: zx::Signals,
9194        set_mask: zx::Signals,
9195    ) -> Result<(), zx_status::Status> {
9196        use fidl::Peered;
9197        self.inner.channel().signal_peer(clear_mask, set_mask)
9198    }
9199}
9200
9201impl SmcResourceControlHandle {}
9202
9203#[must_use = "FIDL methods require a response to be sent"]
9204#[derive(Debug)]
9205pub struct SmcResourceGetResponder {
9206    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
9207    tx_id: u32,
9208}
9209
9210/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
9211/// if the responder is dropped without sending a response, so that the client
9212/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9213impl std::ops::Drop for SmcResourceGetResponder {
9214    fn drop(&mut self) {
9215        self.control_handle.shutdown();
9216        // Safety: drops once, never accessed again
9217        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9218    }
9219}
9220
9221impl fidl::endpoints::Responder for SmcResourceGetResponder {
9222    type ControlHandle = SmcResourceControlHandle;
9223
9224    fn control_handle(&self) -> &SmcResourceControlHandle {
9225        &self.control_handle
9226    }
9227
9228    fn drop_without_shutdown(mut self) {
9229        // Safety: drops once, never accessed again due to mem::forget
9230        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9231        // Prevent Drop from running (which would shut down the channel)
9232        std::mem::forget(self);
9233    }
9234}
9235
9236impl SmcResourceGetResponder {
9237    /// Sends a response to the FIDL transaction.
9238    ///
9239    /// Sets the channel to shutdown if an error occurs.
9240    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9241        let _result = self.send_raw(resource);
9242        if _result.is_err() {
9243            self.control_handle.shutdown();
9244        }
9245        self.drop_without_shutdown();
9246        _result
9247    }
9248
9249    /// Similar to "send" but does not shutdown the channel if an error occurs.
9250    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9251        let _result = self.send_raw(resource);
9252        self.drop_without_shutdown();
9253        _result
9254    }
9255
9256    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9257        self.control_handle.inner.send::<SmcResourceGetResponse>(
9258            (resource,),
9259            self.tx_id,
9260            0x392cbd495b84ede7,
9261            fidl::encoding::DynamicFlags::empty(),
9262        )
9263    }
9264}
9265
9266#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9267pub struct StallResourceMarker;
9268
9269impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
9270    type Proxy = StallResourceProxy;
9271    type RequestStream = StallResourceRequestStream;
9272    #[cfg(target_os = "fuchsia")]
9273    type SynchronousProxy = StallResourceSynchronousProxy;
9274
9275    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
9276}
9277impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
9278
9279pub trait StallResourceProxyInterface: Send + Sync {
9280    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
9281    fn r#get(&self) -> Self::GetResponseFut;
9282}
9283#[derive(Debug)]
9284#[cfg(target_os = "fuchsia")]
9285pub struct StallResourceSynchronousProxy {
9286    client: fidl::client::sync::Client,
9287}
9288
9289#[cfg(target_os = "fuchsia")]
9290impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
9291    type Proxy = StallResourceProxy;
9292    type Protocol = StallResourceMarker;
9293
9294    fn from_channel(inner: fidl::Channel) -> Self {
9295        Self::new(inner)
9296    }
9297
9298    fn into_channel(self) -> fidl::Channel {
9299        self.client.into_channel()
9300    }
9301
9302    fn as_channel(&self) -> &fidl::Channel {
9303        self.client.as_channel()
9304    }
9305}
9306
9307#[cfg(target_os = "fuchsia")]
9308impl StallResourceSynchronousProxy {
9309    pub fn new(channel: fidl::Channel) -> Self {
9310        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9311        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9312    }
9313
9314    pub fn into_channel(self) -> fidl::Channel {
9315        self.client.into_channel()
9316    }
9317
9318    /// Waits until an event arrives and returns it. It is safe for other
9319    /// threads to make concurrent requests while waiting for an event.
9320    pub fn wait_for_event(
9321        &self,
9322        deadline: zx::MonotonicInstant,
9323    ) -> Result<StallResourceEvent, fidl::Error> {
9324        StallResourceEvent::decode(self.client.wait_for_event(deadline)?)
9325    }
9326
9327    /// Get a stall resource handle.
9328    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
9329        let _response =
9330            self.client.send_query::<fidl::encoding::EmptyPayload, StallResourceGetResponse>(
9331                (),
9332                0x5edf4c8629a9781a,
9333                fidl::encoding::DynamicFlags::empty(),
9334                ___deadline,
9335            )?;
9336        Ok(_response.resource)
9337    }
9338}
9339
9340#[cfg(target_os = "fuchsia")]
9341impl From<StallResourceSynchronousProxy> for zx::Handle {
9342    fn from(value: StallResourceSynchronousProxy) -> Self {
9343        value.into_channel().into()
9344    }
9345}
9346
9347#[cfg(target_os = "fuchsia")]
9348impl From<fidl::Channel> for StallResourceSynchronousProxy {
9349    fn from(value: fidl::Channel) -> Self {
9350        Self::new(value)
9351    }
9352}
9353
9354#[cfg(target_os = "fuchsia")]
9355impl fidl::endpoints::FromClient for StallResourceSynchronousProxy {
9356    type Protocol = StallResourceMarker;
9357
9358    fn from_client(value: fidl::endpoints::ClientEnd<StallResourceMarker>) -> Self {
9359        Self::new(value.into_channel())
9360    }
9361}
9362
9363#[derive(Debug, Clone)]
9364pub struct StallResourceProxy {
9365    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9366}
9367
9368impl fidl::endpoints::Proxy for StallResourceProxy {
9369    type Protocol = StallResourceMarker;
9370
9371    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9372        Self::new(inner)
9373    }
9374
9375    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9376        self.client.into_channel().map_err(|client| Self { client })
9377    }
9378
9379    fn as_channel(&self) -> &::fidl::AsyncChannel {
9380        self.client.as_channel()
9381    }
9382}
9383
9384impl StallResourceProxy {
9385    /// Create a new Proxy for fuchsia.kernel/StallResource.
9386    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9387        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9388        Self { client: fidl::client::Client::new(channel, protocol_name) }
9389    }
9390
9391    /// Get a Stream of events from the remote end of the protocol.
9392    ///
9393    /// # Panics
9394    ///
9395    /// Panics if the event stream was already taken.
9396    pub fn take_event_stream(&self) -> StallResourceEventStream {
9397        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
9398    }
9399
9400    /// Get a stall resource handle.
9401    pub fn r#get(
9402        &self,
9403    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9404    {
9405        StallResourceProxyInterface::r#get(self)
9406    }
9407}
9408
9409impl StallResourceProxyInterface for StallResourceProxy {
9410    type GetResponseFut = fidl::client::QueryResponseFut<
9411        fidl::Resource,
9412        fidl::encoding::DefaultFuchsiaResourceDialect,
9413    >;
9414    fn r#get(&self) -> Self::GetResponseFut {
9415        fn _decode(
9416            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9417        ) -> Result<fidl::Resource, fidl::Error> {
9418            let _response = fidl::client::decode_transaction_body::<
9419                StallResourceGetResponse,
9420                fidl::encoding::DefaultFuchsiaResourceDialect,
9421                0x5edf4c8629a9781a,
9422            >(_buf?)?;
9423            Ok(_response.resource)
9424        }
9425        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9426            (),
9427            0x5edf4c8629a9781a,
9428            fidl::encoding::DynamicFlags::empty(),
9429            _decode,
9430        )
9431    }
9432}
9433
9434pub struct StallResourceEventStream {
9435    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9436}
9437
9438impl std::marker::Unpin for StallResourceEventStream {}
9439
9440impl futures::stream::FusedStream for StallResourceEventStream {
9441    fn is_terminated(&self) -> bool {
9442        self.event_receiver.is_terminated()
9443    }
9444}
9445
9446impl futures::Stream for StallResourceEventStream {
9447    type Item = Result<StallResourceEvent, fidl::Error>;
9448
9449    fn poll_next(
9450        mut self: std::pin::Pin<&mut Self>,
9451        cx: &mut std::task::Context<'_>,
9452    ) -> std::task::Poll<Option<Self::Item>> {
9453        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9454            &mut self.event_receiver,
9455            cx
9456        )?) {
9457            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
9458            None => std::task::Poll::Ready(None),
9459        }
9460    }
9461}
9462
9463#[derive(Debug)]
9464pub enum StallResourceEvent {}
9465
9466impl StallResourceEvent {
9467    /// Decodes a message buffer as a [`StallResourceEvent`].
9468    fn decode(
9469        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9470    ) -> Result<StallResourceEvent, fidl::Error> {
9471        let (bytes, _handles) = buf.split_mut();
9472        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9473        debug_assert_eq!(tx_header.tx_id, 0);
9474        match tx_header.ordinal {
9475            _ => Err(fidl::Error::UnknownOrdinal {
9476                ordinal: tx_header.ordinal,
9477                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9478            }),
9479        }
9480    }
9481}
9482
9483/// A Stream of incoming requests for fuchsia.kernel/StallResource.
9484pub struct StallResourceRequestStream {
9485    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9486    is_terminated: bool,
9487}
9488
9489impl std::marker::Unpin for StallResourceRequestStream {}
9490
9491impl futures::stream::FusedStream for StallResourceRequestStream {
9492    fn is_terminated(&self) -> bool {
9493        self.is_terminated
9494    }
9495}
9496
9497impl fidl::endpoints::RequestStream for StallResourceRequestStream {
9498    type Protocol = StallResourceMarker;
9499    type ControlHandle = StallResourceControlHandle;
9500
9501    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9502        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9503    }
9504
9505    fn control_handle(&self) -> Self::ControlHandle {
9506        StallResourceControlHandle { inner: self.inner.clone() }
9507    }
9508
9509    fn into_inner(
9510        self,
9511    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9512    {
9513        (self.inner, self.is_terminated)
9514    }
9515
9516    fn from_inner(
9517        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9518        is_terminated: bool,
9519    ) -> Self {
9520        Self { inner, is_terminated }
9521    }
9522}
9523
9524impl futures::Stream for StallResourceRequestStream {
9525    type Item = Result<StallResourceRequest, fidl::Error>;
9526
9527    fn poll_next(
9528        mut self: std::pin::Pin<&mut Self>,
9529        cx: &mut std::task::Context<'_>,
9530    ) -> std::task::Poll<Option<Self::Item>> {
9531        let this = &mut *self;
9532        if this.inner.check_shutdown(cx) {
9533            this.is_terminated = true;
9534            return std::task::Poll::Ready(None);
9535        }
9536        if this.is_terminated {
9537            panic!("polled StallResourceRequestStream after completion");
9538        }
9539        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9540            |bytes, handles| {
9541                match this.inner.channel().read_etc(cx, bytes, handles) {
9542                    std::task::Poll::Ready(Ok(())) => {}
9543                    std::task::Poll::Pending => return std::task::Poll::Pending,
9544                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9545                        this.is_terminated = true;
9546                        return std::task::Poll::Ready(None);
9547                    }
9548                    std::task::Poll::Ready(Err(e)) => {
9549                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9550                            e.into(),
9551                        ))));
9552                    }
9553                }
9554
9555                // A message has been received from the channel
9556                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9557
9558                std::task::Poll::Ready(Some(match header.ordinal {
9559                    0x5edf4c8629a9781a => {
9560                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9561                        let mut req = fidl::new_empty!(
9562                            fidl::encoding::EmptyPayload,
9563                            fidl::encoding::DefaultFuchsiaResourceDialect
9564                        );
9565                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9566                        let control_handle =
9567                            StallResourceControlHandle { inner: this.inner.clone() };
9568                        Ok(StallResourceRequest::Get {
9569                            responder: StallResourceGetResponder {
9570                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9571                                tx_id: header.tx_id,
9572                            },
9573                        })
9574                    }
9575                    _ => Err(fidl::Error::UnknownOrdinal {
9576                        ordinal: header.ordinal,
9577                        protocol_name:
9578                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9579                    }),
9580                }))
9581            },
9582        )
9583    }
9584}
9585
9586/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
9587/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
9588/// be notified of stalls.
9589#[derive(Debug)]
9590pub enum StallResourceRequest {
9591    /// Get a stall resource handle.
9592    Get { responder: StallResourceGetResponder },
9593}
9594
9595impl StallResourceRequest {
9596    #[allow(irrefutable_let_patterns)]
9597    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
9598        if let StallResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9599    }
9600
9601    /// Name of the method defined in FIDL
9602    pub fn method_name(&self) -> &'static str {
9603        match *self {
9604            StallResourceRequest::Get { .. } => "get",
9605        }
9606    }
9607}
9608
9609#[derive(Debug, Clone)]
9610pub struct StallResourceControlHandle {
9611    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9612}
9613
9614impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
9615    fn shutdown(&self) {
9616        self.inner.shutdown()
9617    }
9618    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9619        self.inner.shutdown_with_epitaph(status)
9620    }
9621
9622    fn is_closed(&self) -> bool {
9623        self.inner.channel().is_closed()
9624    }
9625    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9626        self.inner.channel().on_closed()
9627    }
9628
9629    #[cfg(target_os = "fuchsia")]
9630    fn signal_peer(
9631        &self,
9632        clear_mask: zx::Signals,
9633        set_mask: zx::Signals,
9634    ) -> Result<(), zx_status::Status> {
9635        use fidl::Peered;
9636        self.inner.channel().signal_peer(clear_mask, set_mask)
9637    }
9638}
9639
9640impl StallResourceControlHandle {}
9641
9642#[must_use = "FIDL methods require a response to be sent"]
9643#[derive(Debug)]
9644pub struct StallResourceGetResponder {
9645    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
9646    tx_id: u32,
9647}
9648
9649/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
9650/// if the responder is dropped without sending a response, so that the client
9651/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9652impl std::ops::Drop for StallResourceGetResponder {
9653    fn drop(&mut self) {
9654        self.control_handle.shutdown();
9655        // Safety: drops once, never accessed again
9656        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9657    }
9658}
9659
9660impl fidl::endpoints::Responder for StallResourceGetResponder {
9661    type ControlHandle = StallResourceControlHandle;
9662
9663    fn control_handle(&self) -> &StallResourceControlHandle {
9664        &self.control_handle
9665    }
9666
9667    fn drop_without_shutdown(mut self) {
9668        // Safety: drops once, never accessed again due to mem::forget
9669        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9670        // Prevent Drop from running (which would shut down the channel)
9671        std::mem::forget(self);
9672    }
9673}
9674
9675impl StallResourceGetResponder {
9676    /// Sends a response to the FIDL transaction.
9677    ///
9678    /// Sets the channel to shutdown if an error occurs.
9679    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9680        let _result = self.send_raw(resource);
9681        if _result.is_err() {
9682            self.control_handle.shutdown();
9683        }
9684        self.drop_without_shutdown();
9685        _result
9686    }
9687
9688    /// Similar to "send" but does not shutdown the channel if an error occurs.
9689    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9690        let _result = self.send_raw(resource);
9691        self.drop_without_shutdown();
9692        _result
9693    }
9694
9695    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9696        self.control_handle.inner.send::<StallResourceGetResponse>(
9697            (resource,),
9698            self.tx_id,
9699            0x5edf4c8629a9781a,
9700            fidl::encoding::DynamicFlags::empty(),
9701        )
9702    }
9703}
9704
9705#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9706pub struct StatsMarker;
9707
9708impl fidl::endpoints::ProtocolMarker for StatsMarker {
9709    type Proxy = StatsProxy;
9710    type RequestStream = StatsRequestStream;
9711    #[cfg(target_os = "fuchsia")]
9712    type SynchronousProxy = StatsSynchronousProxy;
9713
9714    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
9715}
9716impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
9717
9718pub trait StatsProxyInterface: Send + Sync {
9719    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
9720        + Send;
9721    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
9722    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
9723        + Send;
9724    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
9725    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
9726        + Send;
9727    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
9728    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
9729    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
9730    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
9731    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
9732}
9733#[derive(Debug)]
9734#[cfg(target_os = "fuchsia")]
9735pub struct StatsSynchronousProxy {
9736    client: fidl::client::sync::Client,
9737}
9738
9739#[cfg(target_os = "fuchsia")]
9740impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
9741    type Proxy = StatsProxy;
9742    type Protocol = StatsMarker;
9743
9744    fn from_channel(inner: fidl::Channel) -> Self {
9745        Self::new(inner)
9746    }
9747
9748    fn into_channel(self) -> fidl::Channel {
9749        self.client.into_channel()
9750    }
9751
9752    fn as_channel(&self) -> &fidl::Channel {
9753        self.client.as_channel()
9754    }
9755}
9756
9757#[cfg(target_os = "fuchsia")]
9758impl StatsSynchronousProxy {
9759    pub fn new(channel: fidl::Channel) -> Self {
9760        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9761        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9762    }
9763
9764    pub fn into_channel(self) -> fidl::Channel {
9765        self.client.into_channel()
9766    }
9767
9768    /// Waits until an event arrives and returns it. It is safe for other
9769    /// threads to make concurrent requests while waiting for an event.
9770    pub fn wait_for_event(
9771        &self,
9772        deadline: zx::MonotonicInstant,
9773    ) -> Result<StatsEvent, fidl::Error> {
9774        StatsEvent::decode(self.client.wait_for_event(deadline)?)
9775    }
9776
9777    pub fn r#get_memory_stats(
9778        &self,
9779        ___deadline: zx::MonotonicInstant,
9780    ) -> Result<MemoryStats, fidl::Error> {
9781        let _response =
9782            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse>(
9783                (),
9784                0x686677932ae41074,
9785                fidl::encoding::DynamicFlags::empty(),
9786                ___deadline,
9787            )?;
9788        Ok(_response.stats)
9789    }
9790
9791    pub fn r#get_memory_stats_extended(
9792        &self,
9793        ___deadline: zx::MonotonicInstant,
9794    ) -> Result<MemoryStatsExtended, fidl::Error> {
9795        let _response = self
9796            .client
9797            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsExtendedResponse>(
9798                (),
9799                0x60faa0f8aa38c29f,
9800                fidl::encoding::DynamicFlags::empty(),
9801                ___deadline,
9802            )?;
9803        Ok(_response.stats)
9804    }
9805
9806    pub fn r#get_memory_stats_compression(
9807        &self,
9808        ___deadline: zx::MonotonicInstant,
9809    ) -> Result<MemoryStatsCompression, fidl::Error> {
9810        let _response =
9811            self.client.send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9812                (),
9813                0x544a09995befb531,
9814                fidl::encoding::DynamicFlags::empty(),
9815                ___deadline,
9816            )?;
9817        Ok(_response)
9818    }
9819
9820    pub fn r#get_cpu_stats(
9821        &self,
9822        ___deadline: zx::MonotonicInstant,
9823    ) -> Result<CpuStats, fidl::Error> {
9824        let _response =
9825            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse>(
9826                (),
9827                0x470e2684ca1ca19e,
9828                fidl::encoding::DynamicFlags::empty(),
9829                ___deadline,
9830            )?;
9831        Ok(_response.stats)
9832    }
9833
9834    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9835    /// duration.
9836    ///
9837    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9838    /// PerCpuStats) over a time duration.
9839    pub fn r#get_cpu_load(
9840        &self,
9841        mut duration: i64,
9842        ___deadline: zx::MonotonicInstant,
9843    ) -> Result<Vec<f32>, fidl::Error> {
9844        let _response = self.client.send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse>(
9845            (duration,),
9846            0x4c8f0f05e7034666,
9847            fidl::encoding::DynamicFlags::empty(),
9848            ___deadline,
9849        )?;
9850        Ok(_response.per_cpu_load)
9851    }
9852}
9853
9854#[cfg(target_os = "fuchsia")]
9855impl From<StatsSynchronousProxy> for zx::Handle {
9856    fn from(value: StatsSynchronousProxy) -> Self {
9857        value.into_channel().into()
9858    }
9859}
9860
9861#[cfg(target_os = "fuchsia")]
9862impl From<fidl::Channel> for StatsSynchronousProxy {
9863    fn from(value: fidl::Channel) -> Self {
9864        Self::new(value)
9865    }
9866}
9867
9868#[cfg(target_os = "fuchsia")]
9869impl fidl::endpoints::FromClient for StatsSynchronousProxy {
9870    type Protocol = StatsMarker;
9871
9872    fn from_client(value: fidl::endpoints::ClientEnd<StatsMarker>) -> Self {
9873        Self::new(value.into_channel())
9874    }
9875}
9876
9877#[derive(Debug, Clone)]
9878pub struct StatsProxy {
9879    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9880}
9881
9882impl fidl::endpoints::Proxy for StatsProxy {
9883    type Protocol = StatsMarker;
9884
9885    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9886        Self::new(inner)
9887    }
9888
9889    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9890        self.client.into_channel().map_err(|client| Self { client })
9891    }
9892
9893    fn as_channel(&self) -> &::fidl::AsyncChannel {
9894        self.client.as_channel()
9895    }
9896}
9897
9898impl StatsProxy {
9899    /// Create a new Proxy for fuchsia.kernel/Stats.
9900    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9901        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9902        Self { client: fidl::client::Client::new(channel, protocol_name) }
9903    }
9904
9905    /// Get a Stream of events from the remote end of the protocol.
9906    ///
9907    /// # Panics
9908    ///
9909    /// Panics if the event stream was already taken.
9910    pub fn take_event_stream(&self) -> StatsEventStream {
9911        StatsEventStream { event_receiver: self.client.take_event_receiver() }
9912    }
9913
9914    pub fn r#get_memory_stats(
9915        &self,
9916    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9917    {
9918        StatsProxyInterface::r#get_memory_stats(self)
9919    }
9920
9921    pub fn r#get_memory_stats_extended(
9922        &self,
9923    ) -> fidl::client::QueryResponseFut<
9924        MemoryStatsExtended,
9925        fidl::encoding::DefaultFuchsiaResourceDialect,
9926    > {
9927        StatsProxyInterface::r#get_memory_stats_extended(self)
9928    }
9929
9930    pub fn r#get_memory_stats_compression(
9931        &self,
9932    ) -> fidl::client::QueryResponseFut<
9933        MemoryStatsCompression,
9934        fidl::encoding::DefaultFuchsiaResourceDialect,
9935    > {
9936        StatsProxyInterface::r#get_memory_stats_compression(self)
9937    }
9938
9939    pub fn r#get_cpu_stats(
9940        &self,
9941    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9942    {
9943        StatsProxyInterface::r#get_cpu_stats(self)
9944    }
9945
9946    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9947    /// duration.
9948    ///
9949    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9950    /// PerCpuStats) over a time duration.
9951    pub fn r#get_cpu_load(
9952        &self,
9953        mut duration: i64,
9954    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
9955    {
9956        StatsProxyInterface::r#get_cpu_load(self, duration)
9957    }
9958}
9959
9960impl StatsProxyInterface for StatsProxy {
9961    type GetMemoryStatsResponseFut =
9962        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9963    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
9964        fn _decode(
9965            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9966        ) -> Result<MemoryStats, fidl::Error> {
9967            let _response = fidl::client::decode_transaction_body::<
9968                StatsGetMemoryStatsResponse,
9969                fidl::encoding::DefaultFuchsiaResourceDialect,
9970                0x686677932ae41074,
9971            >(_buf?)?;
9972            Ok(_response.stats)
9973        }
9974        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
9975            (),
9976            0x686677932ae41074,
9977            fidl::encoding::DynamicFlags::empty(),
9978            _decode,
9979        )
9980    }
9981
9982    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
9983        MemoryStatsExtended,
9984        fidl::encoding::DefaultFuchsiaResourceDialect,
9985    >;
9986    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
9987        fn _decode(
9988            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9989        ) -> Result<MemoryStatsExtended, fidl::Error> {
9990            let _response = fidl::client::decode_transaction_body::<
9991                StatsGetMemoryStatsExtendedResponse,
9992                fidl::encoding::DefaultFuchsiaResourceDialect,
9993                0x60faa0f8aa38c29f,
9994            >(_buf?)?;
9995            Ok(_response.stats)
9996        }
9997        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
9998            (),
9999            0x60faa0f8aa38c29f,
10000            fidl::encoding::DynamicFlags::empty(),
10001            _decode,
10002        )
10003    }
10004
10005    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
10006        MemoryStatsCompression,
10007        fidl::encoding::DefaultFuchsiaResourceDialect,
10008    >;
10009    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
10010        fn _decode(
10011            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10012        ) -> Result<MemoryStatsCompression, fidl::Error> {
10013            let _response = fidl::client::decode_transaction_body::<
10014                MemoryStatsCompression,
10015                fidl::encoding::DefaultFuchsiaResourceDialect,
10016                0x544a09995befb531,
10017            >(_buf?)?;
10018            Ok(_response)
10019        }
10020        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
10021            (),
10022            0x544a09995befb531,
10023            fidl::encoding::DynamicFlags::empty(),
10024            _decode,
10025        )
10026    }
10027
10028    type GetCpuStatsResponseFut =
10029        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
10030    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
10031        fn _decode(
10032            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10033        ) -> Result<CpuStats, fidl::Error> {
10034            let _response = fidl::client::decode_transaction_body::<
10035                StatsGetCpuStatsResponse,
10036                fidl::encoding::DefaultFuchsiaResourceDialect,
10037                0x470e2684ca1ca19e,
10038            >(_buf?)?;
10039            Ok(_response.stats)
10040        }
10041        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
10042            (),
10043            0x470e2684ca1ca19e,
10044            fidl::encoding::DynamicFlags::empty(),
10045            _decode,
10046        )
10047    }
10048
10049    type GetCpuLoadResponseFut =
10050        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
10051    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
10052        fn _decode(
10053            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10054        ) -> Result<Vec<f32>, fidl::Error> {
10055            let _response = fidl::client::decode_transaction_body::<
10056                StatsGetCpuLoadResponse,
10057                fidl::encoding::DefaultFuchsiaResourceDialect,
10058                0x4c8f0f05e7034666,
10059            >(_buf?)?;
10060            Ok(_response.per_cpu_load)
10061        }
10062        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
10063            (duration,),
10064            0x4c8f0f05e7034666,
10065            fidl::encoding::DynamicFlags::empty(),
10066            _decode,
10067        )
10068    }
10069}
10070
10071pub struct StatsEventStream {
10072    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10073}
10074
10075impl std::marker::Unpin for StatsEventStream {}
10076
10077impl futures::stream::FusedStream for StatsEventStream {
10078    fn is_terminated(&self) -> bool {
10079        self.event_receiver.is_terminated()
10080    }
10081}
10082
10083impl futures::Stream for StatsEventStream {
10084    type Item = Result<StatsEvent, fidl::Error>;
10085
10086    fn poll_next(
10087        mut self: std::pin::Pin<&mut Self>,
10088        cx: &mut std::task::Context<'_>,
10089    ) -> std::task::Poll<Option<Self::Item>> {
10090        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10091            &mut self.event_receiver,
10092            cx
10093        )?) {
10094            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
10095            None => std::task::Poll::Ready(None),
10096        }
10097    }
10098}
10099
10100#[derive(Debug)]
10101pub enum StatsEvent {}
10102
10103impl StatsEvent {
10104    /// Decodes a message buffer as a [`StatsEvent`].
10105    fn decode(
10106        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10107    ) -> Result<StatsEvent, fidl::Error> {
10108        let (bytes, _handles) = buf.split_mut();
10109        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10110        debug_assert_eq!(tx_header.tx_id, 0);
10111        match tx_header.ordinal {
10112            _ => Err(fidl::Error::UnknownOrdinal {
10113                ordinal: tx_header.ordinal,
10114                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10115            }),
10116        }
10117    }
10118}
10119
10120/// A Stream of incoming requests for fuchsia.kernel/Stats.
10121pub struct StatsRequestStream {
10122    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10123    is_terminated: bool,
10124}
10125
10126impl std::marker::Unpin for StatsRequestStream {}
10127
10128impl futures::stream::FusedStream for StatsRequestStream {
10129    fn is_terminated(&self) -> bool {
10130        self.is_terminated
10131    }
10132}
10133
10134impl fidl::endpoints::RequestStream for StatsRequestStream {
10135    type Protocol = StatsMarker;
10136    type ControlHandle = StatsControlHandle;
10137
10138    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10139        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10140    }
10141
10142    fn control_handle(&self) -> Self::ControlHandle {
10143        StatsControlHandle { inner: self.inner.clone() }
10144    }
10145
10146    fn into_inner(
10147        self,
10148    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10149    {
10150        (self.inner, self.is_terminated)
10151    }
10152
10153    fn from_inner(
10154        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10155        is_terminated: bool,
10156    ) -> Self {
10157        Self { inner, is_terminated }
10158    }
10159}
10160
10161impl futures::Stream for StatsRequestStream {
10162    type Item = Result<StatsRequest, fidl::Error>;
10163
10164    fn poll_next(
10165        mut self: std::pin::Pin<&mut Self>,
10166        cx: &mut std::task::Context<'_>,
10167    ) -> std::task::Poll<Option<Self::Item>> {
10168        let this = &mut *self;
10169        if this.inner.check_shutdown(cx) {
10170            this.is_terminated = true;
10171            return std::task::Poll::Ready(None);
10172        }
10173        if this.is_terminated {
10174            panic!("polled StatsRequestStream after completion");
10175        }
10176        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10177            |bytes, handles| {
10178                match this.inner.channel().read_etc(cx, bytes, handles) {
10179                    std::task::Poll::Ready(Ok(())) => {}
10180                    std::task::Poll::Pending => return std::task::Poll::Pending,
10181                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10182                        this.is_terminated = true;
10183                        return std::task::Poll::Ready(None);
10184                    }
10185                    std::task::Poll::Ready(Err(e)) => {
10186                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10187                            e.into(),
10188                        ))));
10189                    }
10190                }
10191
10192                // A message has been received from the channel
10193                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10194
10195                std::task::Poll::Ready(Some(match header.ordinal {
10196                    0x686677932ae41074 => {
10197                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10198                        let mut req = fidl::new_empty!(
10199                            fidl::encoding::EmptyPayload,
10200                            fidl::encoding::DefaultFuchsiaResourceDialect
10201                        );
10202                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10203                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10204                        Ok(StatsRequest::GetMemoryStats {
10205                            responder: StatsGetMemoryStatsResponder {
10206                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10207                                tx_id: header.tx_id,
10208                            },
10209                        })
10210                    }
10211                    0x60faa0f8aa38c29f => {
10212                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10213                        let mut req = fidl::new_empty!(
10214                            fidl::encoding::EmptyPayload,
10215                            fidl::encoding::DefaultFuchsiaResourceDialect
10216                        );
10217                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10218                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10219                        Ok(StatsRequest::GetMemoryStatsExtended {
10220                            responder: StatsGetMemoryStatsExtendedResponder {
10221                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10222                                tx_id: header.tx_id,
10223                            },
10224                        })
10225                    }
10226                    0x544a09995befb531 => {
10227                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10228                        let mut req = fidl::new_empty!(
10229                            fidl::encoding::EmptyPayload,
10230                            fidl::encoding::DefaultFuchsiaResourceDialect
10231                        );
10232                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10233                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10234                        Ok(StatsRequest::GetMemoryStatsCompression {
10235                            responder: StatsGetMemoryStatsCompressionResponder {
10236                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10237                                tx_id: header.tx_id,
10238                            },
10239                        })
10240                    }
10241                    0x470e2684ca1ca19e => {
10242                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10243                        let mut req = fidl::new_empty!(
10244                            fidl::encoding::EmptyPayload,
10245                            fidl::encoding::DefaultFuchsiaResourceDialect
10246                        );
10247                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10248                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10249                        Ok(StatsRequest::GetCpuStats {
10250                            responder: StatsGetCpuStatsResponder {
10251                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10252                                tx_id: header.tx_id,
10253                            },
10254                        })
10255                    }
10256                    0x4c8f0f05e7034666 => {
10257                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10258                        let mut req = fidl::new_empty!(
10259                            StatsGetCpuLoadRequest,
10260                            fidl::encoding::DefaultFuchsiaResourceDialect
10261                        );
10262                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
10263                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10264                        Ok(StatsRequest::GetCpuLoad {
10265                            duration: req.duration,
10266
10267                            responder: StatsGetCpuLoadResponder {
10268                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10269                                tx_id: header.tx_id,
10270                            },
10271                        })
10272                    }
10273                    _ => Err(fidl::Error::UnknownOrdinal {
10274                        ordinal: header.ordinal,
10275                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10276                    }),
10277                }))
10278            },
10279        )
10280    }
10281}
10282
10283/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
10284/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
10285/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
10286/// just want stats should use this service instead. If for some reason the protocol fails to
10287/// retrieve stats, which will be an un-recoverable error, it will close the channel.
10288#[derive(Debug)]
10289pub enum StatsRequest {
10290    GetMemoryStats {
10291        responder: StatsGetMemoryStatsResponder,
10292    },
10293    GetMemoryStatsExtended {
10294        responder: StatsGetMemoryStatsExtendedResponder,
10295    },
10296    GetMemoryStatsCompression {
10297        responder: StatsGetMemoryStatsCompressionResponder,
10298    },
10299    GetCpuStats {
10300        responder: StatsGetCpuStatsResponder,
10301    },
10302    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10303    /// duration.
10304    ///
10305    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10306    /// PerCpuStats) over a time duration.
10307    GetCpuLoad {
10308        duration: i64,
10309        responder: StatsGetCpuLoadResponder,
10310    },
10311}
10312
10313impl StatsRequest {
10314    #[allow(irrefutable_let_patterns)]
10315    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
10316        if let StatsRequest::GetMemoryStats { responder } = self { Some((responder)) } else { None }
10317    }
10318
10319    #[allow(irrefutable_let_patterns)]
10320    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
10321        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
10322            Some((responder))
10323        } else {
10324            None
10325        }
10326    }
10327
10328    #[allow(irrefutable_let_patterns)]
10329    pub fn into_get_memory_stats_compression(
10330        self,
10331    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
10332        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
10333            Some((responder))
10334        } else {
10335            None
10336        }
10337    }
10338
10339    #[allow(irrefutable_let_patterns)]
10340    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
10341        if let StatsRequest::GetCpuStats { responder } = self { Some((responder)) } else { None }
10342    }
10343
10344    #[allow(irrefutable_let_patterns)]
10345    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
10346        if let StatsRequest::GetCpuLoad { duration, responder } = self {
10347            Some((duration, responder))
10348        } else {
10349            None
10350        }
10351    }
10352
10353    /// Name of the method defined in FIDL
10354    pub fn method_name(&self) -> &'static str {
10355        match *self {
10356            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
10357            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
10358            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
10359            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
10360            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
10361        }
10362    }
10363}
10364
10365#[derive(Debug, Clone)]
10366pub struct StatsControlHandle {
10367    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10368}
10369
10370impl fidl::endpoints::ControlHandle for StatsControlHandle {
10371    fn shutdown(&self) {
10372        self.inner.shutdown()
10373    }
10374    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10375        self.inner.shutdown_with_epitaph(status)
10376    }
10377
10378    fn is_closed(&self) -> bool {
10379        self.inner.channel().is_closed()
10380    }
10381    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10382        self.inner.channel().on_closed()
10383    }
10384
10385    #[cfg(target_os = "fuchsia")]
10386    fn signal_peer(
10387        &self,
10388        clear_mask: zx::Signals,
10389        set_mask: zx::Signals,
10390    ) -> Result<(), zx_status::Status> {
10391        use fidl::Peered;
10392        self.inner.channel().signal_peer(clear_mask, set_mask)
10393    }
10394}
10395
10396impl StatsControlHandle {}
10397
10398#[must_use = "FIDL methods require a response to be sent"]
10399#[derive(Debug)]
10400pub struct StatsGetMemoryStatsResponder {
10401    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10402    tx_id: u32,
10403}
10404
10405/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10406/// if the responder is dropped without sending a response, so that the client
10407/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10408impl std::ops::Drop for StatsGetMemoryStatsResponder {
10409    fn drop(&mut self) {
10410        self.control_handle.shutdown();
10411        // Safety: drops once, never accessed again
10412        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10413    }
10414}
10415
10416impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
10417    type ControlHandle = StatsControlHandle;
10418
10419    fn control_handle(&self) -> &StatsControlHandle {
10420        &self.control_handle
10421    }
10422
10423    fn drop_without_shutdown(mut self) {
10424        // Safety: drops once, never accessed again due to mem::forget
10425        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10426        // Prevent Drop from running (which would shut down the channel)
10427        std::mem::forget(self);
10428    }
10429}
10430
10431impl StatsGetMemoryStatsResponder {
10432    /// Sends a response to the FIDL transaction.
10433    ///
10434    /// Sets the channel to shutdown if an error occurs.
10435    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10436        let _result = self.send_raw(stats);
10437        if _result.is_err() {
10438            self.control_handle.shutdown();
10439        }
10440        self.drop_without_shutdown();
10441        _result
10442    }
10443
10444    /// Similar to "send" but does not shutdown the channel if an error occurs.
10445    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10446        let _result = self.send_raw(stats);
10447        self.drop_without_shutdown();
10448        _result
10449    }
10450
10451    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10452        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
10453            (stats,),
10454            self.tx_id,
10455            0x686677932ae41074,
10456            fidl::encoding::DynamicFlags::empty(),
10457        )
10458    }
10459}
10460
10461#[must_use = "FIDL methods require a response to be sent"]
10462#[derive(Debug)]
10463pub struct StatsGetMemoryStatsExtendedResponder {
10464    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10465    tx_id: u32,
10466}
10467
10468/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10469/// if the responder is dropped without sending a response, so that the client
10470/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10471impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
10472    fn drop(&mut self) {
10473        self.control_handle.shutdown();
10474        // Safety: drops once, never accessed again
10475        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10476    }
10477}
10478
10479impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
10480    type ControlHandle = StatsControlHandle;
10481
10482    fn control_handle(&self) -> &StatsControlHandle {
10483        &self.control_handle
10484    }
10485
10486    fn drop_without_shutdown(mut self) {
10487        // Safety: drops once, never accessed again due to mem::forget
10488        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10489        // Prevent Drop from running (which would shut down the channel)
10490        std::mem::forget(self);
10491    }
10492}
10493
10494impl StatsGetMemoryStatsExtendedResponder {
10495    /// Sends a response to the FIDL transaction.
10496    ///
10497    /// Sets the channel to shutdown if an error occurs.
10498    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10499        let _result = self.send_raw(stats);
10500        if _result.is_err() {
10501            self.control_handle.shutdown();
10502        }
10503        self.drop_without_shutdown();
10504        _result
10505    }
10506
10507    /// Similar to "send" but does not shutdown the channel if an error occurs.
10508    pub fn send_no_shutdown_on_err(
10509        self,
10510        mut stats: &MemoryStatsExtended,
10511    ) -> Result<(), fidl::Error> {
10512        let _result = self.send_raw(stats);
10513        self.drop_without_shutdown();
10514        _result
10515    }
10516
10517    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10518        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
10519            (stats,),
10520            self.tx_id,
10521            0x60faa0f8aa38c29f,
10522            fidl::encoding::DynamicFlags::empty(),
10523        )
10524    }
10525}
10526
10527#[must_use = "FIDL methods require a response to be sent"]
10528#[derive(Debug)]
10529pub struct StatsGetMemoryStatsCompressionResponder {
10530    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10531    tx_id: u32,
10532}
10533
10534/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10535/// if the responder is dropped without sending a response, so that the client
10536/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10537impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
10538    fn drop(&mut self) {
10539        self.control_handle.shutdown();
10540        // Safety: drops once, never accessed again
10541        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10542    }
10543}
10544
10545impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
10546    type ControlHandle = StatsControlHandle;
10547
10548    fn control_handle(&self) -> &StatsControlHandle {
10549        &self.control_handle
10550    }
10551
10552    fn drop_without_shutdown(mut self) {
10553        // Safety: drops once, never accessed again due to mem::forget
10554        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10555        // Prevent Drop from running (which would shut down the channel)
10556        std::mem::forget(self);
10557    }
10558}
10559
10560impl StatsGetMemoryStatsCompressionResponder {
10561    /// Sends a response to the FIDL transaction.
10562    ///
10563    /// Sets the channel to shutdown if an error occurs.
10564    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10565        let _result = self.send_raw(payload);
10566        if _result.is_err() {
10567            self.control_handle.shutdown();
10568        }
10569        self.drop_without_shutdown();
10570        _result
10571    }
10572
10573    /// Similar to "send" but does not shutdown the channel if an error occurs.
10574    pub fn send_no_shutdown_on_err(
10575        self,
10576        mut payload: &MemoryStatsCompression,
10577    ) -> Result<(), fidl::Error> {
10578        let _result = self.send_raw(payload);
10579        self.drop_without_shutdown();
10580        _result
10581    }
10582
10583    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10584        self.control_handle.inner.send::<MemoryStatsCompression>(
10585            payload,
10586            self.tx_id,
10587            0x544a09995befb531,
10588            fidl::encoding::DynamicFlags::empty(),
10589        )
10590    }
10591}
10592
10593#[must_use = "FIDL methods require a response to be sent"]
10594#[derive(Debug)]
10595pub struct StatsGetCpuStatsResponder {
10596    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10597    tx_id: u32,
10598}
10599
10600/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10601/// if the responder is dropped without sending a response, so that the client
10602/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10603impl std::ops::Drop for StatsGetCpuStatsResponder {
10604    fn drop(&mut self) {
10605        self.control_handle.shutdown();
10606        // Safety: drops once, never accessed again
10607        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10608    }
10609}
10610
10611impl fidl::endpoints::Responder for StatsGetCpuStatsResponder {
10612    type ControlHandle = StatsControlHandle;
10613
10614    fn control_handle(&self) -> &StatsControlHandle {
10615        &self.control_handle
10616    }
10617
10618    fn drop_without_shutdown(mut self) {
10619        // Safety: drops once, never accessed again due to mem::forget
10620        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10621        // Prevent Drop from running (which would shut down the channel)
10622        std::mem::forget(self);
10623    }
10624}
10625
10626impl StatsGetCpuStatsResponder {
10627    /// Sends a response to the FIDL transaction.
10628    ///
10629    /// Sets the channel to shutdown if an error occurs.
10630    pub fn send(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10631        let _result = self.send_raw(stats);
10632        if _result.is_err() {
10633            self.control_handle.shutdown();
10634        }
10635        self.drop_without_shutdown();
10636        _result
10637    }
10638
10639    /// Similar to "send" but does not shutdown the channel if an error occurs.
10640    pub fn send_no_shutdown_on_err(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10641        let _result = self.send_raw(stats);
10642        self.drop_without_shutdown();
10643        _result
10644    }
10645
10646    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10647        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
10648            (stats,),
10649            self.tx_id,
10650            0x470e2684ca1ca19e,
10651            fidl::encoding::DynamicFlags::empty(),
10652        )
10653    }
10654}
10655
10656#[must_use = "FIDL methods require a response to be sent"]
10657#[derive(Debug)]
10658pub struct StatsGetCpuLoadResponder {
10659    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10660    tx_id: u32,
10661}
10662
10663/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10664/// if the responder is dropped without sending a response, so that the client
10665/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10666impl std::ops::Drop for StatsGetCpuLoadResponder {
10667    fn drop(&mut self) {
10668        self.control_handle.shutdown();
10669        // Safety: drops once, never accessed again
10670        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10671    }
10672}
10673
10674impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
10675    type ControlHandle = StatsControlHandle;
10676
10677    fn control_handle(&self) -> &StatsControlHandle {
10678        &self.control_handle
10679    }
10680
10681    fn drop_without_shutdown(mut self) {
10682        // Safety: drops once, never accessed again due to mem::forget
10683        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10684        // Prevent Drop from running (which would shut down the channel)
10685        std::mem::forget(self);
10686    }
10687}
10688
10689impl StatsGetCpuLoadResponder {
10690    /// Sends a response to the FIDL transaction.
10691    ///
10692    /// Sets the channel to shutdown if an error occurs.
10693    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10694        let _result = self.send_raw(per_cpu_load);
10695        if _result.is_err() {
10696            self.control_handle.shutdown();
10697        }
10698        self.drop_without_shutdown();
10699        _result
10700    }
10701
10702    /// Similar to "send" but does not shutdown the channel if an error occurs.
10703    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10704        let _result = self.send_raw(per_cpu_load);
10705        self.drop_without_shutdown();
10706        _result
10707    }
10708
10709    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10710        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
10711            (per_cpu_load,),
10712            self.tx_id,
10713            0x4c8f0f05e7034666,
10714            fidl::encoding::DynamicFlags::empty(),
10715        )
10716    }
10717}
10718
10719#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10720pub struct TracingResourceMarker;
10721
10722impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
10723    type Proxy = TracingResourceProxy;
10724    type RequestStream = TracingResourceRequestStream;
10725    #[cfg(target_os = "fuchsia")]
10726    type SynchronousProxy = TracingResourceSynchronousProxy;
10727
10728    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
10729}
10730impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
10731
10732pub trait TracingResourceProxyInterface: Send + Sync {
10733    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10734    fn r#get(&self) -> Self::GetResponseFut;
10735}
10736#[derive(Debug)]
10737#[cfg(target_os = "fuchsia")]
10738pub struct TracingResourceSynchronousProxy {
10739    client: fidl::client::sync::Client,
10740}
10741
10742#[cfg(target_os = "fuchsia")]
10743impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
10744    type Proxy = TracingResourceProxy;
10745    type Protocol = TracingResourceMarker;
10746
10747    fn from_channel(inner: fidl::Channel) -> Self {
10748        Self::new(inner)
10749    }
10750
10751    fn into_channel(self) -> fidl::Channel {
10752        self.client.into_channel()
10753    }
10754
10755    fn as_channel(&self) -> &fidl::Channel {
10756        self.client.as_channel()
10757    }
10758}
10759
10760#[cfg(target_os = "fuchsia")]
10761impl TracingResourceSynchronousProxy {
10762    pub fn new(channel: fidl::Channel) -> Self {
10763        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10764        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10765    }
10766
10767    pub fn into_channel(self) -> fidl::Channel {
10768        self.client.into_channel()
10769    }
10770
10771    /// Waits until an event arrives and returns it. It is safe for other
10772    /// threads to make concurrent requests while waiting for an event.
10773    pub fn wait_for_event(
10774        &self,
10775        deadline: zx::MonotonicInstant,
10776    ) -> Result<TracingResourceEvent, fidl::Error> {
10777        TracingResourceEvent::decode(self.client.wait_for_event(deadline)?)
10778    }
10779
10780    /// Get a tracing resource handle.
10781    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10782        let _response =
10783            self.client.send_query::<fidl::encoding::EmptyPayload, TracingResourceGetResponse>(
10784                (),
10785                0x299bc179aa54c6aa,
10786                fidl::encoding::DynamicFlags::empty(),
10787                ___deadline,
10788            )?;
10789        Ok(_response.resource)
10790    }
10791}
10792
10793#[cfg(target_os = "fuchsia")]
10794impl From<TracingResourceSynchronousProxy> for zx::Handle {
10795    fn from(value: TracingResourceSynchronousProxy) -> Self {
10796        value.into_channel().into()
10797    }
10798}
10799
10800#[cfg(target_os = "fuchsia")]
10801impl From<fidl::Channel> for TracingResourceSynchronousProxy {
10802    fn from(value: fidl::Channel) -> Self {
10803        Self::new(value)
10804    }
10805}
10806
10807#[cfg(target_os = "fuchsia")]
10808impl fidl::endpoints::FromClient for TracingResourceSynchronousProxy {
10809    type Protocol = TracingResourceMarker;
10810
10811    fn from_client(value: fidl::endpoints::ClientEnd<TracingResourceMarker>) -> Self {
10812        Self::new(value.into_channel())
10813    }
10814}
10815
10816#[derive(Debug, Clone)]
10817pub struct TracingResourceProxy {
10818    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10819}
10820
10821impl fidl::endpoints::Proxy for TracingResourceProxy {
10822    type Protocol = TracingResourceMarker;
10823
10824    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10825        Self::new(inner)
10826    }
10827
10828    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10829        self.client.into_channel().map_err(|client| Self { client })
10830    }
10831
10832    fn as_channel(&self) -> &::fidl::AsyncChannel {
10833        self.client.as_channel()
10834    }
10835}
10836
10837impl TracingResourceProxy {
10838    /// Create a new Proxy for fuchsia.kernel/TracingResource.
10839    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10840        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10841        Self { client: fidl::client::Client::new(channel, protocol_name) }
10842    }
10843
10844    /// Get a Stream of events from the remote end of the protocol.
10845    ///
10846    /// # Panics
10847    ///
10848    /// Panics if the event stream was already taken.
10849    pub fn take_event_stream(&self) -> TracingResourceEventStream {
10850        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
10851    }
10852
10853    /// Get a tracing resource handle.
10854    pub fn r#get(
10855        &self,
10856    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10857    {
10858        TracingResourceProxyInterface::r#get(self)
10859    }
10860}
10861
10862impl TracingResourceProxyInterface for TracingResourceProxy {
10863    type GetResponseFut = fidl::client::QueryResponseFut<
10864        fidl::Resource,
10865        fidl::encoding::DefaultFuchsiaResourceDialect,
10866    >;
10867    fn r#get(&self) -> Self::GetResponseFut {
10868        fn _decode(
10869            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10870        ) -> Result<fidl::Resource, fidl::Error> {
10871            let _response = fidl::client::decode_transaction_body::<
10872                TracingResourceGetResponse,
10873                fidl::encoding::DefaultFuchsiaResourceDialect,
10874                0x299bc179aa54c6aa,
10875            >(_buf?)?;
10876            Ok(_response.resource)
10877        }
10878        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10879            (),
10880            0x299bc179aa54c6aa,
10881            fidl::encoding::DynamicFlags::empty(),
10882            _decode,
10883        )
10884    }
10885}
10886
10887pub struct TracingResourceEventStream {
10888    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10889}
10890
10891impl std::marker::Unpin for TracingResourceEventStream {}
10892
10893impl futures::stream::FusedStream for TracingResourceEventStream {
10894    fn is_terminated(&self) -> bool {
10895        self.event_receiver.is_terminated()
10896    }
10897}
10898
10899impl futures::Stream for TracingResourceEventStream {
10900    type Item = Result<TracingResourceEvent, fidl::Error>;
10901
10902    fn poll_next(
10903        mut self: std::pin::Pin<&mut Self>,
10904        cx: &mut std::task::Context<'_>,
10905    ) -> std::task::Poll<Option<Self::Item>> {
10906        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10907            &mut self.event_receiver,
10908            cx
10909        )?) {
10910            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
10911            None => std::task::Poll::Ready(None),
10912        }
10913    }
10914}
10915
10916#[derive(Debug)]
10917pub enum TracingResourceEvent {}
10918
10919impl TracingResourceEvent {
10920    /// Decodes a message buffer as a [`TracingResourceEvent`].
10921    fn decode(
10922        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10923    ) -> Result<TracingResourceEvent, fidl::Error> {
10924        let (bytes, _handles) = buf.split_mut();
10925        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10926        debug_assert_eq!(tx_header.tx_id, 0);
10927        match tx_header.ordinal {
10928            _ => Err(fidl::Error::UnknownOrdinal {
10929                ordinal: tx_header.ordinal,
10930                protocol_name:
10931                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10932            }),
10933        }
10934    }
10935}
10936
10937/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
10938pub struct TracingResourceRequestStream {
10939    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10940    is_terminated: bool,
10941}
10942
10943impl std::marker::Unpin for TracingResourceRequestStream {}
10944
10945impl futures::stream::FusedStream for TracingResourceRequestStream {
10946    fn is_terminated(&self) -> bool {
10947        self.is_terminated
10948    }
10949}
10950
10951impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
10952    type Protocol = TracingResourceMarker;
10953    type ControlHandle = TracingResourceControlHandle;
10954
10955    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10956        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10957    }
10958
10959    fn control_handle(&self) -> Self::ControlHandle {
10960        TracingResourceControlHandle { inner: self.inner.clone() }
10961    }
10962
10963    fn into_inner(
10964        self,
10965    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10966    {
10967        (self.inner, self.is_terminated)
10968    }
10969
10970    fn from_inner(
10971        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10972        is_terminated: bool,
10973    ) -> Self {
10974        Self { inner, is_terminated }
10975    }
10976}
10977
10978impl futures::Stream for TracingResourceRequestStream {
10979    type Item = Result<TracingResourceRequest, fidl::Error>;
10980
10981    fn poll_next(
10982        mut self: std::pin::Pin<&mut Self>,
10983        cx: &mut std::task::Context<'_>,
10984    ) -> std::task::Poll<Option<Self::Item>> {
10985        let this = &mut *self;
10986        if this.inner.check_shutdown(cx) {
10987            this.is_terminated = true;
10988            return std::task::Poll::Ready(None);
10989        }
10990        if this.is_terminated {
10991            panic!("polled TracingResourceRequestStream after completion");
10992        }
10993        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10994            |bytes, handles| {
10995                match this.inner.channel().read_etc(cx, bytes, handles) {
10996                    std::task::Poll::Ready(Ok(())) => {}
10997                    std::task::Poll::Pending => return std::task::Poll::Pending,
10998                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10999                        this.is_terminated = true;
11000                        return std::task::Poll::Ready(None);
11001                    }
11002                    std::task::Poll::Ready(Err(e)) => {
11003                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11004                            e.into(),
11005                        ))));
11006                    }
11007                }
11008
11009                // A message has been received from the channel
11010                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11011
11012                std::task::Poll::Ready(Some(match header.ordinal {
11013                    0x299bc179aa54c6aa => {
11014                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11015                        let mut req = fidl::new_empty!(
11016                            fidl::encoding::EmptyPayload,
11017                            fidl::encoding::DefaultFuchsiaResourceDialect
11018                        );
11019                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11020                        let control_handle =
11021                            TracingResourceControlHandle { inner: this.inner.clone() };
11022                        Ok(TracingResourceRequest::Get {
11023                            responder: TracingResourceGetResponder {
11024                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11025                                tx_id: header.tx_id,
11026                            },
11027                        })
11028                    }
11029                    _ => Err(fidl::Error::UnknownOrdinal {
11030                        ordinal: header.ordinal,
11031                        protocol_name:
11032                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11033                    }),
11034                }))
11035            },
11036        )
11037    }
11038}
11039
11040/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11041/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
11042#[derive(Debug)]
11043pub enum TracingResourceRequest {
11044    /// Get a tracing resource handle.
11045    Get { responder: TracingResourceGetResponder },
11046}
11047
11048impl TracingResourceRequest {
11049    #[allow(irrefutable_let_patterns)]
11050    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
11051        if let TracingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11052    }
11053
11054    /// Name of the method defined in FIDL
11055    pub fn method_name(&self) -> &'static str {
11056        match *self {
11057            TracingResourceRequest::Get { .. } => "get",
11058        }
11059    }
11060}
11061
11062#[derive(Debug, Clone)]
11063pub struct TracingResourceControlHandle {
11064    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11065}
11066
11067impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
11068    fn shutdown(&self) {
11069        self.inner.shutdown()
11070    }
11071    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11072        self.inner.shutdown_with_epitaph(status)
11073    }
11074
11075    fn is_closed(&self) -> bool {
11076        self.inner.channel().is_closed()
11077    }
11078    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11079        self.inner.channel().on_closed()
11080    }
11081
11082    #[cfg(target_os = "fuchsia")]
11083    fn signal_peer(
11084        &self,
11085        clear_mask: zx::Signals,
11086        set_mask: zx::Signals,
11087    ) -> Result<(), zx_status::Status> {
11088        use fidl::Peered;
11089        self.inner.channel().signal_peer(clear_mask, set_mask)
11090    }
11091}
11092
11093impl TracingResourceControlHandle {}
11094
11095#[must_use = "FIDL methods require a response to be sent"]
11096#[derive(Debug)]
11097pub struct TracingResourceGetResponder {
11098    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
11099    tx_id: u32,
11100}
11101
11102/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
11103/// if the responder is dropped without sending a response, so that the client
11104/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11105impl std::ops::Drop for TracingResourceGetResponder {
11106    fn drop(&mut self) {
11107        self.control_handle.shutdown();
11108        // Safety: drops once, never accessed again
11109        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11110    }
11111}
11112
11113impl fidl::endpoints::Responder for TracingResourceGetResponder {
11114    type ControlHandle = TracingResourceControlHandle;
11115
11116    fn control_handle(&self) -> &TracingResourceControlHandle {
11117        &self.control_handle
11118    }
11119
11120    fn drop_without_shutdown(mut self) {
11121        // Safety: drops once, never accessed again due to mem::forget
11122        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11123        // Prevent Drop from running (which would shut down the channel)
11124        std::mem::forget(self);
11125    }
11126}
11127
11128impl TracingResourceGetResponder {
11129    /// Sends a response to the FIDL transaction.
11130    ///
11131    /// Sets the channel to shutdown if an error occurs.
11132    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11133        let _result = self.send_raw(resource);
11134        if _result.is_err() {
11135            self.control_handle.shutdown();
11136        }
11137        self.drop_without_shutdown();
11138        _result
11139    }
11140
11141    /// Similar to "send" but does not shutdown the channel if an error occurs.
11142    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11143        let _result = self.send_raw(resource);
11144        self.drop_without_shutdown();
11145        _result
11146    }
11147
11148    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11149        self.control_handle.inner.send::<TracingResourceGetResponse>(
11150            (resource,),
11151            self.tx_id,
11152            0x299bc179aa54c6aa,
11153            fidl::encoding::DynamicFlags::empty(),
11154        )
11155    }
11156}
11157
11158#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11159pub struct VmexResourceMarker;
11160
11161impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
11162    type Proxy = VmexResourceProxy;
11163    type RequestStream = VmexResourceRequestStream;
11164    #[cfg(target_os = "fuchsia")]
11165    type SynchronousProxy = VmexResourceSynchronousProxy;
11166
11167    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
11168}
11169impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
11170
11171pub trait VmexResourceProxyInterface: Send + Sync {
11172    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
11173    fn r#get(&self) -> Self::GetResponseFut;
11174}
11175#[derive(Debug)]
11176#[cfg(target_os = "fuchsia")]
11177pub struct VmexResourceSynchronousProxy {
11178    client: fidl::client::sync::Client,
11179}
11180
11181#[cfg(target_os = "fuchsia")]
11182impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
11183    type Proxy = VmexResourceProxy;
11184    type Protocol = VmexResourceMarker;
11185
11186    fn from_channel(inner: fidl::Channel) -> Self {
11187        Self::new(inner)
11188    }
11189
11190    fn into_channel(self) -> fidl::Channel {
11191        self.client.into_channel()
11192    }
11193
11194    fn as_channel(&self) -> &fidl::Channel {
11195        self.client.as_channel()
11196    }
11197}
11198
11199#[cfg(target_os = "fuchsia")]
11200impl VmexResourceSynchronousProxy {
11201    pub fn new(channel: fidl::Channel) -> Self {
11202        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11203        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
11204    }
11205
11206    pub fn into_channel(self) -> fidl::Channel {
11207        self.client.into_channel()
11208    }
11209
11210    /// Waits until an event arrives and returns it. It is safe for other
11211    /// threads to make concurrent requests while waiting for an event.
11212    pub fn wait_for_event(
11213        &self,
11214        deadline: zx::MonotonicInstant,
11215    ) -> Result<VmexResourceEvent, fidl::Error> {
11216        VmexResourceEvent::decode(self.client.wait_for_event(deadline)?)
11217    }
11218
11219    /// Get a VMEX resource handle.
11220    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
11221        let _response =
11222            self.client.send_query::<fidl::encoding::EmptyPayload, VmexResourceGetResponse>(
11223                (),
11224                0x33db32deed650699,
11225                fidl::encoding::DynamicFlags::empty(),
11226                ___deadline,
11227            )?;
11228        Ok(_response.resource)
11229    }
11230}
11231
11232#[cfg(target_os = "fuchsia")]
11233impl From<VmexResourceSynchronousProxy> for zx::Handle {
11234    fn from(value: VmexResourceSynchronousProxy) -> Self {
11235        value.into_channel().into()
11236    }
11237}
11238
11239#[cfg(target_os = "fuchsia")]
11240impl From<fidl::Channel> for VmexResourceSynchronousProxy {
11241    fn from(value: fidl::Channel) -> Self {
11242        Self::new(value)
11243    }
11244}
11245
11246#[cfg(target_os = "fuchsia")]
11247impl fidl::endpoints::FromClient for VmexResourceSynchronousProxy {
11248    type Protocol = VmexResourceMarker;
11249
11250    fn from_client(value: fidl::endpoints::ClientEnd<VmexResourceMarker>) -> Self {
11251        Self::new(value.into_channel())
11252    }
11253}
11254
11255#[derive(Debug, Clone)]
11256pub struct VmexResourceProxy {
11257    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11258}
11259
11260impl fidl::endpoints::Proxy for VmexResourceProxy {
11261    type Protocol = VmexResourceMarker;
11262
11263    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11264        Self::new(inner)
11265    }
11266
11267    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11268        self.client.into_channel().map_err(|client| Self { client })
11269    }
11270
11271    fn as_channel(&self) -> &::fidl::AsyncChannel {
11272        self.client.as_channel()
11273    }
11274}
11275
11276impl VmexResourceProxy {
11277    /// Create a new Proxy for fuchsia.kernel/VmexResource.
11278    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11279        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11280        Self { client: fidl::client::Client::new(channel, protocol_name) }
11281    }
11282
11283    /// Get a Stream of events from the remote end of the protocol.
11284    ///
11285    /// # Panics
11286    ///
11287    /// Panics if the event stream was already taken.
11288    pub fn take_event_stream(&self) -> VmexResourceEventStream {
11289        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
11290    }
11291
11292    /// Get a VMEX resource handle.
11293    pub fn r#get(
11294        &self,
11295    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
11296    {
11297        VmexResourceProxyInterface::r#get(self)
11298    }
11299}
11300
11301impl VmexResourceProxyInterface for VmexResourceProxy {
11302    type GetResponseFut = fidl::client::QueryResponseFut<
11303        fidl::Resource,
11304        fidl::encoding::DefaultFuchsiaResourceDialect,
11305    >;
11306    fn r#get(&self) -> Self::GetResponseFut {
11307        fn _decode(
11308            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11309        ) -> Result<fidl::Resource, fidl::Error> {
11310            let _response = fidl::client::decode_transaction_body::<
11311                VmexResourceGetResponse,
11312                fidl::encoding::DefaultFuchsiaResourceDialect,
11313                0x33db32deed650699,
11314            >(_buf?)?;
11315            Ok(_response.resource)
11316        }
11317        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
11318            (),
11319            0x33db32deed650699,
11320            fidl::encoding::DynamicFlags::empty(),
11321            _decode,
11322        )
11323    }
11324}
11325
11326pub struct VmexResourceEventStream {
11327    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11328}
11329
11330impl std::marker::Unpin for VmexResourceEventStream {}
11331
11332impl futures::stream::FusedStream for VmexResourceEventStream {
11333    fn is_terminated(&self) -> bool {
11334        self.event_receiver.is_terminated()
11335    }
11336}
11337
11338impl futures::Stream for VmexResourceEventStream {
11339    type Item = Result<VmexResourceEvent, fidl::Error>;
11340
11341    fn poll_next(
11342        mut self: std::pin::Pin<&mut Self>,
11343        cx: &mut std::task::Context<'_>,
11344    ) -> std::task::Poll<Option<Self::Item>> {
11345        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11346            &mut self.event_receiver,
11347            cx
11348        )?) {
11349            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
11350            None => std::task::Poll::Ready(None),
11351        }
11352    }
11353}
11354
11355#[derive(Debug)]
11356pub enum VmexResourceEvent {}
11357
11358impl VmexResourceEvent {
11359    /// Decodes a message buffer as a [`VmexResourceEvent`].
11360    fn decode(
11361        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11362    ) -> Result<VmexResourceEvent, fidl::Error> {
11363        let (bytes, _handles) = buf.split_mut();
11364        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11365        debug_assert_eq!(tx_header.tx_id, 0);
11366        match tx_header.ordinal {
11367            _ => Err(fidl::Error::UnknownOrdinal {
11368                ordinal: tx_header.ordinal,
11369                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11370            }),
11371        }
11372    }
11373}
11374
11375/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
11376pub struct VmexResourceRequestStream {
11377    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11378    is_terminated: bool,
11379}
11380
11381impl std::marker::Unpin for VmexResourceRequestStream {}
11382
11383impl futures::stream::FusedStream for VmexResourceRequestStream {
11384    fn is_terminated(&self) -> bool {
11385        self.is_terminated
11386    }
11387}
11388
11389impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
11390    type Protocol = VmexResourceMarker;
11391    type ControlHandle = VmexResourceControlHandle;
11392
11393    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11394        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11395    }
11396
11397    fn control_handle(&self) -> Self::ControlHandle {
11398        VmexResourceControlHandle { inner: self.inner.clone() }
11399    }
11400
11401    fn into_inner(
11402        self,
11403    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11404    {
11405        (self.inner, self.is_terminated)
11406    }
11407
11408    fn from_inner(
11409        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11410        is_terminated: bool,
11411    ) -> Self {
11412        Self { inner, is_terminated }
11413    }
11414}
11415
11416impl futures::Stream for VmexResourceRequestStream {
11417    type Item = Result<VmexResourceRequest, fidl::Error>;
11418
11419    fn poll_next(
11420        mut self: std::pin::Pin<&mut Self>,
11421        cx: &mut std::task::Context<'_>,
11422    ) -> std::task::Poll<Option<Self::Item>> {
11423        let this = &mut *self;
11424        if this.inner.check_shutdown(cx) {
11425            this.is_terminated = true;
11426            return std::task::Poll::Ready(None);
11427        }
11428        if this.is_terminated {
11429            panic!("polled VmexResourceRequestStream after completion");
11430        }
11431        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11432            |bytes, handles| {
11433                match this.inner.channel().read_etc(cx, bytes, handles) {
11434                    std::task::Poll::Ready(Ok(())) => {}
11435                    std::task::Poll::Pending => return std::task::Poll::Pending,
11436                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11437                        this.is_terminated = true;
11438                        return std::task::Poll::Ready(None);
11439                    }
11440                    std::task::Poll::Ready(Err(e)) => {
11441                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11442                            e.into(),
11443                        ))));
11444                    }
11445                }
11446
11447                // A message has been received from the channel
11448                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11449
11450                std::task::Poll::Ready(Some(match header.ordinal {
11451                    0x33db32deed650699 => {
11452                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11453                        let mut req = fidl::new_empty!(
11454                            fidl::encoding::EmptyPayload,
11455                            fidl::encoding::DefaultFuchsiaResourceDialect
11456                        );
11457                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11458                        let control_handle =
11459                            VmexResourceControlHandle { inner: this.inner.clone() };
11460                        Ok(VmexResourceRequest::Get {
11461                            responder: VmexResourceGetResponder {
11462                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11463                                tx_id: header.tx_id,
11464                            },
11465                        })
11466                    }
11467                    _ => Err(fidl::Error::UnknownOrdinal {
11468                        ordinal: header.ordinal,
11469                        protocol_name:
11470                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11471                    }),
11472                }))
11473            },
11474        )
11475    }
11476}
11477
11478/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11479/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
11480/// executable.
11481#[derive(Debug)]
11482pub enum VmexResourceRequest {
11483    /// Get a VMEX resource handle.
11484    Get { responder: VmexResourceGetResponder },
11485}
11486
11487impl VmexResourceRequest {
11488    #[allow(irrefutable_let_patterns)]
11489    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
11490        if let VmexResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11491    }
11492
11493    /// Name of the method defined in FIDL
11494    pub fn method_name(&self) -> &'static str {
11495        match *self {
11496            VmexResourceRequest::Get { .. } => "get",
11497        }
11498    }
11499}
11500
11501#[derive(Debug, Clone)]
11502pub struct VmexResourceControlHandle {
11503    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11504}
11505
11506impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
11507    fn shutdown(&self) {
11508        self.inner.shutdown()
11509    }
11510    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11511        self.inner.shutdown_with_epitaph(status)
11512    }
11513
11514    fn is_closed(&self) -> bool {
11515        self.inner.channel().is_closed()
11516    }
11517    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11518        self.inner.channel().on_closed()
11519    }
11520
11521    #[cfg(target_os = "fuchsia")]
11522    fn signal_peer(
11523        &self,
11524        clear_mask: zx::Signals,
11525        set_mask: zx::Signals,
11526    ) -> Result<(), zx_status::Status> {
11527        use fidl::Peered;
11528        self.inner.channel().signal_peer(clear_mask, set_mask)
11529    }
11530}
11531
11532impl VmexResourceControlHandle {}
11533
11534#[must_use = "FIDL methods require a response to be sent"]
11535#[derive(Debug)]
11536pub struct VmexResourceGetResponder {
11537    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
11538    tx_id: u32,
11539}
11540
11541/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
11542/// if the responder is dropped without sending a response, so that the client
11543/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11544impl std::ops::Drop for VmexResourceGetResponder {
11545    fn drop(&mut self) {
11546        self.control_handle.shutdown();
11547        // Safety: drops once, never accessed again
11548        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11549    }
11550}
11551
11552impl fidl::endpoints::Responder for VmexResourceGetResponder {
11553    type ControlHandle = VmexResourceControlHandle;
11554
11555    fn control_handle(&self) -> &VmexResourceControlHandle {
11556        &self.control_handle
11557    }
11558
11559    fn drop_without_shutdown(mut self) {
11560        // Safety: drops once, never accessed again due to mem::forget
11561        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11562        // Prevent Drop from running (which would shut down the channel)
11563        std::mem::forget(self);
11564    }
11565}
11566
11567impl VmexResourceGetResponder {
11568    /// Sends a response to the FIDL transaction.
11569    ///
11570    /// Sets the channel to shutdown if an error occurs.
11571    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11572        let _result = self.send_raw(resource);
11573        if _result.is_err() {
11574            self.control_handle.shutdown();
11575        }
11576        self.drop_without_shutdown();
11577        _result
11578    }
11579
11580    /// Similar to "send" but does not shutdown the channel if an error occurs.
11581    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11582        let _result = self.send_raw(resource);
11583        self.drop_without_shutdown();
11584        _result
11585    }
11586
11587    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11588        self.control_handle.inner.send::<VmexResourceGetResponse>(
11589            (resource,),
11590            self.tx_id,
11591            0x33db32deed650699,
11592            fidl::encoding::DynamicFlags::empty(),
11593        )
11594    }
11595}
11596
11597mod internal {
11598    use super::*;
11599
11600    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
11601        type Borrowed<'a> = &'a mut Self;
11602        fn take_or_borrow<'a>(
11603            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11604        ) -> Self::Borrowed<'a> {
11605            value
11606        }
11607    }
11608
11609    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
11610        type Owned = Self;
11611
11612        #[inline(always)]
11613        fn inline_align(_context: fidl::encoding::Context) -> usize {
11614            8
11615        }
11616
11617        #[inline(always)]
11618        fn inline_size(_context: fidl::encoding::Context) -> usize {
11619            24
11620        }
11621    }
11622
11623    unsafe impl
11624        fidl::encoding::Encode<
11625            CounterGetInspectVmoResponse,
11626            fidl::encoding::DefaultFuchsiaResourceDialect,
11627        > for &mut CounterGetInspectVmoResponse
11628    {
11629        #[inline]
11630        unsafe fn encode(
11631            self,
11632            encoder: &mut fidl::encoding::Encoder<
11633                '_,
11634                fidl::encoding::DefaultFuchsiaResourceDialect,
11635            >,
11636            offset: usize,
11637            _depth: fidl::encoding::Depth,
11638        ) -> fidl::Result<()> {
11639            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11640            // Delegate to tuple encoding.
11641            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11642                (
11643                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
11644                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
11645                ),
11646                encoder, offset, _depth
11647            )
11648        }
11649    }
11650    unsafe impl<
11651        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11652        T1: fidl::encoding::Encode<
11653                fidl_fuchsia_mem::Buffer,
11654                fidl::encoding::DefaultFuchsiaResourceDialect,
11655            >,
11656    >
11657        fidl::encoding::Encode<
11658            CounterGetInspectVmoResponse,
11659            fidl::encoding::DefaultFuchsiaResourceDialect,
11660        > for (T0, T1)
11661    {
11662        #[inline]
11663        unsafe fn encode(
11664            self,
11665            encoder: &mut fidl::encoding::Encoder<
11666                '_,
11667                fidl::encoding::DefaultFuchsiaResourceDialect,
11668            >,
11669            offset: usize,
11670            depth: fidl::encoding::Depth,
11671        ) -> fidl::Result<()> {
11672            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11673            // Zero out padding regions. There's no need to apply masks
11674            // because the unmasked parts will be overwritten by fields.
11675            unsafe {
11676                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11677                (ptr as *mut u64).write_unaligned(0);
11678            }
11679            // Write the fields.
11680            self.0.encode(encoder, offset + 0, depth)?;
11681            self.1.encode(encoder, offset + 8, depth)?;
11682            Ok(())
11683        }
11684    }
11685
11686    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11687        for CounterGetInspectVmoResponse
11688    {
11689        #[inline(always)]
11690        fn new_empty() -> Self {
11691            Self {
11692                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
11693                buffer: fidl::new_empty!(
11694                    fidl_fuchsia_mem::Buffer,
11695                    fidl::encoding::DefaultFuchsiaResourceDialect
11696                ),
11697            }
11698        }
11699
11700        #[inline]
11701        unsafe fn decode(
11702            &mut self,
11703            decoder: &mut fidl::encoding::Decoder<
11704                '_,
11705                fidl::encoding::DefaultFuchsiaResourceDialect,
11706            >,
11707            offset: usize,
11708            _depth: fidl::encoding::Depth,
11709        ) -> fidl::Result<()> {
11710            decoder.debug_check_bounds::<Self>(offset);
11711            // Verify that padding bytes are zero.
11712            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11713            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11714            let mask = 0xffffffff00000000u64;
11715            let maskedval = padval & mask;
11716            if maskedval != 0 {
11717                return Err(fidl::Error::NonZeroPadding {
11718                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11719                });
11720            }
11721            fidl::decode!(
11722                i32,
11723                fidl::encoding::DefaultFuchsiaResourceDialect,
11724                &mut self.status,
11725                decoder,
11726                offset + 0,
11727                _depth
11728            )?;
11729            fidl::decode!(
11730                fidl_fuchsia_mem::Buffer,
11731                fidl::encoding::DefaultFuchsiaResourceDialect,
11732                &mut self.buffer,
11733                decoder,
11734                offset + 8,
11735                _depth
11736            )?;
11737            Ok(())
11738        }
11739    }
11740
11741    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
11742        type Borrowed<'a> = &'a mut Self;
11743        fn take_or_borrow<'a>(
11744            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11745        ) -> Self::Borrowed<'a> {
11746            value
11747        }
11748    }
11749
11750    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
11751        type Owned = Self;
11752
11753        #[inline(always)]
11754        fn inline_align(_context: fidl::encoding::Context) -> usize {
11755            4
11756        }
11757
11758        #[inline(always)]
11759        fn inline_size(_context: fidl::encoding::Context) -> usize {
11760            4
11761        }
11762    }
11763
11764    unsafe impl
11765        fidl::encoding::Encode<
11766            CpuResourceGetResponse,
11767            fidl::encoding::DefaultFuchsiaResourceDialect,
11768        > for &mut CpuResourceGetResponse
11769    {
11770        #[inline]
11771        unsafe fn encode(
11772            self,
11773            encoder: &mut fidl::encoding::Encoder<
11774                '_,
11775                fidl::encoding::DefaultFuchsiaResourceDialect,
11776            >,
11777            offset: usize,
11778            _depth: fidl::encoding::Depth,
11779        ) -> fidl::Result<()> {
11780            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11781            // Delegate to tuple encoding.
11782            fidl::encoding::Encode::<
11783                CpuResourceGetResponse,
11784                fidl::encoding::DefaultFuchsiaResourceDialect,
11785            >::encode(
11786                (<fidl::encoding::HandleType<
11787                    fidl::Resource,
11788                    { fidl::ObjectType::RESOURCE.into_raw() },
11789                    2147483648,
11790                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11791                    &mut self.resource
11792                ),),
11793                encoder,
11794                offset,
11795                _depth,
11796            )
11797        }
11798    }
11799    unsafe impl<
11800        T0: fidl::encoding::Encode<
11801                fidl::encoding::HandleType<
11802                    fidl::Resource,
11803                    { fidl::ObjectType::RESOURCE.into_raw() },
11804                    2147483648,
11805                >,
11806                fidl::encoding::DefaultFuchsiaResourceDialect,
11807            >,
11808    >
11809        fidl::encoding::Encode<
11810            CpuResourceGetResponse,
11811            fidl::encoding::DefaultFuchsiaResourceDialect,
11812        > for (T0,)
11813    {
11814        #[inline]
11815        unsafe fn encode(
11816            self,
11817            encoder: &mut fidl::encoding::Encoder<
11818                '_,
11819                fidl::encoding::DefaultFuchsiaResourceDialect,
11820            >,
11821            offset: usize,
11822            depth: fidl::encoding::Depth,
11823        ) -> fidl::Result<()> {
11824            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11825            // Zero out padding regions. There's no need to apply masks
11826            // because the unmasked parts will be overwritten by fields.
11827            // Write the fields.
11828            self.0.encode(encoder, offset + 0, depth)?;
11829            Ok(())
11830        }
11831    }
11832
11833    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11834        for CpuResourceGetResponse
11835    {
11836        #[inline(always)]
11837        fn new_empty() -> Self {
11838            Self {
11839                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11840            }
11841        }
11842
11843        #[inline]
11844        unsafe fn decode(
11845            &mut self,
11846            decoder: &mut fidl::encoding::Decoder<
11847                '_,
11848                fidl::encoding::DefaultFuchsiaResourceDialect,
11849            >,
11850            offset: usize,
11851            _depth: fidl::encoding::Depth,
11852        ) -> fidl::Result<()> {
11853            decoder.debug_check_bounds::<Self>(offset);
11854            // Verify that padding bytes are zero.
11855            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11856            Ok(())
11857        }
11858    }
11859
11860    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
11861        type Borrowed<'a> = &'a mut Self;
11862        fn take_or_borrow<'a>(
11863            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11864        ) -> Self::Borrowed<'a> {
11865            value
11866        }
11867    }
11868
11869    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
11870        type Owned = Self;
11871
11872        #[inline(always)]
11873        fn inline_align(_context: fidl::encoding::Context) -> usize {
11874            4
11875        }
11876
11877        #[inline(always)]
11878        fn inline_size(_context: fidl::encoding::Context) -> usize {
11879            4
11880        }
11881    }
11882
11883    unsafe impl
11884        fidl::encoding::Encode<
11885            DebugResourceGetResponse,
11886            fidl::encoding::DefaultFuchsiaResourceDialect,
11887        > for &mut DebugResourceGetResponse
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::<DebugResourceGetResponse>(offset);
11900            // Delegate to tuple encoding.
11901            fidl::encoding::Encode::<
11902                DebugResourceGetResponse,
11903                fidl::encoding::DefaultFuchsiaResourceDialect,
11904            >::encode(
11905                (<fidl::encoding::HandleType<
11906                    fidl::Resource,
11907                    { fidl::ObjectType::RESOURCE.into_raw() },
11908                    2147483648,
11909                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11910                    &mut self.resource
11911                ),),
11912                encoder,
11913                offset,
11914                _depth,
11915            )
11916        }
11917    }
11918    unsafe impl<
11919        T0: fidl::encoding::Encode<
11920                fidl::encoding::HandleType<
11921                    fidl::Resource,
11922                    { fidl::ObjectType::RESOURCE.into_raw() },
11923                    2147483648,
11924                >,
11925                fidl::encoding::DefaultFuchsiaResourceDialect,
11926            >,
11927    >
11928        fidl::encoding::Encode<
11929            DebugResourceGetResponse,
11930            fidl::encoding::DefaultFuchsiaResourceDialect,
11931        > for (T0,)
11932    {
11933        #[inline]
11934        unsafe fn encode(
11935            self,
11936            encoder: &mut fidl::encoding::Encoder<
11937                '_,
11938                fidl::encoding::DefaultFuchsiaResourceDialect,
11939            >,
11940            offset: usize,
11941            depth: fidl::encoding::Depth,
11942        ) -> fidl::Result<()> {
11943            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11944            // Zero out padding regions. There's no need to apply masks
11945            // because the unmasked parts will be overwritten by fields.
11946            // Write the fields.
11947            self.0.encode(encoder, offset + 0, depth)?;
11948            Ok(())
11949        }
11950    }
11951
11952    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11953        for DebugResourceGetResponse
11954    {
11955        #[inline(always)]
11956        fn new_empty() -> Self {
11957            Self {
11958                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11959            }
11960        }
11961
11962        #[inline]
11963        unsafe fn decode(
11964            &mut self,
11965            decoder: &mut fidl::encoding::Decoder<
11966                '_,
11967                fidl::encoding::DefaultFuchsiaResourceDialect,
11968            >,
11969            offset: usize,
11970            _depth: fidl::encoding::Depth,
11971        ) -> fidl::Result<()> {
11972            decoder.debug_check_bounds::<Self>(offset);
11973            // Verify that padding bytes are zero.
11974            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11975            Ok(())
11976        }
11977    }
11978
11979    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
11980        type Borrowed<'a> = &'a mut Self;
11981        fn take_or_borrow<'a>(
11982            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11983        ) -> Self::Borrowed<'a> {
11984            value
11985        }
11986    }
11987
11988    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
11989        type Owned = Self;
11990
11991        #[inline(always)]
11992        fn inline_align(_context: fidl::encoding::Context) -> usize {
11993            4
11994        }
11995
11996        #[inline(always)]
11997        fn inline_size(_context: fidl::encoding::Context) -> usize {
11998            4
11999        }
12000    }
12001
12002    unsafe impl
12003        fidl::encoding::Encode<
12004            DebuglogResourceGetResponse,
12005            fidl::encoding::DefaultFuchsiaResourceDialect,
12006        > for &mut DebuglogResourceGetResponse
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::<DebuglogResourceGetResponse>(offset);
12019            // Delegate to tuple encoding.
12020            fidl::encoding::Encode::<
12021                DebuglogResourceGetResponse,
12022                fidl::encoding::DefaultFuchsiaResourceDialect,
12023            >::encode(
12024                (<fidl::encoding::HandleType<
12025                    fidl::Resource,
12026                    { fidl::ObjectType::RESOURCE.into_raw() },
12027                    2147483648,
12028                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12029                    &mut self.resource
12030                ),),
12031                encoder,
12032                offset,
12033                _depth,
12034            )
12035        }
12036    }
12037    unsafe impl<
12038        T0: fidl::encoding::Encode<
12039                fidl::encoding::HandleType<
12040                    fidl::Resource,
12041                    { fidl::ObjectType::RESOURCE.into_raw() },
12042                    2147483648,
12043                >,
12044                fidl::encoding::DefaultFuchsiaResourceDialect,
12045            >,
12046    >
12047        fidl::encoding::Encode<
12048            DebuglogResourceGetResponse,
12049            fidl::encoding::DefaultFuchsiaResourceDialect,
12050        > for (T0,)
12051    {
12052        #[inline]
12053        unsafe fn encode(
12054            self,
12055            encoder: &mut fidl::encoding::Encoder<
12056                '_,
12057                fidl::encoding::DefaultFuchsiaResourceDialect,
12058            >,
12059            offset: usize,
12060            depth: fidl::encoding::Depth,
12061        ) -> fidl::Result<()> {
12062            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
12063            // Zero out padding regions. There's no need to apply masks
12064            // because the unmasked parts will be overwritten by fields.
12065            // Write the fields.
12066            self.0.encode(encoder, offset + 0, depth)?;
12067            Ok(())
12068        }
12069    }
12070
12071    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12072        for DebuglogResourceGetResponse
12073    {
12074        #[inline(always)]
12075        fn new_empty() -> Self {
12076            Self {
12077                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12078            }
12079        }
12080
12081        #[inline]
12082        unsafe fn decode(
12083            &mut self,
12084            decoder: &mut fidl::encoding::Decoder<
12085                '_,
12086                fidl::encoding::DefaultFuchsiaResourceDialect,
12087            >,
12088            offset: usize,
12089            _depth: fidl::encoding::Depth,
12090        ) -> fidl::Result<()> {
12091            decoder.debug_check_bounds::<Self>(offset);
12092            // Verify that padding bytes are zero.
12093            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12094            Ok(())
12095        }
12096    }
12097
12098    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
12099        type Borrowed<'a> = &'a mut Self;
12100        fn take_or_borrow<'a>(
12101            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12102        ) -> Self::Borrowed<'a> {
12103            value
12104        }
12105    }
12106
12107    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
12108        type Owned = Self;
12109
12110        #[inline(always)]
12111        fn inline_align(_context: fidl::encoding::Context) -> usize {
12112            4
12113        }
12114
12115        #[inline(always)]
12116        fn inline_size(_context: fidl::encoding::Context) -> usize {
12117            4
12118        }
12119    }
12120
12121    unsafe impl
12122        fidl::encoding::Encode<
12123            EnergyInfoResourceGetResponse,
12124            fidl::encoding::DefaultFuchsiaResourceDialect,
12125        > for &mut EnergyInfoResourceGetResponse
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::<EnergyInfoResourceGetResponse>(offset);
12138            // Delegate to tuple encoding.
12139            fidl::encoding::Encode::<
12140                EnergyInfoResourceGetResponse,
12141                fidl::encoding::DefaultFuchsiaResourceDialect,
12142            >::encode(
12143                (<fidl::encoding::HandleType<
12144                    fidl::Resource,
12145                    { fidl::ObjectType::RESOURCE.into_raw() },
12146                    2147483648,
12147                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12148                    &mut self.resource
12149                ),),
12150                encoder,
12151                offset,
12152                _depth,
12153            )
12154        }
12155    }
12156    unsafe impl<
12157        T0: fidl::encoding::Encode<
12158                fidl::encoding::HandleType<
12159                    fidl::Resource,
12160                    { fidl::ObjectType::RESOURCE.into_raw() },
12161                    2147483648,
12162                >,
12163                fidl::encoding::DefaultFuchsiaResourceDialect,
12164            >,
12165    >
12166        fidl::encoding::Encode<
12167            EnergyInfoResourceGetResponse,
12168            fidl::encoding::DefaultFuchsiaResourceDialect,
12169        > for (T0,)
12170    {
12171        #[inline]
12172        unsafe fn encode(
12173            self,
12174            encoder: &mut fidl::encoding::Encoder<
12175                '_,
12176                fidl::encoding::DefaultFuchsiaResourceDialect,
12177            >,
12178            offset: usize,
12179            depth: fidl::encoding::Depth,
12180        ) -> fidl::Result<()> {
12181            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
12182            // Zero out padding regions. There's no need to apply masks
12183            // because the unmasked parts will be overwritten by fields.
12184            // Write the fields.
12185            self.0.encode(encoder, offset + 0, depth)?;
12186            Ok(())
12187        }
12188    }
12189
12190    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12191        for EnergyInfoResourceGetResponse
12192    {
12193        #[inline(always)]
12194        fn new_empty() -> Self {
12195            Self {
12196                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12197            }
12198        }
12199
12200        #[inline]
12201        unsafe fn decode(
12202            &mut self,
12203            decoder: &mut fidl::encoding::Decoder<
12204                '_,
12205                fidl::encoding::DefaultFuchsiaResourceDialect,
12206            >,
12207            offset: usize,
12208            _depth: fidl::encoding::Depth,
12209        ) -> fidl::Result<()> {
12210            decoder.debug_check_bounds::<Self>(offset);
12211            // Verify that padding bytes are zero.
12212            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12213            Ok(())
12214        }
12215    }
12216
12217    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
12218        type Borrowed<'a> = &'a mut Self;
12219        fn take_or_borrow<'a>(
12220            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12221        ) -> Self::Borrowed<'a> {
12222            value
12223        }
12224    }
12225
12226    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
12227        type Owned = Self;
12228
12229        #[inline(always)]
12230        fn inline_align(_context: fidl::encoding::Context) -> usize {
12231            4
12232        }
12233
12234        #[inline(always)]
12235        fn inline_size(_context: fidl::encoding::Context) -> usize {
12236            4
12237        }
12238    }
12239
12240    unsafe impl
12241        fidl::encoding::Encode<
12242            HypervisorResourceGetResponse,
12243            fidl::encoding::DefaultFuchsiaResourceDialect,
12244        > for &mut HypervisorResourceGetResponse
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::<HypervisorResourceGetResponse>(offset);
12257            // Delegate to tuple encoding.
12258            fidl::encoding::Encode::<
12259                HypervisorResourceGetResponse,
12260                fidl::encoding::DefaultFuchsiaResourceDialect,
12261            >::encode(
12262                (<fidl::encoding::HandleType<
12263                    fidl::Resource,
12264                    { fidl::ObjectType::RESOURCE.into_raw() },
12265                    2147483648,
12266                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12267                    &mut self.resource
12268                ),),
12269                encoder,
12270                offset,
12271                _depth,
12272            )
12273        }
12274    }
12275    unsafe impl<
12276        T0: fidl::encoding::Encode<
12277                fidl::encoding::HandleType<
12278                    fidl::Resource,
12279                    { fidl::ObjectType::RESOURCE.into_raw() },
12280                    2147483648,
12281                >,
12282                fidl::encoding::DefaultFuchsiaResourceDialect,
12283            >,
12284    >
12285        fidl::encoding::Encode<
12286            HypervisorResourceGetResponse,
12287            fidl::encoding::DefaultFuchsiaResourceDialect,
12288        > for (T0,)
12289    {
12290        #[inline]
12291        unsafe fn encode(
12292            self,
12293            encoder: &mut fidl::encoding::Encoder<
12294                '_,
12295                fidl::encoding::DefaultFuchsiaResourceDialect,
12296            >,
12297            offset: usize,
12298            depth: fidl::encoding::Depth,
12299        ) -> fidl::Result<()> {
12300            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12301            // Zero out padding regions. There's no need to apply masks
12302            // because the unmasked parts will be overwritten by fields.
12303            // Write the fields.
12304            self.0.encode(encoder, offset + 0, depth)?;
12305            Ok(())
12306        }
12307    }
12308
12309    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12310        for HypervisorResourceGetResponse
12311    {
12312        #[inline(always)]
12313        fn new_empty() -> Self {
12314            Self {
12315                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12316            }
12317        }
12318
12319        #[inline]
12320        unsafe fn decode(
12321            &mut self,
12322            decoder: &mut fidl::encoding::Decoder<
12323                '_,
12324                fidl::encoding::DefaultFuchsiaResourceDialect,
12325            >,
12326            offset: usize,
12327            _depth: fidl::encoding::Depth,
12328        ) -> fidl::Result<()> {
12329            decoder.debug_check_bounds::<Self>(offset);
12330            // Verify that padding bytes are zero.
12331            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12332            Ok(())
12333        }
12334    }
12335
12336    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
12337        type Borrowed<'a> = &'a mut Self;
12338        fn take_or_borrow<'a>(
12339            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12340        ) -> Self::Borrowed<'a> {
12341            value
12342        }
12343    }
12344
12345    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
12346        type Owned = Self;
12347
12348        #[inline(always)]
12349        fn inline_align(_context: fidl::encoding::Context) -> usize {
12350            4
12351        }
12352
12353        #[inline(always)]
12354        fn inline_size(_context: fidl::encoding::Context) -> usize {
12355            4
12356        }
12357    }
12358
12359    unsafe impl
12360        fidl::encoding::Encode<
12361            InfoResourceGetResponse,
12362            fidl::encoding::DefaultFuchsiaResourceDialect,
12363        > for &mut InfoResourceGetResponse
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::<InfoResourceGetResponse>(offset);
12376            // Delegate to tuple encoding.
12377            fidl::encoding::Encode::<
12378                InfoResourceGetResponse,
12379                fidl::encoding::DefaultFuchsiaResourceDialect,
12380            >::encode(
12381                (<fidl::encoding::HandleType<
12382                    fidl::Resource,
12383                    { fidl::ObjectType::RESOURCE.into_raw() },
12384                    2147483648,
12385                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12386                    &mut self.resource
12387                ),),
12388                encoder,
12389                offset,
12390                _depth,
12391            )
12392        }
12393    }
12394    unsafe impl<
12395        T0: fidl::encoding::Encode<
12396                fidl::encoding::HandleType<
12397                    fidl::Resource,
12398                    { fidl::ObjectType::RESOURCE.into_raw() },
12399                    2147483648,
12400                >,
12401                fidl::encoding::DefaultFuchsiaResourceDialect,
12402            >,
12403    >
12404        fidl::encoding::Encode<
12405            InfoResourceGetResponse,
12406            fidl::encoding::DefaultFuchsiaResourceDialect,
12407        > for (T0,)
12408    {
12409        #[inline]
12410        unsafe fn encode(
12411            self,
12412            encoder: &mut fidl::encoding::Encoder<
12413                '_,
12414                fidl::encoding::DefaultFuchsiaResourceDialect,
12415            >,
12416            offset: usize,
12417            depth: fidl::encoding::Depth,
12418        ) -> fidl::Result<()> {
12419            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12420            // Zero out padding regions. There's no need to apply masks
12421            // because the unmasked parts will be overwritten by fields.
12422            // Write the fields.
12423            self.0.encode(encoder, offset + 0, depth)?;
12424            Ok(())
12425        }
12426    }
12427
12428    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12429        for InfoResourceGetResponse
12430    {
12431        #[inline(always)]
12432        fn new_empty() -> Self {
12433            Self {
12434                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12435            }
12436        }
12437
12438        #[inline]
12439        unsafe fn decode(
12440            &mut self,
12441            decoder: &mut fidl::encoding::Decoder<
12442                '_,
12443                fidl::encoding::DefaultFuchsiaResourceDialect,
12444            >,
12445            offset: usize,
12446            _depth: fidl::encoding::Depth,
12447        ) -> fidl::Result<()> {
12448            decoder.debug_check_bounds::<Self>(offset);
12449            // Verify that padding bytes are zero.
12450            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12451            Ok(())
12452        }
12453    }
12454
12455    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
12456        type Borrowed<'a> = &'a mut Self;
12457        fn take_or_borrow<'a>(
12458            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12459        ) -> Self::Borrowed<'a> {
12460            value
12461        }
12462    }
12463
12464    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
12465        type Owned = Self;
12466
12467        #[inline(always)]
12468        fn inline_align(_context: fidl::encoding::Context) -> usize {
12469            4
12470        }
12471
12472        #[inline(always)]
12473        fn inline_size(_context: fidl::encoding::Context) -> usize {
12474            4
12475        }
12476    }
12477
12478    unsafe impl
12479        fidl::encoding::Encode<
12480            IommuResourceGetResponse,
12481            fidl::encoding::DefaultFuchsiaResourceDialect,
12482        > for &mut IommuResourceGetResponse
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::<IommuResourceGetResponse>(offset);
12495            // Delegate to tuple encoding.
12496            fidl::encoding::Encode::<
12497                IommuResourceGetResponse,
12498                fidl::encoding::DefaultFuchsiaResourceDialect,
12499            >::encode(
12500                (<fidl::encoding::HandleType<
12501                    fidl::Resource,
12502                    { fidl::ObjectType::RESOURCE.into_raw() },
12503                    2147483648,
12504                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12505                    &mut self.resource
12506                ),),
12507                encoder,
12508                offset,
12509                _depth,
12510            )
12511        }
12512    }
12513    unsafe impl<
12514        T0: fidl::encoding::Encode<
12515                fidl::encoding::HandleType<
12516                    fidl::Resource,
12517                    { fidl::ObjectType::RESOURCE.into_raw() },
12518                    2147483648,
12519                >,
12520                fidl::encoding::DefaultFuchsiaResourceDialect,
12521            >,
12522    >
12523        fidl::encoding::Encode<
12524            IommuResourceGetResponse,
12525            fidl::encoding::DefaultFuchsiaResourceDialect,
12526        > for (T0,)
12527    {
12528        #[inline]
12529        unsafe fn encode(
12530            self,
12531            encoder: &mut fidl::encoding::Encoder<
12532                '_,
12533                fidl::encoding::DefaultFuchsiaResourceDialect,
12534            >,
12535            offset: usize,
12536            depth: fidl::encoding::Depth,
12537        ) -> fidl::Result<()> {
12538            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12539            // Zero out padding regions. There's no need to apply masks
12540            // because the unmasked parts will be overwritten by fields.
12541            // Write the fields.
12542            self.0.encode(encoder, offset + 0, depth)?;
12543            Ok(())
12544        }
12545    }
12546
12547    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12548        for IommuResourceGetResponse
12549    {
12550        #[inline(always)]
12551        fn new_empty() -> Self {
12552            Self {
12553                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12554            }
12555        }
12556
12557        #[inline]
12558        unsafe fn decode(
12559            &mut self,
12560            decoder: &mut fidl::encoding::Decoder<
12561                '_,
12562                fidl::encoding::DefaultFuchsiaResourceDialect,
12563            >,
12564            offset: usize,
12565            _depth: fidl::encoding::Depth,
12566        ) -> fidl::Result<()> {
12567            decoder.debug_check_bounds::<Self>(offset);
12568            // Verify that padding bytes are zero.
12569            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12570            Ok(())
12571        }
12572    }
12573
12574    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
12575        type Borrowed<'a> = &'a mut Self;
12576        fn take_or_borrow<'a>(
12577            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12578        ) -> Self::Borrowed<'a> {
12579            value
12580        }
12581    }
12582
12583    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
12584        type Owned = Self;
12585
12586        #[inline(always)]
12587        fn inline_align(_context: fidl::encoding::Context) -> usize {
12588            4
12589        }
12590
12591        #[inline(always)]
12592        fn inline_size(_context: fidl::encoding::Context) -> usize {
12593            4
12594        }
12595    }
12596
12597    unsafe impl
12598        fidl::encoding::Encode<
12599            IoportResourceGetResponse,
12600            fidl::encoding::DefaultFuchsiaResourceDialect,
12601        > for &mut IoportResourceGetResponse
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::<IoportResourceGetResponse>(offset);
12614            // Delegate to tuple encoding.
12615            fidl::encoding::Encode::<
12616                IoportResourceGetResponse,
12617                fidl::encoding::DefaultFuchsiaResourceDialect,
12618            >::encode(
12619                (<fidl::encoding::HandleType<
12620                    fidl::Resource,
12621                    { fidl::ObjectType::RESOURCE.into_raw() },
12622                    2147483648,
12623                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12624                    &mut self.resource
12625                ),),
12626                encoder,
12627                offset,
12628                _depth,
12629            )
12630        }
12631    }
12632    unsafe impl<
12633        T0: fidl::encoding::Encode<
12634                fidl::encoding::HandleType<
12635                    fidl::Resource,
12636                    { fidl::ObjectType::RESOURCE.into_raw() },
12637                    2147483648,
12638                >,
12639                fidl::encoding::DefaultFuchsiaResourceDialect,
12640            >,
12641    >
12642        fidl::encoding::Encode<
12643            IoportResourceGetResponse,
12644            fidl::encoding::DefaultFuchsiaResourceDialect,
12645        > for (T0,)
12646    {
12647        #[inline]
12648        unsafe fn encode(
12649            self,
12650            encoder: &mut fidl::encoding::Encoder<
12651                '_,
12652                fidl::encoding::DefaultFuchsiaResourceDialect,
12653            >,
12654            offset: usize,
12655            depth: fidl::encoding::Depth,
12656        ) -> fidl::Result<()> {
12657            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12658            // Zero out padding regions. There's no need to apply masks
12659            // because the unmasked parts will be overwritten by fields.
12660            // Write the fields.
12661            self.0.encode(encoder, offset + 0, depth)?;
12662            Ok(())
12663        }
12664    }
12665
12666    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12667        for IoportResourceGetResponse
12668    {
12669        #[inline(always)]
12670        fn new_empty() -> Self {
12671            Self {
12672                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12673            }
12674        }
12675
12676        #[inline]
12677        unsafe fn decode(
12678            &mut self,
12679            decoder: &mut fidl::encoding::Decoder<
12680                '_,
12681                fidl::encoding::DefaultFuchsiaResourceDialect,
12682            >,
12683            offset: usize,
12684            _depth: fidl::encoding::Depth,
12685        ) -> fidl::Result<()> {
12686            decoder.debug_check_bounds::<Self>(offset);
12687            // Verify that padding bytes are zero.
12688            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12689            Ok(())
12690        }
12691    }
12692
12693    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
12694        type Borrowed<'a> = &'a mut Self;
12695        fn take_or_borrow<'a>(
12696            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12697        ) -> Self::Borrowed<'a> {
12698            value
12699        }
12700    }
12701
12702    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
12703        type Owned = Self;
12704
12705        #[inline(always)]
12706        fn inline_align(_context: fidl::encoding::Context) -> usize {
12707            4
12708        }
12709
12710        #[inline(always)]
12711        fn inline_size(_context: fidl::encoding::Context) -> usize {
12712            4
12713        }
12714    }
12715
12716    unsafe impl
12717        fidl::encoding::Encode<
12718            IrqResourceGetResponse,
12719            fidl::encoding::DefaultFuchsiaResourceDialect,
12720        > for &mut IrqResourceGetResponse
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::<IrqResourceGetResponse>(offset);
12733            // Delegate to tuple encoding.
12734            fidl::encoding::Encode::<
12735                IrqResourceGetResponse,
12736                fidl::encoding::DefaultFuchsiaResourceDialect,
12737            >::encode(
12738                (<fidl::encoding::HandleType<
12739                    fidl::Resource,
12740                    { fidl::ObjectType::RESOURCE.into_raw() },
12741                    2147483648,
12742                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12743                    &mut self.resource
12744                ),),
12745                encoder,
12746                offset,
12747                _depth,
12748            )
12749        }
12750    }
12751    unsafe impl<
12752        T0: fidl::encoding::Encode<
12753                fidl::encoding::HandleType<
12754                    fidl::Resource,
12755                    { fidl::ObjectType::RESOURCE.into_raw() },
12756                    2147483648,
12757                >,
12758                fidl::encoding::DefaultFuchsiaResourceDialect,
12759            >,
12760    >
12761        fidl::encoding::Encode<
12762            IrqResourceGetResponse,
12763            fidl::encoding::DefaultFuchsiaResourceDialect,
12764        > for (T0,)
12765    {
12766        #[inline]
12767        unsafe fn encode(
12768            self,
12769            encoder: &mut fidl::encoding::Encoder<
12770                '_,
12771                fidl::encoding::DefaultFuchsiaResourceDialect,
12772            >,
12773            offset: usize,
12774            depth: fidl::encoding::Depth,
12775        ) -> fidl::Result<()> {
12776            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12777            // Zero out padding regions. There's no need to apply masks
12778            // because the unmasked parts will be overwritten by fields.
12779            // Write the fields.
12780            self.0.encode(encoder, offset + 0, depth)?;
12781            Ok(())
12782        }
12783    }
12784
12785    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12786        for IrqResourceGetResponse
12787    {
12788        #[inline(always)]
12789        fn new_empty() -> Self {
12790            Self {
12791                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12792            }
12793        }
12794
12795        #[inline]
12796        unsafe fn decode(
12797            &mut self,
12798            decoder: &mut fidl::encoding::Decoder<
12799                '_,
12800                fidl::encoding::DefaultFuchsiaResourceDialect,
12801            >,
12802            offset: usize,
12803            _depth: fidl::encoding::Depth,
12804        ) -> fidl::Result<()> {
12805            decoder.debug_check_bounds::<Self>(offset);
12806            // Verify that padding bytes are zero.
12807            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12808            Ok(())
12809        }
12810    }
12811
12812    impl fidl::encoding::ResourceTypeMarker for MexecResourceGetResponse {
12813        type Borrowed<'a> = &'a mut Self;
12814        fn take_or_borrow<'a>(
12815            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12816        ) -> Self::Borrowed<'a> {
12817            value
12818        }
12819    }
12820
12821    unsafe impl fidl::encoding::TypeMarker for MexecResourceGetResponse {
12822        type Owned = Self;
12823
12824        #[inline(always)]
12825        fn inline_align(_context: fidl::encoding::Context) -> usize {
12826            4
12827        }
12828
12829        #[inline(always)]
12830        fn inline_size(_context: fidl::encoding::Context) -> usize {
12831            4
12832        }
12833    }
12834
12835    unsafe impl
12836        fidl::encoding::Encode<
12837            MexecResourceGetResponse,
12838            fidl::encoding::DefaultFuchsiaResourceDialect,
12839        > for &mut MexecResourceGetResponse
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::<MexecResourceGetResponse>(offset);
12852            // Delegate to tuple encoding.
12853            fidl::encoding::Encode::<
12854                MexecResourceGetResponse,
12855                fidl::encoding::DefaultFuchsiaResourceDialect,
12856            >::encode(
12857                (<fidl::encoding::HandleType<
12858                    fidl::Resource,
12859                    { fidl::ObjectType::RESOURCE.into_raw() },
12860                    2147483648,
12861                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12862                    &mut self.resource
12863                ),),
12864                encoder,
12865                offset,
12866                _depth,
12867            )
12868        }
12869    }
12870    unsafe impl<
12871        T0: fidl::encoding::Encode<
12872                fidl::encoding::HandleType<
12873                    fidl::Resource,
12874                    { fidl::ObjectType::RESOURCE.into_raw() },
12875                    2147483648,
12876                >,
12877                fidl::encoding::DefaultFuchsiaResourceDialect,
12878            >,
12879    >
12880        fidl::encoding::Encode<
12881            MexecResourceGetResponse,
12882            fidl::encoding::DefaultFuchsiaResourceDialect,
12883        > for (T0,)
12884    {
12885        #[inline]
12886        unsafe fn encode(
12887            self,
12888            encoder: &mut fidl::encoding::Encoder<
12889                '_,
12890                fidl::encoding::DefaultFuchsiaResourceDialect,
12891            >,
12892            offset: usize,
12893            depth: fidl::encoding::Depth,
12894        ) -> fidl::Result<()> {
12895            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12896            // Zero out padding regions. There's no need to apply masks
12897            // because the unmasked parts will be overwritten by fields.
12898            // Write the fields.
12899            self.0.encode(encoder, offset + 0, depth)?;
12900            Ok(())
12901        }
12902    }
12903
12904    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12905        for MexecResourceGetResponse
12906    {
12907        #[inline(always)]
12908        fn new_empty() -> Self {
12909            Self {
12910                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12911            }
12912        }
12913
12914        #[inline]
12915        unsafe fn decode(
12916            &mut self,
12917            decoder: &mut fidl::encoding::Decoder<
12918                '_,
12919                fidl::encoding::DefaultFuchsiaResourceDialect,
12920            >,
12921            offset: usize,
12922            _depth: fidl::encoding::Depth,
12923        ) -> fidl::Result<()> {
12924            decoder.debug_check_bounds::<Self>(offset);
12925            // Verify that padding bytes are zero.
12926            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12927            Ok(())
12928        }
12929    }
12930
12931    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
12932        type Borrowed<'a> = &'a mut Self;
12933        fn take_or_borrow<'a>(
12934            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12935        ) -> Self::Borrowed<'a> {
12936            value
12937        }
12938    }
12939
12940    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
12941        type Owned = Self;
12942
12943        #[inline(always)]
12944        fn inline_align(_context: fidl::encoding::Context) -> usize {
12945            4
12946        }
12947
12948        #[inline(always)]
12949        fn inline_size(_context: fidl::encoding::Context) -> usize {
12950            4
12951        }
12952    }
12953
12954    unsafe impl
12955        fidl::encoding::Encode<
12956            MmioResourceGetResponse,
12957            fidl::encoding::DefaultFuchsiaResourceDialect,
12958        > for &mut MmioResourceGetResponse
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::<MmioResourceGetResponse>(offset);
12971            // Delegate to tuple encoding.
12972            fidl::encoding::Encode::<
12973                MmioResourceGetResponse,
12974                fidl::encoding::DefaultFuchsiaResourceDialect,
12975            >::encode(
12976                (<fidl::encoding::HandleType<
12977                    fidl::Resource,
12978                    { fidl::ObjectType::RESOURCE.into_raw() },
12979                    2147483648,
12980                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12981                    &mut self.resource
12982                ),),
12983                encoder,
12984                offset,
12985                _depth,
12986            )
12987        }
12988    }
12989    unsafe impl<
12990        T0: fidl::encoding::Encode<
12991                fidl::encoding::HandleType<
12992                    fidl::Resource,
12993                    { fidl::ObjectType::RESOURCE.into_raw() },
12994                    2147483648,
12995                >,
12996                fidl::encoding::DefaultFuchsiaResourceDialect,
12997            >,
12998    >
12999        fidl::encoding::Encode<
13000            MmioResourceGetResponse,
13001            fidl::encoding::DefaultFuchsiaResourceDialect,
13002        > for (T0,)
13003    {
13004        #[inline]
13005        unsafe fn encode(
13006            self,
13007            encoder: &mut fidl::encoding::Encoder<
13008                '_,
13009                fidl::encoding::DefaultFuchsiaResourceDialect,
13010            >,
13011            offset: usize,
13012            depth: fidl::encoding::Depth,
13013        ) -> fidl::Result<()> {
13014            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
13015            // Zero out padding regions. There's no need to apply masks
13016            // because the unmasked parts will be overwritten by fields.
13017            // Write the fields.
13018            self.0.encode(encoder, offset + 0, depth)?;
13019            Ok(())
13020        }
13021    }
13022
13023    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13024        for MmioResourceGetResponse
13025    {
13026        #[inline(always)]
13027        fn new_empty() -> Self {
13028            Self {
13029                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13030            }
13031        }
13032
13033        #[inline]
13034        unsafe fn decode(
13035            &mut self,
13036            decoder: &mut fidl::encoding::Decoder<
13037                '_,
13038                fidl::encoding::DefaultFuchsiaResourceDialect,
13039            >,
13040            offset: usize,
13041            _depth: fidl::encoding::Depth,
13042        ) -> fidl::Result<()> {
13043            decoder.debug_check_bounds::<Self>(offset);
13044            // Verify that padding bytes are zero.
13045            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13046            Ok(())
13047        }
13048    }
13049
13050    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
13051        type Borrowed<'a> = &'a mut Self;
13052        fn take_or_borrow<'a>(
13053            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13054        ) -> Self::Borrowed<'a> {
13055            value
13056        }
13057    }
13058
13059    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
13060        type Owned = Self;
13061
13062        #[inline(always)]
13063        fn inline_align(_context: fidl::encoding::Context) -> usize {
13064            4
13065        }
13066
13067        #[inline(always)]
13068        fn inline_size(_context: fidl::encoding::Context) -> usize {
13069            4
13070        }
13071    }
13072
13073    unsafe impl
13074        fidl::encoding::Encode<
13075            MsiResourceGetResponse,
13076            fidl::encoding::DefaultFuchsiaResourceDialect,
13077        > for &mut MsiResourceGetResponse
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::<MsiResourceGetResponse>(offset);
13090            // Delegate to tuple encoding.
13091            fidl::encoding::Encode::<
13092                MsiResourceGetResponse,
13093                fidl::encoding::DefaultFuchsiaResourceDialect,
13094            >::encode(
13095                (<fidl::encoding::HandleType<
13096                    fidl::Resource,
13097                    { fidl::ObjectType::RESOURCE.into_raw() },
13098                    2147483648,
13099                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13100                    &mut self.resource
13101                ),),
13102                encoder,
13103                offset,
13104                _depth,
13105            )
13106        }
13107    }
13108    unsafe impl<
13109        T0: fidl::encoding::Encode<
13110                fidl::encoding::HandleType<
13111                    fidl::Resource,
13112                    { fidl::ObjectType::RESOURCE.into_raw() },
13113                    2147483648,
13114                >,
13115                fidl::encoding::DefaultFuchsiaResourceDialect,
13116            >,
13117    >
13118        fidl::encoding::Encode<
13119            MsiResourceGetResponse,
13120            fidl::encoding::DefaultFuchsiaResourceDialect,
13121        > for (T0,)
13122    {
13123        #[inline]
13124        unsafe fn encode(
13125            self,
13126            encoder: &mut fidl::encoding::Encoder<
13127                '_,
13128                fidl::encoding::DefaultFuchsiaResourceDialect,
13129            >,
13130            offset: usize,
13131            depth: fidl::encoding::Depth,
13132        ) -> fidl::Result<()> {
13133            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
13134            // Zero out padding regions. There's no need to apply masks
13135            // because the unmasked parts will be overwritten by fields.
13136            // Write the fields.
13137            self.0.encode(encoder, offset + 0, depth)?;
13138            Ok(())
13139        }
13140    }
13141
13142    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13143        for MsiResourceGetResponse
13144    {
13145        #[inline(always)]
13146        fn new_empty() -> Self {
13147            Self {
13148                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13149            }
13150        }
13151
13152        #[inline]
13153        unsafe fn decode(
13154            &mut self,
13155            decoder: &mut fidl::encoding::Decoder<
13156                '_,
13157                fidl::encoding::DefaultFuchsiaResourceDialect,
13158            >,
13159            offset: usize,
13160            _depth: fidl::encoding::Depth,
13161        ) -> fidl::Result<()> {
13162            decoder.debug_check_bounds::<Self>(offset);
13163            // Verify that padding bytes are zero.
13164            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13165            Ok(())
13166        }
13167    }
13168
13169    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
13170        type Borrowed<'a> = &'a mut Self;
13171        fn take_or_borrow<'a>(
13172            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13173        ) -> Self::Borrowed<'a> {
13174            value
13175        }
13176    }
13177
13178    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
13179        type Owned = Self;
13180
13181        #[inline(always)]
13182        fn inline_align(_context: fidl::encoding::Context) -> usize {
13183            4
13184        }
13185
13186        #[inline(always)]
13187        fn inline_size(_context: fidl::encoding::Context) -> usize {
13188            4
13189        }
13190    }
13191
13192    unsafe impl
13193        fidl::encoding::Encode<
13194            PowerResourceGetResponse,
13195            fidl::encoding::DefaultFuchsiaResourceDialect,
13196        > for &mut PowerResourceGetResponse
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::<PowerResourceGetResponse>(offset);
13209            // Delegate to tuple encoding.
13210            fidl::encoding::Encode::<
13211                PowerResourceGetResponse,
13212                fidl::encoding::DefaultFuchsiaResourceDialect,
13213            >::encode(
13214                (<fidl::encoding::HandleType<
13215                    fidl::Resource,
13216                    { fidl::ObjectType::RESOURCE.into_raw() },
13217                    2147483648,
13218                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13219                    &mut self.resource
13220                ),),
13221                encoder,
13222                offset,
13223                _depth,
13224            )
13225        }
13226    }
13227    unsafe impl<
13228        T0: fidl::encoding::Encode<
13229                fidl::encoding::HandleType<
13230                    fidl::Resource,
13231                    { fidl::ObjectType::RESOURCE.into_raw() },
13232                    2147483648,
13233                >,
13234                fidl::encoding::DefaultFuchsiaResourceDialect,
13235            >,
13236    >
13237        fidl::encoding::Encode<
13238            PowerResourceGetResponse,
13239            fidl::encoding::DefaultFuchsiaResourceDialect,
13240        > for (T0,)
13241    {
13242        #[inline]
13243        unsafe fn encode(
13244            self,
13245            encoder: &mut fidl::encoding::Encoder<
13246                '_,
13247                fidl::encoding::DefaultFuchsiaResourceDialect,
13248            >,
13249            offset: usize,
13250            depth: fidl::encoding::Depth,
13251        ) -> fidl::Result<()> {
13252            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
13253            // Zero out padding regions. There's no need to apply masks
13254            // because the unmasked parts will be overwritten by fields.
13255            // Write the fields.
13256            self.0.encode(encoder, offset + 0, depth)?;
13257            Ok(())
13258        }
13259    }
13260
13261    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13262        for PowerResourceGetResponse
13263    {
13264        #[inline(always)]
13265        fn new_empty() -> Self {
13266            Self {
13267                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13268            }
13269        }
13270
13271        #[inline]
13272        unsafe fn decode(
13273            &mut self,
13274            decoder: &mut fidl::encoding::Decoder<
13275                '_,
13276                fidl::encoding::DefaultFuchsiaResourceDialect,
13277            >,
13278            offset: usize,
13279            _depth: fidl::encoding::Depth,
13280        ) -> fidl::Result<()> {
13281            decoder.debug_check_bounds::<Self>(offset);
13282            // Verify that padding bytes are zero.
13283            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13284            Ok(())
13285        }
13286    }
13287
13288    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
13289        type Borrowed<'a> = &'a mut Self;
13290        fn take_or_borrow<'a>(
13291            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13292        ) -> Self::Borrowed<'a> {
13293            value
13294        }
13295    }
13296
13297    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
13298        type Owned = Self;
13299
13300        #[inline(always)]
13301        fn inline_align(_context: fidl::encoding::Context) -> usize {
13302            4
13303        }
13304
13305        #[inline(always)]
13306        fn inline_size(_context: fidl::encoding::Context) -> usize {
13307            4
13308        }
13309    }
13310
13311    unsafe impl
13312        fidl::encoding::Encode<
13313            ProfileResourceGetResponse,
13314            fidl::encoding::DefaultFuchsiaResourceDialect,
13315        > for &mut ProfileResourceGetResponse
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::<ProfileResourceGetResponse>(offset);
13328            // Delegate to tuple encoding.
13329            fidl::encoding::Encode::<
13330                ProfileResourceGetResponse,
13331                fidl::encoding::DefaultFuchsiaResourceDialect,
13332            >::encode(
13333                (<fidl::encoding::HandleType<
13334                    fidl::Resource,
13335                    { fidl::ObjectType::RESOURCE.into_raw() },
13336                    2147483648,
13337                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13338                    &mut self.resource
13339                ),),
13340                encoder,
13341                offset,
13342                _depth,
13343            )
13344        }
13345    }
13346    unsafe impl<
13347        T0: fidl::encoding::Encode<
13348                fidl::encoding::HandleType<
13349                    fidl::Resource,
13350                    { fidl::ObjectType::RESOURCE.into_raw() },
13351                    2147483648,
13352                >,
13353                fidl::encoding::DefaultFuchsiaResourceDialect,
13354            >,
13355    >
13356        fidl::encoding::Encode<
13357            ProfileResourceGetResponse,
13358            fidl::encoding::DefaultFuchsiaResourceDialect,
13359        > for (T0,)
13360    {
13361        #[inline]
13362        unsafe fn encode(
13363            self,
13364            encoder: &mut fidl::encoding::Encoder<
13365                '_,
13366                fidl::encoding::DefaultFuchsiaResourceDialect,
13367            >,
13368            offset: usize,
13369            depth: fidl::encoding::Depth,
13370        ) -> fidl::Result<()> {
13371            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13372            // Zero out padding regions. There's no need to apply masks
13373            // because the unmasked parts will be overwritten by fields.
13374            // Write the fields.
13375            self.0.encode(encoder, offset + 0, depth)?;
13376            Ok(())
13377        }
13378    }
13379
13380    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13381        for ProfileResourceGetResponse
13382    {
13383        #[inline(always)]
13384        fn new_empty() -> Self {
13385            Self {
13386                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13387            }
13388        }
13389
13390        #[inline]
13391        unsafe fn decode(
13392            &mut self,
13393            decoder: &mut fidl::encoding::Decoder<
13394                '_,
13395                fidl::encoding::DefaultFuchsiaResourceDialect,
13396            >,
13397            offset: usize,
13398            _depth: fidl::encoding::Depth,
13399        ) -> fidl::Result<()> {
13400            decoder.debug_check_bounds::<Self>(offset);
13401            // Verify that padding bytes are zero.
13402            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13403            Ok(())
13404        }
13405    }
13406
13407    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
13408        type Borrowed<'a> = &'a mut Self;
13409        fn take_or_borrow<'a>(
13410            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13411        ) -> Self::Borrowed<'a> {
13412            value
13413        }
13414    }
13415
13416    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
13417        type Owned = Self;
13418
13419        #[inline(always)]
13420        fn inline_align(_context: fidl::encoding::Context) -> usize {
13421            4
13422        }
13423
13424        #[inline(always)]
13425        fn inline_size(_context: fidl::encoding::Context) -> usize {
13426            4
13427        }
13428    }
13429
13430    unsafe impl
13431        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13432        for &mut RootJobGetResponse
13433    {
13434        #[inline]
13435        unsafe fn encode(
13436            self,
13437            encoder: &mut fidl::encoding::Encoder<
13438                '_,
13439                fidl::encoding::DefaultFuchsiaResourceDialect,
13440            >,
13441            offset: usize,
13442            _depth: fidl::encoding::Depth,
13443        ) -> fidl::Result<()> {
13444            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13445            // Delegate to tuple encoding.
13446            fidl::encoding::Encode::<
13447                RootJobGetResponse,
13448                fidl::encoding::DefaultFuchsiaResourceDialect,
13449            >::encode(
13450                (<fidl::encoding::HandleType<
13451                    fidl::Job,
13452                    { fidl::ObjectType::JOB.into_raw() },
13453                    2147483648,
13454                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13455                    &mut self.job
13456                ),),
13457                encoder,
13458                offset,
13459                _depth,
13460            )
13461        }
13462    }
13463    unsafe impl<
13464        T0: fidl::encoding::Encode<
13465                fidl::encoding::HandleType<
13466                    fidl::Job,
13467                    { fidl::ObjectType::JOB.into_raw() },
13468                    2147483648,
13469                >,
13470                fidl::encoding::DefaultFuchsiaResourceDialect,
13471            >,
13472    > fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13473        for (T0,)
13474    {
13475        #[inline]
13476        unsafe fn encode(
13477            self,
13478            encoder: &mut fidl::encoding::Encoder<
13479                '_,
13480                fidl::encoding::DefaultFuchsiaResourceDialect,
13481            >,
13482            offset: usize,
13483            depth: fidl::encoding::Depth,
13484        ) -> fidl::Result<()> {
13485            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13486            // Zero out padding regions. There's no need to apply masks
13487            // because the unmasked parts will be overwritten by fields.
13488            // Write the fields.
13489            self.0.encode(encoder, offset + 0, depth)?;
13490            Ok(())
13491        }
13492    }
13493
13494    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13495        for RootJobGetResponse
13496    {
13497        #[inline(always)]
13498        fn new_empty() -> Self {
13499            Self {
13500                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13501            }
13502        }
13503
13504        #[inline]
13505        unsafe fn decode(
13506            &mut self,
13507            decoder: &mut fidl::encoding::Decoder<
13508                '_,
13509                fidl::encoding::DefaultFuchsiaResourceDialect,
13510            >,
13511            offset: usize,
13512            _depth: fidl::encoding::Depth,
13513        ) -> fidl::Result<()> {
13514            decoder.debug_check_bounds::<Self>(offset);
13515            // Verify that padding bytes are zero.
13516            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
13517            Ok(())
13518        }
13519    }
13520
13521    impl fidl::encoding::ResourceTypeMarker for SamplingResourceGetResponse {
13522        type Borrowed<'a> = &'a mut Self;
13523        fn take_or_borrow<'a>(
13524            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13525        ) -> Self::Borrowed<'a> {
13526            value
13527        }
13528    }
13529
13530    unsafe impl fidl::encoding::TypeMarker for SamplingResourceGetResponse {
13531        type Owned = Self;
13532
13533        #[inline(always)]
13534        fn inline_align(_context: fidl::encoding::Context) -> usize {
13535            4
13536        }
13537
13538        #[inline(always)]
13539        fn inline_size(_context: fidl::encoding::Context) -> usize {
13540            4
13541        }
13542    }
13543
13544    unsafe impl
13545        fidl::encoding::Encode<
13546            SamplingResourceGetResponse,
13547            fidl::encoding::DefaultFuchsiaResourceDialect,
13548        > for &mut SamplingResourceGetResponse
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::<SamplingResourceGetResponse>(offset);
13561            // Delegate to tuple encoding.
13562            fidl::encoding::Encode::<
13563                SamplingResourceGetResponse,
13564                fidl::encoding::DefaultFuchsiaResourceDialect,
13565            >::encode(
13566                (<fidl::encoding::HandleType<
13567                    fidl::Resource,
13568                    { fidl::ObjectType::RESOURCE.into_raw() },
13569                    2147483648,
13570                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13571                    &mut self.resource
13572                ),),
13573                encoder,
13574                offset,
13575                _depth,
13576            )
13577        }
13578    }
13579    unsafe impl<
13580        T0: fidl::encoding::Encode<
13581                fidl::encoding::HandleType<
13582                    fidl::Resource,
13583                    { fidl::ObjectType::RESOURCE.into_raw() },
13584                    2147483648,
13585                >,
13586                fidl::encoding::DefaultFuchsiaResourceDialect,
13587            >,
13588    >
13589        fidl::encoding::Encode<
13590            SamplingResourceGetResponse,
13591            fidl::encoding::DefaultFuchsiaResourceDialect,
13592        > for (T0,)
13593    {
13594        #[inline]
13595        unsafe fn encode(
13596            self,
13597            encoder: &mut fidl::encoding::Encoder<
13598                '_,
13599                fidl::encoding::DefaultFuchsiaResourceDialect,
13600            >,
13601            offset: usize,
13602            depth: fidl::encoding::Depth,
13603        ) -> fidl::Result<()> {
13604            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13605            // Zero out padding regions. There's no need to apply masks
13606            // because the unmasked parts will be overwritten by fields.
13607            // Write the fields.
13608            self.0.encode(encoder, offset + 0, depth)?;
13609            Ok(())
13610        }
13611    }
13612
13613    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13614        for SamplingResourceGetResponse
13615    {
13616        #[inline(always)]
13617        fn new_empty() -> Self {
13618            Self {
13619                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13620            }
13621        }
13622
13623        #[inline]
13624        unsafe fn decode(
13625            &mut self,
13626            decoder: &mut fidl::encoding::Decoder<
13627                '_,
13628                fidl::encoding::DefaultFuchsiaResourceDialect,
13629            >,
13630            offset: usize,
13631            _depth: fidl::encoding::Depth,
13632        ) -> fidl::Result<()> {
13633            decoder.debug_check_bounds::<Self>(offset);
13634            // Verify that padding bytes are zero.
13635            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13636            Ok(())
13637        }
13638    }
13639
13640    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
13641        type Borrowed<'a> = &'a mut Self;
13642        fn take_or_borrow<'a>(
13643            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13644        ) -> Self::Borrowed<'a> {
13645            value
13646        }
13647    }
13648
13649    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
13650        type Owned = Self;
13651
13652        #[inline(always)]
13653        fn inline_align(_context: fidl::encoding::Context) -> usize {
13654            4
13655        }
13656
13657        #[inline(always)]
13658        fn inline_size(_context: fidl::encoding::Context) -> usize {
13659            4
13660        }
13661    }
13662
13663    unsafe impl
13664        fidl::encoding::Encode<
13665            SmcResourceGetResponse,
13666            fidl::encoding::DefaultFuchsiaResourceDialect,
13667        > for &mut SmcResourceGetResponse
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::<SmcResourceGetResponse>(offset);
13680            // Delegate to tuple encoding.
13681            fidl::encoding::Encode::<
13682                SmcResourceGetResponse,
13683                fidl::encoding::DefaultFuchsiaResourceDialect,
13684            >::encode(
13685                (<fidl::encoding::HandleType<
13686                    fidl::Resource,
13687                    { fidl::ObjectType::RESOURCE.into_raw() },
13688                    2147483648,
13689                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13690                    &mut self.resource
13691                ),),
13692                encoder,
13693                offset,
13694                _depth,
13695            )
13696        }
13697    }
13698    unsafe impl<
13699        T0: fidl::encoding::Encode<
13700                fidl::encoding::HandleType<
13701                    fidl::Resource,
13702                    { fidl::ObjectType::RESOURCE.into_raw() },
13703                    2147483648,
13704                >,
13705                fidl::encoding::DefaultFuchsiaResourceDialect,
13706            >,
13707    >
13708        fidl::encoding::Encode<
13709            SmcResourceGetResponse,
13710            fidl::encoding::DefaultFuchsiaResourceDialect,
13711        > for (T0,)
13712    {
13713        #[inline]
13714        unsafe fn encode(
13715            self,
13716            encoder: &mut fidl::encoding::Encoder<
13717                '_,
13718                fidl::encoding::DefaultFuchsiaResourceDialect,
13719            >,
13720            offset: usize,
13721            depth: fidl::encoding::Depth,
13722        ) -> fidl::Result<()> {
13723            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13724            // Zero out padding regions. There's no need to apply masks
13725            // because the unmasked parts will be overwritten by fields.
13726            // Write the fields.
13727            self.0.encode(encoder, offset + 0, depth)?;
13728            Ok(())
13729        }
13730    }
13731
13732    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13733        for SmcResourceGetResponse
13734    {
13735        #[inline(always)]
13736        fn new_empty() -> Self {
13737            Self {
13738                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13739            }
13740        }
13741
13742        #[inline]
13743        unsafe fn decode(
13744            &mut self,
13745            decoder: &mut fidl::encoding::Decoder<
13746                '_,
13747                fidl::encoding::DefaultFuchsiaResourceDialect,
13748            >,
13749            offset: usize,
13750            _depth: fidl::encoding::Depth,
13751        ) -> fidl::Result<()> {
13752            decoder.debug_check_bounds::<Self>(offset);
13753            // Verify that padding bytes are zero.
13754            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13755            Ok(())
13756        }
13757    }
13758
13759    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
13760        type Borrowed<'a> = &'a mut Self;
13761        fn take_or_borrow<'a>(
13762            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13763        ) -> Self::Borrowed<'a> {
13764            value
13765        }
13766    }
13767
13768    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
13769        type Owned = Self;
13770
13771        #[inline(always)]
13772        fn inline_align(_context: fidl::encoding::Context) -> usize {
13773            4
13774        }
13775
13776        #[inline(always)]
13777        fn inline_size(_context: fidl::encoding::Context) -> usize {
13778            4
13779        }
13780    }
13781
13782    unsafe impl
13783        fidl::encoding::Encode<
13784            StallResourceGetResponse,
13785            fidl::encoding::DefaultFuchsiaResourceDialect,
13786        > for &mut StallResourceGetResponse
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::<StallResourceGetResponse>(offset);
13799            // Delegate to tuple encoding.
13800            fidl::encoding::Encode::<
13801                StallResourceGetResponse,
13802                fidl::encoding::DefaultFuchsiaResourceDialect,
13803            >::encode(
13804                (<fidl::encoding::HandleType<
13805                    fidl::Resource,
13806                    { fidl::ObjectType::RESOURCE.into_raw() },
13807                    2147483648,
13808                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13809                    &mut self.resource
13810                ),),
13811                encoder,
13812                offset,
13813                _depth,
13814            )
13815        }
13816    }
13817    unsafe impl<
13818        T0: fidl::encoding::Encode<
13819                fidl::encoding::HandleType<
13820                    fidl::Resource,
13821                    { fidl::ObjectType::RESOURCE.into_raw() },
13822                    2147483648,
13823                >,
13824                fidl::encoding::DefaultFuchsiaResourceDialect,
13825            >,
13826    >
13827        fidl::encoding::Encode<
13828            StallResourceGetResponse,
13829            fidl::encoding::DefaultFuchsiaResourceDialect,
13830        > for (T0,)
13831    {
13832        #[inline]
13833        unsafe fn encode(
13834            self,
13835            encoder: &mut fidl::encoding::Encoder<
13836                '_,
13837                fidl::encoding::DefaultFuchsiaResourceDialect,
13838            >,
13839            offset: usize,
13840            depth: fidl::encoding::Depth,
13841        ) -> fidl::Result<()> {
13842            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13843            // Zero out padding regions. There's no need to apply masks
13844            // because the unmasked parts will be overwritten by fields.
13845            // Write the fields.
13846            self.0.encode(encoder, offset + 0, depth)?;
13847            Ok(())
13848        }
13849    }
13850
13851    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13852        for StallResourceGetResponse
13853    {
13854        #[inline(always)]
13855        fn new_empty() -> Self {
13856            Self {
13857                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13858            }
13859        }
13860
13861        #[inline]
13862        unsafe fn decode(
13863            &mut self,
13864            decoder: &mut fidl::encoding::Decoder<
13865                '_,
13866                fidl::encoding::DefaultFuchsiaResourceDialect,
13867            >,
13868            offset: usize,
13869            _depth: fidl::encoding::Depth,
13870        ) -> fidl::Result<()> {
13871            decoder.debug_check_bounds::<Self>(offset);
13872            // Verify that padding bytes are zero.
13873            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13874            Ok(())
13875        }
13876    }
13877
13878    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
13879        type Borrowed<'a> = &'a mut Self;
13880        fn take_or_borrow<'a>(
13881            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13882        ) -> Self::Borrowed<'a> {
13883            value
13884        }
13885    }
13886
13887    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
13888        type Owned = Self;
13889
13890        #[inline(always)]
13891        fn inline_align(_context: fidl::encoding::Context) -> usize {
13892            4
13893        }
13894
13895        #[inline(always)]
13896        fn inline_size(_context: fidl::encoding::Context) -> usize {
13897            4
13898        }
13899    }
13900
13901    unsafe impl
13902        fidl::encoding::Encode<
13903            TracingResourceGetResponse,
13904            fidl::encoding::DefaultFuchsiaResourceDialect,
13905        > for &mut TracingResourceGetResponse
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::<TracingResourceGetResponse>(offset);
13918            // Delegate to tuple encoding.
13919            fidl::encoding::Encode::<
13920                TracingResourceGetResponse,
13921                fidl::encoding::DefaultFuchsiaResourceDialect,
13922            >::encode(
13923                (<fidl::encoding::HandleType<
13924                    fidl::Resource,
13925                    { fidl::ObjectType::RESOURCE.into_raw() },
13926                    2147483648,
13927                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13928                    &mut self.resource
13929                ),),
13930                encoder,
13931                offset,
13932                _depth,
13933            )
13934        }
13935    }
13936    unsafe impl<
13937        T0: fidl::encoding::Encode<
13938                fidl::encoding::HandleType<
13939                    fidl::Resource,
13940                    { fidl::ObjectType::RESOURCE.into_raw() },
13941                    2147483648,
13942                >,
13943                fidl::encoding::DefaultFuchsiaResourceDialect,
13944            >,
13945    >
13946        fidl::encoding::Encode<
13947            TracingResourceGetResponse,
13948            fidl::encoding::DefaultFuchsiaResourceDialect,
13949        > for (T0,)
13950    {
13951        #[inline]
13952        unsafe fn encode(
13953            self,
13954            encoder: &mut fidl::encoding::Encoder<
13955                '_,
13956                fidl::encoding::DefaultFuchsiaResourceDialect,
13957            >,
13958            offset: usize,
13959            depth: fidl::encoding::Depth,
13960        ) -> fidl::Result<()> {
13961            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13962            // Zero out padding regions. There's no need to apply masks
13963            // because the unmasked parts will be overwritten by fields.
13964            // Write the fields.
13965            self.0.encode(encoder, offset + 0, depth)?;
13966            Ok(())
13967        }
13968    }
13969
13970    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13971        for TracingResourceGetResponse
13972    {
13973        #[inline(always)]
13974        fn new_empty() -> Self {
13975            Self {
13976                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13977            }
13978        }
13979
13980        #[inline]
13981        unsafe fn decode(
13982            &mut self,
13983            decoder: &mut fidl::encoding::Decoder<
13984                '_,
13985                fidl::encoding::DefaultFuchsiaResourceDialect,
13986            >,
13987            offset: usize,
13988            _depth: fidl::encoding::Depth,
13989        ) -> fidl::Result<()> {
13990            decoder.debug_check_bounds::<Self>(offset);
13991            // Verify that padding bytes are zero.
13992            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13993            Ok(())
13994        }
13995    }
13996
13997    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
13998        type Borrowed<'a> = &'a mut Self;
13999        fn take_or_borrow<'a>(
14000            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14001        ) -> Self::Borrowed<'a> {
14002            value
14003        }
14004    }
14005
14006    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
14007        type Owned = Self;
14008
14009        #[inline(always)]
14010        fn inline_align(_context: fidl::encoding::Context) -> usize {
14011            4
14012        }
14013
14014        #[inline(always)]
14015        fn inline_size(_context: fidl::encoding::Context) -> usize {
14016            4
14017        }
14018    }
14019
14020    unsafe impl
14021        fidl::encoding::Encode<
14022            VmexResourceGetResponse,
14023            fidl::encoding::DefaultFuchsiaResourceDialect,
14024        > for &mut VmexResourceGetResponse
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::<VmexResourceGetResponse>(offset);
14037            // Delegate to tuple encoding.
14038            fidl::encoding::Encode::<
14039                VmexResourceGetResponse,
14040                fidl::encoding::DefaultFuchsiaResourceDialect,
14041            >::encode(
14042                (<fidl::encoding::HandleType<
14043                    fidl::Resource,
14044                    { fidl::ObjectType::RESOURCE.into_raw() },
14045                    2147483648,
14046                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14047                    &mut self.resource
14048                ),),
14049                encoder,
14050                offset,
14051                _depth,
14052            )
14053        }
14054    }
14055    unsafe impl<
14056        T0: fidl::encoding::Encode<
14057                fidl::encoding::HandleType<
14058                    fidl::Resource,
14059                    { fidl::ObjectType::RESOURCE.into_raw() },
14060                    2147483648,
14061                >,
14062                fidl::encoding::DefaultFuchsiaResourceDialect,
14063            >,
14064    >
14065        fidl::encoding::Encode<
14066            VmexResourceGetResponse,
14067            fidl::encoding::DefaultFuchsiaResourceDialect,
14068        > for (T0,)
14069    {
14070        #[inline]
14071        unsafe fn encode(
14072            self,
14073            encoder: &mut fidl::encoding::Encoder<
14074                '_,
14075                fidl::encoding::DefaultFuchsiaResourceDialect,
14076            >,
14077            offset: usize,
14078            depth: fidl::encoding::Depth,
14079        ) -> fidl::Result<()> {
14080            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
14081            // Zero out padding regions. There's no need to apply masks
14082            // because the unmasked parts will be overwritten by fields.
14083            // Write the fields.
14084            self.0.encode(encoder, offset + 0, depth)?;
14085            Ok(())
14086        }
14087    }
14088
14089    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14090        for VmexResourceGetResponse
14091    {
14092        #[inline(always)]
14093        fn new_empty() -> Self {
14094            Self {
14095                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14096            }
14097        }
14098
14099        #[inline]
14100        unsafe fn decode(
14101            &mut self,
14102            decoder: &mut fidl::encoding::Decoder<
14103                '_,
14104                fidl::encoding::DefaultFuchsiaResourceDialect,
14105            >,
14106            offset: usize,
14107            _depth: fidl::encoding::Depth,
14108        ) -> fidl::Result<()> {
14109            decoder.debug_check_bounds::<Self>(offset);
14110            // Verify that padding bytes are zero.
14111            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14112            Ok(())
14113        }
14114    }
14115}