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::NullableHandle {
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
626    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
627        self.inner.shutdown_with_epitaph(status)
628    }
629
630    fn is_closed(&self) -> bool {
631        self.inner.channel().is_closed()
632    }
633    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
634        self.inner.channel().on_closed()
635    }
636
637    #[cfg(target_os = "fuchsia")]
638    fn signal_peer(
639        &self,
640        clear_mask: zx::Signals,
641        set_mask: zx::Signals,
642    ) -> Result<(), zx_status::Status> {
643        use fidl::Peered;
644        self.inner.channel().signal_peer(clear_mask, set_mask)
645    }
646}
647
648impl CounterControlHandle {}
649
650#[must_use = "FIDL methods require a response to be sent"]
651#[derive(Debug)]
652pub struct CounterGetInspectVmoResponder {
653    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
654    tx_id: u32,
655}
656
657/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
658/// if the responder is dropped without sending a response, so that the client
659/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
660impl std::ops::Drop for CounterGetInspectVmoResponder {
661    fn drop(&mut self) {
662        self.control_handle.shutdown();
663        // Safety: drops once, never accessed again
664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
665    }
666}
667
668impl fidl::endpoints::Responder for CounterGetInspectVmoResponder {
669    type ControlHandle = CounterControlHandle;
670
671    fn control_handle(&self) -> &CounterControlHandle {
672        &self.control_handle
673    }
674
675    fn drop_without_shutdown(mut self) {
676        // Safety: drops once, never accessed again due to mem::forget
677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
678        // Prevent Drop from running (which would shut down the channel)
679        std::mem::forget(self);
680    }
681}
682
683impl CounterGetInspectVmoResponder {
684    /// Sends a response to the FIDL transaction.
685    ///
686    /// Sets the channel to shutdown if an error occurs.
687    pub fn send(
688        self,
689        mut status: i32,
690        mut buffer: fidl_fuchsia_mem::Buffer,
691    ) -> Result<(), fidl::Error> {
692        let _result = self.send_raw(status, buffer);
693        if _result.is_err() {
694            self.control_handle.shutdown();
695        }
696        self.drop_without_shutdown();
697        _result
698    }
699
700    /// Similar to "send" but does not shutdown the channel if an error occurs.
701    pub fn send_no_shutdown_on_err(
702        self,
703        mut status: i32,
704        mut buffer: fidl_fuchsia_mem::Buffer,
705    ) -> Result<(), fidl::Error> {
706        let _result = self.send_raw(status, buffer);
707        self.drop_without_shutdown();
708        _result
709    }
710
711    fn send_raw(
712        &self,
713        mut status: i32,
714        mut buffer: fidl_fuchsia_mem::Buffer,
715    ) -> Result<(), fidl::Error> {
716        self.control_handle.inner.send::<CounterGetInspectVmoResponse>(
717            (status, &mut buffer),
718            self.tx_id,
719            0x6ea9b2e6b2791b81,
720            fidl::encoding::DynamicFlags::empty(),
721        )
722    }
723}
724
725#[must_use = "FIDL methods require a response to be sent"]
726#[derive(Debug)]
727pub struct CounterUpdateInspectVmoResponder {
728    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
729    tx_id: u32,
730}
731
732/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
733/// if the responder is dropped without sending a response, so that the client
734/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
735impl std::ops::Drop for CounterUpdateInspectVmoResponder {
736    fn drop(&mut self) {
737        self.control_handle.shutdown();
738        // Safety: drops once, never accessed again
739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
740    }
741}
742
743impl fidl::endpoints::Responder for CounterUpdateInspectVmoResponder {
744    type ControlHandle = CounterControlHandle;
745
746    fn control_handle(&self) -> &CounterControlHandle {
747        &self.control_handle
748    }
749
750    fn drop_without_shutdown(mut self) {
751        // Safety: drops once, never accessed again due to mem::forget
752        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
753        // Prevent Drop from running (which would shut down the channel)
754        std::mem::forget(self);
755    }
756}
757
758impl CounterUpdateInspectVmoResponder {
759    /// Sends a response to the FIDL transaction.
760    ///
761    /// Sets the channel to shutdown if an error occurs.
762    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
763        let _result = self.send_raw(status);
764        if _result.is_err() {
765            self.control_handle.shutdown();
766        }
767        self.drop_without_shutdown();
768        _result
769    }
770
771    /// Similar to "send" but does not shutdown the channel if an error occurs.
772    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
773        let _result = self.send_raw(status);
774        self.drop_without_shutdown();
775        _result
776    }
777
778    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
779        self.control_handle.inner.send::<CounterUpdateInspectVmoResponse>(
780            (status,),
781            self.tx_id,
782            0x1d25eb7995a0539f,
783            fidl::encoding::DynamicFlags::empty(),
784        )
785    }
786}
787
788#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
789pub struct CpuResourceMarker;
790
791impl fidl::endpoints::ProtocolMarker for CpuResourceMarker {
792    type Proxy = CpuResourceProxy;
793    type RequestStream = CpuResourceRequestStream;
794    #[cfg(target_os = "fuchsia")]
795    type SynchronousProxy = CpuResourceSynchronousProxy;
796
797    const DEBUG_NAME: &'static str = "fuchsia.kernel.CpuResource";
798}
799impl fidl::endpoints::DiscoverableProtocolMarker for CpuResourceMarker {}
800
801pub trait CpuResourceProxyInterface: Send + Sync {
802    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
803    fn r#get(&self) -> Self::GetResponseFut;
804}
805#[derive(Debug)]
806#[cfg(target_os = "fuchsia")]
807pub struct CpuResourceSynchronousProxy {
808    client: fidl::client::sync::Client,
809}
810
811#[cfg(target_os = "fuchsia")]
812impl fidl::endpoints::SynchronousProxy for CpuResourceSynchronousProxy {
813    type Proxy = CpuResourceProxy;
814    type Protocol = CpuResourceMarker;
815
816    fn from_channel(inner: fidl::Channel) -> Self {
817        Self::new(inner)
818    }
819
820    fn into_channel(self) -> fidl::Channel {
821        self.client.into_channel()
822    }
823
824    fn as_channel(&self) -> &fidl::Channel {
825        self.client.as_channel()
826    }
827}
828
829#[cfg(target_os = "fuchsia")]
830impl CpuResourceSynchronousProxy {
831    pub fn new(channel: fidl::Channel) -> Self {
832        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
833        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
834    }
835
836    pub fn into_channel(self) -> fidl::Channel {
837        self.client.into_channel()
838    }
839
840    /// Waits until an event arrives and returns it. It is safe for other
841    /// threads to make concurrent requests while waiting for an event.
842    pub fn wait_for_event(
843        &self,
844        deadline: zx::MonotonicInstant,
845    ) -> Result<CpuResourceEvent, fidl::Error> {
846        CpuResourceEvent::decode(self.client.wait_for_event(deadline)?)
847    }
848
849    /// Get a CPU resource handle.
850    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
851        let _response =
852            self.client.send_query::<fidl::encoding::EmptyPayload, CpuResourceGetResponse>(
853                (),
854                0x41e1103acf4215e4,
855                fidl::encoding::DynamicFlags::empty(),
856                ___deadline,
857            )?;
858        Ok(_response.resource)
859    }
860}
861
862#[cfg(target_os = "fuchsia")]
863impl From<CpuResourceSynchronousProxy> for zx::NullableHandle {
864    fn from(value: CpuResourceSynchronousProxy) -> Self {
865        value.into_channel().into()
866    }
867}
868
869#[cfg(target_os = "fuchsia")]
870impl From<fidl::Channel> for CpuResourceSynchronousProxy {
871    fn from(value: fidl::Channel) -> Self {
872        Self::new(value)
873    }
874}
875
876#[cfg(target_os = "fuchsia")]
877impl fidl::endpoints::FromClient for CpuResourceSynchronousProxy {
878    type Protocol = CpuResourceMarker;
879
880    fn from_client(value: fidl::endpoints::ClientEnd<CpuResourceMarker>) -> Self {
881        Self::new(value.into_channel())
882    }
883}
884
885#[derive(Debug, Clone)]
886pub struct CpuResourceProxy {
887    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
888}
889
890impl fidl::endpoints::Proxy for CpuResourceProxy {
891    type Protocol = CpuResourceMarker;
892
893    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
894        Self::new(inner)
895    }
896
897    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
898        self.client.into_channel().map_err(|client| Self { client })
899    }
900
901    fn as_channel(&self) -> &::fidl::AsyncChannel {
902        self.client.as_channel()
903    }
904}
905
906impl CpuResourceProxy {
907    /// Create a new Proxy for fuchsia.kernel/CpuResource.
908    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
909        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
910        Self { client: fidl::client::Client::new(channel, protocol_name) }
911    }
912
913    /// Get a Stream of events from the remote end of the protocol.
914    ///
915    /// # Panics
916    ///
917    /// Panics if the event stream was already taken.
918    pub fn take_event_stream(&self) -> CpuResourceEventStream {
919        CpuResourceEventStream { event_receiver: self.client.take_event_receiver() }
920    }
921
922    /// Get a CPU resource handle.
923    pub fn r#get(
924        &self,
925    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
926    {
927        CpuResourceProxyInterface::r#get(self)
928    }
929}
930
931impl CpuResourceProxyInterface for CpuResourceProxy {
932    type GetResponseFut = fidl::client::QueryResponseFut<
933        fidl::Resource,
934        fidl::encoding::DefaultFuchsiaResourceDialect,
935    >;
936    fn r#get(&self) -> Self::GetResponseFut {
937        fn _decode(
938            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
939        ) -> Result<fidl::Resource, fidl::Error> {
940            let _response = fidl::client::decode_transaction_body::<
941                CpuResourceGetResponse,
942                fidl::encoding::DefaultFuchsiaResourceDialect,
943                0x41e1103acf4215e4,
944            >(_buf?)?;
945            Ok(_response.resource)
946        }
947        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
948            (),
949            0x41e1103acf4215e4,
950            fidl::encoding::DynamicFlags::empty(),
951            _decode,
952        )
953    }
954}
955
956pub struct CpuResourceEventStream {
957    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
958}
959
960impl std::marker::Unpin for CpuResourceEventStream {}
961
962impl futures::stream::FusedStream for CpuResourceEventStream {
963    fn is_terminated(&self) -> bool {
964        self.event_receiver.is_terminated()
965    }
966}
967
968impl futures::Stream for CpuResourceEventStream {
969    type Item = Result<CpuResourceEvent, fidl::Error>;
970
971    fn poll_next(
972        mut self: std::pin::Pin<&mut Self>,
973        cx: &mut std::task::Context<'_>,
974    ) -> std::task::Poll<Option<Self::Item>> {
975        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
976            &mut self.event_receiver,
977            cx
978        )?) {
979            Some(buf) => std::task::Poll::Ready(Some(CpuResourceEvent::decode(buf))),
980            None => std::task::Poll::Ready(None),
981        }
982    }
983}
984
985#[derive(Debug)]
986pub enum CpuResourceEvent {}
987
988impl CpuResourceEvent {
989    /// Decodes a message buffer as a [`CpuResourceEvent`].
990    fn decode(
991        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
992    ) -> Result<CpuResourceEvent, fidl::Error> {
993        let (bytes, _handles) = buf.split_mut();
994        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
995        debug_assert_eq!(tx_header.tx_id, 0);
996        match tx_header.ordinal {
997            _ => Err(fidl::Error::UnknownOrdinal {
998                ordinal: tx_header.ordinal,
999                protocol_name: <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1000            }),
1001        }
1002    }
1003}
1004
1005/// A Stream of incoming requests for fuchsia.kernel/CpuResource.
1006pub struct CpuResourceRequestStream {
1007    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1008    is_terminated: bool,
1009}
1010
1011impl std::marker::Unpin for CpuResourceRequestStream {}
1012
1013impl futures::stream::FusedStream for CpuResourceRequestStream {
1014    fn is_terminated(&self) -> bool {
1015        self.is_terminated
1016    }
1017}
1018
1019impl fidl::endpoints::RequestStream for CpuResourceRequestStream {
1020    type Protocol = CpuResourceMarker;
1021    type ControlHandle = CpuResourceControlHandle;
1022
1023    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1024        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1025    }
1026
1027    fn control_handle(&self) -> Self::ControlHandle {
1028        CpuResourceControlHandle { inner: self.inner.clone() }
1029    }
1030
1031    fn into_inner(
1032        self,
1033    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1034    {
1035        (self.inner, self.is_terminated)
1036    }
1037
1038    fn from_inner(
1039        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1040        is_terminated: bool,
1041    ) -> Self {
1042        Self { inner, is_terminated }
1043    }
1044}
1045
1046impl futures::Stream for CpuResourceRequestStream {
1047    type Item = Result<CpuResourceRequest, fidl::Error>;
1048
1049    fn poll_next(
1050        mut self: std::pin::Pin<&mut Self>,
1051        cx: &mut std::task::Context<'_>,
1052    ) -> std::task::Poll<Option<Self::Item>> {
1053        let this = &mut *self;
1054        if this.inner.check_shutdown(cx) {
1055            this.is_terminated = true;
1056            return std::task::Poll::Ready(None);
1057        }
1058        if this.is_terminated {
1059            panic!("polled CpuResourceRequestStream after completion");
1060        }
1061        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1062            |bytes, handles| {
1063                match this.inner.channel().read_etc(cx, bytes, handles) {
1064                    std::task::Poll::Ready(Ok(())) => {}
1065                    std::task::Poll::Pending => return std::task::Poll::Pending,
1066                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1067                        this.is_terminated = true;
1068                        return std::task::Poll::Ready(None);
1069                    }
1070                    std::task::Poll::Ready(Err(e)) => {
1071                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1072                            e.into(),
1073                        ))));
1074                    }
1075                }
1076
1077                // A message has been received from the channel
1078                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1079
1080                std::task::Poll::Ready(Some(match header.ordinal {
1081                    0x41e1103acf4215e4 => {
1082                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1083                        let mut req = fidl::new_empty!(
1084                            fidl::encoding::EmptyPayload,
1085                            fidl::encoding::DefaultFuchsiaResourceDialect
1086                        );
1087                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1088                        let control_handle = CpuResourceControlHandle { inner: this.inner.clone() };
1089                        Ok(CpuResourceRequest::Get {
1090                            responder: CpuResourceGetResponder {
1091                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1092                                tx_id: header.tx_id,
1093                            },
1094                        })
1095                    }
1096                    _ => Err(fidl::Error::UnknownOrdinal {
1097                        ordinal: header.ordinal,
1098                        protocol_name:
1099                            <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1100                    }),
1101                }))
1102            },
1103        )
1104    }
1105}
1106
1107/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
1108/// `ZX_RSRC_SYSTEM_CPU_BASE`.
1109#[derive(Debug)]
1110pub enum CpuResourceRequest {
1111    /// Get a CPU resource handle.
1112    Get { responder: CpuResourceGetResponder },
1113}
1114
1115impl CpuResourceRequest {
1116    #[allow(irrefutable_let_patterns)]
1117    pub fn into_get(self) -> Option<(CpuResourceGetResponder)> {
1118        if let CpuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
1119    }
1120
1121    /// Name of the method defined in FIDL
1122    pub fn method_name(&self) -> &'static str {
1123        match *self {
1124            CpuResourceRequest::Get { .. } => "get",
1125        }
1126    }
1127}
1128
1129#[derive(Debug, Clone)]
1130pub struct CpuResourceControlHandle {
1131    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1132}
1133
1134impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1135    fn shutdown(&self) {
1136        self.inner.shutdown()
1137    }
1138
1139    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1140        self.inner.shutdown_with_epitaph(status)
1141    }
1142
1143    fn is_closed(&self) -> bool {
1144        self.inner.channel().is_closed()
1145    }
1146    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1147        self.inner.channel().on_closed()
1148    }
1149
1150    #[cfg(target_os = "fuchsia")]
1151    fn signal_peer(
1152        &self,
1153        clear_mask: zx::Signals,
1154        set_mask: zx::Signals,
1155    ) -> Result<(), zx_status::Status> {
1156        use fidl::Peered;
1157        self.inner.channel().signal_peer(clear_mask, set_mask)
1158    }
1159}
1160
1161impl CpuResourceControlHandle {}
1162
1163#[must_use = "FIDL methods require a response to be sent"]
1164#[derive(Debug)]
1165pub struct CpuResourceGetResponder {
1166    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1167    tx_id: u32,
1168}
1169
1170/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1171/// if the responder is dropped without sending a response, so that the client
1172/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1173impl std::ops::Drop for CpuResourceGetResponder {
1174    fn drop(&mut self) {
1175        self.control_handle.shutdown();
1176        // Safety: drops once, never accessed again
1177        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1178    }
1179}
1180
1181impl fidl::endpoints::Responder for CpuResourceGetResponder {
1182    type ControlHandle = CpuResourceControlHandle;
1183
1184    fn control_handle(&self) -> &CpuResourceControlHandle {
1185        &self.control_handle
1186    }
1187
1188    fn drop_without_shutdown(mut self) {
1189        // Safety: drops once, never accessed again due to mem::forget
1190        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1191        // Prevent Drop from running (which would shut down the channel)
1192        std::mem::forget(self);
1193    }
1194}
1195
1196impl CpuResourceGetResponder {
1197    /// Sends a response to the FIDL transaction.
1198    ///
1199    /// Sets the channel to shutdown if an error occurs.
1200    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1201        let _result = self.send_raw(resource);
1202        if _result.is_err() {
1203            self.control_handle.shutdown();
1204        }
1205        self.drop_without_shutdown();
1206        _result
1207    }
1208
1209    /// Similar to "send" but does not shutdown the channel if an error occurs.
1210    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1211        let _result = self.send_raw(resource);
1212        self.drop_without_shutdown();
1213        _result
1214    }
1215
1216    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1217        self.control_handle.inner.send::<CpuResourceGetResponse>(
1218            (resource,),
1219            self.tx_id,
1220            0x41e1103acf4215e4,
1221            fidl::encoding::DynamicFlags::empty(),
1222        )
1223    }
1224}
1225
1226#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1227pub struct DebugBrokerMarker;
1228
1229impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1230    type Proxy = DebugBrokerProxy;
1231    type RequestStream = DebugBrokerRequestStream;
1232    #[cfg(target_os = "fuchsia")]
1233    type SynchronousProxy = DebugBrokerSynchronousProxy;
1234
1235    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1236}
1237impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1238
1239pub trait DebugBrokerProxyInterface: Send + Sync {
1240    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1241    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1242    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1243    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1244}
1245#[derive(Debug)]
1246#[cfg(target_os = "fuchsia")]
1247pub struct DebugBrokerSynchronousProxy {
1248    client: fidl::client::sync::Client,
1249}
1250
1251#[cfg(target_os = "fuchsia")]
1252impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1253    type Proxy = DebugBrokerProxy;
1254    type Protocol = DebugBrokerMarker;
1255
1256    fn from_channel(inner: fidl::Channel) -> Self {
1257        Self::new(inner)
1258    }
1259
1260    fn into_channel(self) -> fidl::Channel {
1261        self.client.into_channel()
1262    }
1263
1264    fn as_channel(&self) -> &fidl::Channel {
1265        self.client.as_channel()
1266    }
1267}
1268
1269#[cfg(target_os = "fuchsia")]
1270impl DebugBrokerSynchronousProxy {
1271    pub fn new(channel: fidl::Channel) -> Self {
1272        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1273        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1274    }
1275
1276    pub fn into_channel(self) -> fidl::Channel {
1277        self.client.into_channel()
1278    }
1279
1280    /// Waits until an event arrives and returns it. It is safe for other
1281    /// threads to make concurrent requests while waiting for an event.
1282    pub fn wait_for_event(
1283        &self,
1284        deadline: zx::MonotonicInstant,
1285    ) -> Result<DebugBrokerEvent, fidl::Error> {
1286        DebugBrokerEvent::decode(self.client.wait_for_event(deadline)?)
1287    }
1288
1289    /// Pass debug command through to the kernel shell.
1290    /// Look at zx_debug_send_command syscall handling to find valid values.
1291    pub fn r#send_debug_command(
1292        &self,
1293        mut command: &str,
1294        ___deadline: zx::MonotonicInstant,
1295    ) -> Result<i32, fidl::Error> {
1296        let _response = self
1297            .client
1298            .send_query::<DebugBrokerSendDebugCommandRequest, DebugBrokerSendDebugCommandResponse>(
1299                (command,),
1300                0x1ee270f83b5d6ff6,
1301                fidl::encoding::DynamicFlags::empty(),
1302                ___deadline,
1303            )?;
1304        Ok(_response.status)
1305    }
1306
1307    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1308    pub fn r#set_tracing_enabled(
1309        &self,
1310        mut enabled: bool,
1311        ___deadline: zx::MonotonicInstant,
1312    ) -> Result<i32, fidl::Error> {
1313        let _response = self.client.send_query::<
1314            DebugBrokerSetTracingEnabledRequest,
1315            DebugBrokerSetTracingEnabledResponse,
1316        >(
1317            (enabled,),
1318            0x12e368d05329b30e,
1319            fidl::encoding::DynamicFlags::empty(),
1320            ___deadline,
1321        )?;
1322        Ok(_response.status)
1323    }
1324}
1325
1326#[cfg(target_os = "fuchsia")]
1327impl From<DebugBrokerSynchronousProxy> for zx::NullableHandle {
1328    fn from(value: DebugBrokerSynchronousProxy) -> Self {
1329        value.into_channel().into()
1330    }
1331}
1332
1333#[cfg(target_os = "fuchsia")]
1334impl From<fidl::Channel> for DebugBrokerSynchronousProxy {
1335    fn from(value: fidl::Channel) -> Self {
1336        Self::new(value)
1337    }
1338}
1339
1340#[cfg(target_os = "fuchsia")]
1341impl fidl::endpoints::FromClient for DebugBrokerSynchronousProxy {
1342    type Protocol = DebugBrokerMarker;
1343
1344    fn from_client(value: fidl::endpoints::ClientEnd<DebugBrokerMarker>) -> Self {
1345        Self::new(value.into_channel())
1346    }
1347}
1348
1349#[derive(Debug, Clone)]
1350pub struct DebugBrokerProxy {
1351    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1352}
1353
1354impl fidl::endpoints::Proxy for DebugBrokerProxy {
1355    type Protocol = DebugBrokerMarker;
1356
1357    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1358        Self::new(inner)
1359    }
1360
1361    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1362        self.client.into_channel().map_err(|client| Self { client })
1363    }
1364
1365    fn as_channel(&self) -> &::fidl::AsyncChannel {
1366        self.client.as_channel()
1367    }
1368}
1369
1370impl DebugBrokerProxy {
1371    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1372    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1373        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1374        Self { client: fidl::client::Client::new(channel, protocol_name) }
1375    }
1376
1377    /// Get a Stream of events from the remote end of the protocol.
1378    ///
1379    /// # Panics
1380    ///
1381    /// Panics if the event stream was already taken.
1382    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1383        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1384    }
1385
1386    /// Pass debug command through to the kernel shell.
1387    /// Look at zx_debug_send_command syscall handling to find valid values.
1388    pub fn r#send_debug_command(
1389        &self,
1390        mut command: &str,
1391    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1392        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1393    }
1394
1395    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1396    pub fn r#set_tracing_enabled(
1397        &self,
1398        mut enabled: bool,
1399    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1400        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1401    }
1402}
1403
1404impl DebugBrokerProxyInterface for DebugBrokerProxy {
1405    type SendDebugCommandResponseFut =
1406        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1407    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1408        fn _decode(
1409            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1410        ) -> Result<i32, fidl::Error> {
1411            let _response = fidl::client::decode_transaction_body::<
1412                DebugBrokerSendDebugCommandResponse,
1413                fidl::encoding::DefaultFuchsiaResourceDialect,
1414                0x1ee270f83b5d6ff6,
1415            >(_buf?)?;
1416            Ok(_response.status)
1417        }
1418        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1419            (command,),
1420            0x1ee270f83b5d6ff6,
1421            fidl::encoding::DynamicFlags::empty(),
1422            _decode,
1423        )
1424    }
1425
1426    type SetTracingEnabledResponseFut =
1427        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1428    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1429        fn _decode(
1430            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1431        ) -> Result<i32, fidl::Error> {
1432            let _response = fidl::client::decode_transaction_body::<
1433                DebugBrokerSetTracingEnabledResponse,
1434                fidl::encoding::DefaultFuchsiaResourceDialect,
1435                0x12e368d05329b30e,
1436            >(_buf?)?;
1437            Ok(_response.status)
1438        }
1439        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1440            (enabled,),
1441            0x12e368d05329b30e,
1442            fidl::encoding::DynamicFlags::empty(),
1443            _decode,
1444        )
1445    }
1446}
1447
1448pub struct DebugBrokerEventStream {
1449    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1450}
1451
1452impl std::marker::Unpin for DebugBrokerEventStream {}
1453
1454impl futures::stream::FusedStream for DebugBrokerEventStream {
1455    fn is_terminated(&self) -> bool {
1456        self.event_receiver.is_terminated()
1457    }
1458}
1459
1460impl futures::Stream for DebugBrokerEventStream {
1461    type Item = Result<DebugBrokerEvent, fidl::Error>;
1462
1463    fn poll_next(
1464        mut self: std::pin::Pin<&mut Self>,
1465        cx: &mut std::task::Context<'_>,
1466    ) -> std::task::Poll<Option<Self::Item>> {
1467        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1468            &mut self.event_receiver,
1469            cx
1470        )?) {
1471            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1472            None => std::task::Poll::Ready(None),
1473        }
1474    }
1475}
1476
1477#[derive(Debug)]
1478pub enum DebugBrokerEvent {}
1479
1480impl DebugBrokerEvent {
1481    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1482    fn decode(
1483        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1484    ) -> Result<DebugBrokerEvent, fidl::Error> {
1485        let (bytes, _handles) = buf.split_mut();
1486        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1487        debug_assert_eq!(tx_header.tx_id, 0);
1488        match tx_header.ordinal {
1489            _ => Err(fidl::Error::UnknownOrdinal {
1490                ordinal: tx_header.ordinal,
1491                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1492            }),
1493        }
1494    }
1495}
1496
1497/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1498pub struct DebugBrokerRequestStream {
1499    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1500    is_terminated: bool,
1501}
1502
1503impl std::marker::Unpin for DebugBrokerRequestStream {}
1504
1505impl futures::stream::FusedStream for DebugBrokerRequestStream {
1506    fn is_terminated(&self) -> bool {
1507        self.is_terminated
1508    }
1509}
1510
1511impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1512    type Protocol = DebugBrokerMarker;
1513    type ControlHandle = DebugBrokerControlHandle;
1514
1515    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1516        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1517    }
1518
1519    fn control_handle(&self) -> Self::ControlHandle {
1520        DebugBrokerControlHandle { inner: self.inner.clone() }
1521    }
1522
1523    fn into_inner(
1524        self,
1525    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1526    {
1527        (self.inner, self.is_terminated)
1528    }
1529
1530    fn from_inner(
1531        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1532        is_terminated: bool,
1533    ) -> Self {
1534        Self { inner, is_terminated }
1535    }
1536}
1537
1538impl futures::Stream for DebugBrokerRequestStream {
1539    type Item = Result<DebugBrokerRequest, fidl::Error>;
1540
1541    fn poll_next(
1542        mut self: std::pin::Pin<&mut Self>,
1543        cx: &mut std::task::Context<'_>,
1544    ) -> std::task::Poll<Option<Self::Item>> {
1545        let this = &mut *self;
1546        if this.inner.check_shutdown(cx) {
1547            this.is_terminated = true;
1548            return std::task::Poll::Ready(None);
1549        }
1550        if this.is_terminated {
1551            panic!("polled DebugBrokerRequestStream after completion");
1552        }
1553        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1554            |bytes, handles| {
1555                match this.inner.channel().read_etc(cx, bytes, handles) {
1556                    std::task::Poll::Ready(Ok(())) => {}
1557                    std::task::Poll::Pending => return std::task::Poll::Pending,
1558                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1559                        this.is_terminated = true;
1560                        return std::task::Poll::Ready(None);
1561                    }
1562                    std::task::Poll::Ready(Err(e)) => {
1563                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1564                            e.into(),
1565                        ))));
1566                    }
1567                }
1568
1569                // A message has been received from the channel
1570                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1571
1572                std::task::Poll::Ready(Some(match header.ordinal {
1573                    0x1ee270f83b5d6ff6 => {
1574                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1575                        let mut req = fidl::new_empty!(
1576                            DebugBrokerSendDebugCommandRequest,
1577                            fidl::encoding::DefaultFuchsiaResourceDialect
1578                        );
1579                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1580                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1581                        Ok(DebugBrokerRequest::SendDebugCommand {
1582                            command: req.command,
1583
1584                            responder: DebugBrokerSendDebugCommandResponder {
1585                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1586                                tx_id: header.tx_id,
1587                            },
1588                        })
1589                    }
1590                    0x12e368d05329b30e => {
1591                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1592                        let mut req = fidl::new_empty!(
1593                            DebugBrokerSetTracingEnabledRequest,
1594                            fidl::encoding::DefaultFuchsiaResourceDialect
1595                        );
1596                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1597                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1598                        Ok(DebugBrokerRequest::SetTracingEnabled {
1599                            enabled: req.enabled,
1600
1601                            responder: DebugBrokerSetTracingEnabledResponder {
1602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1603                                tx_id: header.tx_id,
1604                            },
1605                        })
1606                    }
1607                    _ => Err(fidl::Error::UnknownOrdinal {
1608                        ordinal: header.ordinal,
1609                        protocol_name:
1610                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1611                    }),
1612                }))
1613            },
1614        )
1615    }
1616}
1617
1618/// Acts on behalf of the caller to interact with privileged debug system calls.
1619#[derive(Debug)]
1620pub enum DebugBrokerRequest {
1621    /// Pass debug command through to the kernel shell.
1622    /// Look at zx_debug_send_command syscall handling to find valid values.
1623    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1624    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1625    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1626}
1627
1628impl DebugBrokerRequest {
1629    #[allow(irrefutable_let_patterns)]
1630    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1631        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1632            Some((command, responder))
1633        } else {
1634            None
1635        }
1636    }
1637
1638    #[allow(irrefutable_let_patterns)]
1639    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1640        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1641            Some((enabled, responder))
1642        } else {
1643            None
1644        }
1645    }
1646
1647    /// Name of the method defined in FIDL
1648    pub fn method_name(&self) -> &'static str {
1649        match *self {
1650            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1651            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1652        }
1653    }
1654}
1655
1656#[derive(Debug, Clone)]
1657pub struct DebugBrokerControlHandle {
1658    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1659}
1660
1661impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1662    fn shutdown(&self) {
1663        self.inner.shutdown()
1664    }
1665
1666    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1667        self.inner.shutdown_with_epitaph(status)
1668    }
1669
1670    fn is_closed(&self) -> bool {
1671        self.inner.channel().is_closed()
1672    }
1673    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1674        self.inner.channel().on_closed()
1675    }
1676
1677    #[cfg(target_os = "fuchsia")]
1678    fn signal_peer(
1679        &self,
1680        clear_mask: zx::Signals,
1681        set_mask: zx::Signals,
1682    ) -> Result<(), zx_status::Status> {
1683        use fidl::Peered;
1684        self.inner.channel().signal_peer(clear_mask, set_mask)
1685    }
1686}
1687
1688impl DebugBrokerControlHandle {}
1689
1690#[must_use = "FIDL methods require a response to be sent"]
1691#[derive(Debug)]
1692pub struct DebugBrokerSendDebugCommandResponder {
1693    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1694    tx_id: u32,
1695}
1696
1697/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1698/// if the responder is dropped without sending a response, so that the client
1699/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1700impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1701    fn drop(&mut self) {
1702        self.control_handle.shutdown();
1703        // Safety: drops once, never accessed again
1704        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1705    }
1706}
1707
1708impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1709    type ControlHandle = DebugBrokerControlHandle;
1710
1711    fn control_handle(&self) -> &DebugBrokerControlHandle {
1712        &self.control_handle
1713    }
1714
1715    fn drop_without_shutdown(mut self) {
1716        // Safety: drops once, never accessed again due to mem::forget
1717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1718        // Prevent Drop from running (which would shut down the channel)
1719        std::mem::forget(self);
1720    }
1721}
1722
1723impl DebugBrokerSendDebugCommandResponder {
1724    /// Sends a response to the FIDL transaction.
1725    ///
1726    /// Sets the channel to shutdown if an error occurs.
1727    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1728        let _result = self.send_raw(status);
1729        if _result.is_err() {
1730            self.control_handle.shutdown();
1731        }
1732        self.drop_without_shutdown();
1733        _result
1734    }
1735
1736    /// Similar to "send" but does not shutdown the channel if an error occurs.
1737    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1738        let _result = self.send_raw(status);
1739        self.drop_without_shutdown();
1740        _result
1741    }
1742
1743    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1744        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1745            (status,),
1746            self.tx_id,
1747            0x1ee270f83b5d6ff6,
1748            fidl::encoding::DynamicFlags::empty(),
1749        )
1750    }
1751}
1752
1753#[must_use = "FIDL methods require a response to be sent"]
1754#[derive(Debug)]
1755pub struct DebugBrokerSetTracingEnabledResponder {
1756    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1757    tx_id: u32,
1758}
1759
1760/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1761/// if the responder is dropped without sending a response, so that the client
1762/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1763impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1764    fn drop(&mut self) {
1765        self.control_handle.shutdown();
1766        // Safety: drops once, never accessed again
1767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1768    }
1769}
1770
1771impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1772    type ControlHandle = DebugBrokerControlHandle;
1773
1774    fn control_handle(&self) -> &DebugBrokerControlHandle {
1775        &self.control_handle
1776    }
1777
1778    fn drop_without_shutdown(mut self) {
1779        // Safety: drops once, never accessed again due to mem::forget
1780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1781        // Prevent Drop from running (which would shut down the channel)
1782        std::mem::forget(self);
1783    }
1784}
1785
1786impl DebugBrokerSetTracingEnabledResponder {
1787    /// Sends a response to the FIDL transaction.
1788    ///
1789    /// Sets the channel to shutdown if an error occurs.
1790    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1791        let _result = self.send_raw(status);
1792        if _result.is_err() {
1793            self.control_handle.shutdown();
1794        }
1795        self.drop_without_shutdown();
1796        _result
1797    }
1798
1799    /// Similar to "send" but does not shutdown the channel if an error occurs.
1800    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1801        let _result = self.send_raw(status);
1802        self.drop_without_shutdown();
1803        _result
1804    }
1805
1806    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1807        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1808            (status,),
1809            self.tx_id,
1810            0x12e368d05329b30e,
1811            fidl::encoding::DynamicFlags::empty(),
1812        )
1813    }
1814}
1815
1816#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1817pub struct DebugResourceMarker;
1818
1819impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1820    type Proxy = DebugResourceProxy;
1821    type RequestStream = DebugResourceRequestStream;
1822    #[cfg(target_os = "fuchsia")]
1823    type SynchronousProxy = DebugResourceSynchronousProxy;
1824
1825    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1826}
1827impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1828
1829pub trait DebugResourceProxyInterface: Send + Sync {
1830    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1831    fn r#get(&self) -> Self::GetResponseFut;
1832}
1833#[derive(Debug)]
1834#[cfg(target_os = "fuchsia")]
1835pub struct DebugResourceSynchronousProxy {
1836    client: fidl::client::sync::Client,
1837}
1838
1839#[cfg(target_os = "fuchsia")]
1840impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1841    type Proxy = DebugResourceProxy;
1842    type Protocol = DebugResourceMarker;
1843
1844    fn from_channel(inner: fidl::Channel) -> Self {
1845        Self::new(inner)
1846    }
1847
1848    fn into_channel(self) -> fidl::Channel {
1849        self.client.into_channel()
1850    }
1851
1852    fn as_channel(&self) -> &fidl::Channel {
1853        self.client.as_channel()
1854    }
1855}
1856
1857#[cfg(target_os = "fuchsia")]
1858impl DebugResourceSynchronousProxy {
1859    pub fn new(channel: fidl::Channel) -> Self {
1860        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1861        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1862    }
1863
1864    pub fn into_channel(self) -> fidl::Channel {
1865        self.client.into_channel()
1866    }
1867
1868    /// Waits until an event arrives and returns it. It is safe for other
1869    /// threads to make concurrent requests while waiting for an event.
1870    pub fn wait_for_event(
1871        &self,
1872        deadline: zx::MonotonicInstant,
1873    ) -> Result<DebugResourceEvent, fidl::Error> {
1874        DebugResourceEvent::decode(self.client.wait_for_event(deadline)?)
1875    }
1876
1877    /// Get a debug resource handle.
1878    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1879        let _response =
1880            self.client.send_query::<fidl::encoding::EmptyPayload, DebugResourceGetResponse>(
1881                (),
1882                0x1d79d77ea12a6474,
1883                fidl::encoding::DynamicFlags::empty(),
1884                ___deadline,
1885            )?;
1886        Ok(_response.resource)
1887    }
1888}
1889
1890#[cfg(target_os = "fuchsia")]
1891impl From<DebugResourceSynchronousProxy> for zx::NullableHandle {
1892    fn from(value: DebugResourceSynchronousProxy) -> Self {
1893        value.into_channel().into()
1894    }
1895}
1896
1897#[cfg(target_os = "fuchsia")]
1898impl From<fidl::Channel> for DebugResourceSynchronousProxy {
1899    fn from(value: fidl::Channel) -> Self {
1900        Self::new(value)
1901    }
1902}
1903
1904#[cfg(target_os = "fuchsia")]
1905impl fidl::endpoints::FromClient for DebugResourceSynchronousProxy {
1906    type Protocol = DebugResourceMarker;
1907
1908    fn from_client(value: fidl::endpoints::ClientEnd<DebugResourceMarker>) -> Self {
1909        Self::new(value.into_channel())
1910    }
1911}
1912
1913#[derive(Debug, Clone)]
1914pub struct DebugResourceProxy {
1915    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1916}
1917
1918impl fidl::endpoints::Proxy for DebugResourceProxy {
1919    type Protocol = DebugResourceMarker;
1920
1921    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1922        Self::new(inner)
1923    }
1924
1925    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1926        self.client.into_channel().map_err(|client| Self { client })
1927    }
1928
1929    fn as_channel(&self) -> &::fidl::AsyncChannel {
1930        self.client.as_channel()
1931    }
1932}
1933
1934impl DebugResourceProxy {
1935    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1936    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1937        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1938        Self { client: fidl::client::Client::new(channel, protocol_name) }
1939    }
1940
1941    /// Get a Stream of events from the remote end of the protocol.
1942    ///
1943    /// # Panics
1944    ///
1945    /// Panics if the event stream was already taken.
1946    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1947        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1948    }
1949
1950    /// Get a debug resource handle.
1951    pub fn r#get(
1952        &self,
1953    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1954    {
1955        DebugResourceProxyInterface::r#get(self)
1956    }
1957}
1958
1959impl DebugResourceProxyInterface for DebugResourceProxy {
1960    type GetResponseFut = fidl::client::QueryResponseFut<
1961        fidl::Resource,
1962        fidl::encoding::DefaultFuchsiaResourceDialect,
1963    >;
1964    fn r#get(&self) -> Self::GetResponseFut {
1965        fn _decode(
1966            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1967        ) -> Result<fidl::Resource, fidl::Error> {
1968            let _response = fidl::client::decode_transaction_body::<
1969                DebugResourceGetResponse,
1970                fidl::encoding::DefaultFuchsiaResourceDialect,
1971                0x1d79d77ea12a6474,
1972            >(_buf?)?;
1973            Ok(_response.resource)
1974        }
1975        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
1976            (),
1977            0x1d79d77ea12a6474,
1978            fidl::encoding::DynamicFlags::empty(),
1979            _decode,
1980        )
1981    }
1982}
1983
1984pub struct DebugResourceEventStream {
1985    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1986}
1987
1988impl std::marker::Unpin for DebugResourceEventStream {}
1989
1990impl futures::stream::FusedStream for DebugResourceEventStream {
1991    fn is_terminated(&self) -> bool {
1992        self.event_receiver.is_terminated()
1993    }
1994}
1995
1996impl futures::Stream for DebugResourceEventStream {
1997    type Item = Result<DebugResourceEvent, fidl::Error>;
1998
1999    fn poll_next(
2000        mut self: std::pin::Pin<&mut Self>,
2001        cx: &mut std::task::Context<'_>,
2002    ) -> std::task::Poll<Option<Self::Item>> {
2003        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2004            &mut self.event_receiver,
2005            cx
2006        )?) {
2007            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
2008            None => std::task::Poll::Ready(None),
2009        }
2010    }
2011}
2012
2013#[derive(Debug)]
2014pub enum DebugResourceEvent {}
2015
2016impl DebugResourceEvent {
2017    /// Decodes a message buffer as a [`DebugResourceEvent`].
2018    fn decode(
2019        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2020    ) -> Result<DebugResourceEvent, fidl::Error> {
2021        let (bytes, _handles) = buf.split_mut();
2022        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2023        debug_assert_eq!(tx_header.tx_id, 0);
2024        match tx_header.ordinal {
2025            _ => Err(fidl::Error::UnknownOrdinal {
2026                ordinal: tx_header.ordinal,
2027                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2028            }),
2029        }
2030    }
2031}
2032
2033/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
2034pub struct DebugResourceRequestStream {
2035    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2036    is_terminated: bool,
2037}
2038
2039impl std::marker::Unpin for DebugResourceRequestStream {}
2040
2041impl futures::stream::FusedStream for DebugResourceRequestStream {
2042    fn is_terminated(&self) -> bool {
2043        self.is_terminated
2044    }
2045}
2046
2047impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
2048    type Protocol = DebugResourceMarker;
2049    type ControlHandle = DebugResourceControlHandle;
2050
2051    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2052        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2053    }
2054
2055    fn control_handle(&self) -> Self::ControlHandle {
2056        DebugResourceControlHandle { inner: self.inner.clone() }
2057    }
2058
2059    fn into_inner(
2060        self,
2061    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2062    {
2063        (self.inner, self.is_terminated)
2064    }
2065
2066    fn from_inner(
2067        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2068        is_terminated: bool,
2069    ) -> Self {
2070        Self { inner, is_terminated }
2071    }
2072}
2073
2074impl futures::Stream for DebugResourceRequestStream {
2075    type Item = Result<DebugResourceRequest, fidl::Error>;
2076
2077    fn poll_next(
2078        mut self: std::pin::Pin<&mut Self>,
2079        cx: &mut std::task::Context<'_>,
2080    ) -> std::task::Poll<Option<Self::Item>> {
2081        let this = &mut *self;
2082        if this.inner.check_shutdown(cx) {
2083            this.is_terminated = true;
2084            return std::task::Poll::Ready(None);
2085        }
2086        if this.is_terminated {
2087            panic!("polled DebugResourceRequestStream after completion");
2088        }
2089        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2090            |bytes, handles| {
2091                match this.inner.channel().read_etc(cx, bytes, handles) {
2092                    std::task::Poll::Ready(Ok(())) => {}
2093                    std::task::Poll::Pending => return std::task::Poll::Pending,
2094                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2095                        this.is_terminated = true;
2096                        return std::task::Poll::Ready(None);
2097                    }
2098                    std::task::Poll::Ready(Err(e)) => {
2099                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2100                            e.into(),
2101                        ))));
2102                    }
2103                }
2104
2105                // A message has been received from the channel
2106                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2107
2108                std::task::Poll::Ready(Some(match header.ordinal {
2109                    0x1d79d77ea12a6474 => {
2110                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2111                        let mut req = fidl::new_empty!(
2112                            fidl::encoding::EmptyPayload,
2113                            fidl::encoding::DefaultFuchsiaResourceDialect
2114                        );
2115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2116                        let control_handle =
2117                            DebugResourceControlHandle { inner: this.inner.clone() };
2118                        Ok(DebugResourceRequest::Get {
2119                            responder: DebugResourceGetResponder {
2120                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2121                                tx_id: header.tx_id,
2122                            },
2123                        })
2124                    }
2125                    _ => Err(fidl::Error::UnknownOrdinal {
2126                        ordinal: header.ordinal,
2127                        protocol_name:
2128                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2129                    }),
2130                }))
2131            },
2132        )
2133    }
2134}
2135
2136/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2137/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2138#[derive(Debug)]
2139pub enum DebugResourceRequest {
2140    /// Get a debug resource handle.
2141    Get { responder: DebugResourceGetResponder },
2142}
2143
2144impl DebugResourceRequest {
2145    #[allow(irrefutable_let_patterns)]
2146    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2147        if let DebugResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2148    }
2149
2150    /// Name of the method defined in FIDL
2151    pub fn method_name(&self) -> &'static str {
2152        match *self {
2153            DebugResourceRequest::Get { .. } => "get",
2154        }
2155    }
2156}
2157
2158#[derive(Debug, Clone)]
2159pub struct DebugResourceControlHandle {
2160    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2161}
2162
2163impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2164    fn shutdown(&self) {
2165        self.inner.shutdown()
2166    }
2167
2168    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2169        self.inner.shutdown_with_epitaph(status)
2170    }
2171
2172    fn is_closed(&self) -> bool {
2173        self.inner.channel().is_closed()
2174    }
2175    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2176        self.inner.channel().on_closed()
2177    }
2178
2179    #[cfg(target_os = "fuchsia")]
2180    fn signal_peer(
2181        &self,
2182        clear_mask: zx::Signals,
2183        set_mask: zx::Signals,
2184    ) -> Result<(), zx_status::Status> {
2185        use fidl::Peered;
2186        self.inner.channel().signal_peer(clear_mask, set_mask)
2187    }
2188}
2189
2190impl DebugResourceControlHandle {}
2191
2192#[must_use = "FIDL methods require a response to be sent"]
2193#[derive(Debug)]
2194pub struct DebugResourceGetResponder {
2195    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2196    tx_id: u32,
2197}
2198
2199/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2200/// if the responder is dropped without sending a response, so that the client
2201/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2202impl std::ops::Drop for DebugResourceGetResponder {
2203    fn drop(&mut self) {
2204        self.control_handle.shutdown();
2205        // Safety: drops once, never accessed again
2206        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2207    }
2208}
2209
2210impl fidl::endpoints::Responder for DebugResourceGetResponder {
2211    type ControlHandle = DebugResourceControlHandle;
2212
2213    fn control_handle(&self) -> &DebugResourceControlHandle {
2214        &self.control_handle
2215    }
2216
2217    fn drop_without_shutdown(mut self) {
2218        // Safety: drops once, never accessed again due to mem::forget
2219        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2220        // Prevent Drop from running (which would shut down the channel)
2221        std::mem::forget(self);
2222    }
2223}
2224
2225impl DebugResourceGetResponder {
2226    /// Sends a response to the FIDL transaction.
2227    ///
2228    /// Sets the channel to shutdown if an error occurs.
2229    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2230        let _result = self.send_raw(resource);
2231        if _result.is_err() {
2232            self.control_handle.shutdown();
2233        }
2234        self.drop_without_shutdown();
2235        _result
2236    }
2237
2238    /// Similar to "send" but does not shutdown the channel if an error occurs.
2239    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2240        let _result = self.send_raw(resource);
2241        self.drop_without_shutdown();
2242        _result
2243    }
2244
2245    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2246        self.control_handle.inner.send::<DebugResourceGetResponse>(
2247            (resource,),
2248            self.tx_id,
2249            0x1d79d77ea12a6474,
2250            fidl::encoding::DynamicFlags::empty(),
2251        )
2252    }
2253}
2254
2255#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2256pub struct DebuglogResourceMarker;
2257
2258impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2259    type Proxy = DebuglogResourceProxy;
2260    type RequestStream = DebuglogResourceRequestStream;
2261    #[cfg(target_os = "fuchsia")]
2262    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2263
2264    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2265}
2266impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2267
2268pub trait DebuglogResourceProxyInterface: Send + Sync {
2269    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2270    fn r#get(&self) -> Self::GetResponseFut;
2271}
2272#[derive(Debug)]
2273#[cfg(target_os = "fuchsia")]
2274pub struct DebuglogResourceSynchronousProxy {
2275    client: fidl::client::sync::Client,
2276}
2277
2278#[cfg(target_os = "fuchsia")]
2279impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2280    type Proxy = DebuglogResourceProxy;
2281    type Protocol = DebuglogResourceMarker;
2282
2283    fn from_channel(inner: fidl::Channel) -> Self {
2284        Self::new(inner)
2285    }
2286
2287    fn into_channel(self) -> fidl::Channel {
2288        self.client.into_channel()
2289    }
2290
2291    fn as_channel(&self) -> &fidl::Channel {
2292        self.client.as_channel()
2293    }
2294}
2295
2296#[cfg(target_os = "fuchsia")]
2297impl DebuglogResourceSynchronousProxy {
2298    pub fn new(channel: fidl::Channel) -> Self {
2299        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2300        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2301    }
2302
2303    pub fn into_channel(self) -> fidl::Channel {
2304        self.client.into_channel()
2305    }
2306
2307    /// Waits until an event arrives and returns it. It is safe for other
2308    /// threads to make concurrent requests while waiting for an event.
2309    pub fn wait_for_event(
2310        &self,
2311        deadline: zx::MonotonicInstant,
2312    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2313        DebuglogResourceEvent::decode(self.client.wait_for_event(deadline)?)
2314    }
2315
2316    /// Get a debuglog resource handle.
2317    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2318        let _response =
2319            self.client.send_query::<fidl::encoding::EmptyPayload, DebuglogResourceGetResponse>(
2320                (),
2321                0x6e78c1ff74765225,
2322                fidl::encoding::DynamicFlags::empty(),
2323                ___deadline,
2324            )?;
2325        Ok(_response.resource)
2326    }
2327}
2328
2329#[cfg(target_os = "fuchsia")]
2330impl From<DebuglogResourceSynchronousProxy> for zx::NullableHandle {
2331    fn from(value: DebuglogResourceSynchronousProxy) -> Self {
2332        value.into_channel().into()
2333    }
2334}
2335
2336#[cfg(target_os = "fuchsia")]
2337impl From<fidl::Channel> for DebuglogResourceSynchronousProxy {
2338    fn from(value: fidl::Channel) -> Self {
2339        Self::new(value)
2340    }
2341}
2342
2343#[cfg(target_os = "fuchsia")]
2344impl fidl::endpoints::FromClient for DebuglogResourceSynchronousProxy {
2345    type Protocol = DebuglogResourceMarker;
2346
2347    fn from_client(value: fidl::endpoints::ClientEnd<DebuglogResourceMarker>) -> Self {
2348        Self::new(value.into_channel())
2349    }
2350}
2351
2352#[derive(Debug, Clone)]
2353pub struct DebuglogResourceProxy {
2354    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2355}
2356
2357impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2358    type Protocol = DebuglogResourceMarker;
2359
2360    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2361        Self::new(inner)
2362    }
2363
2364    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2365        self.client.into_channel().map_err(|client| Self { client })
2366    }
2367
2368    fn as_channel(&self) -> &::fidl::AsyncChannel {
2369        self.client.as_channel()
2370    }
2371}
2372
2373impl DebuglogResourceProxy {
2374    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2375    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2376        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2377        Self { client: fidl::client::Client::new(channel, protocol_name) }
2378    }
2379
2380    /// Get a Stream of events from the remote end of the protocol.
2381    ///
2382    /// # Panics
2383    ///
2384    /// Panics if the event stream was already taken.
2385    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2386        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2387    }
2388
2389    /// Get a debuglog resource handle.
2390    pub fn r#get(
2391        &self,
2392    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2393    {
2394        DebuglogResourceProxyInterface::r#get(self)
2395    }
2396}
2397
2398impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2399    type GetResponseFut = fidl::client::QueryResponseFut<
2400        fidl::Resource,
2401        fidl::encoding::DefaultFuchsiaResourceDialect,
2402    >;
2403    fn r#get(&self) -> Self::GetResponseFut {
2404        fn _decode(
2405            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2406        ) -> Result<fidl::Resource, fidl::Error> {
2407            let _response = fidl::client::decode_transaction_body::<
2408                DebuglogResourceGetResponse,
2409                fidl::encoding::DefaultFuchsiaResourceDialect,
2410                0x6e78c1ff74765225,
2411            >(_buf?)?;
2412            Ok(_response.resource)
2413        }
2414        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2415            (),
2416            0x6e78c1ff74765225,
2417            fidl::encoding::DynamicFlags::empty(),
2418            _decode,
2419        )
2420    }
2421}
2422
2423pub struct DebuglogResourceEventStream {
2424    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2425}
2426
2427impl std::marker::Unpin for DebuglogResourceEventStream {}
2428
2429impl futures::stream::FusedStream for DebuglogResourceEventStream {
2430    fn is_terminated(&self) -> bool {
2431        self.event_receiver.is_terminated()
2432    }
2433}
2434
2435impl futures::Stream for DebuglogResourceEventStream {
2436    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2437
2438    fn poll_next(
2439        mut self: std::pin::Pin<&mut Self>,
2440        cx: &mut std::task::Context<'_>,
2441    ) -> std::task::Poll<Option<Self::Item>> {
2442        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2443            &mut self.event_receiver,
2444            cx
2445        )?) {
2446            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2447            None => std::task::Poll::Ready(None),
2448        }
2449    }
2450}
2451
2452#[derive(Debug)]
2453pub enum DebuglogResourceEvent {}
2454
2455impl DebuglogResourceEvent {
2456    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2457    fn decode(
2458        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2459    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2460        let (bytes, _handles) = buf.split_mut();
2461        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2462        debug_assert_eq!(tx_header.tx_id, 0);
2463        match tx_header.ordinal {
2464            _ => Err(fidl::Error::UnknownOrdinal {
2465                ordinal: tx_header.ordinal,
2466                protocol_name:
2467                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2468            }),
2469        }
2470    }
2471}
2472
2473/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2474pub struct DebuglogResourceRequestStream {
2475    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2476    is_terminated: bool,
2477}
2478
2479impl std::marker::Unpin for DebuglogResourceRequestStream {}
2480
2481impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2482    fn is_terminated(&self) -> bool {
2483        self.is_terminated
2484    }
2485}
2486
2487impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2488    type Protocol = DebuglogResourceMarker;
2489    type ControlHandle = DebuglogResourceControlHandle;
2490
2491    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2492        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2493    }
2494
2495    fn control_handle(&self) -> Self::ControlHandle {
2496        DebuglogResourceControlHandle { inner: self.inner.clone() }
2497    }
2498
2499    fn into_inner(
2500        self,
2501    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2502    {
2503        (self.inner, self.is_terminated)
2504    }
2505
2506    fn from_inner(
2507        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2508        is_terminated: bool,
2509    ) -> Self {
2510        Self { inner, is_terminated }
2511    }
2512}
2513
2514impl futures::Stream for DebuglogResourceRequestStream {
2515    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2516
2517    fn poll_next(
2518        mut self: std::pin::Pin<&mut Self>,
2519        cx: &mut std::task::Context<'_>,
2520    ) -> std::task::Poll<Option<Self::Item>> {
2521        let this = &mut *self;
2522        if this.inner.check_shutdown(cx) {
2523            this.is_terminated = true;
2524            return std::task::Poll::Ready(None);
2525        }
2526        if this.is_terminated {
2527            panic!("polled DebuglogResourceRequestStream after completion");
2528        }
2529        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2530            |bytes, handles| {
2531                match this.inner.channel().read_etc(cx, bytes, handles) {
2532                    std::task::Poll::Ready(Ok(())) => {}
2533                    std::task::Poll::Pending => return std::task::Poll::Pending,
2534                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2535                        this.is_terminated = true;
2536                        return std::task::Poll::Ready(None);
2537                    }
2538                    std::task::Poll::Ready(Err(e)) => {
2539                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2540                            e.into(),
2541                        ))));
2542                    }
2543                }
2544
2545                // A message has been received from the channel
2546                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2547
2548                std::task::Poll::Ready(Some(match header.ordinal {
2549                    0x6e78c1ff74765225 => {
2550                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2551                        let mut req = fidl::new_empty!(
2552                            fidl::encoding::EmptyPayload,
2553                            fidl::encoding::DefaultFuchsiaResourceDialect
2554                        );
2555                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2556                        let control_handle =
2557                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2558                        Ok(DebuglogResourceRequest::Get {
2559                            responder: DebuglogResourceGetResponder {
2560                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2561                                tx_id: header.tx_id,
2562                            },
2563                        })
2564                    }
2565                    _ => Err(fidl::Error::UnknownOrdinal {
2566                        ordinal: header.ordinal,
2567                        protocol_name:
2568                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2569                    }),
2570                }))
2571            },
2572        )
2573    }
2574}
2575
2576/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2577/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2578#[derive(Debug)]
2579pub enum DebuglogResourceRequest {
2580    /// Get a debuglog resource handle.
2581    Get { responder: DebuglogResourceGetResponder },
2582}
2583
2584impl DebuglogResourceRequest {
2585    #[allow(irrefutable_let_patterns)]
2586    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2587        if let DebuglogResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2588    }
2589
2590    /// Name of the method defined in FIDL
2591    pub fn method_name(&self) -> &'static str {
2592        match *self {
2593            DebuglogResourceRequest::Get { .. } => "get",
2594        }
2595    }
2596}
2597
2598#[derive(Debug, Clone)]
2599pub struct DebuglogResourceControlHandle {
2600    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2601}
2602
2603impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2604    fn shutdown(&self) {
2605        self.inner.shutdown()
2606    }
2607
2608    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2609        self.inner.shutdown_with_epitaph(status)
2610    }
2611
2612    fn is_closed(&self) -> bool {
2613        self.inner.channel().is_closed()
2614    }
2615    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2616        self.inner.channel().on_closed()
2617    }
2618
2619    #[cfg(target_os = "fuchsia")]
2620    fn signal_peer(
2621        &self,
2622        clear_mask: zx::Signals,
2623        set_mask: zx::Signals,
2624    ) -> Result<(), zx_status::Status> {
2625        use fidl::Peered;
2626        self.inner.channel().signal_peer(clear_mask, set_mask)
2627    }
2628}
2629
2630impl DebuglogResourceControlHandle {}
2631
2632#[must_use = "FIDL methods require a response to be sent"]
2633#[derive(Debug)]
2634pub struct DebuglogResourceGetResponder {
2635    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2636    tx_id: u32,
2637}
2638
2639/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2640/// if the responder is dropped without sending a response, so that the client
2641/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2642impl std::ops::Drop for DebuglogResourceGetResponder {
2643    fn drop(&mut self) {
2644        self.control_handle.shutdown();
2645        // Safety: drops once, never accessed again
2646        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2647    }
2648}
2649
2650impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2651    type ControlHandle = DebuglogResourceControlHandle;
2652
2653    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2654        &self.control_handle
2655    }
2656
2657    fn drop_without_shutdown(mut self) {
2658        // Safety: drops once, never accessed again due to mem::forget
2659        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2660        // Prevent Drop from running (which would shut down the channel)
2661        std::mem::forget(self);
2662    }
2663}
2664
2665impl DebuglogResourceGetResponder {
2666    /// Sends a response to the FIDL transaction.
2667    ///
2668    /// Sets the channel to shutdown if an error occurs.
2669    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2670        let _result = self.send_raw(resource);
2671        if _result.is_err() {
2672            self.control_handle.shutdown();
2673        }
2674        self.drop_without_shutdown();
2675        _result
2676    }
2677
2678    /// Similar to "send" but does not shutdown the channel if an error occurs.
2679    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2680        let _result = self.send_raw(resource);
2681        self.drop_without_shutdown();
2682        _result
2683    }
2684
2685    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2686        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2687            (resource,),
2688            self.tx_id,
2689            0x6e78c1ff74765225,
2690            fidl::encoding::DynamicFlags::empty(),
2691        )
2692    }
2693}
2694
2695#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2696pub struct EnergyInfoResourceMarker;
2697
2698impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2699    type Proxy = EnergyInfoResourceProxy;
2700    type RequestStream = EnergyInfoResourceRequestStream;
2701    #[cfg(target_os = "fuchsia")]
2702    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2703
2704    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2705}
2706impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2707
2708pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2709    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2710    fn r#get(&self) -> Self::GetResponseFut;
2711}
2712#[derive(Debug)]
2713#[cfg(target_os = "fuchsia")]
2714pub struct EnergyInfoResourceSynchronousProxy {
2715    client: fidl::client::sync::Client,
2716}
2717
2718#[cfg(target_os = "fuchsia")]
2719impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2720    type Proxy = EnergyInfoResourceProxy;
2721    type Protocol = EnergyInfoResourceMarker;
2722
2723    fn from_channel(inner: fidl::Channel) -> Self {
2724        Self::new(inner)
2725    }
2726
2727    fn into_channel(self) -> fidl::Channel {
2728        self.client.into_channel()
2729    }
2730
2731    fn as_channel(&self) -> &fidl::Channel {
2732        self.client.as_channel()
2733    }
2734}
2735
2736#[cfg(target_os = "fuchsia")]
2737impl EnergyInfoResourceSynchronousProxy {
2738    pub fn new(channel: fidl::Channel) -> Self {
2739        let protocol_name =
2740            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2741        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2742    }
2743
2744    pub fn into_channel(self) -> fidl::Channel {
2745        self.client.into_channel()
2746    }
2747
2748    /// Waits until an event arrives and returns it. It is safe for other
2749    /// threads to make concurrent requests while waiting for an event.
2750    pub fn wait_for_event(
2751        &self,
2752        deadline: zx::MonotonicInstant,
2753    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2754        EnergyInfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
2755    }
2756
2757    /// Get an EnergyInfo resource handle.
2758    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2759        let _response =
2760            self.client.send_query::<fidl::encoding::EmptyPayload, EnergyInfoResourceGetResponse>(
2761                (),
2762                0x5f5cc9f0745f61d0,
2763                fidl::encoding::DynamicFlags::empty(),
2764                ___deadline,
2765            )?;
2766        Ok(_response.resource)
2767    }
2768}
2769
2770#[cfg(target_os = "fuchsia")]
2771impl From<EnergyInfoResourceSynchronousProxy> for zx::NullableHandle {
2772    fn from(value: EnergyInfoResourceSynchronousProxy) -> Self {
2773        value.into_channel().into()
2774    }
2775}
2776
2777#[cfg(target_os = "fuchsia")]
2778impl From<fidl::Channel> for EnergyInfoResourceSynchronousProxy {
2779    fn from(value: fidl::Channel) -> Self {
2780        Self::new(value)
2781    }
2782}
2783
2784#[cfg(target_os = "fuchsia")]
2785impl fidl::endpoints::FromClient for EnergyInfoResourceSynchronousProxy {
2786    type Protocol = EnergyInfoResourceMarker;
2787
2788    fn from_client(value: fidl::endpoints::ClientEnd<EnergyInfoResourceMarker>) -> Self {
2789        Self::new(value.into_channel())
2790    }
2791}
2792
2793#[derive(Debug, Clone)]
2794pub struct EnergyInfoResourceProxy {
2795    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2796}
2797
2798impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2799    type Protocol = EnergyInfoResourceMarker;
2800
2801    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2802        Self::new(inner)
2803    }
2804
2805    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2806        self.client.into_channel().map_err(|client| Self { client })
2807    }
2808
2809    fn as_channel(&self) -> &::fidl::AsyncChannel {
2810        self.client.as_channel()
2811    }
2812}
2813
2814impl EnergyInfoResourceProxy {
2815    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2816    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2817        let protocol_name =
2818            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2819        Self { client: fidl::client::Client::new(channel, protocol_name) }
2820    }
2821
2822    /// Get a Stream of events from the remote end of the protocol.
2823    ///
2824    /// # Panics
2825    ///
2826    /// Panics if the event stream was already taken.
2827    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2828        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2829    }
2830
2831    /// Get an EnergyInfo resource handle.
2832    pub fn r#get(
2833        &self,
2834    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2835    {
2836        EnergyInfoResourceProxyInterface::r#get(self)
2837    }
2838}
2839
2840impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2841    type GetResponseFut = fidl::client::QueryResponseFut<
2842        fidl::Resource,
2843        fidl::encoding::DefaultFuchsiaResourceDialect,
2844    >;
2845    fn r#get(&self) -> Self::GetResponseFut {
2846        fn _decode(
2847            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2848        ) -> Result<fidl::Resource, fidl::Error> {
2849            let _response = fidl::client::decode_transaction_body::<
2850                EnergyInfoResourceGetResponse,
2851                fidl::encoding::DefaultFuchsiaResourceDialect,
2852                0x5f5cc9f0745f61d0,
2853            >(_buf?)?;
2854            Ok(_response.resource)
2855        }
2856        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2857            (),
2858            0x5f5cc9f0745f61d0,
2859            fidl::encoding::DynamicFlags::empty(),
2860            _decode,
2861        )
2862    }
2863}
2864
2865pub struct EnergyInfoResourceEventStream {
2866    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2867}
2868
2869impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2870
2871impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2872    fn is_terminated(&self) -> bool {
2873        self.event_receiver.is_terminated()
2874    }
2875}
2876
2877impl futures::Stream for EnergyInfoResourceEventStream {
2878    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2879
2880    fn poll_next(
2881        mut self: std::pin::Pin<&mut Self>,
2882        cx: &mut std::task::Context<'_>,
2883    ) -> std::task::Poll<Option<Self::Item>> {
2884        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2885            &mut self.event_receiver,
2886            cx
2887        )?) {
2888            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2889            None => std::task::Poll::Ready(None),
2890        }
2891    }
2892}
2893
2894#[derive(Debug)]
2895pub enum EnergyInfoResourceEvent {}
2896
2897impl EnergyInfoResourceEvent {
2898    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2899    fn decode(
2900        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2901    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2902        let (bytes, _handles) = buf.split_mut();
2903        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2904        debug_assert_eq!(tx_header.tx_id, 0);
2905        match tx_header.ordinal {
2906            _ => Err(fidl::Error::UnknownOrdinal {
2907                ordinal: tx_header.ordinal,
2908                protocol_name:
2909                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2910            }),
2911        }
2912    }
2913}
2914
2915/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2916pub struct EnergyInfoResourceRequestStream {
2917    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2918    is_terminated: bool,
2919}
2920
2921impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2922
2923impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2924    fn is_terminated(&self) -> bool {
2925        self.is_terminated
2926    }
2927}
2928
2929impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2930    type Protocol = EnergyInfoResourceMarker;
2931    type ControlHandle = EnergyInfoResourceControlHandle;
2932
2933    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2934        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2935    }
2936
2937    fn control_handle(&self) -> Self::ControlHandle {
2938        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2939    }
2940
2941    fn into_inner(
2942        self,
2943    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2944    {
2945        (self.inner, self.is_terminated)
2946    }
2947
2948    fn from_inner(
2949        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2950        is_terminated: bool,
2951    ) -> Self {
2952        Self { inner, is_terminated }
2953    }
2954}
2955
2956impl futures::Stream for EnergyInfoResourceRequestStream {
2957    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
2958
2959    fn poll_next(
2960        mut self: std::pin::Pin<&mut Self>,
2961        cx: &mut std::task::Context<'_>,
2962    ) -> std::task::Poll<Option<Self::Item>> {
2963        let this = &mut *self;
2964        if this.inner.check_shutdown(cx) {
2965            this.is_terminated = true;
2966            return std::task::Poll::Ready(None);
2967        }
2968        if this.is_terminated {
2969            panic!("polled EnergyInfoResourceRequestStream after completion");
2970        }
2971        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2972            |bytes, handles| {
2973                match this.inner.channel().read_etc(cx, bytes, handles) {
2974                    std::task::Poll::Ready(Ok(())) => {}
2975                    std::task::Poll::Pending => return std::task::Poll::Pending,
2976                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2977                        this.is_terminated = true;
2978                        return std::task::Poll::Ready(None);
2979                    }
2980                    std::task::Poll::Ready(Err(e)) => {
2981                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2982                            e.into(),
2983                        ))));
2984                    }
2985                }
2986
2987                // A message has been received from the channel
2988                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2989
2990                std::task::Poll::Ready(Some(match header.ordinal {
2991                0x5f5cc9f0745f61d0 => {
2992                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2993                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2994                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2995                    let control_handle = EnergyInfoResourceControlHandle {
2996                        inner: this.inner.clone(),
2997                    };
2998                    Ok(EnergyInfoResourceRequest::Get {
2999                        responder: EnergyInfoResourceGetResponder {
3000                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3001                            tx_id: header.tx_id,
3002                        },
3003                    })
3004                }
3005                _ => Err(fidl::Error::UnknownOrdinal {
3006                    ordinal: header.ordinal,
3007                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3008                }),
3009            }))
3010            },
3011        )
3012    }
3013}
3014
3015/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3016/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
3017#[derive(Debug)]
3018pub enum EnergyInfoResourceRequest {
3019    /// Get an EnergyInfo resource handle.
3020    Get { responder: EnergyInfoResourceGetResponder },
3021}
3022
3023impl EnergyInfoResourceRequest {
3024    #[allow(irrefutable_let_patterns)]
3025    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
3026        if let EnergyInfoResourceRequest::Get { responder } = self {
3027            Some((responder))
3028        } else {
3029            None
3030        }
3031    }
3032
3033    /// Name of the method defined in FIDL
3034    pub fn method_name(&self) -> &'static str {
3035        match *self {
3036            EnergyInfoResourceRequest::Get { .. } => "get",
3037        }
3038    }
3039}
3040
3041#[derive(Debug, Clone)]
3042pub struct EnergyInfoResourceControlHandle {
3043    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3044}
3045
3046impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
3047    fn shutdown(&self) {
3048        self.inner.shutdown()
3049    }
3050
3051    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3052        self.inner.shutdown_with_epitaph(status)
3053    }
3054
3055    fn is_closed(&self) -> bool {
3056        self.inner.channel().is_closed()
3057    }
3058    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3059        self.inner.channel().on_closed()
3060    }
3061
3062    #[cfg(target_os = "fuchsia")]
3063    fn signal_peer(
3064        &self,
3065        clear_mask: zx::Signals,
3066        set_mask: zx::Signals,
3067    ) -> Result<(), zx_status::Status> {
3068        use fidl::Peered;
3069        self.inner.channel().signal_peer(clear_mask, set_mask)
3070    }
3071}
3072
3073impl EnergyInfoResourceControlHandle {}
3074
3075#[must_use = "FIDL methods require a response to be sent"]
3076#[derive(Debug)]
3077pub struct EnergyInfoResourceGetResponder {
3078    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
3079    tx_id: u32,
3080}
3081
3082/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
3083/// if the responder is dropped without sending a response, so that the client
3084/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3085impl std::ops::Drop for EnergyInfoResourceGetResponder {
3086    fn drop(&mut self) {
3087        self.control_handle.shutdown();
3088        // Safety: drops once, never accessed again
3089        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3090    }
3091}
3092
3093impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
3094    type ControlHandle = EnergyInfoResourceControlHandle;
3095
3096    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
3097        &self.control_handle
3098    }
3099
3100    fn drop_without_shutdown(mut self) {
3101        // Safety: drops once, never accessed again due to mem::forget
3102        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3103        // Prevent Drop from running (which would shut down the channel)
3104        std::mem::forget(self);
3105    }
3106}
3107
3108impl EnergyInfoResourceGetResponder {
3109    /// Sends a response to the FIDL transaction.
3110    ///
3111    /// Sets the channel to shutdown if an error occurs.
3112    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3113        let _result = self.send_raw(resource);
3114        if _result.is_err() {
3115            self.control_handle.shutdown();
3116        }
3117        self.drop_without_shutdown();
3118        _result
3119    }
3120
3121    /// Similar to "send" but does not shutdown the channel if an error occurs.
3122    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3123        let _result = self.send_raw(resource);
3124        self.drop_without_shutdown();
3125        _result
3126    }
3127
3128    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3129        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
3130            (resource,),
3131            self.tx_id,
3132            0x5f5cc9f0745f61d0,
3133            fidl::encoding::DynamicFlags::empty(),
3134        )
3135    }
3136}
3137
3138#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3139pub struct HypervisorResourceMarker;
3140
3141impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3142    type Proxy = HypervisorResourceProxy;
3143    type RequestStream = HypervisorResourceRequestStream;
3144    #[cfg(target_os = "fuchsia")]
3145    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3146
3147    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3148}
3149impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3150
3151pub trait HypervisorResourceProxyInterface: Send + Sync {
3152    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3153    fn r#get(&self) -> Self::GetResponseFut;
3154}
3155#[derive(Debug)]
3156#[cfg(target_os = "fuchsia")]
3157pub struct HypervisorResourceSynchronousProxy {
3158    client: fidl::client::sync::Client,
3159}
3160
3161#[cfg(target_os = "fuchsia")]
3162impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3163    type Proxy = HypervisorResourceProxy;
3164    type Protocol = HypervisorResourceMarker;
3165
3166    fn from_channel(inner: fidl::Channel) -> Self {
3167        Self::new(inner)
3168    }
3169
3170    fn into_channel(self) -> fidl::Channel {
3171        self.client.into_channel()
3172    }
3173
3174    fn as_channel(&self) -> &fidl::Channel {
3175        self.client.as_channel()
3176    }
3177}
3178
3179#[cfg(target_os = "fuchsia")]
3180impl HypervisorResourceSynchronousProxy {
3181    pub fn new(channel: fidl::Channel) -> Self {
3182        let protocol_name =
3183            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3184        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3185    }
3186
3187    pub fn into_channel(self) -> fidl::Channel {
3188        self.client.into_channel()
3189    }
3190
3191    /// Waits until an event arrives and returns it. It is safe for other
3192    /// threads to make concurrent requests while waiting for an event.
3193    pub fn wait_for_event(
3194        &self,
3195        deadline: zx::MonotonicInstant,
3196    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3197        HypervisorResourceEvent::decode(self.client.wait_for_event(deadline)?)
3198    }
3199
3200    /// Get a hypervisor resource handle.
3201    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3202        let _response =
3203            self.client.send_query::<fidl::encoding::EmptyPayload, HypervisorResourceGetResponse>(
3204                (),
3205                0x1c312131d3b824a2,
3206                fidl::encoding::DynamicFlags::empty(),
3207                ___deadline,
3208            )?;
3209        Ok(_response.resource)
3210    }
3211}
3212
3213#[cfg(target_os = "fuchsia")]
3214impl From<HypervisorResourceSynchronousProxy> for zx::NullableHandle {
3215    fn from(value: HypervisorResourceSynchronousProxy) -> Self {
3216        value.into_channel().into()
3217    }
3218}
3219
3220#[cfg(target_os = "fuchsia")]
3221impl From<fidl::Channel> for HypervisorResourceSynchronousProxy {
3222    fn from(value: fidl::Channel) -> Self {
3223        Self::new(value)
3224    }
3225}
3226
3227#[cfg(target_os = "fuchsia")]
3228impl fidl::endpoints::FromClient for HypervisorResourceSynchronousProxy {
3229    type Protocol = HypervisorResourceMarker;
3230
3231    fn from_client(value: fidl::endpoints::ClientEnd<HypervisorResourceMarker>) -> Self {
3232        Self::new(value.into_channel())
3233    }
3234}
3235
3236#[derive(Debug, Clone)]
3237pub struct HypervisorResourceProxy {
3238    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3239}
3240
3241impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3242    type Protocol = HypervisorResourceMarker;
3243
3244    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3245        Self::new(inner)
3246    }
3247
3248    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3249        self.client.into_channel().map_err(|client| Self { client })
3250    }
3251
3252    fn as_channel(&self) -> &::fidl::AsyncChannel {
3253        self.client.as_channel()
3254    }
3255}
3256
3257impl HypervisorResourceProxy {
3258    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3259    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3260        let protocol_name =
3261            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3262        Self { client: fidl::client::Client::new(channel, protocol_name) }
3263    }
3264
3265    /// Get a Stream of events from the remote end of the protocol.
3266    ///
3267    /// # Panics
3268    ///
3269    /// Panics if the event stream was already taken.
3270    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3271        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3272    }
3273
3274    /// Get a hypervisor resource handle.
3275    pub fn r#get(
3276        &self,
3277    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3278    {
3279        HypervisorResourceProxyInterface::r#get(self)
3280    }
3281}
3282
3283impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3284    type GetResponseFut = fidl::client::QueryResponseFut<
3285        fidl::Resource,
3286        fidl::encoding::DefaultFuchsiaResourceDialect,
3287    >;
3288    fn r#get(&self) -> Self::GetResponseFut {
3289        fn _decode(
3290            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3291        ) -> Result<fidl::Resource, fidl::Error> {
3292            let _response = fidl::client::decode_transaction_body::<
3293                HypervisorResourceGetResponse,
3294                fidl::encoding::DefaultFuchsiaResourceDialect,
3295                0x1c312131d3b824a2,
3296            >(_buf?)?;
3297            Ok(_response.resource)
3298        }
3299        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3300            (),
3301            0x1c312131d3b824a2,
3302            fidl::encoding::DynamicFlags::empty(),
3303            _decode,
3304        )
3305    }
3306}
3307
3308pub struct HypervisorResourceEventStream {
3309    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3310}
3311
3312impl std::marker::Unpin for HypervisorResourceEventStream {}
3313
3314impl futures::stream::FusedStream for HypervisorResourceEventStream {
3315    fn is_terminated(&self) -> bool {
3316        self.event_receiver.is_terminated()
3317    }
3318}
3319
3320impl futures::Stream for HypervisorResourceEventStream {
3321    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3322
3323    fn poll_next(
3324        mut self: std::pin::Pin<&mut Self>,
3325        cx: &mut std::task::Context<'_>,
3326    ) -> std::task::Poll<Option<Self::Item>> {
3327        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3328            &mut self.event_receiver,
3329            cx
3330        )?) {
3331            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3332            None => std::task::Poll::Ready(None),
3333        }
3334    }
3335}
3336
3337#[derive(Debug)]
3338pub enum HypervisorResourceEvent {}
3339
3340impl HypervisorResourceEvent {
3341    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3342    fn decode(
3343        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3344    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3345        let (bytes, _handles) = buf.split_mut();
3346        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3347        debug_assert_eq!(tx_header.tx_id, 0);
3348        match tx_header.ordinal {
3349            _ => Err(fidl::Error::UnknownOrdinal {
3350                ordinal: tx_header.ordinal,
3351                protocol_name:
3352                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3353            }),
3354        }
3355    }
3356}
3357
3358/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3359pub struct HypervisorResourceRequestStream {
3360    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3361    is_terminated: bool,
3362}
3363
3364impl std::marker::Unpin for HypervisorResourceRequestStream {}
3365
3366impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3367    fn is_terminated(&self) -> bool {
3368        self.is_terminated
3369    }
3370}
3371
3372impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3373    type Protocol = HypervisorResourceMarker;
3374    type ControlHandle = HypervisorResourceControlHandle;
3375
3376    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3377        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3378    }
3379
3380    fn control_handle(&self) -> Self::ControlHandle {
3381        HypervisorResourceControlHandle { inner: self.inner.clone() }
3382    }
3383
3384    fn into_inner(
3385        self,
3386    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3387    {
3388        (self.inner, self.is_terminated)
3389    }
3390
3391    fn from_inner(
3392        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3393        is_terminated: bool,
3394    ) -> Self {
3395        Self { inner, is_terminated }
3396    }
3397}
3398
3399impl futures::Stream for HypervisorResourceRequestStream {
3400    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3401
3402    fn poll_next(
3403        mut self: std::pin::Pin<&mut Self>,
3404        cx: &mut std::task::Context<'_>,
3405    ) -> std::task::Poll<Option<Self::Item>> {
3406        let this = &mut *self;
3407        if this.inner.check_shutdown(cx) {
3408            this.is_terminated = true;
3409            return std::task::Poll::Ready(None);
3410        }
3411        if this.is_terminated {
3412            panic!("polled HypervisorResourceRequestStream after completion");
3413        }
3414        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3415            |bytes, handles| {
3416                match this.inner.channel().read_etc(cx, bytes, handles) {
3417                    std::task::Poll::Ready(Ok(())) => {}
3418                    std::task::Poll::Pending => return std::task::Poll::Pending,
3419                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3420                        this.is_terminated = true;
3421                        return std::task::Poll::Ready(None);
3422                    }
3423                    std::task::Poll::Ready(Err(e)) => {
3424                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3425                            e.into(),
3426                        ))));
3427                    }
3428                }
3429
3430                // A message has been received from the channel
3431                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3432
3433                std::task::Poll::Ready(Some(match header.ordinal {
3434                0x1c312131d3b824a2 => {
3435                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3436                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3437                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3438                    let control_handle = HypervisorResourceControlHandle {
3439                        inner: this.inner.clone(),
3440                    };
3441                    Ok(HypervisorResourceRequest::Get {
3442                        responder: HypervisorResourceGetResponder {
3443                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3444                            tx_id: header.tx_id,
3445                        },
3446                    })
3447                }
3448                _ => Err(fidl::Error::UnknownOrdinal {
3449                    ordinal: header.ordinal,
3450                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3451                }),
3452            }))
3453            },
3454        )
3455    }
3456}
3457
3458/// Protocol for providing the hypervisor resource.
3459#[derive(Debug)]
3460pub enum HypervisorResourceRequest {
3461    /// Get a hypervisor resource handle.
3462    Get { responder: HypervisorResourceGetResponder },
3463}
3464
3465impl HypervisorResourceRequest {
3466    #[allow(irrefutable_let_patterns)]
3467    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3468        if let HypervisorResourceRequest::Get { responder } = self {
3469            Some((responder))
3470        } else {
3471            None
3472        }
3473    }
3474
3475    /// Name of the method defined in FIDL
3476    pub fn method_name(&self) -> &'static str {
3477        match *self {
3478            HypervisorResourceRequest::Get { .. } => "get",
3479        }
3480    }
3481}
3482
3483#[derive(Debug, Clone)]
3484pub struct HypervisorResourceControlHandle {
3485    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3486}
3487
3488impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3489    fn shutdown(&self) {
3490        self.inner.shutdown()
3491    }
3492
3493    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3494        self.inner.shutdown_with_epitaph(status)
3495    }
3496
3497    fn is_closed(&self) -> bool {
3498        self.inner.channel().is_closed()
3499    }
3500    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3501        self.inner.channel().on_closed()
3502    }
3503
3504    #[cfg(target_os = "fuchsia")]
3505    fn signal_peer(
3506        &self,
3507        clear_mask: zx::Signals,
3508        set_mask: zx::Signals,
3509    ) -> Result<(), zx_status::Status> {
3510        use fidl::Peered;
3511        self.inner.channel().signal_peer(clear_mask, set_mask)
3512    }
3513}
3514
3515impl HypervisorResourceControlHandle {}
3516
3517#[must_use = "FIDL methods require a response to be sent"]
3518#[derive(Debug)]
3519pub struct HypervisorResourceGetResponder {
3520    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3521    tx_id: u32,
3522}
3523
3524/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3525/// if the responder is dropped without sending a response, so that the client
3526/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3527impl std::ops::Drop for HypervisorResourceGetResponder {
3528    fn drop(&mut self) {
3529        self.control_handle.shutdown();
3530        // Safety: drops once, never accessed again
3531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3532    }
3533}
3534
3535impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3536    type ControlHandle = HypervisorResourceControlHandle;
3537
3538    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3539        &self.control_handle
3540    }
3541
3542    fn drop_without_shutdown(mut self) {
3543        // Safety: drops once, never accessed again due to mem::forget
3544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3545        // Prevent Drop from running (which would shut down the channel)
3546        std::mem::forget(self);
3547    }
3548}
3549
3550impl HypervisorResourceGetResponder {
3551    /// Sends a response to the FIDL transaction.
3552    ///
3553    /// Sets the channel to shutdown if an error occurs.
3554    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3555        let _result = self.send_raw(resource);
3556        if _result.is_err() {
3557            self.control_handle.shutdown();
3558        }
3559        self.drop_without_shutdown();
3560        _result
3561    }
3562
3563    /// Similar to "send" but does not shutdown the channel if an error occurs.
3564    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3565        let _result = self.send_raw(resource);
3566        self.drop_without_shutdown();
3567        _result
3568    }
3569
3570    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3571        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3572            (resource,),
3573            self.tx_id,
3574            0x1c312131d3b824a2,
3575            fidl::encoding::DynamicFlags::empty(),
3576        )
3577    }
3578}
3579
3580#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3581pub struct InfoResourceMarker;
3582
3583impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3584    type Proxy = InfoResourceProxy;
3585    type RequestStream = InfoResourceRequestStream;
3586    #[cfg(target_os = "fuchsia")]
3587    type SynchronousProxy = InfoResourceSynchronousProxy;
3588
3589    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3590}
3591impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3592
3593pub trait InfoResourceProxyInterface: Send + Sync {
3594    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3595    fn r#get(&self) -> Self::GetResponseFut;
3596}
3597#[derive(Debug)]
3598#[cfg(target_os = "fuchsia")]
3599pub struct InfoResourceSynchronousProxy {
3600    client: fidl::client::sync::Client,
3601}
3602
3603#[cfg(target_os = "fuchsia")]
3604impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3605    type Proxy = InfoResourceProxy;
3606    type Protocol = InfoResourceMarker;
3607
3608    fn from_channel(inner: fidl::Channel) -> Self {
3609        Self::new(inner)
3610    }
3611
3612    fn into_channel(self) -> fidl::Channel {
3613        self.client.into_channel()
3614    }
3615
3616    fn as_channel(&self) -> &fidl::Channel {
3617        self.client.as_channel()
3618    }
3619}
3620
3621#[cfg(target_os = "fuchsia")]
3622impl InfoResourceSynchronousProxy {
3623    pub fn new(channel: fidl::Channel) -> Self {
3624        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3625        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3626    }
3627
3628    pub fn into_channel(self) -> fidl::Channel {
3629        self.client.into_channel()
3630    }
3631
3632    /// Waits until an event arrives and returns it. It is safe for other
3633    /// threads to make concurrent requests while waiting for an event.
3634    pub fn wait_for_event(
3635        &self,
3636        deadline: zx::MonotonicInstant,
3637    ) -> Result<InfoResourceEvent, fidl::Error> {
3638        InfoResourceEvent::decode(self.client.wait_for_event(deadline)?)
3639    }
3640
3641    /// Get an info resource handle.
3642    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3643        let _response =
3644            self.client.send_query::<fidl::encoding::EmptyPayload, InfoResourceGetResponse>(
3645                (),
3646                0x1de8edcb4abc2067,
3647                fidl::encoding::DynamicFlags::empty(),
3648                ___deadline,
3649            )?;
3650        Ok(_response.resource)
3651    }
3652}
3653
3654#[cfg(target_os = "fuchsia")]
3655impl From<InfoResourceSynchronousProxy> for zx::NullableHandle {
3656    fn from(value: InfoResourceSynchronousProxy) -> Self {
3657        value.into_channel().into()
3658    }
3659}
3660
3661#[cfg(target_os = "fuchsia")]
3662impl From<fidl::Channel> for InfoResourceSynchronousProxy {
3663    fn from(value: fidl::Channel) -> Self {
3664        Self::new(value)
3665    }
3666}
3667
3668#[cfg(target_os = "fuchsia")]
3669impl fidl::endpoints::FromClient for InfoResourceSynchronousProxy {
3670    type Protocol = InfoResourceMarker;
3671
3672    fn from_client(value: fidl::endpoints::ClientEnd<InfoResourceMarker>) -> Self {
3673        Self::new(value.into_channel())
3674    }
3675}
3676
3677#[derive(Debug, Clone)]
3678pub struct InfoResourceProxy {
3679    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3680}
3681
3682impl fidl::endpoints::Proxy for InfoResourceProxy {
3683    type Protocol = InfoResourceMarker;
3684
3685    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3686        Self::new(inner)
3687    }
3688
3689    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3690        self.client.into_channel().map_err(|client| Self { client })
3691    }
3692
3693    fn as_channel(&self) -> &::fidl::AsyncChannel {
3694        self.client.as_channel()
3695    }
3696}
3697
3698impl InfoResourceProxy {
3699    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3700    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3701        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3702        Self { client: fidl::client::Client::new(channel, protocol_name) }
3703    }
3704
3705    /// Get a Stream of events from the remote end of the protocol.
3706    ///
3707    /// # Panics
3708    ///
3709    /// Panics if the event stream was already taken.
3710    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3711        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3712    }
3713
3714    /// Get an info resource handle.
3715    pub fn r#get(
3716        &self,
3717    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3718    {
3719        InfoResourceProxyInterface::r#get(self)
3720    }
3721}
3722
3723impl InfoResourceProxyInterface for InfoResourceProxy {
3724    type GetResponseFut = fidl::client::QueryResponseFut<
3725        fidl::Resource,
3726        fidl::encoding::DefaultFuchsiaResourceDialect,
3727    >;
3728    fn r#get(&self) -> Self::GetResponseFut {
3729        fn _decode(
3730            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3731        ) -> Result<fidl::Resource, fidl::Error> {
3732            let _response = fidl::client::decode_transaction_body::<
3733                InfoResourceGetResponse,
3734                fidl::encoding::DefaultFuchsiaResourceDialect,
3735                0x1de8edcb4abc2067,
3736            >(_buf?)?;
3737            Ok(_response.resource)
3738        }
3739        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3740            (),
3741            0x1de8edcb4abc2067,
3742            fidl::encoding::DynamicFlags::empty(),
3743            _decode,
3744        )
3745    }
3746}
3747
3748pub struct InfoResourceEventStream {
3749    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3750}
3751
3752impl std::marker::Unpin for InfoResourceEventStream {}
3753
3754impl futures::stream::FusedStream for InfoResourceEventStream {
3755    fn is_terminated(&self) -> bool {
3756        self.event_receiver.is_terminated()
3757    }
3758}
3759
3760impl futures::Stream for InfoResourceEventStream {
3761    type Item = Result<InfoResourceEvent, fidl::Error>;
3762
3763    fn poll_next(
3764        mut self: std::pin::Pin<&mut Self>,
3765        cx: &mut std::task::Context<'_>,
3766    ) -> std::task::Poll<Option<Self::Item>> {
3767        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3768            &mut self.event_receiver,
3769            cx
3770        )?) {
3771            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3772            None => std::task::Poll::Ready(None),
3773        }
3774    }
3775}
3776
3777#[derive(Debug)]
3778pub enum InfoResourceEvent {}
3779
3780impl InfoResourceEvent {
3781    /// Decodes a message buffer as a [`InfoResourceEvent`].
3782    fn decode(
3783        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3784    ) -> Result<InfoResourceEvent, fidl::Error> {
3785        let (bytes, _handles) = buf.split_mut();
3786        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3787        debug_assert_eq!(tx_header.tx_id, 0);
3788        match tx_header.ordinal {
3789            _ => Err(fidl::Error::UnknownOrdinal {
3790                ordinal: tx_header.ordinal,
3791                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3792            }),
3793        }
3794    }
3795}
3796
3797/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3798pub struct InfoResourceRequestStream {
3799    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3800    is_terminated: bool,
3801}
3802
3803impl std::marker::Unpin for InfoResourceRequestStream {}
3804
3805impl futures::stream::FusedStream for InfoResourceRequestStream {
3806    fn is_terminated(&self) -> bool {
3807        self.is_terminated
3808    }
3809}
3810
3811impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3812    type Protocol = InfoResourceMarker;
3813    type ControlHandle = InfoResourceControlHandle;
3814
3815    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3816        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3817    }
3818
3819    fn control_handle(&self) -> Self::ControlHandle {
3820        InfoResourceControlHandle { inner: self.inner.clone() }
3821    }
3822
3823    fn into_inner(
3824        self,
3825    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3826    {
3827        (self.inner, self.is_terminated)
3828    }
3829
3830    fn from_inner(
3831        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3832        is_terminated: bool,
3833    ) -> Self {
3834        Self { inner, is_terminated }
3835    }
3836}
3837
3838impl futures::Stream for InfoResourceRequestStream {
3839    type Item = Result<InfoResourceRequest, fidl::Error>;
3840
3841    fn poll_next(
3842        mut self: std::pin::Pin<&mut Self>,
3843        cx: &mut std::task::Context<'_>,
3844    ) -> std::task::Poll<Option<Self::Item>> {
3845        let this = &mut *self;
3846        if this.inner.check_shutdown(cx) {
3847            this.is_terminated = true;
3848            return std::task::Poll::Ready(None);
3849        }
3850        if this.is_terminated {
3851            panic!("polled InfoResourceRequestStream after completion");
3852        }
3853        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3854            |bytes, handles| {
3855                match this.inner.channel().read_etc(cx, bytes, handles) {
3856                    std::task::Poll::Ready(Ok(())) => {}
3857                    std::task::Poll::Pending => return std::task::Poll::Pending,
3858                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3859                        this.is_terminated = true;
3860                        return std::task::Poll::Ready(None);
3861                    }
3862                    std::task::Poll::Ready(Err(e)) => {
3863                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3864                            e.into(),
3865                        ))));
3866                    }
3867                }
3868
3869                // A message has been received from the channel
3870                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3871
3872                std::task::Poll::Ready(Some(match header.ordinal {
3873                    0x1de8edcb4abc2067 => {
3874                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3875                        let mut req = fidl::new_empty!(
3876                            fidl::encoding::EmptyPayload,
3877                            fidl::encoding::DefaultFuchsiaResourceDialect
3878                        );
3879                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3880                        let control_handle =
3881                            InfoResourceControlHandle { inner: this.inner.clone() };
3882                        Ok(InfoResourceRequest::Get {
3883                            responder: InfoResourceGetResponder {
3884                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3885                                tx_id: header.tx_id,
3886                            },
3887                        })
3888                    }
3889                    _ => Err(fidl::Error::UnknownOrdinal {
3890                        ordinal: header.ordinal,
3891                        protocol_name:
3892                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3893                    }),
3894                }))
3895            },
3896        )
3897    }
3898}
3899
3900/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3901/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3902#[derive(Debug)]
3903pub enum InfoResourceRequest {
3904    /// Get an info resource handle.
3905    Get { responder: InfoResourceGetResponder },
3906}
3907
3908impl InfoResourceRequest {
3909    #[allow(irrefutable_let_patterns)]
3910    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3911        if let InfoResourceRequest::Get { responder } = self { Some((responder)) } else { None }
3912    }
3913
3914    /// Name of the method defined in FIDL
3915    pub fn method_name(&self) -> &'static str {
3916        match *self {
3917            InfoResourceRequest::Get { .. } => "get",
3918        }
3919    }
3920}
3921
3922#[derive(Debug, Clone)]
3923pub struct InfoResourceControlHandle {
3924    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3925}
3926
3927impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3928    fn shutdown(&self) {
3929        self.inner.shutdown()
3930    }
3931
3932    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3933        self.inner.shutdown_with_epitaph(status)
3934    }
3935
3936    fn is_closed(&self) -> bool {
3937        self.inner.channel().is_closed()
3938    }
3939    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3940        self.inner.channel().on_closed()
3941    }
3942
3943    #[cfg(target_os = "fuchsia")]
3944    fn signal_peer(
3945        &self,
3946        clear_mask: zx::Signals,
3947        set_mask: zx::Signals,
3948    ) -> Result<(), zx_status::Status> {
3949        use fidl::Peered;
3950        self.inner.channel().signal_peer(clear_mask, set_mask)
3951    }
3952}
3953
3954impl InfoResourceControlHandle {}
3955
3956#[must_use = "FIDL methods require a response to be sent"]
3957#[derive(Debug)]
3958pub struct InfoResourceGetResponder {
3959    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
3960    tx_id: u32,
3961}
3962
3963/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
3964/// if the responder is dropped without sending a response, so that the client
3965/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3966impl std::ops::Drop for InfoResourceGetResponder {
3967    fn drop(&mut self) {
3968        self.control_handle.shutdown();
3969        // Safety: drops once, never accessed again
3970        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3971    }
3972}
3973
3974impl fidl::endpoints::Responder for InfoResourceGetResponder {
3975    type ControlHandle = InfoResourceControlHandle;
3976
3977    fn control_handle(&self) -> &InfoResourceControlHandle {
3978        &self.control_handle
3979    }
3980
3981    fn drop_without_shutdown(mut self) {
3982        // Safety: drops once, never accessed again due to mem::forget
3983        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3984        // Prevent Drop from running (which would shut down the channel)
3985        std::mem::forget(self);
3986    }
3987}
3988
3989impl InfoResourceGetResponder {
3990    /// Sends a response to the FIDL transaction.
3991    ///
3992    /// Sets the channel to shutdown if an error occurs.
3993    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3994        let _result = self.send_raw(resource);
3995        if _result.is_err() {
3996            self.control_handle.shutdown();
3997        }
3998        self.drop_without_shutdown();
3999        _result
4000    }
4001
4002    /// Similar to "send" but does not shutdown the channel if an error occurs.
4003    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4004        let _result = self.send_raw(resource);
4005        self.drop_without_shutdown();
4006        _result
4007    }
4008
4009    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4010        self.control_handle.inner.send::<InfoResourceGetResponse>(
4011            (resource,),
4012            self.tx_id,
4013            0x1de8edcb4abc2067,
4014            fidl::encoding::DynamicFlags::empty(),
4015        )
4016    }
4017}
4018
4019#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4020pub struct IommuResourceMarker;
4021
4022impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
4023    type Proxy = IommuResourceProxy;
4024    type RequestStream = IommuResourceRequestStream;
4025    #[cfg(target_os = "fuchsia")]
4026    type SynchronousProxy = IommuResourceSynchronousProxy;
4027
4028    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
4029}
4030impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
4031
4032pub trait IommuResourceProxyInterface: Send + Sync {
4033    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4034    fn r#get(&self) -> Self::GetResponseFut;
4035}
4036#[derive(Debug)]
4037#[cfg(target_os = "fuchsia")]
4038pub struct IommuResourceSynchronousProxy {
4039    client: fidl::client::sync::Client,
4040}
4041
4042#[cfg(target_os = "fuchsia")]
4043impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
4044    type Proxy = IommuResourceProxy;
4045    type Protocol = IommuResourceMarker;
4046
4047    fn from_channel(inner: fidl::Channel) -> Self {
4048        Self::new(inner)
4049    }
4050
4051    fn into_channel(self) -> fidl::Channel {
4052        self.client.into_channel()
4053    }
4054
4055    fn as_channel(&self) -> &fidl::Channel {
4056        self.client.as_channel()
4057    }
4058}
4059
4060#[cfg(target_os = "fuchsia")]
4061impl IommuResourceSynchronousProxy {
4062    pub fn new(channel: fidl::Channel) -> Self {
4063        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4064        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4065    }
4066
4067    pub fn into_channel(self) -> fidl::Channel {
4068        self.client.into_channel()
4069    }
4070
4071    /// Waits until an event arrives and returns it. It is safe for other
4072    /// threads to make concurrent requests while waiting for an event.
4073    pub fn wait_for_event(
4074        &self,
4075        deadline: zx::MonotonicInstant,
4076    ) -> Result<IommuResourceEvent, fidl::Error> {
4077        IommuResourceEvent::decode(self.client.wait_for_event(deadline)?)
4078    }
4079
4080    /// Get an iommu resource handle.
4081    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4082        let _response =
4083            self.client.send_query::<fidl::encoding::EmptyPayload, IommuResourceGetResponse>(
4084                (),
4085                0x5af309b619aa7c5b,
4086                fidl::encoding::DynamicFlags::empty(),
4087                ___deadline,
4088            )?;
4089        Ok(_response.resource)
4090    }
4091}
4092
4093#[cfg(target_os = "fuchsia")]
4094impl From<IommuResourceSynchronousProxy> for zx::NullableHandle {
4095    fn from(value: IommuResourceSynchronousProxy) -> Self {
4096        value.into_channel().into()
4097    }
4098}
4099
4100#[cfg(target_os = "fuchsia")]
4101impl From<fidl::Channel> for IommuResourceSynchronousProxy {
4102    fn from(value: fidl::Channel) -> Self {
4103        Self::new(value)
4104    }
4105}
4106
4107#[cfg(target_os = "fuchsia")]
4108impl fidl::endpoints::FromClient for IommuResourceSynchronousProxy {
4109    type Protocol = IommuResourceMarker;
4110
4111    fn from_client(value: fidl::endpoints::ClientEnd<IommuResourceMarker>) -> Self {
4112        Self::new(value.into_channel())
4113    }
4114}
4115
4116#[derive(Debug, Clone)]
4117pub struct IommuResourceProxy {
4118    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4119}
4120
4121impl fidl::endpoints::Proxy for IommuResourceProxy {
4122    type Protocol = IommuResourceMarker;
4123
4124    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4125        Self::new(inner)
4126    }
4127
4128    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4129        self.client.into_channel().map_err(|client| Self { client })
4130    }
4131
4132    fn as_channel(&self) -> &::fidl::AsyncChannel {
4133        self.client.as_channel()
4134    }
4135}
4136
4137impl IommuResourceProxy {
4138    /// Create a new Proxy for fuchsia.kernel/IommuResource.
4139    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4140        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4141        Self { client: fidl::client::Client::new(channel, protocol_name) }
4142    }
4143
4144    /// Get a Stream of events from the remote end of the protocol.
4145    ///
4146    /// # Panics
4147    ///
4148    /// Panics if the event stream was already taken.
4149    pub fn take_event_stream(&self) -> IommuResourceEventStream {
4150        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
4151    }
4152
4153    /// Get an iommu resource handle.
4154    pub fn r#get(
4155        &self,
4156    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4157    {
4158        IommuResourceProxyInterface::r#get(self)
4159    }
4160}
4161
4162impl IommuResourceProxyInterface for IommuResourceProxy {
4163    type GetResponseFut = fidl::client::QueryResponseFut<
4164        fidl::Resource,
4165        fidl::encoding::DefaultFuchsiaResourceDialect,
4166    >;
4167    fn r#get(&self) -> Self::GetResponseFut {
4168        fn _decode(
4169            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4170        ) -> Result<fidl::Resource, fidl::Error> {
4171            let _response = fidl::client::decode_transaction_body::<
4172                IommuResourceGetResponse,
4173                fidl::encoding::DefaultFuchsiaResourceDialect,
4174                0x5af309b619aa7c5b,
4175            >(_buf?)?;
4176            Ok(_response.resource)
4177        }
4178        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4179            (),
4180            0x5af309b619aa7c5b,
4181            fidl::encoding::DynamicFlags::empty(),
4182            _decode,
4183        )
4184    }
4185}
4186
4187pub struct IommuResourceEventStream {
4188    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4189}
4190
4191impl std::marker::Unpin for IommuResourceEventStream {}
4192
4193impl futures::stream::FusedStream for IommuResourceEventStream {
4194    fn is_terminated(&self) -> bool {
4195        self.event_receiver.is_terminated()
4196    }
4197}
4198
4199impl futures::Stream for IommuResourceEventStream {
4200    type Item = Result<IommuResourceEvent, fidl::Error>;
4201
4202    fn poll_next(
4203        mut self: std::pin::Pin<&mut Self>,
4204        cx: &mut std::task::Context<'_>,
4205    ) -> std::task::Poll<Option<Self::Item>> {
4206        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4207            &mut self.event_receiver,
4208            cx
4209        )?) {
4210            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4211            None => std::task::Poll::Ready(None),
4212        }
4213    }
4214}
4215
4216#[derive(Debug)]
4217pub enum IommuResourceEvent {}
4218
4219impl IommuResourceEvent {
4220    /// Decodes a message buffer as a [`IommuResourceEvent`].
4221    fn decode(
4222        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4223    ) -> Result<IommuResourceEvent, fidl::Error> {
4224        let (bytes, _handles) = buf.split_mut();
4225        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4226        debug_assert_eq!(tx_header.tx_id, 0);
4227        match tx_header.ordinal {
4228            _ => Err(fidl::Error::UnknownOrdinal {
4229                ordinal: tx_header.ordinal,
4230                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4231            }),
4232        }
4233    }
4234}
4235
4236/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4237pub struct IommuResourceRequestStream {
4238    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4239    is_terminated: bool,
4240}
4241
4242impl std::marker::Unpin for IommuResourceRequestStream {}
4243
4244impl futures::stream::FusedStream for IommuResourceRequestStream {
4245    fn is_terminated(&self) -> bool {
4246        self.is_terminated
4247    }
4248}
4249
4250impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4251    type Protocol = IommuResourceMarker;
4252    type ControlHandle = IommuResourceControlHandle;
4253
4254    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4255        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4256    }
4257
4258    fn control_handle(&self) -> Self::ControlHandle {
4259        IommuResourceControlHandle { inner: self.inner.clone() }
4260    }
4261
4262    fn into_inner(
4263        self,
4264    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4265    {
4266        (self.inner, self.is_terminated)
4267    }
4268
4269    fn from_inner(
4270        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4271        is_terminated: bool,
4272    ) -> Self {
4273        Self { inner, is_terminated }
4274    }
4275}
4276
4277impl futures::Stream for IommuResourceRequestStream {
4278    type Item = Result<IommuResourceRequest, fidl::Error>;
4279
4280    fn poll_next(
4281        mut self: std::pin::Pin<&mut Self>,
4282        cx: &mut std::task::Context<'_>,
4283    ) -> std::task::Poll<Option<Self::Item>> {
4284        let this = &mut *self;
4285        if this.inner.check_shutdown(cx) {
4286            this.is_terminated = true;
4287            return std::task::Poll::Ready(None);
4288        }
4289        if this.is_terminated {
4290            panic!("polled IommuResourceRequestStream after completion");
4291        }
4292        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4293            |bytes, handles| {
4294                match this.inner.channel().read_etc(cx, bytes, handles) {
4295                    std::task::Poll::Ready(Ok(())) => {}
4296                    std::task::Poll::Pending => return std::task::Poll::Pending,
4297                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4298                        this.is_terminated = true;
4299                        return std::task::Poll::Ready(None);
4300                    }
4301                    std::task::Poll::Ready(Err(e)) => {
4302                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4303                            e.into(),
4304                        ))));
4305                    }
4306                }
4307
4308                // A message has been received from the channel
4309                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4310
4311                std::task::Poll::Ready(Some(match header.ordinal {
4312                    0x5af309b619aa7c5b => {
4313                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4314                        let mut req = fidl::new_empty!(
4315                            fidl::encoding::EmptyPayload,
4316                            fidl::encoding::DefaultFuchsiaResourceDialect
4317                        );
4318                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4319                        let control_handle =
4320                            IommuResourceControlHandle { inner: this.inner.clone() };
4321                        Ok(IommuResourceRequest::Get {
4322                            responder: IommuResourceGetResponder {
4323                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4324                                tx_id: header.tx_id,
4325                            },
4326                        })
4327                    }
4328                    _ => Err(fidl::Error::UnknownOrdinal {
4329                        ordinal: header.ordinal,
4330                        protocol_name:
4331                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4332                    }),
4333                }))
4334            },
4335        )
4336    }
4337}
4338
4339/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4340/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4341#[derive(Debug)]
4342pub enum IommuResourceRequest {
4343    /// Get an iommu resource handle.
4344    Get { responder: IommuResourceGetResponder },
4345}
4346
4347impl IommuResourceRequest {
4348    #[allow(irrefutable_let_patterns)]
4349    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4350        if let IommuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4351    }
4352
4353    /// Name of the method defined in FIDL
4354    pub fn method_name(&self) -> &'static str {
4355        match *self {
4356            IommuResourceRequest::Get { .. } => "get",
4357        }
4358    }
4359}
4360
4361#[derive(Debug, Clone)]
4362pub struct IommuResourceControlHandle {
4363    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4364}
4365
4366impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4367    fn shutdown(&self) {
4368        self.inner.shutdown()
4369    }
4370
4371    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4372        self.inner.shutdown_with_epitaph(status)
4373    }
4374
4375    fn is_closed(&self) -> bool {
4376        self.inner.channel().is_closed()
4377    }
4378    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4379        self.inner.channel().on_closed()
4380    }
4381
4382    #[cfg(target_os = "fuchsia")]
4383    fn signal_peer(
4384        &self,
4385        clear_mask: zx::Signals,
4386        set_mask: zx::Signals,
4387    ) -> Result<(), zx_status::Status> {
4388        use fidl::Peered;
4389        self.inner.channel().signal_peer(clear_mask, set_mask)
4390    }
4391}
4392
4393impl IommuResourceControlHandle {}
4394
4395#[must_use = "FIDL methods require a response to be sent"]
4396#[derive(Debug)]
4397pub struct IommuResourceGetResponder {
4398    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4399    tx_id: u32,
4400}
4401
4402/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4403/// if the responder is dropped without sending a response, so that the client
4404/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4405impl std::ops::Drop for IommuResourceGetResponder {
4406    fn drop(&mut self) {
4407        self.control_handle.shutdown();
4408        // Safety: drops once, never accessed again
4409        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4410    }
4411}
4412
4413impl fidl::endpoints::Responder for IommuResourceGetResponder {
4414    type ControlHandle = IommuResourceControlHandle;
4415
4416    fn control_handle(&self) -> &IommuResourceControlHandle {
4417        &self.control_handle
4418    }
4419
4420    fn drop_without_shutdown(mut self) {
4421        // Safety: drops once, never accessed again due to mem::forget
4422        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4423        // Prevent Drop from running (which would shut down the channel)
4424        std::mem::forget(self);
4425    }
4426}
4427
4428impl IommuResourceGetResponder {
4429    /// Sends a response to the FIDL transaction.
4430    ///
4431    /// Sets the channel to shutdown if an error occurs.
4432    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4433        let _result = self.send_raw(resource);
4434        if _result.is_err() {
4435            self.control_handle.shutdown();
4436        }
4437        self.drop_without_shutdown();
4438        _result
4439    }
4440
4441    /// Similar to "send" but does not shutdown the channel if an error occurs.
4442    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4443        let _result = self.send_raw(resource);
4444        self.drop_without_shutdown();
4445        _result
4446    }
4447
4448    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4449        self.control_handle.inner.send::<IommuResourceGetResponse>(
4450            (resource,),
4451            self.tx_id,
4452            0x5af309b619aa7c5b,
4453            fidl::encoding::DynamicFlags::empty(),
4454        )
4455    }
4456}
4457
4458#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4459pub struct IoportResourceMarker;
4460
4461impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4462    type Proxy = IoportResourceProxy;
4463    type RequestStream = IoportResourceRequestStream;
4464    #[cfg(target_os = "fuchsia")]
4465    type SynchronousProxy = IoportResourceSynchronousProxy;
4466
4467    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4468}
4469impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4470
4471pub trait IoportResourceProxyInterface: Send + Sync {
4472    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4473    fn r#get(&self) -> Self::GetResponseFut;
4474}
4475#[derive(Debug)]
4476#[cfg(target_os = "fuchsia")]
4477pub struct IoportResourceSynchronousProxy {
4478    client: fidl::client::sync::Client,
4479}
4480
4481#[cfg(target_os = "fuchsia")]
4482impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4483    type Proxy = IoportResourceProxy;
4484    type Protocol = IoportResourceMarker;
4485
4486    fn from_channel(inner: fidl::Channel) -> Self {
4487        Self::new(inner)
4488    }
4489
4490    fn into_channel(self) -> fidl::Channel {
4491        self.client.into_channel()
4492    }
4493
4494    fn as_channel(&self) -> &fidl::Channel {
4495        self.client.as_channel()
4496    }
4497}
4498
4499#[cfg(target_os = "fuchsia")]
4500impl IoportResourceSynchronousProxy {
4501    pub fn new(channel: fidl::Channel) -> Self {
4502        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4503        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4504    }
4505
4506    pub fn into_channel(self) -> fidl::Channel {
4507        self.client.into_channel()
4508    }
4509
4510    /// Waits until an event arrives and returns it. It is safe for other
4511    /// threads to make concurrent requests while waiting for an event.
4512    pub fn wait_for_event(
4513        &self,
4514        deadline: zx::MonotonicInstant,
4515    ) -> Result<IoportResourceEvent, fidl::Error> {
4516        IoportResourceEvent::decode(self.client.wait_for_event(deadline)?)
4517    }
4518
4519    /// Get an IO Port resource handle.
4520    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4521        let _response =
4522            self.client.send_query::<fidl::encoding::EmptyPayload, IoportResourceGetResponse>(
4523                (),
4524                0x4db20876b537c52b,
4525                fidl::encoding::DynamicFlags::empty(),
4526                ___deadline,
4527            )?;
4528        Ok(_response.resource)
4529    }
4530}
4531
4532#[cfg(target_os = "fuchsia")]
4533impl From<IoportResourceSynchronousProxy> for zx::NullableHandle {
4534    fn from(value: IoportResourceSynchronousProxy) -> Self {
4535        value.into_channel().into()
4536    }
4537}
4538
4539#[cfg(target_os = "fuchsia")]
4540impl From<fidl::Channel> for IoportResourceSynchronousProxy {
4541    fn from(value: fidl::Channel) -> Self {
4542        Self::new(value)
4543    }
4544}
4545
4546#[cfg(target_os = "fuchsia")]
4547impl fidl::endpoints::FromClient for IoportResourceSynchronousProxy {
4548    type Protocol = IoportResourceMarker;
4549
4550    fn from_client(value: fidl::endpoints::ClientEnd<IoportResourceMarker>) -> Self {
4551        Self::new(value.into_channel())
4552    }
4553}
4554
4555#[derive(Debug, Clone)]
4556pub struct IoportResourceProxy {
4557    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4558}
4559
4560impl fidl::endpoints::Proxy for IoportResourceProxy {
4561    type Protocol = IoportResourceMarker;
4562
4563    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4564        Self::new(inner)
4565    }
4566
4567    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4568        self.client.into_channel().map_err(|client| Self { client })
4569    }
4570
4571    fn as_channel(&self) -> &::fidl::AsyncChannel {
4572        self.client.as_channel()
4573    }
4574}
4575
4576impl IoportResourceProxy {
4577    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4578    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4579        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4580        Self { client: fidl::client::Client::new(channel, protocol_name) }
4581    }
4582
4583    /// Get a Stream of events from the remote end of the protocol.
4584    ///
4585    /// # Panics
4586    ///
4587    /// Panics if the event stream was already taken.
4588    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4589        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4590    }
4591
4592    /// Get an IO Port resource handle.
4593    pub fn r#get(
4594        &self,
4595    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4596    {
4597        IoportResourceProxyInterface::r#get(self)
4598    }
4599}
4600
4601impl IoportResourceProxyInterface for IoportResourceProxy {
4602    type GetResponseFut = fidl::client::QueryResponseFut<
4603        fidl::Resource,
4604        fidl::encoding::DefaultFuchsiaResourceDialect,
4605    >;
4606    fn r#get(&self) -> Self::GetResponseFut {
4607        fn _decode(
4608            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4609        ) -> Result<fidl::Resource, fidl::Error> {
4610            let _response = fidl::client::decode_transaction_body::<
4611                IoportResourceGetResponse,
4612                fidl::encoding::DefaultFuchsiaResourceDialect,
4613                0x4db20876b537c52b,
4614            >(_buf?)?;
4615            Ok(_response.resource)
4616        }
4617        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4618            (),
4619            0x4db20876b537c52b,
4620            fidl::encoding::DynamicFlags::empty(),
4621            _decode,
4622        )
4623    }
4624}
4625
4626pub struct IoportResourceEventStream {
4627    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4628}
4629
4630impl std::marker::Unpin for IoportResourceEventStream {}
4631
4632impl futures::stream::FusedStream for IoportResourceEventStream {
4633    fn is_terminated(&self) -> bool {
4634        self.event_receiver.is_terminated()
4635    }
4636}
4637
4638impl futures::Stream for IoportResourceEventStream {
4639    type Item = Result<IoportResourceEvent, fidl::Error>;
4640
4641    fn poll_next(
4642        mut self: std::pin::Pin<&mut Self>,
4643        cx: &mut std::task::Context<'_>,
4644    ) -> std::task::Poll<Option<Self::Item>> {
4645        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4646            &mut self.event_receiver,
4647            cx
4648        )?) {
4649            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4650            None => std::task::Poll::Ready(None),
4651        }
4652    }
4653}
4654
4655#[derive(Debug)]
4656pub enum IoportResourceEvent {}
4657
4658impl IoportResourceEvent {
4659    /// Decodes a message buffer as a [`IoportResourceEvent`].
4660    fn decode(
4661        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4662    ) -> Result<IoportResourceEvent, fidl::Error> {
4663        let (bytes, _handles) = buf.split_mut();
4664        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4665        debug_assert_eq!(tx_header.tx_id, 0);
4666        match tx_header.ordinal {
4667            _ => Err(fidl::Error::UnknownOrdinal {
4668                ordinal: tx_header.ordinal,
4669                protocol_name:
4670                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4671            }),
4672        }
4673    }
4674}
4675
4676/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4677pub struct IoportResourceRequestStream {
4678    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4679    is_terminated: bool,
4680}
4681
4682impl std::marker::Unpin for IoportResourceRequestStream {}
4683
4684impl futures::stream::FusedStream for IoportResourceRequestStream {
4685    fn is_terminated(&self) -> bool {
4686        self.is_terminated
4687    }
4688}
4689
4690impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4691    type Protocol = IoportResourceMarker;
4692    type ControlHandle = IoportResourceControlHandle;
4693
4694    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4695        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4696    }
4697
4698    fn control_handle(&self) -> Self::ControlHandle {
4699        IoportResourceControlHandle { inner: self.inner.clone() }
4700    }
4701
4702    fn into_inner(
4703        self,
4704    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4705    {
4706        (self.inner, self.is_terminated)
4707    }
4708
4709    fn from_inner(
4710        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4711        is_terminated: bool,
4712    ) -> Self {
4713        Self { inner, is_terminated }
4714    }
4715}
4716
4717impl futures::Stream for IoportResourceRequestStream {
4718    type Item = Result<IoportResourceRequest, fidl::Error>;
4719
4720    fn poll_next(
4721        mut self: std::pin::Pin<&mut Self>,
4722        cx: &mut std::task::Context<'_>,
4723    ) -> std::task::Poll<Option<Self::Item>> {
4724        let this = &mut *self;
4725        if this.inner.check_shutdown(cx) {
4726            this.is_terminated = true;
4727            return std::task::Poll::Ready(None);
4728        }
4729        if this.is_terminated {
4730            panic!("polled IoportResourceRequestStream after completion");
4731        }
4732        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4733            |bytes, handles| {
4734                match this.inner.channel().read_etc(cx, bytes, handles) {
4735                    std::task::Poll::Ready(Ok(())) => {}
4736                    std::task::Poll::Pending => return std::task::Poll::Pending,
4737                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4738                        this.is_terminated = true;
4739                        return std::task::Poll::Ready(None);
4740                    }
4741                    std::task::Poll::Ready(Err(e)) => {
4742                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4743                            e.into(),
4744                        ))));
4745                    }
4746                }
4747
4748                // A message has been received from the channel
4749                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4750
4751                std::task::Poll::Ready(Some(match header.ordinal {
4752                    0x4db20876b537c52b => {
4753                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4754                        let mut req = fidl::new_empty!(
4755                            fidl::encoding::EmptyPayload,
4756                            fidl::encoding::DefaultFuchsiaResourceDialect
4757                        );
4758                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4759                        let control_handle =
4760                            IoportResourceControlHandle { inner: this.inner.clone() };
4761                        Ok(IoportResourceRequest::Get {
4762                            responder: IoportResourceGetResponder {
4763                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4764                                tx_id: header.tx_id,
4765                            },
4766                        })
4767                    }
4768                    _ => Err(fidl::Error::UnknownOrdinal {
4769                        ordinal: header.ordinal,
4770                        protocol_name:
4771                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4772                    }),
4773                }))
4774            },
4775        )
4776    }
4777}
4778
4779/// Protocol for providing an IO Port resource with access to all valid ranges.
4780#[derive(Debug)]
4781pub enum IoportResourceRequest {
4782    /// Get an IO Port resource handle.
4783    Get { responder: IoportResourceGetResponder },
4784}
4785
4786impl IoportResourceRequest {
4787    #[allow(irrefutable_let_patterns)]
4788    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4789        if let IoportResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4790    }
4791
4792    /// Name of the method defined in FIDL
4793    pub fn method_name(&self) -> &'static str {
4794        match *self {
4795            IoportResourceRequest::Get { .. } => "get",
4796        }
4797    }
4798}
4799
4800#[derive(Debug, Clone)]
4801pub struct IoportResourceControlHandle {
4802    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4803}
4804
4805impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4806    fn shutdown(&self) {
4807        self.inner.shutdown()
4808    }
4809
4810    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4811        self.inner.shutdown_with_epitaph(status)
4812    }
4813
4814    fn is_closed(&self) -> bool {
4815        self.inner.channel().is_closed()
4816    }
4817    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4818        self.inner.channel().on_closed()
4819    }
4820
4821    #[cfg(target_os = "fuchsia")]
4822    fn signal_peer(
4823        &self,
4824        clear_mask: zx::Signals,
4825        set_mask: zx::Signals,
4826    ) -> Result<(), zx_status::Status> {
4827        use fidl::Peered;
4828        self.inner.channel().signal_peer(clear_mask, set_mask)
4829    }
4830}
4831
4832impl IoportResourceControlHandle {}
4833
4834#[must_use = "FIDL methods require a response to be sent"]
4835#[derive(Debug)]
4836pub struct IoportResourceGetResponder {
4837    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4838    tx_id: u32,
4839}
4840
4841/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4842/// if the responder is dropped without sending a response, so that the client
4843/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4844impl std::ops::Drop for IoportResourceGetResponder {
4845    fn drop(&mut self) {
4846        self.control_handle.shutdown();
4847        // Safety: drops once, never accessed again
4848        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4849    }
4850}
4851
4852impl fidl::endpoints::Responder for IoportResourceGetResponder {
4853    type ControlHandle = IoportResourceControlHandle;
4854
4855    fn control_handle(&self) -> &IoportResourceControlHandle {
4856        &self.control_handle
4857    }
4858
4859    fn drop_without_shutdown(mut self) {
4860        // Safety: drops once, never accessed again due to mem::forget
4861        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4862        // Prevent Drop from running (which would shut down the channel)
4863        std::mem::forget(self);
4864    }
4865}
4866
4867impl IoportResourceGetResponder {
4868    /// Sends a response to the FIDL transaction.
4869    ///
4870    /// Sets the channel to shutdown if an error occurs.
4871    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4872        let _result = self.send_raw(resource);
4873        if _result.is_err() {
4874            self.control_handle.shutdown();
4875        }
4876        self.drop_without_shutdown();
4877        _result
4878    }
4879
4880    /// Similar to "send" but does not shutdown the channel if an error occurs.
4881    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4882        let _result = self.send_raw(resource);
4883        self.drop_without_shutdown();
4884        _result
4885    }
4886
4887    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4888        self.control_handle.inner.send::<IoportResourceGetResponse>(
4889            (resource,),
4890            self.tx_id,
4891            0x4db20876b537c52b,
4892            fidl::encoding::DynamicFlags::empty(),
4893        )
4894    }
4895}
4896
4897#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4898pub struct IrqResourceMarker;
4899
4900impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4901    type Proxy = IrqResourceProxy;
4902    type RequestStream = IrqResourceRequestStream;
4903    #[cfg(target_os = "fuchsia")]
4904    type SynchronousProxy = IrqResourceSynchronousProxy;
4905
4906    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4907}
4908impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4909
4910pub trait IrqResourceProxyInterface: Send + Sync {
4911    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4912    fn r#get(&self) -> Self::GetResponseFut;
4913}
4914#[derive(Debug)]
4915#[cfg(target_os = "fuchsia")]
4916pub struct IrqResourceSynchronousProxy {
4917    client: fidl::client::sync::Client,
4918}
4919
4920#[cfg(target_os = "fuchsia")]
4921impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
4922    type Proxy = IrqResourceProxy;
4923    type Protocol = IrqResourceMarker;
4924
4925    fn from_channel(inner: fidl::Channel) -> Self {
4926        Self::new(inner)
4927    }
4928
4929    fn into_channel(self) -> fidl::Channel {
4930        self.client.into_channel()
4931    }
4932
4933    fn as_channel(&self) -> &fidl::Channel {
4934        self.client.as_channel()
4935    }
4936}
4937
4938#[cfg(target_os = "fuchsia")]
4939impl IrqResourceSynchronousProxy {
4940    pub fn new(channel: fidl::Channel) -> Self {
4941        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4942        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4943    }
4944
4945    pub fn into_channel(self) -> fidl::Channel {
4946        self.client.into_channel()
4947    }
4948
4949    /// Waits until an event arrives and returns it. It is safe for other
4950    /// threads to make concurrent requests while waiting for an event.
4951    pub fn wait_for_event(
4952        &self,
4953        deadline: zx::MonotonicInstant,
4954    ) -> Result<IrqResourceEvent, fidl::Error> {
4955        IrqResourceEvent::decode(self.client.wait_for_event(deadline)?)
4956    }
4957
4958    /// Get an IRQ resource handle.
4959    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4960        let _response =
4961            self.client.send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse>(
4962                (),
4963                0x491be54504b041e9,
4964                fidl::encoding::DynamicFlags::empty(),
4965                ___deadline,
4966            )?;
4967        Ok(_response.resource)
4968    }
4969}
4970
4971#[cfg(target_os = "fuchsia")]
4972impl From<IrqResourceSynchronousProxy> for zx::NullableHandle {
4973    fn from(value: IrqResourceSynchronousProxy) -> Self {
4974        value.into_channel().into()
4975    }
4976}
4977
4978#[cfg(target_os = "fuchsia")]
4979impl From<fidl::Channel> for IrqResourceSynchronousProxy {
4980    fn from(value: fidl::Channel) -> Self {
4981        Self::new(value)
4982    }
4983}
4984
4985#[cfg(target_os = "fuchsia")]
4986impl fidl::endpoints::FromClient for IrqResourceSynchronousProxy {
4987    type Protocol = IrqResourceMarker;
4988
4989    fn from_client(value: fidl::endpoints::ClientEnd<IrqResourceMarker>) -> Self {
4990        Self::new(value.into_channel())
4991    }
4992}
4993
4994#[derive(Debug, Clone)]
4995pub struct IrqResourceProxy {
4996    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4997}
4998
4999impl fidl::endpoints::Proxy for IrqResourceProxy {
5000    type Protocol = IrqResourceMarker;
5001
5002    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5003        Self::new(inner)
5004    }
5005
5006    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5007        self.client.into_channel().map_err(|client| Self { client })
5008    }
5009
5010    fn as_channel(&self) -> &::fidl::AsyncChannel {
5011        self.client.as_channel()
5012    }
5013}
5014
5015impl IrqResourceProxy {
5016    /// Create a new Proxy for fuchsia.kernel/IrqResource.
5017    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5018        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5019        Self { client: fidl::client::Client::new(channel, protocol_name) }
5020    }
5021
5022    /// Get a Stream of events from the remote end of the protocol.
5023    ///
5024    /// # Panics
5025    ///
5026    /// Panics if the event stream was already taken.
5027    pub fn take_event_stream(&self) -> IrqResourceEventStream {
5028        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
5029    }
5030
5031    /// Get an IRQ resource handle.
5032    pub fn r#get(
5033        &self,
5034    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5035    {
5036        IrqResourceProxyInterface::r#get(self)
5037    }
5038}
5039
5040impl IrqResourceProxyInterface for IrqResourceProxy {
5041    type GetResponseFut = fidl::client::QueryResponseFut<
5042        fidl::Resource,
5043        fidl::encoding::DefaultFuchsiaResourceDialect,
5044    >;
5045    fn r#get(&self) -> Self::GetResponseFut {
5046        fn _decode(
5047            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5048        ) -> Result<fidl::Resource, fidl::Error> {
5049            let _response = fidl::client::decode_transaction_body::<
5050                IrqResourceGetResponse,
5051                fidl::encoding::DefaultFuchsiaResourceDialect,
5052                0x491be54504b041e9,
5053            >(_buf?)?;
5054            Ok(_response.resource)
5055        }
5056        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5057            (),
5058            0x491be54504b041e9,
5059            fidl::encoding::DynamicFlags::empty(),
5060            _decode,
5061        )
5062    }
5063}
5064
5065pub struct IrqResourceEventStream {
5066    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5067}
5068
5069impl std::marker::Unpin for IrqResourceEventStream {}
5070
5071impl futures::stream::FusedStream for IrqResourceEventStream {
5072    fn is_terminated(&self) -> bool {
5073        self.event_receiver.is_terminated()
5074    }
5075}
5076
5077impl futures::Stream for IrqResourceEventStream {
5078    type Item = Result<IrqResourceEvent, fidl::Error>;
5079
5080    fn poll_next(
5081        mut self: std::pin::Pin<&mut Self>,
5082        cx: &mut std::task::Context<'_>,
5083    ) -> std::task::Poll<Option<Self::Item>> {
5084        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5085            &mut self.event_receiver,
5086            cx
5087        )?) {
5088            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
5089            None => std::task::Poll::Ready(None),
5090        }
5091    }
5092}
5093
5094#[derive(Debug)]
5095pub enum IrqResourceEvent {}
5096
5097impl IrqResourceEvent {
5098    /// Decodes a message buffer as a [`IrqResourceEvent`].
5099    fn decode(
5100        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5101    ) -> Result<IrqResourceEvent, fidl::Error> {
5102        let (bytes, _handles) = buf.split_mut();
5103        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5104        debug_assert_eq!(tx_header.tx_id, 0);
5105        match tx_header.ordinal {
5106            _ => Err(fidl::Error::UnknownOrdinal {
5107                ordinal: tx_header.ordinal,
5108                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5109            }),
5110        }
5111    }
5112}
5113
5114/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
5115pub struct IrqResourceRequestStream {
5116    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5117    is_terminated: bool,
5118}
5119
5120impl std::marker::Unpin for IrqResourceRequestStream {}
5121
5122impl futures::stream::FusedStream for IrqResourceRequestStream {
5123    fn is_terminated(&self) -> bool {
5124        self.is_terminated
5125    }
5126}
5127
5128impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
5129    type Protocol = IrqResourceMarker;
5130    type ControlHandle = IrqResourceControlHandle;
5131
5132    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5133        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5134    }
5135
5136    fn control_handle(&self) -> Self::ControlHandle {
5137        IrqResourceControlHandle { inner: self.inner.clone() }
5138    }
5139
5140    fn into_inner(
5141        self,
5142    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5143    {
5144        (self.inner, self.is_terminated)
5145    }
5146
5147    fn from_inner(
5148        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5149        is_terminated: bool,
5150    ) -> Self {
5151        Self { inner, is_terminated }
5152    }
5153}
5154
5155impl futures::Stream for IrqResourceRequestStream {
5156    type Item = Result<IrqResourceRequest, fidl::Error>;
5157
5158    fn poll_next(
5159        mut self: std::pin::Pin<&mut Self>,
5160        cx: &mut std::task::Context<'_>,
5161    ) -> std::task::Poll<Option<Self::Item>> {
5162        let this = &mut *self;
5163        if this.inner.check_shutdown(cx) {
5164            this.is_terminated = true;
5165            return std::task::Poll::Ready(None);
5166        }
5167        if this.is_terminated {
5168            panic!("polled IrqResourceRequestStream after completion");
5169        }
5170        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5171            |bytes, handles| {
5172                match this.inner.channel().read_etc(cx, bytes, handles) {
5173                    std::task::Poll::Ready(Ok(())) => {}
5174                    std::task::Poll::Pending => return std::task::Poll::Pending,
5175                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5176                        this.is_terminated = true;
5177                        return std::task::Poll::Ready(None);
5178                    }
5179                    std::task::Poll::Ready(Err(e)) => {
5180                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5181                            e.into(),
5182                        ))));
5183                    }
5184                }
5185
5186                // A message has been received from the channel
5187                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5188
5189                std::task::Poll::Ready(Some(match header.ordinal {
5190                    0x491be54504b041e9 => {
5191                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5192                        let mut req = fidl::new_empty!(
5193                            fidl::encoding::EmptyPayload,
5194                            fidl::encoding::DefaultFuchsiaResourceDialect
5195                        );
5196                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5197                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
5198                        Ok(IrqResourceRequest::Get {
5199                            responder: IrqResourceGetResponder {
5200                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5201                                tx_id: header.tx_id,
5202                            },
5203                        })
5204                    }
5205                    _ => Err(fidl::Error::UnknownOrdinal {
5206                        ordinal: header.ordinal,
5207                        protocol_name:
5208                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5209                    }),
5210                }))
5211            },
5212        )
5213    }
5214}
5215
5216/// Protocol for providing an IRQ resource with access to all valid ranges.
5217#[derive(Debug)]
5218pub enum IrqResourceRequest {
5219    /// Get an IRQ resource handle.
5220    Get { responder: IrqResourceGetResponder },
5221}
5222
5223impl IrqResourceRequest {
5224    #[allow(irrefutable_let_patterns)]
5225    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
5226        if let IrqResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5227    }
5228
5229    /// Name of the method defined in FIDL
5230    pub fn method_name(&self) -> &'static str {
5231        match *self {
5232            IrqResourceRequest::Get { .. } => "get",
5233        }
5234    }
5235}
5236
5237#[derive(Debug, Clone)]
5238pub struct IrqResourceControlHandle {
5239    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5240}
5241
5242impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
5243    fn shutdown(&self) {
5244        self.inner.shutdown()
5245    }
5246
5247    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5248        self.inner.shutdown_with_epitaph(status)
5249    }
5250
5251    fn is_closed(&self) -> bool {
5252        self.inner.channel().is_closed()
5253    }
5254    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5255        self.inner.channel().on_closed()
5256    }
5257
5258    #[cfg(target_os = "fuchsia")]
5259    fn signal_peer(
5260        &self,
5261        clear_mask: zx::Signals,
5262        set_mask: zx::Signals,
5263    ) -> Result<(), zx_status::Status> {
5264        use fidl::Peered;
5265        self.inner.channel().signal_peer(clear_mask, set_mask)
5266    }
5267}
5268
5269impl IrqResourceControlHandle {}
5270
5271#[must_use = "FIDL methods require a response to be sent"]
5272#[derive(Debug)]
5273pub struct IrqResourceGetResponder {
5274    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5275    tx_id: u32,
5276}
5277
5278/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5279/// if the responder is dropped without sending a response, so that the client
5280/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5281impl std::ops::Drop for IrqResourceGetResponder {
5282    fn drop(&mut self) {
5283        self.control_handle.shutdown();
5284        // Safety: drops once, never accessed again
5285        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5286    }
5287}
5288
5289impl fidl::endpoints::Responder for IrqResourceGetResponder {
5290    type ControlHandle = IrqResourceControlHandle;
5291
5292    fn control_handle(&self) -> &IrqResourceControlHandle {
5293        &self.control_handle
5294    }
5295
5296    fn drop_without_shutdown(mut self) {
5297        // Safety: drops once, never accessed again due to mem::forget
5298        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5299        // Prevent Drop from running (which would shut down the channel)
5300        std::mem::forget(self);
5301    }
5302}
5303
5304impl IrqResourceGetResponder {
5305    /// Sends a response to the FIDL transaction.
5306    ///
5307    /// Sets the channel to shutdown if an error occurs.
5308    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5309        let _result = self.send_raw(resource);
5310        if _result.is_err() {
5311            self.control_handle.shutdown();
5312        }
5313        self.drop_without_shutdown();
5314        _result
5315    }
5316
5317    /// Similar to "send" but does not shutdown the channel if an error occurs.
5318    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5319        let _result = self.send_raw(resource);
5320        self.drop_without_shutdown();
5321        _result
5322    }
5323
5324    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5325        self.control_handle.inner.send::<IrqResourceGetResponse>(
5326            (resource,),
5327            self.tx_id,
5328            0x491be54504b041e9,
5329            fidl::encoding::DynamicFlags::empty(),
5330        )
5331    }
5332}
5333
5334#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5335pub struct MexecResourceMarker;
5336
5337impl fidl::endpoints::ProtocolMarker for MexecResourceMarker {
5338    type Proxy = MexecResourceProxy;
5339    type RequestStream = MexecResourceRequestStream;
5340    #[cfg(target_os = "fuchsia")]
5341    type SynchronousProxy = MexecResourceSynchronousProxy;
5342
5343    const DEBUG_NAME: &'static str = "fuchsia.kernel.MexecResource";
5344}
5345impl fidl::endpoints::DiscoverableProtocolMarker for MexecResourceMarker {}
5346
5347pub trait MexecResourceProxyInterface: Send + Sync {
5348    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5349    fn r#get(&self) -> Self::GetResponseFut;
5350}
5351#[derive(Debug)]
5352#[cfg(target_os = "fuchsia")]
5353pub struct MexecResourceSynchronousProxy {
5354    client: fidl::client::sync::Client,
5355}
5356
5357#[cfg(target_os = "fuchsia")]
5358impl fidl::endpoints::SynchronousProxy for MexecResourceSynchronousProxy {
5359    type Proxy = MexecResourceProxy;
5360    type Protocol = MexecResourceMarker;
5361
5362    fn from_channel(inner: fidl::Channel) -> Self {
5363        Self::new(inner)
5364    }
5365
5366    fn into_channel(self) -> fidl::Channel {
5367        self.client.into_channel()
5368    }
5369
5370    fn as_channel(&self) -> &fidl::Channel {
5371        self.client.as_channel()
5372    }
5373}
5374
5375#[cfg(target_os = "fuchsia")]
5376impl MexecResourceSynchronousProxy {
5377    pub fn new(channel: fidl::Channel) -> Self {
5378        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5379        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5380    }
5381
5382    pub fn into_channel(self) -> fidl::Channel {
5383        self.client.into_channel()
5384    }
5385
5386    /// Waits until an event arrives and returns it. It is safe for other
5387    /// threads to make concurrent requests while waiting for an event.
5388    pub fn wait_for_event(
5389        &self,
5390        deadline: zx::MonotonicInstant,
5391    ) -> Result<MexecResourceEvent, fidl::Error> {
5392        MexecResourceEvent::decode(self.client.wait_for_event(deadline)?)
5393    }
5394
5395    /// Get an MEXEC resource handle as `resource`.
5396    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5397        let _response =
5398            self.client.send_query::<fidl::encoding::EmptyPayload, MexecResourceGetResponse>(
5399                (),
5400                0xff93e6722900f54,
5401                fidl::encoding::DynamicFlags::empty(),
5402                ___deadline,
5403            )?;
5404        Ok(_response.resource)
5405    }
5406}
5407
5408#[cfg(target_os = "fuchsia")]
5409impl From<MexecResourceSynchronousProxy> for zx::NullableHandle {
5410    fn from(value: MexecResourceSynchronousProxy) -> Self {
5411        value.into_channel().into()
5412    }
5413}
5414
5415#[cfg(target_os = "fuchsia")]
5416impl From<fidl::Channel> for MexecResourceSynchronousProxy {
5417    fn from(value: fidl::Channel) -> Self {
5418        Self::new(value)
5419    }
5420}
5421
5422#[cfg(target_os = "fuchsia")]
5423impl fidl::endpoints::FromClient for MexecResourceSynchronousProxy {
5424    type Protocol = MexecResourceMarker;
5425
5426    fn from_client(value: fidl::endpoints::ClientEnd<MexecResourceMarker>) -> Self {
5427        Self::new(value.into_channel())
5428    }
5429}
5430
5431#[derive(Debug, Clone)]
5432pub struct MexecResourceProxy {
5433    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5434}
5435
5436impl fidl::endpoints::Proxy for MexecResourceProxy {
5437    type Protocol = MexecResourceMarker;
5438
5439    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5440        Self::new(inner)
5441    }
5442
5443    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5444        self.client.into_channel().map_err(|client| Self { client })
5445    }
5446
5447    fn as_channel(&self) -> &::fidl::AsyncChannel {
5448        self.client.as_channel()
5449    }
5450}
5451
5452impl MexecResourceProxy {
5453    /// Create a new Proxy for fuchsia.kernel/MexecResource.
5454    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5455        let protocol_name = <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5456        Self { client: fidl::client::Client::new(channel, protocol_name) }
5457    }
5458
5459    /// Get a Stream of events from the remote end of the protocol.
5460    ///
5461    /// # Panics
5462    ///
5463    /// Panics if the event stream was already taken.
5464    pub fn take_event_stream(&self) -> MexecResourceEventStream {
5465        MexecResourceEventStream { event_receiver: self.client.take_event_receiver() }
5466    }
5467
5468    /// Get an MEXEC resource handle as `resource`.
5469    pub fn r#get(
5470        &self,
5471    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5472    {
5473        MexecResourceProxyInterface::r#get(self)
5474    }
5475}
5476
5477impl MexecResourceProxyInterface for MexecResourceProxy {
5478    type GetResponseFut = fidl::client::QueryResponseFut<
5479        fidl::Resource,
5480        fidl::encoding::DefaultFuchsiaResourceDialect,
5481    >;
5482    fn r#get(&self) -> Self::GetResponseFut {
5483        fn _decode(
5484            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5485        ) -> Result<fidl::Resource, fidl::Error> {
5486            let _response = fidl::client::decode_transaction_body::<
5487                MexecResourceGetResponse,
5488                fidl::encoding::DefaultFuchsiaResourceDialect,
5489                0xff93e6722900f54,
5490            >(_buf?)?;
5491            Ok(_response.resource)
5492        }
5493        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5494            (),
5495            0xff93e6722900f54,
5496            fidl::encoding::DynamicFlags::empty(),
5497            _decode,
5498        )
5499    }
5500}
5501
5502pub struct MexecResourceEventStream {
5503    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5504}
5505
5506impl std::marker::Unpin for MexecResourceEventStream {}
5507
5508impl futures::stream::FusedStream for MexecResourceEventStream {
5509    fn is_terminated(&self) -> bool {
5510        self.event_receiver.is_terminated()
5511    }
5512}
5513
5514impl futures::Stream for MexecResourceEventStream {
5515    type Item = Result<MexecResourceEvent, fidl::Error>;
5516
5517    fn poll_next(
5518        mut self: std::pin::Pin<&mut Self>,
5519        cx: &mut std::task::Context<'_>,
5520    ) -> std::task::Poll<Option<Self::Item>> {
5521        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5522            &mut self.event_receiver,
5523            cx
5524        )?) {
5525            Some(buf) => std::task::Poll::Ready(Some(MexecResourceEvent::decode(buf))),
5526            None => std::task::Poll::Ready(None),
5527        }
5528    }
5529}
5530
5531#[derive(Debug)]
5532pub enum MexecResourceEvent {}
5533
5534impl MexecResourceEvent {
5535    /// Decodes a message buffer as a [`MexecResourceEvent`].
5536    fn decode(
5537        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5538    ) -> Result<MexecResourceEvent, fidl::Error> {
5539        let (bytes, _handles) = buf.split_mut();
5540        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5541        debug_assert_eq!(tx_header.tx_id, 0);
5542        match tx_header.ordinal {
5543            _ => Err(fidl::Error::UnknownOrdinal {
5544                ordinal: tx_header.ordinal,
5545                protocol_name: <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5546            }),
5547        }
5548    }
5549}
5550
5551/// A Stream of incoming requests for fuchsia.kernel/MexecResource.
5552pub struct MexecResourceRequestStream {
5553    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5554    is_terminated: bool,
5555}
5556
5557impl std::marker::Unpin for MexecResourceRequestStream {}
5558
5559impl futures::stream::FusedStream for MexecResourceRequestStream {
5560    fn is_terminated(&self) -> bool {
5561        self.is_terminated
5562    }
5563}
5564
5565impl fidl::endpoints::RequestStream for MexecResourceRequestStream {
5566    type Protocol = MexecResourceMarker;
5567    type ControlHandle = MexecResourceControlHandle;
5568
5569    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5570        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5571    }
5572
5573    fn control_handle(&self) -> Self::ControlHandle {
5574        MexecResourceControlHandle { inner: self.inner.clone() }
5575    }
5576
5577    fn into_inner(
5578        self,
5579    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5580    {
5581        (self.inner, self.is_terminated)
5582    }
5583
5584    fn from_inner(
5585        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5586        is_terminated: bool,
5587    ) -> Self {
5588        Self { inner, is_terminated }
5589    }
5590}
5591
5592impl futures::Stream for MexecResourceRequestStream {
5593    type Item = Result<MexecResourceRequest, fidl::Error>;
5594
5595    fn poll_next(
5596        mut self: std::pin::Pin<&mut Self>,
5597        cx: &mut std::task::Context<'_>,
5598    ) -> std::task::Poll<Option<Self::Item>> {
5599        let this = &mut *self;
5600        if this.inner.check_shutdown(cx) {
5601            this.is_terminated = true;
5602            return std::task::Poll::Ready(None);
5603        }
5604        if this.is_terminated {
5605            panic!("polled MexecResourceRequestStream after completion");
5606        }
5607        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5608            |bytes, handles| {
5609                match this.inner.channel().read_etc(cx, bytes, handles) {
5610                    std::task::Poll::Ready(Ok(())) => {}
5611                    std::task::Poll::Pending => return std::task::Poll::Pending,
5612                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5613                        this.is_terminated = true;
5614                        return std::task::Poll::Ready(None);
5615                    }
5616                    std::task::Poll::Ready(Err(e)) => {
5617                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5618                            e.into(),
5619                        ))));
5620                    }
5621                }
5622
5623                // A message has been received from the channel
5624                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5625
5626                std::task::Poll::Ready(Some(match header.ordinal {
5627                    0xff93e6722900f54 => {
5628                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5629                        let mut req = fidl::new_empty!(
5630                            fidl::encoding::EmptyPayload,
5631                            fidl::encoding::DefaultFuchsiaResourceDialect
5632                        );
5633                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5634                        let control_handle =
5635                            MexecResourceControlHandle { inner: this.inner.clone() };
5636                        Ok(MexecResourceRequest::Get {
5637                            responder: MexecResourceGetResponder {
5638                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5639                                tx_id: header.tx_id,
5640                            },
5641                        })
5642                    }
5643                    _ => Err(fidl::Error::UnknownOrdinal {
5644                        ordinal: header.ordinal,
5645                        protocol_name:
5646                            <MexecResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5647                    }),
5648                }))
5649            },
5650        )
5651    }
5652}
5653
5654/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
5655/// `ZX_RSRC_SYSTEM_MEXEC_BASE`.
5656#[derive(Debug)]
5657pub enum MexecResourceRequest {
5658    /// Get an MEXEC resource handle as `resource`.
5659    Get { responder: MexecResourceGetResponder },
5660}
5661
5662impl MexecResourceRequest {
5663    #[allow(irrefutable_let_patterns)]
5664    pub fn into_get(self) -> Option<(MexecResourceGetResponder)> {
5665        if let MexecResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5666    }
5667
5668    /// Name of the method defined in FIDL
5669    pub fn method_name(&self) -> &'static str {
5670        match *self {
5671            MexecResourceRequest::Get { .. } => "get",
5672        }
5673    }
5674}
5675
5676#[derive(Debug, Clone)]
5677pub struct MexecResourceControlHandle {
5678    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5679}
5680
5681impl fidl::endpoints::ControlHandle for MexecResourceControlHandle {
5682    fn shutdown(&self) {
5683        self.inner.shutdown()
5684    }
5685
5686    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5687        self.inner.shutdown_with_epitaph(status)
5688    }
5689
5690    fn is_closed(&self) -> bool {
5691        self.inner.channel().is_closed()
5692    }
5693    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5694        self.inner.channel().on_closed()
5695    }
5696
5697    #[cfg(target_os = "fuchsia")]
5698    fn signal_peer(
5699        &self,
5700        clear_mask: zx::Signals,
5701        set_mask: zx::Signals,
5702    ) -> Result<(), zx_status::Status> {
5703        use fidl::Peered;
5704        self.inner.channel().signal_peer(clear_mask, set_mask)
5705    }
5706}
5707
5708impl MexecResourceControlHandle {}
5709
5710#[must_use = "FIDL methods require a response to be sent"]
5711#[derive(Debug)]
5712pub struct MexecResourceGetResponder {
5713    control_handle: std::mem::ManuallyDrop<MexecResourceControlHandle>,
5714    tx_id: u32,
5715}
5716
5717/// Set the the channel to be shutdown (see [`MexecResourceControlHandle::shutdown`])
5718/// if the responder is dropped without sending a response, so that the client
5719/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5720impl std::ops::Drop for MexecResourceGetResponder {
5721    fn drop(&mut self) {
5722        self.control_handle.shutdown();
5723        // Safety: drops once, never accessed again
5724        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5725    }
5726}
5727
5728impl fidl::endpoints::Responder for MexecResourceGetResponder {
5729    type ControlHandle = MexecResourceControlHandle;
5730
5731    fn control_handle(&self) -> &MexecResourceControlHandle {
5732        &self.control_handle
5733    }
5734
5735    fn drop_without_shutdown(mut self) {
5736        // Safety: drops once, never accessed again due to mem::forget
5737        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5738        // Prevent Drop from running (which would shut down the channel)
5739        std::mem::forget(self);
5740    }
5741}
5742
5743impl MexecResourceGetResponder {
5744    /// Sends a response to the FIDL transaction.
5745    ///
5746    /// Sets the channel to shutdown if an error occurs.
5747    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5748        let _result = self.send_raw(resource);
5749        if _result.is_err() {
5750            self.control_handle.shutdown();
5751        }
5752        self.drop_without_shutdown();
5753        _result
5754    }
5755
5756    /// Similar to "send" but does not shutdown the channel if an error occurs.
5757    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5758        let _result = self.send_raw(resource);
5759        self.drop_without_shutdown();
5760        _result
5761    }
5762
5763    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5764        self.control_handle.inner.send::<MexecResourceGetResponse>(
5765            (resource,),
5766            self.tx_id,
5767            0xff93e6722900f54,
5768            fidl::encoding::DynamicFlags::empty(),
5769        )
5770    }
5771}
5772
5773#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5774pub struct MmioResourceMarker;
5775
5776impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5777    type Proxy = MmioResourceProxy;
5778    type RequestStream = MmioResourceRequestStream;
5779    #[cfg(target_os = "fuchsia")]
5780    type SynchronousProxy = MmioResourceSynchronousProxy;
5781
5782    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5783}
5784impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5785
5786pub trait MmioResourceProxyInterface: Send + Sync {
5787    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5788    fn r#get(&self) -> Self::GetResponseFut;
5789}
5790#[derive(Debug)]
5791#[cfg(target_os = "fuchsia")]
5792pub struct MmioResourceSynchronousProxy {
5793    client: fidl::client::sync::Client,
5794}
5795
5796#[cfg(target_os = "fuchsia")]
5797impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5798    type Proxy = MmioResourceProxy;
5799    type Protocol = MmioResourceMarker;
5800
5801    fn from_channel(inner: fidl::Channel) -> Self {
5802        Self::new(inner)
5803    }
5804
5805    fn into_channel(self) -> fidl::Channel {
5806        self.client.into_channel()
5807    }
5808
5809    fn as_channel(&self) -> &fidl::Channel {
5810        self.client.as_channel()
5811    }
5812}
5813
5814#[cfg(target_os = "fuchsia")]
5815impl MmioResourceSynchronousProxy {
5816    pub fn new(channel: fidl::Channel) -> Self {
5817        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5818        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5819    }
5820
5821    pub fn into_channel(self) -> fidl::Channel {
5822        self.client.into_channel()
5823    }
5824
5825    /// Waits until an event arrives and returns it. It is safe for other
5826    /// threads to make concurrent requests while waiting for an event.
5827    pub fn wait_for_event(
5828        &self,
5829        deadline: zx::MonotonicInstant,
5830    ) -> Result<MmioResourceEvent, fidl::Error> {
5831        MmioResourceEvent::decode(self.client.wait_for_event(deadline)?)
5832    }
5833
5834    /// Get an MMIO resource handle.
5835    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5836        let _response =
5837            self.client.send_query::<fidl::encoding::EmptyPayload, MmioResourceGetResponse>(
5838                (),
5839                0x66747b9c5a6dfe7b,
5840                fidl::encoding::DynamicFlags::empty(),
5841                ___deadline,
5842            )?;
5843        Ok(_response.resource)
5844    }
5845}
5846
5847#[cfg(target_os = "fuchsia")]
5848impl From<MmioResourceSynchronousProxy> for zx::NullableHandle {
5849    fn from(value: MmioResourceSynchronousProxy) -> Self {
5850        value.into_channel().into()
5851    }
5852}
5853
5854#[cfg(target_os = "fuchsia")]
5855impl From<fidl::Channel> for MmioResourceSynchronousProxy {
5856    fn from(value: fidl::Channel) -> Self {
5857        Self::new(value)
5858    }
5859}
5860
5861#[cfg(target_os = "fuchsia")]
5862impl fidl::endpoints::FromClient for MmioResourceSynchronousProxy {
5863    type Protocol = MmioResourceMarker;
5864
5865    fn from_client(value: fidl::endpoints::ClientEnd<MmioResourceMarker>) -> Self {
5866        Self::new(value.into_channel())
5867    }
5868}
5869
5870#[derive(Debug, Clone)]
5871pub struct MmioResourceProxy {
5872    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5873}
5874
5875impl fidl::endpoints::Proxy for MmioResourceProxy {
5876    type Protocol = MmioResourceMarker;
5877
5878    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5879        Self::new(inner)
5880    }
5881
5882    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5883        self.client.into_channel().map_err(|client| Self { client })
5884    }
5885
5886    fn as_channel(&self) -> &::fidl::AsyncChannel {
5887        self.client.as_channel()
5888    }
5889}
5890
5891impl MmioResourceProxy {
5892    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5893    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5894        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5895        Self { client: fidl::client::Client::new(channel, protocol_name) }
5896    }
5897
5898    /// Get a Stream of events from the remote end of the protocol.
5899    ///
5900    /// # Panics
5901    ///
5902    /// Panics if the event stream was already taken.
5903    pub fn take_event_stream(&self) -> MmioResourceEventStream {
5904        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
5905    }
5906
5907    /// Get an MMIO resource handle.
5908    pub fn r#get(
5909        &self,
5910    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5911    {
5912        MmioResourceProxyInterface::r#get(self)
5913    }
5914}
5915
5916impl MmioResourceProxyInterface for MmioResourceProxy {
5917    type GetResponseFut = fidl::client::QueryResponseFut<
5918        fidl::Resource,
5919        fidl::encoding::DefaultFuchsiaResourceDialect,
5920    >;
5921    fn r#get(&self) -> Self::GetResponseFut {
5922        fn _decode(
5923            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5924        ) -> Result<fidl::Resource, fidl::Error> {
5925            let _response = fidl::client::decode_transaction_body::<
5926                MmioResourceGetResponse,
5927                fidl::encoding::DefaultFuchsiaResourceDialect,
5928                0x66747b9c5a6dfe7b,
5929            >(_buf?)?;
5930            Ok(_response.resource)
5931        }
5932        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5933            (),
5934            0x66747b9c5a6dfe7b,
5935            fidl::encoding::DynamicFlags::empty(),
5936            _decode,
5937        )
5938    }
5939}
5940
5941pub struct MmioResourceEventStream {
5942    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5943}
5944
5945impl std::marker::Unpin for MmioResourceEventStream {}
5946
5947impl futures::stream::FusedStream for MmioResourceEventStream {
5948    fn is_terminated(&self) -> bool {
5949        self.event_receiver.is_terminated()
5950    }
5951}
5952
5953impl futures::Stream for MmioResourceEventStream {
5954    type Item = Result<MmioResourceEvent, fidl::Error>;
5955
5956    fn poll_next(
5957        mut self: std::pin::Pin<&mut Self>,
5958        cx: &mut std::task::Context<'_>,
5959    ) -> std::task::Poll<Option<Self::Item>> {
5960        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5961            &mut self.event_receiver,
5962            cx
5963        )?) {
5964            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
5965            None => std::task::Poll::Ready(None),
5966        }
5967    }
5968}
5969
5970#[derive(Debug)]
5971pub enum MmioResourceEvent {}
5972
5973impl MmioResourceEvent {
5974    /// Decodes a message buffer as a [`MmioResourceEvent`].
5975    fn decode(
5976        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5977    ) -> Result<MmioResourceEvent, fidl::Error> {
5978        let (bytes, _handles) = buf.split_mut();
5979        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5980        debug_assert_eq!(tx_header.tx_id, 0);
5981        match tx_header.ordinal {
5982            _ => Err(fidl::Error::UnknownOrdinal {
5983                ordinal: tx_header.ordinal,
5984                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5985            }),
5986        }
5987    }
5988}
5989
5990/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
5991pub struct MmioResourceRequestStream {
5992    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5993    is_terminated: bool,
5994}
5995
5996impl std::marker::Unpin for MmioResourceRequestStream {}
5997
5998impl futures::stream::FusedStream for MmioResourceRequestStream {
5999    fn is_terminated(&self) -> bool {
6000        self.is_terminated
6001    }
6002}
6003
6004impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
6005    type Protocol = MmioResourceMarker;
6006    type ControlHandle = MmioResourceControlHandle;
6007
6008    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6009        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6010    }
6011
6012    fn control_handle(&self) -> Self::ControlHandle {
6013        MmioResourceControlHandle { inner: self.inner.clone() }
6014    }
6015
6016    fn into_inner(
6017        self,
6018    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6019    {
6020        (self.inner, self.is_terminated)
6021    }
6022
6023    fn from_inner(
6024        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6025        is_terminated: bool,
6026    ) -> Self {
6027        Self { inner, is_terminated }
6028    }
6029}
6030
6031impl futures::Stream for MmioResourceRequestStream {
6032    type Item = Result<MmioResourceRequest, fidl::Error>;
6033
6034    fn poll_next(
6035        mut self: std::pin::Pin<&mut Self>,
6036        cx: &mut std::task::Context<'_>,
6037    ) -> std::task::Poll<Option<Self::Item>> {
6038        let this = &mut *self;
6039        if this.inner.check_shutdown(cx) {
6040            this.is_terminated = true;
6041            return std::task::Poll::Ready(None);
6042        }
6043        if this.is_terminated {
6044            panic!("polled MmioResourceRequestStream after completion");
6045        }
6046        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6047            |bytes, handles| {
6048                match this.inner.channel().read_etc(cx, bytes, handles) {
6049                    std::task::Poll::Ready(Ok(())) => {}
6050                    std::task::Poll::Pending => return std::task::Poll::Pending,
6051                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6052                        this.is_terminated = true;
6053                        return std::task::Poll::Ready(None);
6054                    }
6055                    std::task::Poll::Ready(Err(e)) => {
6056                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6057                            e.into(),
6058                        ))));
6059                    }
6060                }
6061
6062                // A message has been received from the channel
6063                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6064
6065                std::task::Poll::Ready(Some(match header.ordinal {
6066                    0x66747b9c5a6dfe7b => {
6067                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6068                        let mut req = fidl::new_empty!(
6069                            fidl::encoding::EmptyPayload,
6070                            fidl::encoding::DefaultFuchsiaResourceDialect
6071                        );
6072                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6073                        let control_handle =
6074                            MmioResourceControlHandle { inner: this.inner.clone() };
6075                        Ok(MmioResourceRequest::Get {
6076                            responder: MmioResourceGetResponder {
6077                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6078                                tx_id: header.tx_id,
6079                            },
6080                        })
6081                    }
6082                    _ => Err(fidl::Error::UnknownOrdinal {
6083                        ordinal: header.ordinal,
6084                        protocol_name:
6085                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6086                    }),
6087                }))
6088            },
6089        )
6090    }
6091}
6092
6093/// Protocol for providing an MMIO resource with access to all valid ranges.
6094#[derive(Debug)]
6095pub enum MmioResourceRequest {
6096    /// Get an MMIO resource handle.
6097    Get { responder: MmioResourceGetResponder },
6098}
6099
6100impl MmioResourceRequest {
6101    #[allow(irrefutable_let_patterns)]
6102    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
6103        if let MmioResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6104    }
6105
6106    /// Name of the method defined in FIDL
6107    pub fn method_name(&self) -> &'static str {
6108        match *self {
6109            MmioResourceRequest::Get { .. } => "get",
6110        }
6111    }
6112}
6113
6114#[derive(Debug, Clone)]
6115pub struct MmioResourceControlHandle {
6116    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6117}
6118
6119impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
6120    fn shutdown(&self) {
6121        self.inner.shutdown()
6122    }
6123
6124    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6125        self.inner.shutdown_with_epitaph(status)
6126    }
6127
6128    fn is_closed(&self) -> bool {
6129        self.inner.channel().is_closed()
6130    }
6131    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6132        self.inner.channel().on_closed()
6133    }
6134
6135    #[cfg(target_os = "fuchsia")]
6136    fn signal_peer(
6137        &self,
6138        clear_mask: zx::Signals,
6139        set_mask: zx::Signals,
6140    ) -> Result<(), zx_status::Status> {
6141        use fidl::Peered;
6142        self.inner.channel().signal_peer(clear_mask, set_mask)
6143    }
6144}
6145
6146impl MmioResourceControlHandle {}
6147
6148#[must_use = "FIDL methods require a response to be sent"]
6149#[derive(Debug)]
6150pub struct MmioResourceGetResponder {
6151    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
6152    tx_id: u32,
6153}
6154
6155/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
6156/// if the responder is dropped without sending a response, so that the client
6157/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6158impl std::ops::Drop for MmioResourceGetResponder {
6159    fn drop(&mut self) {
6160        self.control_handle.shutdown();
6161        // Safety: drops once, never accessed again
6162        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6163    }
6164}
6165
6166impl fidl::endpoints::Responder for MmioResourceGetResponder {
6167    type ControlHandle = MmioResourceControlHandle;
6168
6169    fn control_handle(&self) -> &MmioResourceControlHandle {
6170        &self.control_handle
6171    }
6172
6173    fn drop_without_shutdown(mut self) {
6174        // Safety: drops once, never accessed again due to mem::forget
6175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6176        // Prevent Drop from running (which would shut down the channel)
6177        std::mem::forget(self);
6178    }
6179}
6180
6181impl MmioResourceGetResponder {
6182    /// Sends a response to the FIDL transaction.
6183    ///
6184    /// Sets the channel to shutdown if an error occurs.
6185    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6186        let _result = self.send_raw(resource);
6187        if _result.is_err() {
6188            self.control_handle.shutdown();
6189        }
6190        self.drop_without_shutdown();
6191        _result
6192    }
6193
6194    /// Similar to "send" but does not shutdown the channel if an error occurs.
6195    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6196        let _result = self.send_raw(resource);
6197        self.drop_without_shutdown();
6198        _result
6199    }
6200
6201    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6202        self.control_handle.inner.send::<MmioResourceGetResponse>(
6203            (resource,),
6204            self.tx_id,
6205            0x66747b9c5a6dfe7b,
6206            fidl::encoding::DynamicFlags::empty(),
6207        )
6208    }
6209}
6210
6211#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6212pub struct MsiResourceMarker;
6213
6214impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
6215    type Proxy = MsiResourceProxy;
6216    type RequestStream = MsiResourceRequestStream;
6217    #[cfg(target_os = "fuchsia")]
6218    type SynchronousProxy = MsiResourceSynchronousProxy;
6219
6220    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
6221}
6222impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
6223
6224pub trait MsiResourceProxyInterface: Send + Sync {
6225    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6226    fn r#get(&self) -> Self::GetResponseFut;
6227}
6228#[derive(Debug)]
6229#[cfg(target_os = "fuchsia")]
6230pub struct MsiResourceSynchronousProxy {
6231    client: fidl::client::sync::Client,
6232}
6233
6234#[cfg(target_os = "fuchsia")]
6235impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
6236    type Proxy = MsiResourceProxy;
6237    type Protocol = MsiResourceMarker;
6238
6239    fn from_channel(inner: fidl::Channel) -> Self {
6240        Self::new(inner)
6241    }
6242
6243    fn into_channel(self) -> fidl::Channel {
6244        self.client.into_channel()
6245    }
6246
6247    fn as_channel(&self) -> &fidl::Channel {
6248        self.client.as_channel()
6249    }
6250}
6251
6252#[cfg(target_os = "fuchsia")]
6253impl MsiResourceSynchronousProxy {
6254    pub fn new(channel: fidl::Channel) -> Self {
6255        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6256        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6257    }
6258
6259    pub fn into_channel(self) -> fidl::Channel {
6260        self.client.into_channel()
6261    }
6262
6263    /// Waits until an event arrives and returns it. It is safe for other
6264    /// threads to make concurrent requests while waiting for an event.
6265    pub fn wait_for_event(
6266        &self,
6267        deadline: zx::MonotonicInstant,
6268    ) -> Result<MsiResourceEvent, fidl::Error> {
6269        MsiResourceEvent::decode(self.client.wait_for_event(deadline)?)
6270    }
6271
6272    /// Get an msi resource handle.
6273    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6274        let _response =
6275            self.client.send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse>(
6276                (),
6277                0x360a97e47e8c4f1f,
6278                fidl::encoding::DynamicFlags::empty(),
6279                ___deadline,
6280            )?;
6281        Ok(_response.resource)
6282    }
6283}
6284
6285#[cfg(target_os = "fuchsia")]
6286impl From<MsiResourceSynchronousProxy> for zx::NullableHandle {
6287    fn from(value: MsiResourceSynchronousProxy) -> Self {
6288        value.into_channel().into()
6289    }
6290}
6291
6292#[cfg(target_os = "fuchsia")]
6293impl From<fidl::Channel> for MsiResourceSynchronousProxy {
6294    fn from(value: fidl::Channel) -> Self {
6295        Self::new(value)
6296    }
6297}
6298
6299#[cfg(target_os = "fuchsia")]
6300impl fidl::endpoints::FromClient for MsiResourceSynchronousProxy {
6301    type Protocol = MsiResourceMarker;
6302
6303    fn from_client(value: fidl::endpoints::ClientEnd<MsiResourceMarker>) -> Self {
6304        Self::new(value.into_channel())
6305    }
6306}
6307
6308#[derive(Debug, Clone)]
6309pub struct MsiResourceProxy {
6310    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6311}
6312
6313impl fidl::endpoints::Proxy for MsiResourceProxy {
6314    type Protocol = MsiResourceMarker;
6315
6316    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6317        Self::new(inner)
6318    }
6319
6320    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6321        self.client.into_channel().map_err(|client| Self { client })
6322    }
6323
6324    fn as_channel(&self) -> &::fidl::AsyncChannel {
6325        self.client.as_channel()
6326    }
6327}
6328
6329impl MsiResourceProxy {
6330    /// Create a new Proxy for fuchsia.kernel/MsiResource.
6331    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6332        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6333        Self { client: fidl::client::Client::new(channel, protocol_name) }
6334    }
6335
6336    /// Get a Stream of events from the remote end of the protocol.
6337    ///
6338    /// # Panics
6339    ///
6340    /// Panics if the event stream was already taken.
6341    pub fn take_event_stream(&self) -> MsiResourceEventStream {
6342        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
6343    }
6344
6345    /// Get an msi resource handle.
6346    pub fn r#get(
6347        &self,
6348    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6349    {
6350        MsiResourceProxyInterface::r#get(self)
6351    }
6352}
6353
6354impl MsiResourceProxyInterface for MsiResourceProxy {
6355    type GetResponseFut = fidl::client::QueryResponseFut<
6356        fidl::Resource,
6357        fidl::encoding::DefaultFuchsiaResourceDialect,
6358    >;
6359    fn r#get(&self) -> Self::GetResponseFut {
6360        fn _decode(
6361            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6362        ) -> Result<fidl::Resource, fidl::Error> {
6363            let _response = fidl::client::decode_transaction_body::<
6364                MsiResourceGetResponse,
6365                fidl::encoding::DefaultFuchsiaResourceDialect,
6366                0x360a97e47e8c4f1f,
6367            >(_buf?)?;
6368            Ok(_response.resource)
6369        }
6370        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6371            (),
6372            0x360a97e47e8c4f1f,
6373            fidl::encoding::DynamicFlags::empty(),
6374            _decode,
6375        )
6376    }
6377}
6378
6379pub struct MsiResourceEventStream {
6380    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6381}
6382
6383impl std::marker::Unpin for MsiResourceEventStream {}
6384
6385impl futures::stream::FusedStream for MsiResourceEventStream {
6386    fn is_terminated(&self) -> bool {
6387        self.event_receiver.is_terminated()
6388    }
6389}
6390
6391impl futures::Stream for MsiResourceEventStream {
6392    type Item = Result<MsiResourceEvent, fidl::Error>;
6393
6394    fn poll_next(
6395        mut self: std::pin::Pin<&mut Self>,
6396        cx: &mut std::task::Context<'_>,
6397    ) -> std::task::Poll<Option<Self::Item>> {
6398        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6399            &mut self.event_receiver,
6400            cx
6401        )?) {
6402            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6403            None => std::task::Poll::Ready(None),
6404        }
6405    }
6406}
6407
6408#[derive(Debug)]
6409pub enum MsiResourceEvent {}
6410
6411impl MsiResourceEvent {
6412    /// Decodes a message buffer as a [`MsiResourceEvent`].
6413    fn decode(
6414        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6415    ) -> Result<MsiResourceEvent, fidl::Error> {
6416        let (bytes, _handles) = buf.split_mut();
6417        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6418        debug_assert_eq!(tx_header.tx_id, 0);
6419        match tx_header.ordinal {
6420            _ => Err(fidl::Error::UnknownOrdinal {
6421                ordinal: tx_header.ordinal,
6422                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6423            }),
6424        }
6425    }
6426}
6427
6428/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6429pub struct MsiResourceRequestStream {
6430    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6431    is_terminated: bool,
6432}
6433
6434impl std::marker::Unpin for MsiResourceRequestStream {}
6435
6436impl futures::stream::FusedStream for MsiResourceRequestStream {
6437    fn is_terminated(&self) -> bool {
6438        self.is_terminated
6439    }
6440}
6441
6442impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6443    type Protocol = MsiResourceMarker;
6444    type ControlHandle = MsiResourceControlHandle;
6445
6446    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6447        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6448    }
6449
6450    fn control_handle(&self) -> Self::ControlHandle {
6451        MsiResourceControlHandle { inner: self.inner.clone() }
6452    }
6453
6454    fn into_inner(
6455        self,
6456    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6457    {
6458        (self.inner, self.is_terminated)
6459    }
6460
6461    fn from_inner(
6462        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6463        is_terminated: bool,
6464    ) -> Self {
6465        Self { inner, is_terminated }
6466    }
6467}
6468
6469impl futures::Stream for MsiResourceRequestStream {
6470    type Item = Result<MsiResourceRequest, fidl::Error>;
6471
6472    fn poll_next(
6473        mut self: std::pin::Pin<&mut Self>,
6474        cx: &mut std::task::Context<'_>,
6475    ) -> std::task::Poll<Option<Self::Item>> {
6476        let this = &mut *self;
6477        if this.inner.check_shutdown(cx) {
6478            this.is_terminated = true;
6479            return std::task::Poll::Ready(None);
6480        }
6481        if this.is_terminated {
6482            panic!("polled MsiResourceRequestStream after completion");
6483        }
6484        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6485            |bytes, handles| {
6486                match this.inner.channel().read_etc(cx, bytes, handles) {
6487                    std::task::Poll::Ready(Ok(())) => {}
6488                    std::task::Poll::Pending => return std::task::Poll::Pending,
6489                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6490                        this.is_terminated = true;
6491                        return std::task::Poll::Ready(None);
6492                    }
6493                    std::task::Poll::Ready(Err(e)) => {
6494                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6495                            e.into(),
6496                        ))));
6497                    }
6498                }
6499
6500                // A message has been received from the channel
6501                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6502
6503                std::task::Poll::Ready(Some(match header.ordinal {
6504                    0x360a97e47e8c4f1f => {
6505                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6506                        let mut req = fidl::new_empty!(
6507                            fidl::encoding::EmptyPayload,
6508                            fidl::encoding::DefaultFuchsiaResourceDialect
6509                        );
6510                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6511                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6512                        Ok(MsiResourceRequest::Get {
6513                            responder: MsiResourceGetResponder {
6514                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6515                                tx_id: header.tx_id,
6516                            },
6517                        })
6518                    }
6519                    _ => Err(fidl::Error::UnknownOrdinal {
6520                        ordinal: header.ordinal,
6521                        protocol_name:
6522                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6523                    }),
6524                }))
6525            },
6526        )
6527    }
6528}
6529
6530/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6531/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6532#[derive(Debug)]
6533pub enum MsiResourceRequest {
6534    /// Get an msi resource handle.
6535    Get { responder: MsiResourceGetResponder },
6536}
6537
6538impl MsiResourceRequest {
6539    #[allow(irrefutable_let_patterns)]
6540    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6541        if let MsiResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6542    }
6543
6544    /// Name of the method defined in FIDL
6545    pub fn method_name(&self) -> &'static str {
6546        match *self {
6547            MsiResourceRequest::Get { .. } => "get",
6548        }
6549    }
6550}
6551
6552#[derive(Debug, Clone)]
6553pub struct MsiResourceControlHandle {
6554    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6555}
6556
6557impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6558    fn shutdown(&self) {
6559        self.inner.shutdown()
6560    }
6561
6562    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6563        self.inner.shutdown_with_epitaph(status)
6564    }
6565
6566    fn is_closed(&self) -> bool {
6567        self.inner.channel().is_closed()
6568    }
6569    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6570        self.inner.channel().on_closed()
6571    }
6572
6573    #[cfg(target_os = "fuchsia")]
6574    fn signal_peer(
6575        &self,
6576        clear_mask: zx::Signals,
6577        set_mask: zx::Signals,
6578    ) -> Result<(), zx_status::Status> {
6579        use fidl::Peered;
6580        self.inner.channel().signal_peer(clear_mask, set_mask)
6581    }
6582}
6583
6584impl MsiResourceControlHandle {}
6585
6586#[must_use = "FIDL methods require a response to be sent"]
6587#[derive(Debug)]
6588pub struct MsiResourceGetResponder {
6589    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6590    tx_id: u32,
6591}
6592
6593/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6594/// if the responder is dropped without sending a response, so that the client
6595/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6596impl std::ops::Drop for MsiResourceGetResponder {
6597    fn drop(&mut self) {
6598        self.control_handle.shutdown();
6599        // Safety: drops once, never accessed again
6600        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6601    }
6602}
6603
6604impl fidl::endpoints::Responder for MsiResourceGetResponder {
6605    type ControlHandle = MsiResourceControlHandle;
6606
6607    fn control_handle(&self) -> &MsiResourceControlHandle {
6608        &self.control_handle
6609    }
6610
6611    fn drop_without_shutdown(mut self) {
6612        // Safety: drops once, never accessed again due to mem::forget
6613        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6614        // Prevent Drop from running (which would shut down the channel)
6615        std::mem::forget(self);
6616    }
6617}
6618
6619impl MsiResourceGetResponder {
6620    /// Sends a response to the FIDL transaction.
6621    ///
6622    /// Sets the channel to shutdown if an error occurs.
6623    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6624        let _result = self.send_raw(resource);
6625        if _result.is_err() {
6626            self.control_handle.shutdown();
6627        }
6628        self.drop_without_shutdown();
6629        _result
6630    }
6631
6632    /// Similar to "send" but does not shutdown the channel if an error occurs.
6633    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6634        let _result = self.send_raw(resource);
6635        self.drop_without_shutdown();
6636        _result
6637    }
6638
6639    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6640        self.control_handle.inner.send::<MsiResourceGetResponse>(
6641            (resource,),
6642            self.tx_id,
6643            0x360a97e47e8c4f1f,
6644            fidl::encoding::DynamicFlags::empty(),
6645        )
6646    }
6647}
6648
6649#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6650pub struct PowerResourceMarker;
6651
6652impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6653    type Proxy = PowerResourceProxy;
6654    type RequestStream = PowerResourceRequestStream;
6655    #[cfg(target_os = "fuchsia")]
6656    type SynchronousProxy = PowerResourceSynchronousProxy;
6657
6658    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6659}
6660impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6661
6662pub trait PowerResourceProxyInterface: Send + Sync {
6663    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6664    fn r#get(&self) -> Self::GetResponseFut;
6665}
6666#[derive(Debug)]
6667#[cfg(target_os = "fuchsia")]
6668pub struct PowerResourceSynchronousProxy {
6669    client: fidl::client::sync::Client,
6670}
6671
6672#[cfg(target_os = "fuchsia")]
6673impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6674    type Proxy = PowerResourceProxy;
6675    type Protocol = PowerResourceMarker;
6676
6677    fn from_channel(inner: fidl::Channel) -> Self {
6678        Self::new(inner)
6679    }
6680
6681    fn into_channel(self) -> fidl::Channel {
6682        self.client.into_channel()
6683    }
6684
6685    fn as_channel(&self) -> &fidl::Channel {
6686        self.client.as_channel()
6687    }
6688}
6689
6690#[cfg(target_os = "fuchsia")]
6691impl PowerResourceSynchronousProxy {
6692    pub fn new(channel: fidl::Channel) -> Self {
6693        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6694        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6695    }
6696
6697    pub fn into_channel(self) -> fidl::Channel {
6698        self.client.into_channel()
6699    }
6700
6701    /// Waits until an event arrives and returns it. It is safe for other
6702    /// threads to make concurrent requests while waiting for an event.
6703    pub fn wait_for_event(
6704        &self,
6705        deadline: zx::MonotonicInstant,
6706    ) -> Result<PowerResourceEvent, fidl::Error> {
6707        PowerResourceEvent::decode(self.client.wait_for_event(deadline)?)
6708    }
6709
6710    /// Get a power resource handle.
6711    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6712        let _response =
6713            self.client.send_query::<fidl::encoding::EmptyPayload, PowerResourceGetResponse>(
6714                (),
6715                0x2b8df8ca24d1e866,
6716                fidl::encoding::DynamicFlags::empty(),
6717                ___deadline,
6718            )?;
6719        Ok(_response.resource)
6720    }
6721}
6722
6723#[cfg(target_os = "fuchsia")]
6724impl From<PowerResourceSynchronousProxy> for zx::NullableHandle {
6725    fn from(value: PowerResourceSynchronousProxy) -> Self {
6726        value.into_channel().into()
6727    }
6728}
6729
6730#[cfg(target_os = "fuchsia")]
6731impl From<fidl::Channel> for PowerResourceSynchronousProxy {
6732    fn from(value: fidl::Channel) -> Self {
6733        Self::new(value)
6734    }
6735}
6736
6737#[cfg(target_os = "fuchsia")]
6738impl fidl::endpoints::FromClient for PowerResourceSynchronousProxy {
6739    type Protocol = PowerResourceMarker;
6740
6741    fn from_client(value: fidl::endpoints::ClientEnd<PowerResourceMarker>) -> Self {
6742        Self::new(value.into_channel())
6743    }
6744}
6745
6746#[derive(Debug, Clone)]
6747pub struct PowerResourceProxy {
6748    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6749}
6750
6751impl fidl::endpoints::Proxy for PowerResourceProxy {
6752    type Protocol = PowerResourceMarker;
6753
6754    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6755        Self::new(inner)
6756    }
6757
6758    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6759        self.client.into_channel().map_err(|client| Self { client })
6760    }
6761
6762    fn as_channel(&self) -> &::fidl::AsyncChannel {
6763        self.client.as_channel()
6764    }
6765}
6766
6767impl PowerResourceProxy {
6768    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6769    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6770        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6771        Self { client: fidl::client::Client::new(channel, protocol_name) }
6772    }
6773
6774    /// Get a Stream of events from the remote end of the protocol.
6775    ///
6776    /// # Panics
6777    ///
6778    /// Panics if the event stream was already taken.
6779    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6780        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6781    }
6782
6783    /// Get a power resource handle.
6784    pub fn r#get(
6785        &self,
6786    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6787    {
6788        PowerResourceProxyInterface::r#get(self)
6789    }
6790}
6791
6792impl PowerResourceProxyInterface for PowerResourceProxy {
6793    type GetResponseFut = fidl::client::QueryResponseFut<
6794        fidl::Resource,
6795        fidl::encoding::DefaultFuchsiaResourceDialect,
6796    >;
6797    fn r#get(&self) -> Self::GetResponseFut {
6798        fn _decode(
6799            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6800        ) -> Result<fidl::Resource, fidl::Error> {
6801            let _response = fidl::client::decode_transaction_body::<
6802                PowerResourceGetResponse,
6803                fidl::encoding::DefaultFuchsiaResourceDialect,
6804                0x2b8df8ca24d1e866,
6805            >(_buf?)?;
6806            Ok(_response.resource)
6807        }
6808        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6809            (),
6810            0x2b8df8ca24d1e866,
6811            fidl::encoding::DynamicFlags::empty(),
6812            _decode,
6813        )
6814    }
6815}
6816
6817pub struct PowerResourceEventStream {
6818    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6819}
6820
6821impl std::marker::Unpin for PowerResourceEventStream {}
6822
6823impl futures::stream::FusedStream for PowerResourceEventStream {
6824    fn is_terminated(&self) -> bool {
6825        self.event_receiver.is_terminated()
6826    }
6827}
6828
6829impl futures::Stream for PowerResourceEventStream {
6830    type Item = Result<PowerResourceEvent, fidl::Error>;
6831
6832    fn poll_next(
6833        mut self: std::pin::Pin<&mut Self>,
6834        cx: &mut std::task::Context<'_>,
6835    ) -> std::task::Poll<Option<Self::Item>> {
6836        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6837            &mut self.event_receiver,
6838            cx
6839        )?) {
6840            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6841            None => std::task::Poll::Ready(None),
6842        }
6843    }
6844}
6845
6846#[derive(Debug)]
6847pub enum PowerResourceEvent {}
6848
6849impl PowerResourceEvent {
6850    /// Decodes a message buffer as a [`PowerResourceEvent`].
6851    fn decode(
6852        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6853    ) -> Result<PowerResourceEvent, fidl::Error> {
6854        let (bytes, _handles) = buf.split_mut();
6855        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6856        debug_assert_eq!(tx_header.tx_id, 0);
6857        match tx_header.ordinal {
6858            _ => Err(fidl::Error::UnknownOrdinal {
6859                ordinal: tx_header.ordinal,
6860                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6861            }),
6862        }
6863    }
6864}
6865
6866/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6867pub struct PowerResourceRequestStream {
6868    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6869    is_terminated: bool,
6870}
6871
6872impl std::marker::Unpin for PowerResourceRequestStream {}
6873
6874impl futures::stream::FusedStream for PowerResourceRequestStream {
6875    fn is_terminated(&self) -> bool {
6876        self.is_terminated
6877    }
6878}
6879
6880impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6881    type Protocol = PowerResourceMarker;
6882    type ControlHandle = PowerResourceControlHandle;
6883
6884    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6885        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6886    }
6887
6888    fn control_handle(&self) -> Self::ControlHandle {
6889        PowerResourceControlHandle { inner: self.inner.clone() }
6890    }
6891
6892    fn into_inner(
6893        self,
6894    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6895    {
6896        (self.inner, self.is_terminated)
6897    }
6898
6899    fn from_inner(
6900        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6901        is_terminated: bool,
6902    ) -> Self {
6903        Self { inner, is_terminated }
6904    }
6905}
6906
6907impl futures::Stream for PowerResourceRequestStream {
6908    type Item = Result<PowerResourceRequest, fidl::Error>;
6909
6910    fn poll_next(
6911        mut self: std::pin::Pin<&mut Self>,
6912        cx: &mut std::task::Context<'_>,
6913    ) -> std::task::Poll<Option<Self::Item>> {
6914        let this = &mut *self;
6915        if this.inner.check_shutdown(cx) {
6916            this.is_terminated = true;
6917            return std::task::Poll::Ready(None);
6918        }
6919        if this.is_terminated {
6920            panic!("polled PowerResourceRequestStream after completion");
6921        }
6922        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6923            |bytes, handles| {
6924                match this.inner.channel().read_etc(cx, bytes, handles) {
6925                    std::task::Poll::Ready(Ok(())) => {}
6926                    std::task::Poll::Pending => return std::task::Poll::Pending,
6927                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6928                        this.is_terminated = true;
6929                        return std::task::Poll::Ready(None);
6930                    }
6931                    std::task::Poll::Ready(Err(e)) => {
6932                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6933                            e.into(),
6934                        ))));
6935                    }
6936                }
6937
6938                // A message has been received from the channel
6939                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6940
6941                std::task::Poll::Ready(Some(match header.ordinal {
6942                    0x2b8df8ca24d1e866 => {
6943                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6944                        let mut req = fidl::new_empty!(
6945                            fidl::encoding::EmptyPayload,
6946                            fidl::encoding::DefaultFuchsiaResourceDialect
6947                        );
6948                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6949                        let control_handle =
6950                            PowerResourceControlHandle { inner: this.inner.clone() };
6951                        Ok(PowerResourceRequest::Get {
6952                            responder: PowerResourceGetResponder {
6953                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6954                                tx_id: header.tx_id,
6955                            },
6956                        })
6957                    }
6958                    _ => Err(fidl::Error::UnknownOrdinal {
6959                        ordinal: header.ordinal,
6960                        protocol_name:
6961                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6962                    }),
6963                }))
6964            },
6965        )
6966    }
6967}
6968
6969/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6970/// `ZX_RSRC_SYSTEM_POWER_BASE`.
6971#[derive(Debug)]
6972pub enum PowerResourceRequest {
6973    /// Get a power resource handle.
6974    Get { responder: PowerResourceGetResponder },
6975}
6976
6977impl PowerResourceRequest {
6978    #[allow(irrefutable_let_patterns)]
6979    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
6980        if let PowerResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6981    }
6982
6983    /// Name of the method defined in FIDL
6984    pub fn method_name(&self) -> &'static str {
6985        match *self {
6986            PowerResourceRequest::Get { .. } => "get",
6987        }
6988    }
6989}
6990
6991#[derive(Debug, Clone)]
6992pub struct PowerResourceControlHandle {
6993    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6994}
6995
6996impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
6997    fn shutdown(&self) {
6998        self.inner.shutdown()
6999    }
7000
7001    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7002        self.inner.shutdown_with_epitaph(status)
7003    }
7004
7005    fn is_closed(&self) -> bool {
7006        self.inner.channel().is_closed()
7007    }
7008    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7009        self.inner.channel().on_closed()
7010    }
7011
7012    #[cfg(target_os = "fuchsia")]
7013    fn signal_peer(
7014        &self,
7015        clear_mask: zx::Signals,
7016        set_mask: zx::Signals,
7017    ) -> Result<(), zx_status::Status> {
7018        use fidl::Peered;
7019        self.inner.channel().signal_peer(clear_mask, set_mask)
7020    }
7021}
7022
7023impl PowerResourceControlHandle {}
7024
7025#[must_use = "FIDL methods require a response to be sent"]
7026#[derive(Debug)]
7027pub struct PowerResourceGetResponder {
7028    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
7029    tx_id: u32,
7030}
7031
7032/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
7033/// if the responder is dropped without sending a response, so that the client
7034/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7035impl std::ops::Drop for PowerResourceGetResponder {
7036    fn drop(&mut self) {
7037        self.control_handle.shutdown();
7038        // Safety: drops once, never accessed again
7039        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7040    }
7041}
7042
7043impl fidl::endpoints::Responder for PowerResourceGetResponder {
7044    type ControlHandle = PowerResourceControlHandle;
7045
7046    fn control_handle(&self) -> &PowerResourceControlHandle {
7047        &self.control_handle
7048    }
7049
7050    fn drop_without_shutdown(mut self) {
7051        // Safety: drops once, never accessed again due to mem::forget
7052        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7053        // Prevent Drop from running (which would shut down the channel)
7054        std::mem::forget(self);
7055    }
7056}
7057
7058impl PowerResourceGetResponder {
7059    /// Sends a response to the FIDL transaction.
7060    ///
7061    /// Sets the channel to shutdown if an error occurs.
7062    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7063        let _result = self.send_raw(resource);
7064        if _result.is_err() {
7065            self.control_handle.shutdown();
7066        }
7067        self.drop_without_shutdown();
7068        _result
7069    }
7070
7071    /// Similar to "send" but does not shutdown the channel if an error occurs.
7072    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7073        let _result = self.send_raw(resource);
7074        self.drop_without_shutdown();
7075        _result
7076    }
7077
7078    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7079        self.control_handle.inner.send::<PowerResourceGetResponse>(
7080            (resource,),
7081            self.tx_id,
7082            0x2b8df8ca24d1e866,
7083            fidl::encoding::DynamicFlags::empty(),
7084        )
7085    }
7086}
7087
7088#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7089pub struct ProfileResourceMarker;
7090
7091impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
7092    type Proxy = ProfileResourceProxy;
7093    type RequestStream = ProfileResourceRequestStream;
7094    #[cfg(target_os = "fuchsia")]
7095    type SynchronousProxy = ProfileResourceSynchronousProxy;
7096
7097    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
7098}
7099impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
7100
7101pub trait ProfileResourceProxyInterface: Send + Sync {
7102    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
7103    fn r#get(&self) -> Self::GetResponseFut;
7104}
7105#[derive(Debug)]
7106#[cfg(target_os = "fuchsia")]
7107pub struct ProfileResourceSynchronousProxy {
7108    client: fidl::client::sync::Client,
7109}
7110
7111#[cfg(target_os = "fuchsia")]
7112impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
7113    type Proxy = ProfileResourceProxy;
7114    type Protocol = ProfileResourceMarker;
7115
7116    fn from_channel(inner: fidl::Channel) -> Self {
7117        Self::new(inner)
7118    }
7119
7120    fn into_channel(self) -> fidl::Channel {
7121        self.client.into_channel()
7122    }
7123
7124    fn as_channel(&self) -> &fidl::Channel {
7125        self.client.as_channel()
7126    }
7127}
7128
7129#[cfg(target_os = "fuchsia")]
7130impl ProfileResourceSynchronousProxy {
7131    pub fn new(channel: fidl::Channel) -> Self {
7132        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7133        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7134    }
7135
7136    pub fn into_channel(self) -> fidl::Channel {
7137        self.client.into_channel()
7138    }
7139
7140    /// Waits until an event arrives and returns it. It is safe for other
7141    /// threads to make concurrent requests while waiting for an event.
7142    pub fn wait_for_event(
7143        &self,
7144        deadline: zx::MonotonicInstant,
7145    ) -> Result<ProfileResourceEvent, fidl::Error> {
7146        ProfileResourceEvent::decode(self.client.wait_for_event(deadline)?)
7147    }
7148
7149    /// Get a profile resource handle.
7150    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
7151        let _response =
7152            self.client.send_query::<fidl::encoding::EmptyPayload, ProfileResourceGetResponse>(
7153                (),
7154                0x3003a0c14de1fa86,
7155                fidl::encoding::DynamicFlags::empty(),
7156                ___deadline,
7157            )?;
7158        Ok(_response.resource)
7159    }
7160}
7161
7162#[cfg(target_os = "fuchsia")]
7163impl From<ProfileResourceSynchronousProxy> for zx::NullableHandle {
7164    fn from(value: ProfileResourceSynchronousProxy) -> Self {
7165        value.into_channel().into()
7166    }
7167}
7168
7169#[cfg(target_os = "fuchsia")]
7170impl From<fidl::Channel> for ProfileResourceSynchronousProxy {
7171    fn from(value: fidl::Channel) -> Self {
7172        Self::new(value)
7173    }
7174}
7175
7176#[cfg(target_os = "fuchsia")]
7177impl fidl::endpoints::FromClient for ProfileResourceSynchronousProxy {
7178    type Protocol = ProfileResourceMarker;
7179
7180    fn from_client(value: fidl::endpoints::ClientEnd<ProfileResourceMarker>) -> Self {
7181        Self::new(value.into_channel())
7182    }
7183}
7184
7185#[derive(Debug, Clone)]
7186pub struct ProfileResourceProxy {
7187    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7188}
7189
7190impl fidl::endpoints::Proxy for ProfileResourceProxy {
7191    type Protocol = ProfileResourceMarker;
7192
7193    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7194        Self::new(inner)
7195    }
7196
7197    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7198        self.client.into_channel().map_err(|client| Self { client })
7199    }
7200
7201    fn as_channel(&self) -> &::fidl::AsyncChannel {
7202        self.client.as_channel()
7203    }
7204}
7205
7206impl ProfileResourceProxy {
7207    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
7208    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7209        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7210        Self { client: fidl::client::Client::new(channel, protocol_name) }
7211    }
7212
7213    /// Get a Stream of events from the remote end of the protocol.
7214    ///
7215    /// # Panics
7216    ///
7217    /// Panics if the event stream was already taken.
7218    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
7219        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
7220    }
7221
7222    /// Get a profile resource handle.
7223    pub fn r#get(
7224        &self,
7225    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
7226    {
7227        ProfileResourceProxyInterface::r#get(self)
7228    }
7229}
7230
7231impl ProfileResourceProxyInterface for ProfileResourceProxy {
7232    type GetResponseFut = fidl::client::QueryResponseFut<
7233        fidl::Resource,
7234        fidl::encoding::DefaultFuchsiaResourceDialect,
7235    >;
7236    fn r#get(&self) -> Self::GetResponseFut {
7237        fn _decode(
7238            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7239        ) -> Result<fidl::Resource, fidl::Error> {
7240            let _response = fidl::client::decode_transaction_body::<
7241                ProfileResourceGetResponse,
7242                fidl::encoding::DefaultFuchsiaResourceDialect,
7243                0x3003a0c14de1fa86,
7244            >(_buf?)?;
7245            Ok(_response.resource)
7246        }
7247        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
7248            (),
7249            0x3003a0c14de1fa86,
7250            fidl::encoding::DynamicFlags::empty(),
7251            _decode,
7252        )
7253    }
7254}
7255
7256pub struct ProfileResourceEventStream {
7257    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7258}
7259
7260impl std::marker::Unpin for ProfileResourceEventStream {}
7261
7262impl futures::stream::FusedStream for ProfileResourceEventStream {
7263    fn is_terminated(&self) -> bool {
7264        self.event_receiver.is_terminated()
7265    }
7266}
7267
7268impl futures::Stream for ProfileResourceEventStream {
7269    type Item = Result<ProfileResourceEvent, fidl::Error>;
7270
7271    fn poll_next(
7272        mut self: std::pin::Pin<&mut Self>,
7273        cx: &mut std::task::Context<'_>,
7274    ) -> std::task::Poll<Option<Self::Item>> {
7275        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7276            &mut self.event_receiver,
7277            cx
7278        )?) {
7279            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
7280            None => std::task::Poll::Ready(None),
7281        }
7282    }
7283}
7284
7285#[derive(Debug)]
7286pub enum ProfileResourceEvent {}
7287
7288impl ProfileResourceEvent {
7289    /// Decodes a message buffer as a [`ProfileResourceEvent`].
7290    fn decode(
7291        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7292    ) -> Result<ProfileResourceEvent, fidl::Error> {
7293        let (bytes, _handles) = buf.split_mut();
7294        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7295        debug_assert_eq!(tx_header.tx_id, 0);
7296        match tx_header.ordinal {
7297            _ => Err(fidl::Error::UnknownOrdinal {
7298                ordinal: tx_header.ordinal,
7299                protocol_name:
7300                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7301            }),
7302        }
7303    }
7304}
7305
7306/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
7307pub struct ProfileResourceRequestStream {
7308    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7309    is_terminated: bool,
7310}
7311
7312impl std::marker::Unpin for ProfileResourceRequestStream {}
7313
7314impl futures::stream::FusedStream for ProfileResourceRequestStream {
7315    fn is_terminated(&self) -> bool {
7316        self.is_terminated
7317    }
7318}
7319
7320impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
7321    type Protocol = ProfileResourceMarker;
7322    type ControlHandle = ProfileResourceControlHandle;
7323
7324    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7325        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7326    }
7327
7328    fn control_handle(&self) -> Self::ControlHandle {
7329        ProfileResourceControlHandle { inner: self.inner.clone() }
7330    }
7331
7332    fn into_inner(
7333        self,
7334    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7335    {
7336        (self.inner, self.is_terminated)
7337    }
7338
7339    fn from_inner(
7340        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7341        is_terminated: bool,
7342    ) -> Self {
7343        Self { inner, is_terminated }
7344    }
7345}
7346
7347impl futures::Stream for ProfileResourceRequestStream {
7348    type Item = Result<ProfileResourceRequest, fidl::Error>;
7349
7350    fn poll_next(
7351        mut self: std::pin::Pin<&mut Self>,
7352        cx: &mut std::task::Context<'_>,
7353    ) -> std::task::Poll<Option<Self::Item>> {
7354        let this = &mut *self;
7355        if this.inner.check_shutdown(cx) {
7356            this.is_terminated = true;
7357            return std::task::Poll::Ready(None);
7358        }
7359        if this.is_terminated {
7360            panic!("polled ProfileResourceRequestStream after completion");
7361        }
7362        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7363            |bytes, handles| {
7364                match this.inner.channel().read_etc(cx, bytes, handles) {
7365                    std::task::Poll::Ready(Ok(())) => {}
7366                    std::task::Poll::Pending => return std::task::Poll::Pending,
7367                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7368                        this.is_terminated = true;
7369                        return std::task::Poll::Ready(None);
7370                    }
7371                    std::task::Poll::Ready(Err(e)) => {
7372                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7373                            e.into(),
7374                        ))));
7375                    }
7376                }
7377
7378                // A message has been received from the channel
7379                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7380
7381                std::task::Poll::Ready(Some(match header.ordinal {
7382                    0x3003a0c14de1fa86 => {
7383                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7384                        let mut req = fidl::new_empty!(
7385                            fidl::encoding::EmptyPayload,
7386                            fidl::encoding::DefaultFuchsiaResourceDialect
7387                        );
7388                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7389                        let control_handle =
7390                            ProfileResourceControlHandle { inner: this.inner.clone() };
7391                        Ok(ProfileResourceRequest::Get {
7392                            responder: ProfileResourceGetResponder {
7393                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7394                                tx_id: header.tx_id,
7395                            },
7396                        })
7397                    }
7398                    _ => Err(fidl::Error::UnknownOrdinal {
7399                        ordinal: header.ordinal,
7400                        protocol_name:
7401                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7402                    }),
7403                }))
7404            },
7405        )
7406    }
7407}
7408
7409/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7410/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7411#[derive(Debug)]
7412pub enum ProfileResourceRequest {
7413    /// Get a profile resource handle.
7414    Get { responder: ProfileResourceGetResponder },
7415}
7416
7417impl ProfileResourceRequest {
7418    #[allow(irrefutable_let_patterns)]
7419    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7420        if let ProfileResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7421    }
7422
7423    /// Name of the method defined in FIDL
7424    pub fn method_name(&self) -> &'static str {
7425        match *self {
7426            ProfileResourceRequest::Get { .. } => "get",
7427        }
7428    }
7429}
7430
7431#[derive(Debug, Clone)]
7432pub struct ProfileResourceControlHandle {
7433    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7434}
7435
7436impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7437    fn shutdown(&self) {
7438        self.inner.shutdown()
7439    }
7440
7441    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7442        self.inner.shutdown_with_epitaph(status)
7443    }
7444
7445    fn is_closed(&self) -> bool {
7446        self.inner.channel().is_closed()
7447    }
7448    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7449        self.inner.channel().on_closed()
7450    }
7451
7452    #[cfg(target_os = "fuchsia")]
7453    fn signal_peer(
7454        &self,
7455        clear_mask: zx::Signals,
7456        set_mask: zx::Signals,
7457    ) -> Result<(), zx_status::Status> {
7458        use fidl::Peered;
7459        self.inner.channel().signal_peer(clear_mask, set_mask)
7460    }
7461}
7462
7463impl ProfileResourceControlHandle {}
7464
7465#[must_use = "FIDL methods require a response to be sent"]
7466#[derive(Debug)]
7467pub struct ProfileResourceGetResponder {
7468    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7469    tx_id: u32,
7470}
7471
7472/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7473/// if the responder is dropped without sending a response, so that the client
7474/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7475impl std::ops::Drop for ProfileResourceGetResponder {
7476    fn drop(&mut self) {
7477        self.control_handle.shutdown();
7478        // Safety: drops once, never accessed again
7479        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7480    }
7481}
7482
7483impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7484    type ControlHandle = ProfileResourceControlHandle;
7485
7486    fn control_handle(&self) -> &ProfileResourceControlHandle {
7487        &self.control_handle
7488    }
7489
7490    fn drop_without_shutdown(mut self) {
7491        // Safety: drops once, never accessed again due to mem::forget
7492        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7493        // Prevent Drop from running (which would shut down the channel)
7494        std::mem::forget(self);
7495    }
7496}
7497
7498impl ProfileResourceGetResponder {
7499    /// Sends a response to the FIDL transaction.
7500    ///
7501    /// Sets the channel to shutdown if an error occurs.
7502    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7503        let _result = self.send_raw(resource);
7504        if _result.is_err() {
7505            self.control_handle.shutdown();
7506        }
7507        self.drop_without_shutdown();
7508        _result
7509    }
7510
7511    /// Similar to "send" but does not shutdown the channel if an error occurs.
7512    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7513        let _result = self.send_raw(resource);
7514        self.drop_without_shutdown();
7515        _result
7516    }
7517
7518    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7519        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7520            (resource,),
7521            self.tx_id,
7522            0x3003a0c14de1fa86,
7523            fidl::encoding::DynamicFlags::empty(),
7524        )
7525    }
7526}
7527
7528#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7529pub struct RootJobMarker;
7530
7531impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7532    type Proxy = RootJobProxy;
7533    type RequestStream = RootJobRequestStream;
7534    #[cfg(target_os = "fuchsia")]
7535    type SynchronousProxy = RootJobSynchronousProxy;
7536
7537    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7538}
7539impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7540
7541pub trait RootJobProxyInterface: Send + Sync {
7542    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7543    fn r#get(&self) -> Self::GetResponseFut;
7544}
7545#[derive(Debug)]
7546#[cfg(target_os = "fuchsia")]
7547pub struct RootJobSynchronousProxy {
7548    client: fidl::client::sync::Client,
7549}
7550
7551#[cfg(target_os = "fuchsia")]
7552impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7553    type Proxy = RootJobProxy;
7554    type Protocol = RootJobMarker;
7555
7556    fn from_channel(inner: fidl::Channel) -> Self {
7557        Self::new(inner)
7558    }
7559
7560    fn into_channel(self) -> fidl::Channel {
7561        self.client.into_channel()
7562    }
7563
7564    fn as_channel(&self) -> &fidl::Channel {
7565        self.client.as_channel()
7566    }
7567}
7568
7569#[cfg(target_os = "fuchsia")]
7570impl RootJobSynchronousProxy {
7571    pub fn new(channel: fidl::Channel) -> Self {
7572        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7573        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7574    }
7575
7576    pub fn into_channel(self) -> fidl::Channel {
7577        self.client.into_channel()
7578    }
7579
7580    /// Waits until an event arrives and returns it. It is safe for other
7581    /// threads to make concurrent requests while waiting for an event.
7582    pub fn wait_for_event(
7583        &self,
7584        deadline: zx::MonotonicInstant,
7585    ) -> Result<RootJobEvent, fidl::Error> {
7586        RootJobEvent::decode(self.client.wait_for_event(deadline)?)
7587    }
7588
7589    /// Get the root `job`.
7590    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7591        let _response =
7592            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
7593                (),
7594                0x73acb63f93d53eac,
7595                fidl::encoding::DynamicFlags::empty(),
7596                ___deadline,
7597            )?;
7598        Ok(_response.job)
7599    }
7600}
7601
7602#[cfg(target_os = "fuchsia")]
7603impl From<RootJobSynchronousProxy> for zx::NullableHandle {
7604    fn from(value: RootJobSynchronousProxy) -> Self {
7605        value.into_channel().into()
7606    }
7607}
7608
7609#[cfg(target_os = "fuchsia")]
7610impl From<fidl::Channel> for RootJobSynchronousProxy {
7611    fn from(value: fidl::Channel) -> Self {
7612        Self::new(value)
7613    }
7614}
7615
7616#[cfg(target_os = "fuchsia")]
7617impl fidl::endpoints::FromClient for RootJobSynchronousProxy {
7618    type Protocol = RootJobMarker;
7619
7620    fn from_client(value: fidl::endpoints::ClientEnd<RootJobMarker>) -> Self {
7621        Self::new(value.into_channel())
7622    }
7623}
7624
7625#[derive(Debug, Clone)]
7626pub struct RootJobProxy {
7627    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7628}
7629
7630impl fidl::endpoints::Proxy for RootJobProxy {
7631    type Protocol = RootJobMarker;
7632
7633    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7634        Self::new(inner)
7635    }
7636
7637    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7638        self.client.into_channel().map_err(|client| Self { client })
7639    }
7640
7641    fn as_channel(&self) -> &::fidl::AsyncChannel {
7642        self.client.as_channel()
7643    }
7644}
7645
7646impl RootJobProxy {
7647    /// Create a new Proxy for fuchsia.kernel/RootJob.
7648    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7649        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7650        Self { client: fidl::client::Client::new(channel, protocol_name) }
7651    }
7652
7653    /// Get a Stream of events from the remote end of the protocol.
7654    ///
7655    /// # Panics
7656    ///
7657    /// Panics if the event stream was already taken.
7658    pub fn take_event_stream(&self) -> RootJobEventStream {
7659        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7660    }
7661
7662    /// Get the root `job`.
7663    pub fn r#get(
7664        &self,
7665    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7666    {
7667        RootJobProxyInterface::r#get(self)
7668    }
7669}
7670
7671impl RootJobProxyInterface for RootJobProxy {
7672    type GetResponseFut =
7673        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7674    fn r#get(&self) -> Self::GetResponseFut {
7675        fn _decode(
7676            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7677        ) -> Result<fidl::Job, fidl::Error> {
7678            let _response = fidl::client::decode_transaction_body::<
7679                RootJobGetResponse,
7680                fidl::encoding::DefaultFuchsiaResourceDialect,
7681                0x73acb63f93d53eac,
7682            >(_buf?)?;
7683            Ok(_response.job)
7684        }
7685        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7686            (),
7687            0x73acb63f93d53eac,
7688            fidl::encoding::DynamicFlags::empty(),
7689            _decode,
7690        )
7691    }
7692}
7693
7694pub struct RootJobEventStream {
7695    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7696}
7697
7698impl std::marker::Unpin for RootJobEventStream {}
7699
7700impl futures::stream::FusedStream for RootJobEventStream {
7701    fn is_terminated(&self) -> bool {
7702        self.event_receiver.is_terminated()
7703    }
7704}
7705
7706impl futures::Stream for RootJobEventStream {
7707    type Item = Result<RootJobEvent, fidl::Error>;
7708
7709    fn poll_next(
7710        mut self: std::pin::Pin<&mut Self>,
7711        cx: &mut std::task::Context<'_>,
7712    ) -> std::task::Poll<Option<Self::Item>> {
7713        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7714            &mut self.event_receiver,
7715            cx
7716        )?) {
7717            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7718            None => std::task::Poll::Ready(None),
7719        }
7720    }
7721}
7722
7723#[derive(Debug)]
7724pub enum RootJobEvent {}
7725
7726impl RootJobEvent {
7727    /// Decodes a message buffer as a [`RootJobEvent`].
7728    fn decode(
7729        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7730    ) -> Result<RootJobEvent, fidl::Error> {
7731        let (bytes, _handles) = buf.split_mut();
7732        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7733        debug_assert_eq!(tx_header.tx_id, 0);
7734        match tx_header.ordinal {
7735            _ => Err(fidl::Error::UnknownOrdinal {
7736                ordinal: tx_header.ordinal,
7737                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7738            }),
7739        }
7740    }
7741}
7742
7743/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7744pub struct RootJobRequestStream {
7745    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7746    is_terminated: bool,
7747}
7748
7749impl std::marker::Unpin for RootJobRequestStream {}
7750
7751impl futures::stream::FusedStream for RootJobRequestStream {
7752    fn is_terminated(&self) -> bool {
7753        self.is_terminated
7754    }
7755}
7756
7757impl fidl::endpoints::RequestStream for RootJobRequestStream {
7758    type Protocol = RootJobMarker;
7759    type ControlHandle = RootJobControlHandle;
7760
7761    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7762        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7763    }
7764
7765    fn control_handle(&self) -> Self::ControlHandle {
7766        RootJobControlHandle { inner: self.inner.clone() }
7767    }
7768
7769    fn into_inner(
7770        self,
7771    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7772    {
7773        (self.inner, self.is_terminated)
7774    }
7775
7776    fn from_inner(
7777        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7778        is_terminated: bool,
7779    ) -> Self {
7780        Self { inner, is_terminated }
7781    }
7782}
7783
7784impl futures::Stream for RootJobRequestStream {
7785    type Item = Result<RootJobRequest, fidl::Error>;
7786
7787    fn poll_next(
7788        mut self: std::pin::Pin<&mut Self>,
7789        cx: &mut std::task::Context<'_>,
7790    ) -> std::task::Poll<Option<Self::Item>> {
7791        let this = &mut *self;
7792        if this.inner.check_shutdown(cx) {
7793            this.is_terminated = true;
7794            return std::task::Poll::Ready(None);
7795        }
7796        if this.is_terminated {
7797            panic!("polled RootJobRequestStream after completion");
7798        }
7799        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7800            |bytes, handles| {
7801                match this.inner.channel().read_etc(cx, bytes, handles) {
7802                    std::task::Poll::Ready(Ok(())) => {}
7803                    std::task::Poll::Pending => return std::task::Poll::Pending,
7804                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7805                        this.is_terminated = true;
7806                        return std::task::Poll::Ready(None);
7807                    }
7808                    std::task::Poll::Ready(Err(e)) => {
7809                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7810                            e.into(),
7811                        ))));
7812                    }
7813                }
7814
7815                // A message has been received from the channel
7816                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7817
7818                std::task::Poll::Ready(Some(match header.ordinal {
7819                    0x73acb63f93d53eac => {
7820                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7821                        let mut req = fidl::new_empty!(
7822                            fidl::encoding::EmptyPayload,
7823                            fidl::encoding::DefaultFuchsiaResourceDialect
7824                        );
7825                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7826                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7827                        Ok(RootJobRequest::Get {
7828                            responder: RootJobGetResponder {
7829                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7830                                tx_id: header.tx_id,
7831                            },
7832                        })
7833                    }
7834                    _ => Err(fidl::Error::UnknownOrdinal {
7835                        ordinal: header.ordinal,
7836                        protocol_name:
7837                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7838                    }),
7839                }))
7840            },
7841        )
7842    }
7843}
7844
7845/// Protocol for providing the root job.
7846///
7847/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7848#[derive(Debug)]
7849pub enum RootJobRequest {
7850    /// Get the root `job`.
7851    Get { responder: RootJobGetResponder },
7852}
7853
7854impl RootJobRequest {
7855    #[allow(irrefutable_let_patterns)]
7856    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7857        if let RootJobRequest::Get { responder } = self { Some((responder)) } else { None }
7858    }
7859
7860    /// Name of the method defined in FIDL
7861    pub fn method_name(&self) -> &'static str {
7862        match *self {
7863            RootJobRequest::Get { .. } => "get",
7864        }
7865    }
7866}
7867
7868#[derive(Debug, Clone)]
7869pub struct RootJobControlHandle {
7870    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7871}
7872
7873impl fidl::endpoints::ControlHandle for RootJobControlHandle {
7874    fn shutdown(&self) {
7875        self.inner.shutdown()
7876    }
7877
7878    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7879        self.inner.shutdown_with_epitaph(status)
7880    }
7881
7882    fn is_closed(&self) -> bool {
7883        self.inner.channel().is_closed()
7884    }
7885    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7886        self.inner.channel().on_closed()
7887    }
7888
7889    #[cfg(target_os = "fuchsia")]
7890    fn signal_peer(
7891        &self,
7892        clear_mask: zx::Signals,
7893        set_mask: zx::Signals,
7894    ) -> Result<(), zx_status::Status> {
7895        use fidl::Peered;
7896        self.inner.channel().signal_peer(clear_mask, set_mask)
7897    }
7898}
7899
7900impl RootJobControlHandle {}
7901
7902#[must_use = "FIDL methods require a response to be sent"]
7903#[derive(Debug)]
7904pub struct RootJobGetResponder {
7905    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
7906    tx_id: u32,
7907}
7908
7909/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
7910/// if the responder is dropped without sending a response, so that the client
7911/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7912impl std::ops::Drop for RootJobGetResponder {
7913    fn drop(&mut self) {
7914        self.control_handle.shutdown();
7915        // Safety: drops once, never accessed again
7916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7917    }
7918}
7919
7920impl fidl::endpoints::Responder for RootJobGetResponder {
7921    type ControlHandle = RootJobControlHandle;
7922
7923    fn control_handle(&self) -> &RootJobControlHandle {
7924        &self.control_handle
7925    }
7926
7927    fn drop_without_shutdown(mut self) {
7928        // Safety: drops once, never accessed again due to mem::forget
7929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7930        // Prevent Drop from running (which would shut down the channel)
7931        std::mem::forget(self);
7932    }
7933}
7934
7935impl RootJobGetResponder {
7936    /// Sends a response to the FIDL transaction.
7937    ///
7938    /// Sets the channel to shutdown if an error occurs.
7939    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7940        let _result = self.send_raw(job);
7941        if _result.is_err() {
7942            self.control_handle.shutdown();
7943        }
7944        self.drop_without_shutdown();
7945        _result
7946    }
7947
7948    /// Similar to "send" but does not shutdown the channel if an error occurs.
7949    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7950        let _result = self.send_raw(job);
7951        self.drop_without_shutdown();
7952        _result
7953    }
7954
7955    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7956        self.control_handle.inner.send::<RootJobGetResponse>(
7957            (job,),
7958            self.tx_id,
7959            0x73acb63f93d53eac,
7960            fidl::encoding::DynamicFlags::empty(),
7961        )
7962    }
7963}
7964
7965#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7966pub struct RootJobForInspectMarker;
7967
7968impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
7969    type Proxy = RootJobForInspectProxy;
7970    type RequestStream = RootJobForInspectRequestStream;
7971    #[cfg(target_os = "fuchsia")]
7972    type SynchronousProxy = RootJobForInspectSynchronousProxy;
7973
7974    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
7975}
7976impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
7977
7978pub trait RootJobForInspectProxyInterface: Send + Sync {
7979    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7980    fn r#get(&self) -> Self::GetResponseFut;
7981}
7982#[derive(Debug)]
7983#[cfg(target_os = "fuchsia")]
7984pub struct RootJobForInspectSynchronousProxy {
7985    client: fidl::client::sync::Client,
7986}
7987
7988#[cfg(target_os = "fuchsia")]
7989impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
7990    type Proxy = RootJobForInspectProxy;
7991    type Protocol = RootJobForInspectMarker;
7992
7993    fn from_channel(inner: fidl::Channel) -> Self {
7994        Self::new(inner)
7995    }
7996
7997    fn into_channel(self) -> fidl::Channel {
7998        self.client.into_channel()
7999    }
8000
8001    fn as_channel(&self) -> &fidl::Channel {
8002        self.client.as_channel()
8003    }
8004}
8005
8006#[cfg(target_os = "fuchsia")]
8007impl RootJobForInspectSynchronousProxy {
8008    pub fn new(channel: fidl::Channel) -> Self {
8009        let protocol_name =
8010            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8011        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8012    }
8013
8014    pub fn into_channel(self) -> fidl::Channel {
8015        self.client.into_channel()
8016    }
8017
8018    /// Waits until an event arrives and returns it. It is safe for other
8019    /// threads to make concurrent requests while waiting for an event.
8020    pub fn wait_for_event(
8021        &self,
8022        deadline: zx::MonotonicInstant,
8023    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8024        RootJobForInspectEvent::decode(self.client.wait_for_event(deadline)?)
8025    }
8026
8027    /// Get the root `job`.
8028    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
8029        let _response =
8030            self.client.send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse>(
8031                (),
8032                0x73acb63f93d53eac,
8033                fidl::encoding::DynamicFlags::empty(),
8034                ___deadline,
8035            )?;
8036        Ok(_response.job)
8037    }
8038}
8039
8040#[cfg(target_os = "fuchsia")]
8041impl From<RootJobForInspectSynchronousProxy> for zx::NullableHandle {
8042    fn from(value: RootJobForInspectSynchronousProxy) -> Self {
8043        value.into_channel().into()
8044    }
8045}
8046
8047#[cfg(target_os = "fuchsia")]
8048impl From<fidl::Channel> for RootJobForInspectSynchronousProxy {
8049    fn from(value: fidl::Channel) -> Self {
8050        Self::new(value)
8051    }
8052}
8053
8054#[cfg(target_os = "fuchsia")]
8055impl fidl::endpoints::FromClient for RootJobForInspectSynchronousProxy {
8056    type Protocol = RootJobForInspectMarker;
8057
8058    fn from_client(value: fidl::endpoints::ClientEnd<RootJobForInspectMarker>) -> Self {
8059        Self::new(value.into_channel())
8060    }
8061}
8062
8063#[derive(Debug, Clone)]
8064pub struct RootJobForInspectProxy {
8065    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8066}
8067
8068impl fidl::endpoints::Proxy for RootJobForInspectProxy {
8069    type Protocol = RootJobForInspectMarker;
8070
8071    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8072        Self::new(inner)
8073    }
8074
8075    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8076        self.client.into_channel().map_err(|client| Self { client })
8077    }
8078
8079    fn as_channel(&self) -> &::fidl::AsyncChannel {
8080        self.client.as_channel()
8081    }
8082}
8083
8084impl RootJobForInspectProxy {
8085    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
8086    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8087        let protocol_name =
8088            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8089        Self { client: fidl::client::Client::new(channel, protocol_name) }
8090    }
8091
8092    /// Get a Stream of events from the remote end of the protocol.
8093    ///
8094    /// # Panics
8095    ///
8096    /// Panics if the event stream was already taken.
8097    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
8098        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
8099    }
8100
8101    /// Get the root `job`.
8102    pub fn r#get(
8103        &self,
8104    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
8105    {
8106        RootJobForInspectProxyInterface::r#get(self)
8107    }
8108}
8109
8110impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
8111    type GetResponseFut =
8112        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
8113    fn r#get(&self) -> Self::GetResponseFut {
8114        fn _decode(
8115            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8116        ) -> Result<fidl::Job, fidl::Error> {
8117            let _response = fidl::client::decode_transaction_body::<
8118                RootJobGetResponse,
8119                fidl::encoding::DefaultFuchsiaResourceDialect,
8120                0x73acb63f93d53eac,
8121            >(_buf?)?;
8122            Ok(_response.job)
8123        }
8124        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
8125            (),
8126            0x73acb63f93d53eac,
8127            fidl::encoding::DynamicFlags::empty(),
8128            _decode,
8129        )
8130    }
8131}
8132
8133pub struct RootJobForInspectEventStream {
8134    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8135}
8136
8137impl std::marker::Unpin for RootJobForInspectEventStream {}
8138
8139impl futures::stream::FusedStream for RootJobForInspectEventStream {
8140    fn is_terminated(&self) -> bool {
8141        self.event_receiver.is_terminated()
8142    }
8143}
8144
8145impl futures::Stream for RootJobForInspectEventStream {
8146    type Item = Result<RootJobForInspectEvent, fidl::Error>;
8147
8148    fn poll_next(
8149        mut self: std::pin::Pin<&mut Self>,
8150        cx: &mut std::task::Context<'_>,
8151    ) -> std::task::Poll<Option<Self::Item>> {
8152        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8153            &mut self.event_receiver,
8154            cx
8155        )?) {
8156            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
8157            None => std::task::Poll::Ready(None),
8158        }
8159    }
8160}
8161
8162#[derive(Debug)]
8163pub enum RootJobForInspectEvent {}
8164
8165impl RootJobForInspectEvent {
8166    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
8167    fn decode(
8168        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8169    ) -> Result<RootJobForInspectEvent, fidl::Error> {
8170        let (bytes, _handles) = buf.split_mut();
8171        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8172        debug_assert_eq!(tx_header.tx_id, 0);
8173        match tx_header.ordinal {
8174            _ => Err(fidl::Error::UnknownOrdinal {
8175                ordinal: tx_header.ordinal,
8176                protocol_name:
8177                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8178            }),
8179        }
8180    }
8181}
8182
8183/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
8184pub struct RootJobForInspectRequestStream {
8185    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8186    is_terminated: bool,
8187}
8188
8189impl std::marker::Unpin for RootJobForInspectRequestStream {}
8190
8191impl futures::stream::FusedStream for RootJobForInspectRequestStream {
8192    fn is_terminated(&self) -> bool {
8193        self.is_terminated
8194    }
8195}
8196
8197impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
8198    type Protocol = RootJobForInspectMarker;
8199    type ControlHandle = RootJobForInspectControlHandle;
8200
8201    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8202        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8203    }
8204
8205    fn control_handle(&self) -> Self::ControlHandle {
8206        RootJobForInspectControlHandle { inner: self.inner.clone() }
8207    }
8208
8209    fn into_inner(
8210        self,
8211    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8212    {
8213        (self.inner, self.is_terminated)
8214    }
8215
8216    fn from_inner(
8217        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8218        is_terminated: bool,
8219    ) -> Self {
8220        Self { inner, is_terminated }
8221    }
8222}
8223
8224impl futures::Stream for RootJobForInspectRequestStream {
8225    type Item = Result<RootJobForInspectRequest, fidl::Error>;
8226
8227    fn poll_next(
8228        mut self: std::pin::Pin<&mut Self>,
8229        cx: &mut std::task::Context<'_>,
8230    ) -> std::task::Poll<Option<Self::Item>> {
8231        let this = &mut *self;
8232        if this.inner.check_shutdown(cx) {
8233            this.is_terminated = true;
8234            return std::task::Poll::Ready(None);
8235        }
8236        if this.is_terminated {
8237            panic!("polled RootJobForInspectRequestStream after completion");
8238        }
8239        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8240            |bytes, handles| {
8241                match this.inner.channel().read_etc(cx, bytes, handles) {
8242                    std::task::Poll::Ready(Ok(())) => {}
8243                    std::task::Poll::Pending => return std::task::Poll::Pending,
8244                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8245                        this.is_terminated = true;
8246                        return std::task::Poll::Ready(None);
8247                    }
8248                    std::task::Poll::Ready(Err(e)) => {
8249                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8250                            e.into(),
8251                        ))));
8252                    }
8253                }
8254
8255                // A message has been received from the channel
8256                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8257
8258                std::task::Poll::Ready(Some(match header.ordinal {
8259                    0x73acb63f93d53eac => {
8260                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8261                        let mut req = fidl::new_empty!(
8262                            fidl::encoding::EmptyPayload,
8263                            fidl::encoding::DefaultFuchsiaResourceDialect
8264                        );
8265                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8266                        let control_handle =
8267                            RootJobForInspectControlHandle { inner: this.inner.clone() };
8268                        Ok(RootJobForInspectRequest::Get {
8269                            responder: RootJobForInspectGetResponder {
8270                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8271                                tx_id: header.tx_id,
8272                            },
8273                        })
8274                    }
8275                    _ => Err(fidl::Error::UnknownOrdinal {
8276                        ordinal: header.ordinal,
8277                        protocol_name:
8278                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8279                    }),
8280                }))
8281            },
8282        )
8283    }
8284}
8285
8286/// Protocol for providing the root job with restricted rights, specifically:
8287/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
8288#[derive(Debug)]
8289pub enum RootJobForInspectRequest {
8290    /// Get the root `job`.
8291    Get { responder: RootJobForInspectGetResponder },
8292}
8293
8294impl RootJobForInspectRequest {
8295    #[allow(irrefutable_let_patterns)]
8296    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
8297        if let RootJobForInspectRequest::Get { responder } = self {
8298            Some((responder))
8299        } else {
8300            None
8301        }
8302    }
8303
8304    /// Name of the method defined in FIDL
8305    pub fn method_name(&self) -> &'static str {
8306        match *self {
8307            RootJobForInspectRequest::Get { .. } => "get",
8308        }
8309    }
8310}
8311
8312#[derive(Debug, Clone)]
8313pub struct RootJobForInspectControlHandle {
8314    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8315}
8316
8317impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
8318    fn shutdown(&self) {
8319        self.inner.shutdown()
8320    }
8321
8322    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8323        self.inner.shutdown_with_epitaph(status)
8324    }
8325
8326    fn is_closed(&self) -> bool {
8327        self.inner.channel().is_closed()
8328    }
8329    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8330        self.inner.channel().on_closed()
8331    }
8332
8333    #[cfg(target_os = "fuchsia")]
8334    fn signal_peer(
8335        &self,
8336        clear_mask: zx::Signals,
8337        set_mask: zx::Signals,
8338    ) -> Result<(), zx_status::Status> {
8339        use fidl::Peered;
8340        self.inner.channel().signal_peer(clear_mask, set_mask)
8341    }
8342}
8343
8344impl RootJobForInspectControlHandle {}
8345
8346#[must_use = "FIDL methods require a response to be sent"]
8347#[derive(Debug)]
8348pub struct RootJobForInspectGetResponder {
8349    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
8350    tx_id: u32,
8351}
8352
8353/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
8354/// if the responder is dropped without sending a response, so that the client
8355/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8356impl std::ops::Drop for RootJobForInspectGetResponder {
8357    fn drop(&mut self) {
8358        self.control_handle.shutdown();
8359        // Safety: drops once, never accessed again
8360        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8361    }
8362}
8363
8364impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
8365    type ControlHandle = RootJobForInspectControlHandle;
8366
8367    fn control_handle(&self) -> &RootJobForInspectControlHandle {
8368        &self.control_handle
8369    }
8370
8371    fn drop_without_shutdown(mut self) {
8372        // Safety: drops once, never accessed again due to mem::forget
8373        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8374        // Prevent Drop from running (which would shut down the channel)
8375        std::mem::forget(self);
8376    }
8377}
8378
8379impl RootJobForInspectGetResponder {
8380    /// Sends a response to the FIDL transaction.
8381    ///
8382    /// Sets the channel to shutdown if an error occurs.
8383    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8384        let _result = self.send_raw(job);
8385        if _result.is_err() {
8386            self.control_handle.shutdown();
8387        }
8388        self.drop_without_shutdown();
8389        _result
8390    }
8391
8392    /// Similar to "send" but does not shutdown the channel if an error occurs.
8393    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8394        let _result = self.send_raw(job);
8395        self.drop_without_shutdown();
8396        _result
8397    }
8398
8399    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8400        self.control_handle.inner.send::<RootJobGetResponse>(
8401            (job,),
8402            self.tx_id,
8403            0x73acb63f93d53eac,
8404            fidl::encoding::DynamicFlags::empty(),
8405        )
8406    }
8407}
8408
8409#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8410pub struct SamplingResourceMarker;
8411
8412impl fidl::endpoints::ProtocolMarker for SamplingResourceMarker {
8413    type Proxy = SamplingResourceProxy;
8414    type RequestStream = SamplingResourceRequestStream;
8415    #[cfg(target_os = "fuchsia")]
8416    type SynchronousProxy = SamplingResourceSynchronousProxy;
8417
8418    const DEBUG_NAME: &'static str = "fuchsia.kernel.SamplingResource";
8419}
8420impl fidl::endpoints::DiscoverableProtocolMarker for SamplingResourceMarker {}
8421
8422pub trait SamplingResourceProxyInterface: Send + Sync {
8423    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8424    fn r#get(&self) -> Self::GetResponseFut;
8425}
8426#[derive(Debug)]
8427#[cfg(target_os = "fuchsia")]
8428pub struct SamplingResourceSynchronousProxy {
8429    client: fidl::client::sync::Client,
8430}
8431
8432#[cfg(target_os = "fuchsia")]
8433impl fidl::endpoints::SynchronousProxy for SamplingResourceSynchronousProxy {
8434    type Proxy = SamplingResourceProxy;
8435    type Protocol = SamplingResourceMarker;
8436
8437    fn from_channel(inner: fidl::Channel) -> Self {
8438        Self::new(inner)
8439    }
8440
8441    fn into_channel(self) -> fidl::Channel {
8442        self.client.into_channel()
8443    }
8444
8445    fn as_channel(&self) -> &fidl::Channel {
8446        self.client.as_channel()
8447    }
8448}
8449
8450#[cfg(target_os = "fuchsia")]
8451impl SamplingResourceSynchronousProxy {
8452    pub fn new(channel: fidl::Channel) -> Self {
8453        let protocol_name = <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8454        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8455    }
8456
8457    pub fn into_channel(self) -> fidl::Channel {
8458        self.client.into_channel()
8459    }
8460
8461    /// Waits until an event arrives and returns it. It is safe for other
8462    /// threads to make concurrent requests while waiting for an event.
8463    pub fn wait_for_event(
8464        &self,
8465        deadline: zx::MonotonicInstant,
8466    ) -> Result<SamplingResourceEvent, fidl::Error> {
8467        SamplingResourceEvent::decode(self.client.wait_for_event(deadline)?)
8468    }
8469
8470    /// Get a sampling resource handle.
8471    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8472        let _response =
8473            self.client.send_query::<fidl::encoding::EmptyPayload, SamplingResourceGetResponse>(
8474                (),
8475                0x51c41ab037e99824,
8476                fidl::encoding::DynamicFlags::empty(),
8477                ___deadline,
8478            )?;
8479        Ok(_response.resource)
8480    }
8481}
8482
8483#[cfg(target_os = "fuchsia")]
8484impl From<SamplingResourceSynchronousProxy> for zx::NullableHandle {
8485    fn from(value: SamplingResourceSynchronousProxy) -> Self {
8486        value.into_channel().into()
8487    }
8488}
8489
8490#[cfg(target_os = "fuchsia")]
8491impl From<fidl::Channel> for SamplingResourceSynchronousProxy {
8492    fn from(value: fidl::Channel) -> Self {
8493        Self::new(value)
8494    }
8495}
8496
8497#[cfg(target_os = "fuchsia")]
8498impl fidl::endpoints::FromClient for SamplingResourceSynchronousProxy {
8499    type Protocol = SamplingResourceMarker;
8500
8501    fn from_client(value: fidl::endpoints::ClientEnd<SamplingResourceMarker>) -> Self {
8502        Self::new(value.into_channel())
8503    }
8504}
8505
8506#[derive(Debug, Clone)]
8507pub struct SamplingResourceProxy {
8508    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8509}
8510
8511impl fidl::endpoints::Proxy for SamplingResourceProxy {
8512    type Protocol = SamplingResourceMarker;
8513
8514    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8515        Self::new(inner)
8516    }
8517
8518    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8519        self.client.into_channel().map_err(|client| Self { client })
8520    }
8521
8522    fn as_channel(&self) -> &::fidl::AsyncChannel {
8523        self.client.as_channel()
8524    }
8525}
8526
8527impl SamplingResourceProxy {
8528    /// Create a new Proxy for fuchsia.kernel/SamplingResource.
8529    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8530        let protocol_name = <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8531        Self { client: fidl::client::Client::new(channel, protocol_name) }
8532    }
8533
8534    /// Get a Stream of events from the remote end of the protocol.
8535    ///
8536    /// # Panics
8537    ///
8538    /// Panics if the event stream was already taken.
8539    pub fn take_event_stream(&self) -> SamplingResourceEventStream {
8540        SamplingResourceEventStream { event_receiver: self.client.take_event_receiver() }
8541    }
8542
8543    /// Get a sampling resource handle.
8544    pub fn r#get(
8545        &self,
8546    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8547    {
8548        SamplingResourceProxyInterface::r#get(self)
8549    }
8550}
8551
8552impl SamplingResourceProxyInterface for SamplingResourceProxy {
8553    type GetResponseFut = fidl::client::QueryResponseFut<
8554        fidl::Resource,
8555        fidl::encoding::DefaultFuchsiaResourceDialect,
8556    >;
8557    fn r#get(&self) -> Self::GetResponseFut {
8558        fn _decode(
8559            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8560        ) -> Result<fidl::Resource, fidl::Error> {
8561            let _response = fidl::client::decode_transaction_body::<
8562                SamplingResourceGetResponse,
8563                fidl::encoding::DefaultFuchsiaResourceDialect,
8564                0x51c41ab037e99824,
8565            >(_buf?)?;
8566            Ok(_response.resource)
8567        }
8568        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8569            (),
8570            0x51c41ab037e99824,
8571            fidl::encoding::DynamicFlags::empty(),
8572            _decode,
8573        )
8574    }
8575}
8576
8577pub struct SamplingResourceEventStream {
8578    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8579}
8580
8581impl std::marker::Unpin for SamplingResourceEventStream {}
8582
8583impl futures::stream::FusedStream for SamplingResourceEventStream {
8584    fn is_terminated(&self) -> bool {
8585        self.event_receiver.is_terminated()
8586    }
8587}
8588
8589impl futures::Stream for SamplingResourceEventStream {
8590    type Item = Result<SamplingResourceEvent, fidl::Error>;
8591
8592    fn poll_next(
8593        mut self: std::pin::Pin<&mut Self>,
8594        cx: &mut std::task::Context<'_>,
8595    ) -> std::task::Poll<Option<Self::Item>> {
8596        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8597            &mut self.event_receiver,
8598            cx
8599        )?) {
8600            Some(buf) => std::task::Poll::Ready(Some(SamplingResourceEvent::decode(buf))),
8601            None => std::task::Poll::Ready(None),
8602        }
8603    }
8604}
8605
8606#[derive(Debug)]
8607pub enum SamplingResourceEvent {}
8608
8609impl SamplingResourceEvent {
8610    /// Decodes a message buffer as a [`SamplingResourceEvent`].
8611    fn decode(
8612        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8613    ) -> Result<SamplingResourceEvent, fidl::Error> {
8614        let (bytes, _handles) = buf.split_mut();
8615        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8616        debug_assert_eq!(tx_header.tx_id, 0);
8617        match tx_header.ordinal {
8618            _ => Err(fidl::Error::UnknownOrdinal {
8619                ordinal: tx_header.ordinal,
8620                protocol_name:
8621                    <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8622            }),
8623        }
8624    }
8625}
8626
8627/// A Stream of incoming requests for fuchsia.kernel/SamplingResource.
8628pub struct SamplingResourceRequestStream {
8629    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8630    is_terminated: bool,
8631}
8632
8633impl std::marker::Unpin for SamplingResourceRequestStream {}
8634
8635impl futures::stream::FusedStream for SamplingResourceRequestStream {
8636    fn is_terminated(&self) -> bool {
8637        self.is_terminated
8638    }
8639}
8640
8641impl fidl::endpoints::RequestStream for SamplingResourceRequestStream {
8642    type Protocol = SamplingResourceMarker;
8643    type ControlHandle = SamplingResourceControlHandle;
8644
8645    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8646        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8647    }
8648
8649    fn control_handle(&self) -> Self::ControlHandle {
8650        SamplingResourceControlHandle { inner: self.inner.clone() }
8651    }
8652
8653    fn into_inner(
8654        self,
8655    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8656    {
8657        (self.inner, self.is_terminated)
8658    }
8659
8660    fn from_inner(
8661        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8662        is_terminated: bool,
8663    ) -> Self {
8664        Self { inner, is_terminated }
8665    }
8666}
8667
8668impl futures::Stream for SamplingResourceRequestStream {
8669    type Item = Result<SamplingResourceRequest, fidl::Error>;
8670
8671    fn poll_next(
8672        mut self: std::pin::Pin<&mut Self>,
8673        cx: &mut std::task::Context<'_>,
8674    ) -> std::task::Poll<Option<Self::Item>> {
8675        let this = &mut *self;
8676        if this.inner.check_shutdown(cx) {
8677            this.is_terminated = true;
8678            return std::task::Poll::Ready(None);
8679        }
8680        if this.is_terminated {
8681            panic!("polled SamplingResourceRequestStream after completion");
8682        }
8683        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8684            |bytes, handles| {
8685                match this.inner.channel().read_etc(cx, bytes, handles) {
8686                    std::task::Poll::Ready(Ok(())) => {}
8687                    std::task::Poll::Pending => return std::task::Poll::Pending,
8688                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8689                        this.is_terminated = true;
8690                        return std::task::Poll::Ready(None);
8691                    }
8692                    std::task::Poll::Ready(Err(e)) => {
8693                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8694                            e.into(),
8695                        ))));
8696                    }
8697                }
8698
8699                // A message has been received from the channel
8700                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8701
8702                std::task::Poll::Ready(Some(match header.ordinal {
8703                    0x51c41ab037e99824 => {
8704                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8705                        let mut req = fidl::new_empty!(
8706                            fidl::encoding::EmptyPayload,
8707                            fidl::encoding::DefaultFuchsiaResourceDialect
8708                        );
8709                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8710                        let control_handle =
8711                            SamplingResourceControlHandle { inner: this.inner.clone() };
8712                        Ok(SamplingResourceRequest::Get {
8713                            responder: SamplingResourceGetResponder {
8714                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8715                                tx_id: header.tx_id,
8716                            },
8717                        })
8718                    }
8719                    _ => Err(fidl::Error::UnknownOrdinal {
8720                        ordinal: header.ordinal,
8721                        protocol_name:
8722                            <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8723                    }),
8724                }))
8725            },
8726        )
8727    }
8728}
8729
8730/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
8731/// `ZX_RSRC_SYSTEM_SAMPLING_BASE`.
8732#[derive(Debug)]
8733pub enum SamplingResourceRequest {
8734    /// Get a sampling resource handle.
8735    Get { responder: SamplingResourceGetResponder },
8736}
8737
8738impl SamplingResourceRequest {
8739    #[allow(irrefutable_let_patterns)]
8740    pub fn into_get(self) -> Option<(SamplingResourceGetResponder)> {
8741        if let SamplingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
8742    }
8743
8744    /// Name of the method defined in FIDL
8745    pub fn method_name(&self) -> &'static str {
8746        match *self {
8747            SamplingResourceRequest::Get { .. } => "get",
8748        }
8749    }
8750}
8751
8752#[derive(Debug, Clone)]
8753pub struct SamplingResourceControlHandle {
8754    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8755}
8756
8757impl fidl::endpoints::ControlHandle for SamplingResourceControlHandle {
8758    fn shutdown(&self) {
8759        self.inner.shutdown()
8760    }
8761
8762    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8763        self.inner.shutdown_with_epitaph(status)
8764    }
8765
8766    fn is_closed(&self) -> bool {
8767        self.inner.channel().is_closed()
8768    }
8769    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8770        self.inner.channel().on_closed()
8771    }
8772
8773    #[cfg(target_os = "fuchsia")]
8774    fn signal_peer(
8775        &self,
8776        clear_mask: zx::Signals,
8777        set_mask: zx::Signals,
8778    ) -> Result<(), zx_status::Status> {
8779        use fidl::Peered;
8780        self.inner.channel().signal_peer(clear_mask, set_mask)
8781    }
8782}
8783
8784impl SamplingResourceControlHandle {}
8785
8786#[must_use = "FIDL methods require a response to be sent"]
8787#[derive(Debug)]
8788pub struct SamplingResourceGetResponder {
8789    control_handle: std::mem::ManuallyDrop<SamplingResourceControlHandle>,
8790    tx_id: u32,
8791}
8792
8793/// Set the the channel to be shutdown (see [`SamplingResourceControlHandle::shutdown`])
8794/// if the responder is dropped without sending a response, so that the client
8795/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8796impl std::ops::Drop for SamplingResourceGetResponder {
8797    fn drop(&mut self) {
8798        self.control_handle.shutdown();
8799        // Safety: drops once, never accessed again
8800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8801    }
8802}
8803
8804impl fidl::endpoints::Responder for SamplingResourceGetResponder {
8805    type ControlHandle = SamplingResourceControlHandle;
8806
8807    fn control_handle(&self) -> &SamplingResourceControlHandle {
8808        &self.control_handle
8809    }
8810
8811    fn drop_without_shutdown(mut self) {
8812        // Safety: drops once, never accessed again due to mem::forget
8813        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8814        // Prevent Drop from running (which would shut down the channel)
8815        std::mem::forget(self);
8816    }
8817}
8818
8819impl SamplingResourceGetResponder {
8820    /// Sends a response to the FIDL transaction.
8821    ///
8822    /// Sets the channel to shutdown if an error occurs.
8823    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8824        let _result = self.send_raw(resource);
8825        if _result.is_err() {
8826            self.control_handle.shutdown();
8827        }
8828        self.drop_without_shutdown();
8829        _result
8830    }
8831
8832    /// Similar to "send" but does not shutdown the channel if an error occurs.
8833    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8834        let _result = self.send_raw(resource);
8835        self.drop_without_shutdown();
8836        _result
8837    }
8838
8839    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8840        self.control_handle.inner.send::<SamplingResourceGetResponse>(
8841            (resource,),
8842            self.tx_id,
8843            0x51c41ab037e99824,
8844            fidl::encoding::DynamicFlags::empty(),
8845        )
8846    }
8847}
8848
8849#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8850pub struct SmcResourceMarker;
8851
8852impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
8853    type Proxy = SmcResourceProxy;
8854    type RequestStream = SmcResourceRequestStream;
8855    #[cfg(target_os = "fuchsia")]
8856    type SynchronousProxy = SmcResourceSynchronousProxy;
8857
8858    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
8859}
8860impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
8861
8862pub trait SmcResourceProxyInterface: Send + Sync {
8863    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8864    fn r#get(&self) -> Self::GetResponseFut;
8865}
8866#[derive(Debug)]
8867#[cfg(target_os = "fuchsia")]
8868pub struct SmcResourceSynchronousProxy {
8869    client: fidl::client::sync::Client,
8870}
8871
8872#[cfg(target_os = "fuchsia")]
8873impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
8874    type Proxy = SmcResourceProxy;
8875    type Protocol = SmcResourceMarker;
8876
8877    fn from_channel(inner: fidl::Channel) -> Self {
8878        Self::new(inner)
8879    }
8880
8881    fn into_channel(self) -> fidl::Channel {
8882        self.client.into_channel()
8883    }
8884
8885    fn as_channel(&self) -> &fidl::Channel {
8886        self.client.as_channel()
8887    }
8888}
8889
8890#[cfg(target_os = "fuchsia")]
8891impl SmcResourceSynchronousProxy {
8892    pub fn new(channel: fidl::Channel) -> Self {
8893        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8894        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8895    }
8896
8897    pub fn into_channel(self) -> fidl::Channel {
8898        self.client.into_channel()
8899    }
8900
8901    /// Waits until an event arrives and returns it. It is safe for other
8902    /// threads to make concurrent requests while waiting for an event.
8903    pub fn wait_for_event(
8904        &self,
8905        deadline: zx::MonotonicInstant,
8906    ) -> Result<SmcResourceEvent, fidl::Error> {
8907        SmcResourceEvent::decode(self.client.wait_for_event(deadline)?)
8908    }
8909
8910    /// Get an SMC resource handle.
8911    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8912        let _response =
8913            self.client.send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse>(
8914                (),
8915                0x392cbd495b84ede7,
8916                fidl::encoding::DynamicFlags::empty(),
8917                ___deadline,
8918            )?;
8919        Ok(_response.resource)
8920    }
8921}
8922
8923#[cfg(target_os = "fuchsia")]
8924impl From<SmcResourceSynchronousProxy> for zx::NullableHandle {
8925    fn from(value: SmcResourceSynchronousProxy) -> Self {
8926        value.into_channel().into()
8927    }
8928}
8929
8930#[cfg(target_os = "fuchsia")]
8931impl From<fidl::Channel> for SmcResourceSynchronousProxy {
8932    fn from(value: fidl::Channel) -> Self {
8933        Self::new(value)
8934    }
8935}
8936
8937#[cfg(target_os = "fuchsia")]
8938impl fidl::endpoints::FromClient for SmcResourceSynchronousProxy {
8939    type Protocol = SmcResourceMarker;
8940
8941    fn from_client(value: fidl::endpoints::ClientEnd<SmcResourceMarker>) -> Self {
8942        Self::new(value.into_channel())
8943    }
8944}
8945
8946#[derive(Debug, Clone)]
8947pub struct SmcResourceProxy {
8948    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8949}
8950
8951impl fidl::endpoints::Proxy for SmcResourceProxy {
8952    type Protocol = SmcResourceMarker;
8953
8954    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8955        Self::new(inner)
8956    }
8957
8958    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8959        self.client.into_channel().map_err(|client| Self { client })
8960    }
8961
8962    fn as_channel(&self) -> &::fidl::AsyncChannel {
8963        self.client.as_channel()
8964    }
8965}
8966
8967impl SmcResourceProxy {
8968    /// Create a new Proxy for fuchsia.kernel/SmcResource.
8969    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8970        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8971        Self { client: fidl::client::Client::new(channel, protocol_name) }
8972    }
8973
8974    /// Get a Stream of events from the remote end of the protocol.
8975    ///
8976    /// # Panics
8977    ///
8978    /// Panics if the event stream was already taken.
8979    pub fn take_event_stream(&self) -> SmcResourceEventStream {
8980        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
8981    }
8982
8983    /// Get an SMC resource handle.
8984    pub fn r#get(
8985        &self,
8986    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8987    {
8988        SmcResourceProxyInterface::r#get(self)
8989    }
8990}
8991
8992impl SmcResourceProxyInterface for SmcResourceProxy {
8993    type GetResponseFut = fidl::client::QueryResponseFut<
8994        fidl::Resource,
8995        fidl::encoding::DefaultFuchsiaResourceDialect,
8996    >;
8997    fn r#get(&self) -> Self::GetResponseFut {
8998        fn _decode(
8999            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9000        ) -> Result<fidl::Resource, fidl::Error> {
9001            let _response = fidl::client::decode_transaction_body::<
9002                SmcResourceGetResponse,
9003                fidl::encoding::DefaultFuchsiaResourceDialect,
9004                0x392cbd495b84ede7,
9005            >(_buf?)?;
9006            Ok(_response.resource)
9007        }
9008        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9009            (),
9010            0x392cbd495b84ede7,
9011            fidl::encoding::DynamicFlags::empty(),
9012            _decode,
9013        )
9014    }
9015}
9016
9017pub struct SmcResourceEventStream {
9018    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9019}
9020
9021impl std::marker::Unpin for SmcResourceEventStream {}
9022
9023impl futures::stream::FusedStream for SmcResourceEventStream {
9024    fn is_terminated(&self) -> bool {
9025        self.event_receiver.is_terminated()
9026    }
9027}
9028
9029impl futures::Stream for SmcResourceEventStream {
9030    type Item = Result<SmcResourceEvent, fidl::Error>;
9031
9032    fn poll_next(
9033        mut self: std::pin::Pin<&mut Self>,
9034        cx: &mut std::task::Context<'_>,
9035    ) -> std::task::Poll<Option<Self::Item>> {
9036        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9037            &mut self.event_receiver,
9038            cx
9039        )?) {
9040            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
9041            None => std::task::Poll::Ready(None),
9042        }
9043    }
9044}
9045
9046#[derive(Debug)]
9047pub enum SmcResourceEvent {}
9048
9049impl SmcResourceEvent {
9050    /// Decodes a message buffer as a [`SmcResourceEvent`].
9051    fn decode(
9052        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9053    ) -> Result<SmcResourceEvent, fidl::Error> {
9054        let (bytes, _handles) = buf.split_mut();
9055        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9056        debug_assert_eq!(tx_header.tx_id, 0);
9057        match tx_header.ordinal {
9058            _ => Err(fidl::Error::UnknownOrdinal {
9059                ordinal: tx_header.ordinal,
9060                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9061            }),
9062        }
9063    }
9064}
9065
9066/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
9067pub struct SmcResourceRequestStream {
9068    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9069    is_terminated: bool,
9070}
9071
9072impl std::marker::Unpin for SmcResourceRequestStream {}
9073
9074impl futures::stream::FusedStream for SmcResourceRequestStream {
9075    fn is_terminated(&self) -> bool {
9076        self.is_terminated
9077    }
9078}
9079
9080impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
9081    type Protocol = SmcResourceMarker;
9082    type ControlHandle = SmcResourceControlHandle;
9083
9084    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9085        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9086    }
9087
9088    fn control_handle(&self) -> Self::ControlHandle {
9089        SmcResourceControlHandle { inner: self.inner.clone() }
9090    }
9091
9092    fn into_inner(
9093        self,
9094    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9095    {
9096        (self.inner, self.is_terminated)
9097    }
9098
9099    fn from_inner(
9100        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9101        is_terminated: bool,
9102    ) -> Self {
9103        Self { inner, is_terminated }
9104    }
9105}
9106
9107impl futures::Stream for SmcResourceRequestStream {
9108    type Item = Result<SmcResourceRequest, fidl::Error>;
9109
9110    fn poll_next(
9111        mut self: std::pin::Pin<&mut Self>,
9112        cx: &mut std::task::Context<'_>,
9113    ) -> std::task::Poll<Option<Self::Item>> {
9114        let this = &mut *self;
9115        if this.inner.check_shutdown(cx) {
9116            this.is_terminated = true;
9117            return std::task::Poll::Ready(None);
9118        }
9119        if this.is_terminated {
9120            panic!("polled SmcResourceRequestStream after completion");
9121        }
9122        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9123            |bytes, handles| {
9124                match this.inner.channel().read_etc(cx, bytes, handles) {
9125                    std::task::Poll::Ready(Ok(())) => {}
9126                    std::task::Poll::Pending => return std::task::Poll::Pending,
9127                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9128                        this.is_terminated = true;
9129                        return std::task::Poll::Ready(None);
9130                    }
9131                    std::task::Poll::Ready(Err(e)) => {
9132                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9133                            e.into(),
9134                        ))));
9135                    }
9136                }
9137
9138                // A message has been received from the channel
9139                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9140
9141                std::task::Poll::Ready(Some(match header.ordinal {
9142                    0x392cbd495b84ede7 => {
9143                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9144                        let mut req = fidl::new_empty!(
9145                            fidl::encoding::EmptyPayload,
9146                            fidl::encoding::DefaultFuchsiaResourceDialect
9147                        );
9148                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9149                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
9150                        Ok(SmcResourceRequest::Get {
9151                            responder: SmcResourceGetResponder {
9152                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9153                                tx_id: header.tx_id,
9154                            },
9155                        })
9156                    }
9157                    _ => Err(fidl::Error::UnknownOrdinal {
9158                        ordinal: header.ordinal,
9159                        protocol_name:
9160                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9161                    }),
9162                }))
9163            },
9164        )
9165    }
9166}
9167
9168/// Protocol for providing an SMC resource with access to all valid ranges.
9169#[derive(Debug)]
9170pub enum SmcResourceRequest {
9171    /// Get an SMC resource handle.
9172    Get { responder: SmcResourceGetResponder },
9173}
9174
9175impl SmcResourceRequest {
9176    #[allow(irrefutable_let_patterns)]
9177    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
9178        if let SmcResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9179    }
9180
9181    /// Name of the method defined in FIDL
9182    pub fn method_name(&self) -> &'static str {
9183        match *self {
9184            SmcResourceRequest::Get { .. } => "get",
9185        }
9186    }
9187}
9188
9189#[derive(Debug, Clone)]
9190pub struct SmcResourceControlHandle {
9191    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9192}
9193
9194impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
9195    fn shutdown(&self) {
9196        self.inner.shutdown()
9197    }
9198
9199    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9200        self.inner.shutdown_with_epitaph(status)
9201    }
9202
9203    fn is_closed(&self) -> bool {
9204        self.inner.channel().is_closed()
9205    }
9206    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9207        self.inner.channel().on_closed()
9208    }
9209
9210    #[cfg(target_os = "fuchsia")]
9211    fn signal_peer(
9212        &self,
9213        clear_mask: zx::Signals,
9214        set_mask: zx::Signals,
9215    ) -> Result<(), zx_status::Status> {
9216        use fidl::Peered;
9217        self.inner.channel().signal_peer(clear_mask, set_mask)
9218    }
9219}
9220
9221impl SmcResourceControlHandle {}
9222
9223#[must_use = "FIDL methods require a response to be sent"]
9224#[derive(Debug)]
9225pub struct SmcResourceGetResponder {
9226    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
9227    tx_id: u32,
9228}
9229
9230/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
9231/// if the responder is dropped without sending a response, so that the client
9232/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9233impl std::ops::Drop for SmcResourceGetResponder {
9234    fn drop(&mut self) {
9235        self.control_handle.shutdown();
9236        // Safety: drops once, never accessed again
9237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9238    }
9239}
9240
9241impl fidl::endpoints::Responder for SmcResourceGetResponder {
9242    type ControlHandle = SmcResourceControlHandle;
9243
9244    fn control_handle(&self) -> &SmcResourceControlHandle {
9245        &self.control_handle
9246    }
9247
9248    fn drop_without_shutdown(mut self) {
9249        // Safety: drops once, never accessed again due to mem::forget
9250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9251        // Prevent Drop from running (which would shut down the channel)
9252        std::mem::forget(self);
9253    }
9254}
9255
9256impl SmcResourceGetResponder {
9257    /// Sends a response to the FIDL transaction.
9258    ///
9259    /// Sets the channel to shutdown if an error occurs.
9260    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9261        let _result = self.send_raw(resource);
9262        if _result.is_err() {
9263            self.control_handle.shutdown();
9264        }
9265        self.drop_without_shutdown();
9266        _result
9267    }
9268
9269    /// Similar to "send" but does not shutdown the channel if an error occurs.
9270    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9271        let _result = self.send_raw(resource);
9272        self.drop_without_shutdown();
9273        _result
9274    }
9275
9276    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9277        self.control_handle.inner.send::<SmcResourceGetResponse>(
9278            (resource,),
9279            self.tx_id,
9280            0x392cbd495b84ede7,
9281            fidl::encoding::DynamicFlags::empty(),
9282        )
9283    }
9284}
9285
9286#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9287pub struct StallResourceMarker;
9288
9289impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
9290    type Proxy = StallResourceProxy;
9291    type RequestStream = StallResourceRequestStream;
9292    #[cfg(target_os = "fuchsia")]
9293    type SynchronousProxy = StallResourceSynchronousProxy;
9294
9295    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
9296}
9297impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
9298
9299pub trait StallResourceProxyInterface: Send + Sync {
9300    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
9301    fn r#get(&self) -> Self::GetResponseFut;
9302}
9303#[derive(Debug)]
9304#[cfg(target_os = "fuchsia")]
9305pub struct StallResourceSynchronousProxy {
9306    client: fidl::client::sync::Client,
9307}
9308
9309#[cfg(target_os = "fuchsia")]
9310impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
9311    type Proxy = StallResourceProxy;
9312    type Protocol = StallResourceMarker;
9313
9314    fn from_channel(inner: fidl::Channel) -> Self {
9315        Self::new(inner)
9316    }
9317
9318    fn into_channel(self) -> fidl::Channel {
9319        self.client.into_channel()
9320    }
9321
9322    fn as_channel(&self) -> &fidl::Channel {
9323        self.client.as_channel()
9324    }
9325}
9326
9327#[cfg(target_os = "fuchsia")]
9328impl StallResourceSynchronousProxy {
9329    pub fn new(channel: fidl::Channel) -> Self {
9330        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9331        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9332    }
9333
9334    pub fn into_channel(self) -> fidl::Channel {
9335        self.client.into_channel()
9336    }
9337
9338    /// Waits until an event arrives and returns it. It is safe for other
9339    /// threads to make concurrent requests while waiting for an event.
9340    pub fn wait_for_event(
9341        &self,
9342        deadline: zx::MonotonicInstant,
9343    ) -> Result<StallResourceEvent, fidl::Error> {
9344        StallResourceEvent::decode(self.client.wait_for_event(deadline)?)
9345    }
9346
9347    /// Get a stall resource handle.
9348    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
9349        let _response =
9350            self.client.send_query::<fidl::encoding::EmptyPayload, StallResourceGetResponse>(
9351                (),
9352                0x5edf4c8629a9781a,
9353                fidl::encoding::DynamicFlags::empty(),
9354                ___deadline,
9355            )?;
9356        Ok(_response.resource)
9357    }
9358}
9359
9360#[cfg(target_os = "fuchsia")]
9361impl From<StallResourceSynchronousProxy> for zx::NullableHandle {
9362    fn from(value: StallResourceSynchronousProxy) -> Self {
9363        value.into_channel().into()
9364    }
9365}
9366
9367#[cfg(target_os = "fuchsia")]
9368impl From<fidl::Channel> for StallResourceSynchronousProxy {
9369    fn from(value: fidl::Channel) -> Self {
9370        Self::new(value)
9371    }
9372}
9373
9374#[cfg(target_os = "fuchsia")]
9375impl fidl::endpoints::FromClient for StallResourceSynchronousProxy {
9376    type Protocol = StallResourceMarker;
9377
9378    fn from_client(value: fidl::endpoints::ClientEnd<StallResourceMarker>) -> Self {
9379        Self::new(value.into_channel())
9380    }
9381}
9382
9383#[derive(Debug, Clone)]
9384pub struct StallResourceProxy {
9385    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9386}
9387
9388impl fidl::endpoints::Proxy for StallResourceProxy {
9389    type Protocol = StallResourceMarker;
9390
9391    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9392        Self::new(inner)
9393    }
9394
9395    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9396        self.client.into_channel().map_err(|client| Self { client })
9397    }
9398
9399    fn as_channel(&self) -> &::fidl::AsyncChannel {
9400        self.client.as_channel()
9401    }
9402}
9403
9404impl StallResourceProxy {
9405    /// Create a new Proxy for fuchsia.kernel/StallResource.
9406    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9407        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9408        Self { client: fidl::client::Client::new(channel, protocol_name) }
9409    }
9410
9411    /// Get a Stream of events from the remote end of the protocol.
9412    ///
9413    /// # Panics
9414    ///
9415    /// Panics if the event stream was already taken.
9416    pub fn take_event_stream(&self) -> StallResourceEventStream {
9417        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
9418    }
9419
9420    /// Get a stall resource handle.
9421    pub fn r#get(
9422        &self,
9423    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9424    {
9425        StallResourceProxyInterface::r#get(self)
9426    }
9427}
9428
9429impl StallResourceProxyInterface for StallResourceProxy {
9430    type GetResponseFut = fidl::client::QueryResponseFut<
9431        fidl::Resource,
9432        fidl::encoding::DefaultFuchsiaResourceDialect,
9433    >;
9434    fn r#get(&self) -> Self::GetResponseFut {
9435        fn _decode(
9436            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9437        ) -> Result<fidl::Resource, fidl::Error> {
9438            let _response = fidl::client::decode_transaction_body::<
9439                StallResourceGetResponse,
9440                fidl::encoding::DefaultFuchsiaResourceDialect,
9441                0x5edf4c8629a9781a,
9442            >(_buf?)?;
9443            Ok(_response.resource)
9444        }
9445        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9446            (),
9447            0x5edf4c8629a9781a,
9448            fidl::encoding::DynamicFlags::empty(),
9449            _decode,
9450        )
9451    }
9452}
9453
9454pub struct StallResourceEventStream {
9455    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9456}
9457
9458impl std::marker::Unpin for StallResourceEventStream {}
9459
9460impl futures::stream::FusedStream for StallResourceEventStream {
9461    fn is_terminated(&self) -> bool {
9462        self.event_receiver.is_terminated()
9463    }
9464}
9465
9466impl futures::Stream for StallResourceEventStream {
9467    type Item = Result<StallResourceEvent, fidl::Error>;
9468
9469    fn poll_next(
9470        mut self: std::pin::Pin<&mut Self>,
9471        cx: &mut std::task::Context<'_>,
9472    ) -> std::task::Poll<Option<Self::Item>> {
9473        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9474            &mut self.event_receiver,
9475            cx
9476        )?) {
9477            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
9478            None => std::task::Poll::Ready(None),
9479        }
9480    }
9481}
9482
9483#[derive(Debug)]
9484pub enum StallResourceEvent {}
9485
9486impl StallResourceEvent {
9487    /// Decodes a message buffer as a [`StallResourceEvent`].
9488    fn decode(
9489        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9490    ) -> Result<StallResourceEvent, fidl::Error> {
9491        let (bytes, _handles) = buf.split_mut();
9492        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9493        debug_assert_eq!(tx_header.tx_id, 0);
9494        match tx_header.ordinal {
9495            _ => Err(fidl::Error::UnknownOrdinal {
9496                ordinal: tx_header.ordinal,
9497                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9498            }),
9499        }
9500    }
9501}
9502
9503/// A Stream of incoming requests for fuchsia.kernel/StallResource.
9504pub struct StallResourceRequestStream {
9505    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9506    is_terminated: bool,
9507}
9508
9509impl std::marker::Unpin for StallResourceRequestStream {}
9510
9511impl futures::stream::FusedStream for StallResourceRequestStream {
9512    fn is_terminated(&self) -> bool {
9513        self.is_terminated
9514    }
9515}
9516
9517impl fidl::endpoints::RequestStream for StallResourceRequestStream {
9518    type Protocol = StallResourceMarker;
9519    type ControlHandle = StallResourceControlHandle;
9520
9521    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9522        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9523    }
9524
9525    fn control_handle(&self) -> Self::ControlHandle {
9526        StallResourceControlHandle { inner: self.inner.clone() }
9527    }
9528
9529    fn into_inner(
9530        self,
9531    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9532    {
9533        (self.inner, self.is_terminated)
9534    }
9535
9536    fn from_inner(
9537        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9538        is_terminated: bool,
9539    ) -> Self {
9540        Self { inner, is_terminated }
9541    }
9542}
9543
9544impl futures::Stream for StallResourceRequestStream {
9545    type Item = Result<StallResourceRequest, fidl::Error>;
9546
9547    fn poll_next(
9548        mut self: std::pin::Pin<&mut Self>,
9549        cx: &mut std::task::Context<'_>,
9550    ) -> std::task::Poll<Option<Self::Item>> {
9551        let this = &mut *self;
9552        if this.inner.check_shutdown(cx) {
9553            this.is_terminated = true;
9554            return std::task::Poll::Ready(None);
9555        }
9556        if this.is_terminated {
9557            panic!("polled StallResourceRequestStream after completion");
9558        }
9559        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9560            |bytes, handles| {
9561                match this.inner.channel().read_etc(cx, bytes, handles) {
9562                    std::task::Poll::Ready(Ok(())) => {}
9563                    std::task::Poll::Pending => return std::task::Poll::Pending,
9564                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9565                        this.is_terminated = true;
9566                        return std::task::Poll::Ready(None);
9567                    }
9568                    std::task::Poll::Ready(Err(e)) => {
9569                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9570                            e.into(),
9571                        ))));
9572                    }
9573                }
9574
9575                // A message has been received from the channel
9576                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9577
9578                std::task::Poll::Ready(Some(match header.ordinal {
9579                    0x5edf4c8629a9781a => {
9580                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9581                        let mut req = fidl::new_empty!(
9582                            fidl::encoding::EmptyPayload,
9583                            fidl::encoding::DefaultFuchsiaResourceDialect
9584                        );
9585                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9586                        let control_handle =
9587                            StallResourceControlHandle { inner: this.inner.clone() };
9588                        Ok(StallResourceRequest::Get {
9589                            responder: StallResourceGetResponder {
9590                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9591                                tx_id: header.tx_id,
9592                            },
9593                        })
9594                    }
9595                    _ => Err(fidl::Error::UnknownOrdinal {
9596                        ordinal: header.ordinal,
9597                        protocol_name:
9598                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9599                    }),
9600                }))
9601            },
9602        )
9603    }
9604}
9605
9606/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
9607/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
9608/// be notified of stalls.
9609#[derive(Debug)]
9610pub enum StallResourceRequest {
9611    /// Get a stall resource handle.
9612    Get { responder: StallResourceGetResponder },
9613}
9614
9615impl StallResourceRequest {
9616    #[allow(irrefutable_let_patterns)]
9617    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
9618        if let StallResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9619    }
9620
9621    /// Name of the method defined in FIDL
9622    pub fn method_name(&self) -> &'static str {
9623        match *self {
9624            StallResourceRequest::Get { .. } => "get",
9625        }
9626    }
9627}
9628
9629#[derive(Debug, Clone)]
9630pub struct StallResourceControlHandle {
9631    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9632}
9633
9634impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
9635    fn shutdown(&self) {
9636        self.inner.shutdown()
9637    }
9638
9639    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9640        self.inner.shutdown_with_epitaph(status)
9641    }
9642
9643    fn is_closed(&self) -> bool {
9644        self.inner.channel().is_closed()
9645    }
9646    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9647        self.inner.channel().on_closed()
9648    }
9649
9650    #[cfg(target_os = "fuchsia")]
9651    fn signal_peer(
9652        &self,
9653        clear_mask: zx::Signals,
9654        set_mask: zx::Signals,
9655    ) -> Result<(), zx_status::Status> {
9656        use fidl::Peered;
9657        self.inner.channel().signal_peer(clear_mask, set_mask)
9658    }
9659}
9660
9661impl StallResourceControlHandle {}
9662
9663#[must_use = "FIDL methods require a response to be sent"]
9664#[derive(Debug)]
9665pub struct StallResourceGetResponder {
9666    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
9667    tx_id: u32,
9668}
9669
9670/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
9671/// if the responder is dropped without sending a response, so that the client
9672/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9673impl std::ops::Drop for StallResourceGetResponder {
9674    fn drop(&mut self) {
9675        self.control_handle.shutdown();
9676        // Safety: drops once, never accessed again
9677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9678    }
9679}
9680
9681impl fidl::endpoints::Responder for StallResourceGetResponder {
9682    type ControlHandle = StallResourceControlHandle;
9683
9684    fn control_handle(&self) -> &StallResourceControlHandle {
9685        &self.control_handle
9686    }
9687
9688    fn drop_without_shutdown(mut self) {
9689        // Safety: drops once, never accessed again due to mem::forget
9690        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9691        // Prevent Drop from running (which would shut down the channel)
9692        std::mem::forget(self);
9693    }
9694}
9695
9696impl StallResourceGetResponder {
9697    /// Sends a response to the FIDL transaction.
9698    ///
9699    /// Sets the channel to shutdown if an error occurs.
9700    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9701        let _result = self.send_raw(resource);
9702        if _result.is_err() {
9703            self.control_handle.shutdown();
9704        }
9705        self.drop_without_shutdown();
9706        _result
9707    }
9708
9709    /// Similar to "send" but does not shutdown the channel if an error occurs.
9710    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9711        let _result = self.send_raw(resource);
9712        self.drop_without_shutdown();
9713        _result
9714    }
9715
9716    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9717        self.control_handle.inner.send::<StallResourceGetResponse>(
9718            (resource,),
9719            self.tx_id,
9720            0x5edf4c8629a9781a,
9721            fidl::encoding::DynamicFlags::empty(),
9722        )
9723    }
9724}
9725
9726#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9727pub struct StatsMarker;
9728
9729impl fidl::endpoints::ProtocolMarker for StatsMarker {
9730    type Proxy = StatsProxy;
9731    type RequestStream = StatsRequestStream;
9732    #[cfg(target_os = "fuchsia")]
9733    type SynchronousProxy = StatsSynchronousProxy;
9734
9735    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
9736}
9737impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
9738
9739pub trait StatsProxyInterface: Send + Sync {
9740    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
9741        + Send;
9742    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
9743    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
9744        + Send;
9745    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
9746    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
9747        + Send;
9748    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
9749    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
9750    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
9751    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
9752    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
9753}
9754#[derive(Debug)]
9755#[cfg(target_os = "fuchsia")]
9756pub struct StatsSynchronousProxy {
9757    client: fidl::client::sync::Client,
9758}
9759
9760#[cfg(target_os = "fuchsia")]
9761impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
9762    type Proxy = StatsProxy;
9763    type Protocol = StatsMarker;
9764
9765    fn from_channel(inner: fidl::Channel) -> Self {
9766        Self::new(inner)
9767    }
9768
9769    fn into_channel(self) -> fidl::Channel {
9770        self.client.into_channel()
9771    }
9772
9773    fn as_channel(&self) -> &fidl::Channel {
9774        self.client.as_channel()
9775    }
9776}
9777
9778#[cfg(target_os = "fuchsia")]
9779impl StatsSynchronousProxy {
9780    pub fn new(channel: fidl::Channel) -> Self {
9781        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9782        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9783    }
9784
9785    pub fn into_channel(self) -> fidl::Channel {
9786        self.client.into_channel()
9787    }
9788
9789    /// Waits until an event arrives and returns it. It is safe for other
9790    /// threads to make concurrent requests while waiting for an event.
9791    pub fn wait_for_event(
9792        &self,
9793        deadline: zx::MonotonicInstant,
9794    ) -> Result<StatsEvent, fidl::Error> {
9795        StatsEvent::decode(self.client.wait_for_event(deadline)?)
9796    }
9797
9798    pub fn r#get_memory_stats(
9799        &self,
9800        ___deadline: zx::MonotonicInstant,
9801    ) -> Result<MemoryStats, fidl::Error> {
9802        let _response =
9803            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse>(
9804                (),
9805                0x686677932ae41074,
9806                fidl::encoding::DynamicFlags::empty(),
9807                ___deadline,
9808            )?;
9809        Ok(_response.stats)
9810    }
9811
9812    pub fn r#get_memory_stats_extended(
9813        &self,
9814        ___deadline: zx::MonotonicInstant,
9815    ) -> Result<MemoryStatsExtended, fidl::Error> {
9816        let _response = self
9817            .client
9818            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsExtendedResponse>(
9819                (),
9820                0x60faa0f8aa38c29f,
9821                fidl::encoding::DynamicFlags::empty(),
9822                ___deadline,
9823            )?;
9824        Ok(_response.stats)
9825    }
9826
9827    pub fn r#get_memory_stats_compression(
9828        &self,
9829        ___deadline: zx::MonotonicInstant,
9830    ) -> Result<MemoryStatsCompression, fidl::Error> {
9831        let _response =
9832            self.client.send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9833                (),
9834                0x544a09995befb531,
9835                fidl::encoding::DynamicFlags::empty(),
9836                ___deadline,
9837            )?;
9838        Ok(_response)
9839    }
9840
9841    pub fn r#get_cpu_stats(
9842        &self,
9843        ___deadline: zx::MonotonicInstant,
9844    ) -> Result<CpuStats, fidl::Error> {
9845        let _response =
9846            self.client.send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse>(
9847                (),
9848                0x470e2684ca1ca19e,
9849                fidl::encoding::DynamicFlags::empty(),
9850                ___deadline,
9851            )?;
9852        Ok(_response.stats)
9853    }
9854
9855    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9856    /// duration.
9857    ///
9858    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9859    /// PerCpuStats) over a time duration.
9860    pub fn r#get_cpu_load(
9861        &self,
9862        mut duration: i64,
9863        ___deadline: zx::MonotonicInstant,
9864    ) -> Result<Vec<f32>, fidl::Error> {
9865        let _response = self.client.send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse>(
9866            (duration,),
9867            0x4c8f0f05e7034666,
9868            fidl::encoding::DynamicFlags::empty(),
9869            ___deadline,
9870        )?;
9871        Ok(_response.per_cpu_load)
9872    }
9873}
9874
9875#[cfg(target_os = "fuchsia")]
9876impl From<StatsSynchronousProxy> for zx::NullableHandle {
9877    fn from(value: StatsSynchronousProxy) -> Self {
9878        value.into_channel().into()
9879    }
9880}
9881
9882#[cfg(target_os = "fuchsia")]
9883impl From<fidl::Channel> for StatsSynchronousProxy {
9884    fn from(value: fidl::Channel) -> Self {
9885        Self::new(value)
9886    }
9887}
9888
9889#[cfg(target_os = "fuchsia")]
9890impl fidl::endpoints::FromClient for StatsSynchronousProxy {
9891    type Protocol = StatsMarker;
9892
9893    fn from_client(value: fidl::endpoints::ClientEnd<StatsMarker>) -> Self {
9894        Self::new(value.into_channel())
9895    }
9896}
9897
9898#[derive(Debug, Clone)]
9899pub struct StatsProxy {
9900    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9901}
9902
9903impl fidl::endpoints::Proxy for StatsProxy {
9904    type Protocol = StatsMarker;
9905
9906    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9907        Self::new(inner)
9908    }
9909
9910    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9911        self.client.into_channel().map_err(|client| Self { client })
9912    }
9913
9914    fn as_channel(&self) -> &::fidl::AsyncChannel {
9915        self.client.as_channel()
9916    }
9917}
9918
9919impl StatsProxy {
9920    /// Create a new Proxy for fuchsia.kernel/Stats.
9921    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9922        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9923        Self { client: fidl::client::Client::new(channel, protocol_name) }
9924    }
9925
9926    /// Get a Stream of events from the remote end of the protocol.
9927    ///
9928    /// # Panics
9929    ///
9930    /// Panics if the event stream was already taken.
9931    pub fn take_event_stream(&self) -> StatsEventStream {
9932        StatsEventStream { event_receiver: self.client.take_event_receiver() }
9933    }
9934
9935    pub fn r#get_memory_stats(
9936        &self,
9937    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9938    {
9939        StatsProxyInterface::r#get_memory_stats(self)
9940    }
9941
9942    pub fn r#get_memory_stats_extended(
9943        &self,
9944    ) -> fidl::client::QueryResponseFut<
9945        MemoryStatsExtended,
9946        fidl::encoding::DefaultFuchsiaResourceDialect,
9947    > {
9948        StatsProxyInterface::r#get_memory_stats_extended(self)
9949    }
9950
9951    pub fn r#get_memory_stats_compression(
9952        &self,
9953    ) -> fidl::client::QueryResponseFut<
9954        MemoryStatsCompression,
9955        fidl::encoding::DefaultFuchsiaResourceDialect,
9956    > {
9957        StatsProxyInterface::r#get_memory_stats_compression(self)
9958    }
9959
9960    pub fn r#get_cpu_stats(
9961        &self,
9962    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9963    {
9964        StatsProxyInterface::r#get_cpu_stats(self)
9965    }
9966
9967    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9968    /// duration.
9969    ///
9970    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9971    /// PerCpuStats) over a time duration.
9972    pub fn r#get_cpu_load(
9973        &self,
9974        mut duration: i64,
9975    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
9976    {
9977        StatsProxyInterface::r#get_cpu_load(self, duration)
9978    }
9979}
9980
9981impl StatsProxyInterface for StatsProxy {
9982    type GetMemoryStatsResponseFut =
9983        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9984    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
9985        fn _decode(
9986            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9987        ) -> Result<MemoryStats, fidl::Error> {
9988            let _response = fidl::client::decode_transaction_body::<
9989                StatsGetMemoryStatsResponse,
9990                fidl::encoding::DefaultFuchsiaResourceDialect,
9991                0x686677932ae41074,
9992            >(_buf?)?;
9993            Ok(_response.stats)
9994        }
9995        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
9996            (),
9997            0x686677932ae41074,
9998            fidl::encoding::DynamicFlags::empty(),
9999            _decode,
10000        )
10001    }
10002
10003    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
10004        MemoryStatsExtended,
10005        fidl::encoding::DefaultFuchsiaResourceDialect,
10006    >;
10007    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
10008        fn _decode(
10009            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10010        ) -> Result<MemoryStatsExtended, fidl::Error> {
10011            let _response = fidl::client::decode_transaction_body::<
10012                StatsGetMemoryStatsExtendedResponse,
10013                fidl::encoding::DefaultFuchsiaResourceDialect,
10014                0x60faa0f8aa38c29f,
10015            >(_buf?)?;
10016            Ok(_response.stats)
10017        }
10018        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
10019            (),
10020            0x60faa0f8aa38c29f,
10021            fidl::encoding::DynamicFlags::empty(),
10022            _decode,
10023        )
10024    }
10025
10026    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
10027        MemoryStatsCompression,
10028        fidl::encoding::DefaultFuchsiaResourceDialect,
10029    >;
10030    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
10031        fn _decode(
10032            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10033        ) -> Result<MemoryStatsCompression, fidl::Error> {
10034            let _response = fidl::client::decode_transaction_body::<
10035                MemoryStatsCompression,
10036                fidl::encoding::DefaultFuchsiaResourceDialect,
10037                0x544a09995befb531,
10038            >(_buf?)?;
10039            Ok(_response)
10040        }
10041        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
10042            (),
10043            0x544a09995befb531,
10044            fidl::encoding::DynamicFlags::empty(),
10045            _decode,
10046        )
10047    }
10048
10049    type GetCpuStatsResponseFut =
10050        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
10051    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
10052        fn _decode(
10053            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10054        ) -> Result<CpuStats, fidl::Error> {
10055            let _response = fidl::client::decode_transaction_body::<
10056                StatsGetCpuStatsResponse,
10057                fidl::encoding::DefaultFuchsiaResourceDialect,
10058                0x470e2684ca1ca19e,
10059            >(_buf?)?;
10060            Ok(_response.stats)
10061        }
10062        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
10063            (),
10064            0x470e2684ca1ca19e,
10065            fidl::encoding::DynamicFlags::empty(),
10066            _decode,
10067        )
10068    }
10069
10070    type GetCpuLoadResponseFut =
10071        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
10072    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
10073        fn _decode(
10074            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10075        ) -> Result<Vec<f32>, fidl::Error> {
10076            let _response = fidl::client::decode_transaction_body::<
10077                StatsGetCpuLoadResponse,
10078                fidl::encoding::DefaultFuchsiaResourceDialect,
10079                0x4c8f0f05e7034666,
10080            >(_buf?)?;
10081            Ok(_response.per_cpu_load)
10082        }
10083        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
10084            (duration,),
10085            0x4c8f0f05e7034666,
10086            fidl::encoding::DynamicFlags::empty(),
10087            _decode,
10088        )
10089    }
10090}
10091
10092pub struct StatsEventStream {
10093    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10094}
10095
10096impl std::marker::Unpin for StatsEventStream {}
10097
10098impl futures::stream::FusedStream for StatsEventStream {
10099    fn is_terminated(&self) -> bool {
10100        self.event_receiver.is_terminated()
10101    }
10102}
10103
10104impl futures::Stream for StatsEventStream {
10105    type Item = Result<StatsEvent, fidl::Error>;
10106
10107    fn poll_next(
10108        mut self: std::pin::Pin<&mut Self>,
10109        cx: &mut std::task::Context<'_>,
10110    ) -> std::task::Poll<Option<Self::Item>> {
10111        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10112            &mut self.event_receiver,
10113            cx
10114        )?) {
10115            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
10116            None => std::task::Poll::Ready(None),
10117        }
10118    }
10119}
10120
10121#[derive(Debug)]
10122pub enum StatsEvent {}
10123
10124impl StatsEvent {
10125    /// Decodes a message buffer as a [`StatsEvent`].
10126    fn decode(
10127        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10128    ) -> Result<StatsEvent, fidl::Error> {
10129        let (bytes, _handles) = buf.split_mut();
10130        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10131        debug_assert_eq!(tx_header.tx_id, 0);
10132        match tx_header.ordinal {
10133            _ => Err(fidl::Error::UnknownOrdinal {
10134                ordinal: tx_header.ordinal,
10135                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10136            }),
10137        }
10138    }
10139}
10140
10141/// A Stream of incoming requests for fuchsia.kernel/Stats.
10142pub struct StatsRequestStream {
10143    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10144    is_terminated: bool,
10145}
10146
10147impl std::marker::Unpin for StatsRequestStream {}
10148
10149impl futures::stream::FusedStream for StatsRequestStream {
10150    fn is_terminated(&self) -> bool {
10151        self.is_terminated
10152    }
10153}
10154
10155impl fidl::endpoints::RequestStream for StatsRequestStream {
10156    type Protocol = StatsMarker;
10157    type ControlHandle = StatsControlHandle;
10158
10159    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10160        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10161    }
10162
10163    fn control_handle(&self) -> Self::ControlHandle {
10164        StatsControlHandle { inner: self.inner.clone() }
10165    }
10166
10167    fn into_inner(
10168        self,
10169    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10170    {
10171        (self.inner, self.is_terminated)
10172    }
10173
10174    fn from_inner(
10175        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10176        is_terminated: bool,
10177    ) -> Self {
10178        Self { inner, is_terminated }
10179    }
10180}
10181
10182impl futures::Stream for StatsRequestStream {
10183    type Item = Result<StatsRequest, fidl::Error>;
10184
10185    fn poll_next(
10186        mut self: std::pin::Pin<&mut Self>,
10187        cx: &mut std::task::Context<'_>,
10188    ) -> std::task::Poll<Option<Self::Item>> {
10189        let this = &mut *self;
10190        if this.inner.check_shutdown(cx) {
10191            this.is_terminated = true;
10192            return std::task::Poll::Ready(None);
10193        }
10194        if this.is_terminated {
10195            panic!("polled StatsRequestStream after completion");
10196        }
10197        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10198            |bytes, handles| {
10199                match this.inner.channel().read_etc(cx, bytes, handles) {
10200                    std::task::Poll::Ready(Ok(())) => {}
10201                    std::task::Poll::Pending => return std::task::Poll::Pending,
10202                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10203                        this.is_terminated = true;
10204                        return std::task::Poll::Ready(None);
10205                    }
10206                    std::task::Poll::Ready(Err(e)) => {
10207                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10208                            e.into(),
10209                        ))));
10210                    }
10211                }
10212
10213                // A message has been received from the channel
10214                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10215
10216                std::task::Poll::Ready(Some(match header.ordinal {
10217                    0x686677932ae41074 => {
10218                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10219                        let mut req = fidl::new_empty!(
10220                            fidl::encoding::EmptyPayload,
10221                            fidl::encoding::DefaultFuchsiaResourceDialect
10222                        );
10223                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10224                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10225                        Ok(StatsRequest::GetMemoryStats {
10226                            responder: StatsGetMemoryStatsResponder {
10227                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10228                                tx_id: header.tx_id,
10229                            },
10230                        })
10231                    }
10232                    0x60faa0f8aa38c29f => {
10233                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10234                        let mut req = fidl::new_empty!(
10235                            fidl::encoding::EmptyPayload,
10236                            fidl::encoding::DefaultFuchsiaResourceDialect
10237                        );
10238                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10239                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10240                        Ok(StatsRequest::GetMemoryStatsExtended {
10241                            responder: StatsGetMemoryStatsExtendedResponder {
10242                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10243                                tx_id: header.tx_id,
10244                            },
10245                        })
10246                    }
10247                    0x544a09995befb531 => {
10248                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10249                        let mut req = fidl::new_empty!(
10250                            fidl::encoding::EmptyPayload,
10251                            fidl::encoding::DefaultFuchsiaResourceDialect
10252                        );
10253                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10254                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10255                        Ok(StatsRequest::GetMemoryStatsCompression {
10256                            responder: StatsGetMemoryStatsCompressionResponder {
10257                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10258                                tx_id: header.tx_id,
10259                            },
10260                        })
10261                    }
10262                    0x470e2684ca1ca19e => {
10263                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10264                        let mut req = fidl::new_empty!(
10265                            fidl::encoding::EmptyPayload,
10266                            fidl::encoding::DefaultFuchsiaResourceDialect
10267                        );
10268                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10269                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10270                        Ok(StatsRequest::GetCpuStats {
10271                            responder: StatsGetCpuStatsResponder {
10272                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10273                                tx_id: header.tx_id,
10274                            },
10275                        })
10276                    }
10277                    0x4c8f0f05e7034666 => {
10278                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10279                        let mut req = fidl::new_empty!(
10280                            StatsGetCpuLoadRequest,
10281                            fidl::encoding::DefaultFuchsiaResourceDialect
10282                        );
10283                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
10284                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10285                        Ok(StatsRequest::GetCpuLoad {
10286                            duration: req.duration,
10287
10288                            responder: StatsGetCpuLoadResponder {
10289                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10290                                tx_id: header.tx_id,
10291                            },
10292                        })
10293                    }
10294                    _ => Err(fidl::Error::UnknownOrdinal {
10295                        ordinal: header.ordinal,
10296                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10297                    }),
10298                }))
10299            },
10300        )
10301    }
10302}
10303
10304/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
10305/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
10306/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
10307/// just want stats should use this service instead. If for some reason the protocol fails to
10308/// retrieve stats, which will be an un-recoverable error, it will close the channel.
10309#[derive(Debug)]
10310pub enum StatsRequest {
10311    GetMemoryStats {
10312        responder: StatsGetMemoryStatsResponder,
10313    },
10314    GetMemoryStatsExtended {
10315        responder: StatsGetMemoryStatsExtendedResponder,
10316    },
10317    GetMemoryStatsCompression {
10318        responder: StatsGetMemoryStatsCompressionResponder,
10319    },
10320    GetCpuStats {
10321        responder: StatsGetCpuStatsResponder,
10322    },
10323    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10324    /// duration.
10325    ///
10326    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10327    /// PerCpuStats) over a time duration.
10328    GetCpuLoad {
10329        duration: i64,
10330        responder: StatsGetCpuLoadResponder,
10331    },
10332}
10333
10334impl StatsRequest {
10335    #[allow(irrefutable_let_patterns)]
10336    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
10337        if let StatsRequest::GetMemoryStats { responder } = self { Some((responder)) } else { None }
10338    }
10339
10340    #[allow(irrefutable_let_patterns)]
10341    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
10342        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
10343            Some((responder))
10344        } else {
10345            None
10346        }
10347    }
10348
10349    #[allow(irrefutable_let_patterns)]
10350    pub fn into_get_memory_stats_compression(
10351        self,
10352    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
10353        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
10354            Some((responder))
10355        } else {
10356            None
10357        }
10358    }
10359
10360    #[allow(irrefutable_let_patterns)]
10361    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
10362        if let StatsRequest::GetCpuStats { responder } = self { Some((responder)) } else { None }
10363    }
10364
10365    #[allow(irrefutable_let_patterns)]
10366    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
10367        if let StatsRequest::GetCpuLoad { duration, responder } = self {
10368            Some((duration, responder))
10369        } else {
10370            None
10371        }
10372    }
10373
10374    /// Name of the method defined in FIDL
10375    pub fn method_name(&self) -> &'static str {
10376        match *self {
10377            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
10378            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
10379            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
10380            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
10381            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
10382        }
10383    }
10384}
10385
10386#[derive(Debug, Clone)]
10387pub struct StatsControlHandle {
10388    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10389}
10390
10391impl fidl::endpoints::ControlHandle for StatsControlHandle {
10392    fn shutdown(&self) {
10393        self.inner.shutdown()
10394    }
10395
10396    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10397        self.inner.shutdown_with_epitaph(status)
10398    }
10399
10400    fn is_closed(&self) -> bool {
10401        self.inner.channel().is_closed()
10402    }
10403    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10404        self.inner.channel().on_closed()
10405    }
10406
10407    #[cfg(target_os = "fuchsia")]
10408    fn signal_peer(
10409        &self,
10410        clear_mask: zx::Signals,
10411        set_mask: zx::Signals,
10412    ) -> Result<(), zx_status::Status> {
10413        use fidl::Peered;
10414        self.inner.channel().signal_peer(clear_mask, set_mask)
10415    }
10416}
10417
10418impl StatsControlHandle {}
10419
10420#[must_use = "FIDL methods require a response to be sent"]
10421#[derive(Debug)]
10422pub struct StatsGetMemoryStatsResponder {
10423    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10424    tx_id: u32,
10425}
10426
10427/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10428/// if the responder is dropped without sending a response, so that the client
10429/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10430impl std::ops::Drop for StatsGetMemoryStatsResponder {
10431    fn drop(&mut self) {
10432        self.control_handle.shutdown();
10433        // Safety: drops once, never accessed again
10434        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10435    }
10436}
10437
10438impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
10439    type ControlHandle = StatsControlHandle;
10440
10441    fn control_handle(&self) -> &StatsControlHandle {
10442        &self.control_handle
10443    }
10444
10445    fn drop_without_shutdown(mut self) {
10446        // Safety: drops once, never accessed again due to mem::forget
10447        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10448        // Prevent Drop from running (which would shut down the channel)
10449        std::mem::forget(self);
10450    }
10451}
10452
10453impl StatsGetMemoryStatsResponder {
10454    /// Sends a response to the FIDL transaction.
10455    ///
10456    /// Sets the channel to shutdown if an error occurs.
10457    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10458        let _result = self.send_raw(stats);
10459        if _result.is_err() {
10460            self.control_handle.shutdown();
10461        }
10462        self.drop_without_shutdown();
10463        _result
10464    }
10465
10466    /// Similar to "send" but does not shutdown the channel if an error occurs.
10467    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10468        let _result = self.send_raw(stats);
10469        self.drop_without_shutdown();
10470        _result
10471    }
10472
10473    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10474        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
10475            (stats,),
10476            self.tx_id,
10477            0x686677932ae41074,
10478            fidl::encoding::DynamicFlags::empty(),
10479        )
10480    }
10481}
10482
10483#[must_use = "FIDL methods require a response to be sent"]
10484#[derive(Debug)]
10485pub struct StatsGetMemoryStatsExtendedResponder {
10486    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10487    tx_id: u32,
10488}
10489
10490/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10491/// if the responder is dropped without sending a response, so that the client
10492/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10493impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
10494    fn drop(&mut self) {
10495        self.control_handle.shutdown();
10496        // Safety: drops once, never accessed again
10497        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10498    }
10499}
10500
10501impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
10502    type ControlHandle = StatsControlHandle;
10503
10504    fn control_handle(&self) -> &StatsControlHandle {
10505        &self.control_handle
10506    }
10507
10508    fn drop_without_shutdown(mut self) {
10509        // Safety: drops once, never accessed again due to mem::forget
10510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10511        // Prevent Drop from running (which would shut down the channel)
10512        std::mem::forget(self);
10513    }
10514}
10515
10516impl StatsGetMemoryStatsExtendedResponder {
10517    /// Sends a response to the FIDL transaction.
10518    ///
10519    /// Sets the channel to shutdown if an error occurs.
10520    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10521        let _result = self.send_raw(stats);
10522        if _result.is_err() {
10523            self.control_handle.shutdown();
10524        }
10525        self.drop_without_shutdown();
10526        _result
10527    }
10528
10529    /// Similar to "send" but does not shutdown the channel if an error occurs.
10530    pub fn send_no_shutdown_on_err(
10531        self,
10532        mut stats: &MemoryStatsExtended,
10533    ) -> Result<(), fidl::Error> {
10534        let _result = self.send_raw(stats);
10535        self.drop_without_shutdown();
10536        _result
10537    }
10538
10539    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10540        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
10541            (stats,),
10542            self.tx_id,
10543            0x60faa0f8aa38c29f,
10544            fidl::encoding::DynamicFlags::empty(),
10545        )
10546    }
10547}
10548
10549#[must_use = "FIDL methods require a response to be sent"]
10550#[derive(Debug)]
10551pub struct StatsGetMemoryStatsCompressionResponder {
10552    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10553    tx_id: u32,
10554}
10555
10556/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10557/// if the responder is dropped without sending a response, so that the client
10558/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10559impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
10560    fn drop(&mut self) {
10561        self.control_handle.shutdown();
10562        // Safety: drops once, never accessed again
10563        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10564    }
10565}
10566
10567impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
10568    type ControlHandle = StatsControlHandle;
10569
10570    fn control_handle(&self) -> &StatsControlHandle {
10571        &self.control_handle
10572    }
10573
10574    fn drop_without_shutdown(mut self) {
10575        // Safety: drops once, never accessed again due to mem::forget
10576        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10577        // Prevent Drop from running (which would shut down the channel)
10578        std::mem::forget(self);
10579    }
10580}
10581
10582impl StatsGetMemoryStatsCompressionResponder {
10583    /// Sends a response to the FIDL transaction.
10584    ///
10585    /// Sets the channel to shutdown if an error occurs.
10586    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10587        let _result = self.send_raw(payload);
10588        if _result.is_err() {
10589            self.control_handle.shutdown();
10590        }
10591        self.drop_without_shutdown();
10592        _result
10593    }
10594
10595    /// Similar to "send" but does not shutdown the channel if an error occurs.
10596    pub fn send_no_shutdown_on_err(
10597        self,
10598        mut payload: &MemoryStatsCompression,
10599    ) -> Result<(), fidl::Error> {
10600        let _result = self.send_raw(payload);
10601        self.drop_without_shutdown();
10602        _result
10603    }
10604
10605    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10606        self.control_handle.inner.send::<MemoryStatsCompression>(
10607            payload,
10608            self.tx_id,
10609            0x544a09995befb531,
10610            fidl::encoding::DynamicFlags::empty(),
10611        )
10612    }
10613}
10614
10615#[must_use = "FIDL methods require a response to be sent"]
10616#[derive(Debug)]
10617pub struct StatsGetCpuStatsResponder {
10618    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10619    tx_id: u32,
10620}
10621
10622/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10623/// if the responder is dropped without sending a response, so that the client
10624/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10625impl std::ops::Drop for StatsGetCpuStatsResponder {
10626    fn drop(&mut self) {
10627        self.control_handle.shutdown();
10628        // Safety: drops once, never accessed again
10629        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10630    }
10631}
10632
10633impl fidl::endpoints::Responder for StatsGetCpuStatsResponder {
10634    type ControlHandle = StatsControlHandle;
10635
10636    fn control_handle(&self) -> &StatsControlHandle {
10637        &self.control_handle
10638    }
10639
10640    fn drop_without_shutdown(mut self) {
10641        // Safety: drops once, never accessed again due to mem::forget
10642        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10643        // Prevent Drop from running (which would shut down the channel)
10644        std::mem::forget(self);
10645    }
10646}
10647
10648impl StatsGetCpuStatsResponder {
10649    /// Sends a response to the FIDL transaction.
10650    ///
10651    /// Sets the channel to shutdown if an error occurs.
10652    pub fn send(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10653        let _result = self.send_raw(stats);
10654        if _result.is_err() {
10655            self.control_handle.shutdown();
10656        }
10657        self.drop_without_shutdown();
10658        _result
10659    }
10660
10661    /// Similar to "send" but does not shutdown the channel if an error occurs.
10662    pub fn send_no_shutdown_on_err(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10663        let _result = self.send_raw(stats);
10664        self.drop_without_shutdown();
10665        _result
10666    }
10667
10668    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10669        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
10670            (stats,),
10671            self.tx_id,
10672            0x470e2684ca1ca19e,
10673            fidl::encoding::DynamicFlags::empty(),
10674        )
10675    }
10676}
10677
10678#[must_use = "FIDL methods require a response to be sent"]
10679#[derive(Debug)]
10680pub struct StatsGetCpuLoadResponder {
10681    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10682    tx_id: u32,
10683}
10684
10685/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10686/// if the responder is dropped without sending a response, so that the client
10687/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10688impl std::ops::Drop for StatsGetCpuLoadResponder {
10689    fn drop(&mut self) {
10690        self.control_handle.shutdown();
10691        // Safety: drops once, never accessed again
10692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10693    }
10694}
10695
10696impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
10697    type ControlHandle = StatsControlHandle;
10698
10699    fn control_handle(&self) -> &StatsControlHandle {
10700        &self.control_handle
10701    }
10702
10703    fn drop_without_shutdown(mut self) {
10704        // Safety: drops once, never accessed again due to mem::forget
10705        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10706        // Prevent Drop from running (which would shut down the channel)
10707        std::mem::forget(self);
10708    }
10709}
10710
10711impl StatsGetCpuLoadResponder {
10712    /// Sends a response to the FIDL transaction.
10713    ///
10714    /// Sets the channel to shutdown if an error occurs.
10715    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10716        let _result = self.send_raw(per_cpu_load);
10717        if _result.is_err() {
10718            self.control_handle.shutdown();
10719        }
10720        self.drop_without_shutdown();
10721        _result
10722    }
10723
10724    /// Similar to "send" but does not shutdown the channel if an error occurs.
10725    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10726        let _result = self.send_raw(per_cpu_load);
10727        self.drop_without_shutdown();
10728        _result
10729    }
10730
10731    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10732        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
10733            (per_cpu_load,),
10734            self.tx_id,
10735            0x4c8f0f05e7034666,
10736            fidl::encoding::DynamicFlags::empty(),
10737        )
10738    }
10739}
10740
10741#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10742pub struct TracingResourceMarker;
10743
10744impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
10745    type Proxy = TracingResourceProxy;
10746    type RequestStream = TracingResourceRequestStream;
10747    #[cfg(target_os = "fuchsia")]
10748    type SynchronousProxy = TracingResourceSynchronousProxy;
10749
10750    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
10751}
10752impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
10753
10754pub trait TracingResourceProxyInterface: Send + Sync {
10755    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10756    fn r#get(&self) -> Self::GetResponseFut;
10757}
10758#[derive(Debug)]
10759#[cfg(target_os = "fuchsia")]
10760pub struct TracingResourceSynchronousProxy {
10761    client: fidl::client::sync::Client,
10762}
10763
10764#[cfg(target_os = "fuchsia")]
10765impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
10766    type Proxy = TracingResourceProxy;
10767    type Protocol = TracingResourceMarker;
10768
10769    fn from_channel(inner: fidl::Channel) -> Self {
10770        Self::new(inner)
10771    }
10772
10773    fn into_channel(self) -> fidl::Channel {
10774        self.client.into_channel()
10775    }
10776
10777    fn as_channel(&self) -> &fidl::Channel {
10778        self.client.as_channel()
10779    }
10780}
10781
10782#[cfg(target_os = "fuchsia")]
10783impl TracingResourceSynchronousProxy {
10784    pub fn new(channel: fidl::Channel) -> Self {
10785        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10786        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
10787    }
10788
10789    pub fn into_channel(self) -> fidl::Channel {
10790        self.client.into_channel()
10791    }
10792
10793    /// Waits until an event arrives and returns it. It is safe for other
10794    /// threads to make concurrent requests while waiting for an event.
10795    pub fn wait_for_event(
10796        &self,
10797        deadline: zx::MonotonicInstant,
10798    ) -> Result<TracingResourceEvent, fidl::Error> {
10799        TracingResourceEvent::decode(self.client.wait_for_event(deadline)?)
10800    }
10801
10802    /// Get a tracing resource handle.
10803    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10804        let _response =
10805            self.client.send_query::<fidl::encoding::EmptyPayload, TracingResourceGetResponse>(
10806                (),
10807                0x299bc179aa54c6aa,
10808                fidl::encoding::DynamicFlags::empty(),
10809                ___deadline,
10810            )?;
10811        Ok(_response.resource)
10812    }
10813}
10814
10815#[cfg(target_os = "fuchsia")]
10816impl From<TracingResourceSynchronousProxy> for zx::NullableHandle {
10817    fn from(value: TracingResourceSynchronousProxy) -> Self {
10818        value.into_channel().into()
10819    }
10820}
10821
10822#[cfg(target_os = "fuchsia")]
10823impl From<fidl::Channel> for TracingResourceSynchronousProxy {
10824    fn from(value: fidl::Channel) -> Self {
10825        Self::new(value)
10826    }
10827}
10828
10829#[cfg(target_os = "fuchsia")]
10830impl fidl::endpoints::FromClient for TracingResourceSynchronousProxy {
10831    type Protocol = TracingResourceMarker;
10832
10833    fn from_client(value: fidl::endpoints::ClientEnd<TracingResourceMarker>) -> Self {
10834        Self::new(value.into_channel())
10835    }
10836}
10837
10838#[derive(Debug, Clone)]
10839pub struct TracingResourceProxy {
10840    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10841}
10842
10843impl fidl::endpoints::Proxy for TracingResourceProxy {
10844    type Protocol = TracingResourceMarker;
10845
10846    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10847        Self::new(inner)
10848    }
10849
10850    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10851        self.client.into_channel().map_err(|client| Self { client })
10852    }
10853
10854    fn as_channel(&self) -> &::fidl::AsyncChannel {
10855        self.client.as_channel()
10856    }
10857}
10858
10859impl TracingResourceProxy {
10860    /// Create a new Proxy for fuchsia.kernel/TracingResource.
10861    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10862        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10863        Self { client: fidl::client::Client::new(channel, protocol_name) }
10864    }
10865
10866    /// Get a Stream of events from the remote end of the protocol.
10867    ///
10868    /// # Panics
10869    ///
10870    /// Panics if the event stream was already taken.
10871    pub fn take_event_stream(&self) -> TracingResourceEventStream {
10872        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
10873    }
10874
10875    /// Get a tracing resource handle.
10876    pub fn r#get(
10877        &self,
10878    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10879    {
10880        TracingResourceProxyInterface::r#get(self)
10881    }
10882}
10883
10884impl TracingResourceProxyInterface for TracingResourceProxy {
10885    type GetResponseFut = fidl::client::QueryResponseFut<
10886        fidl::Resource,
10887        fidl::encoding::DefaultFuchsiaResourceDialect,
10888    >;
10889    fn r#get(&self) -> Self::GetResponseFut {
10890        fn _decode(
10891            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10892        ) -> Result<fidl::Resource, fidl::Error> {
10893            let _response = fidl::client::decode_transaction_body::<
10894                TracingResourceGetResponse,
10895                fidl::encoding::DefaultFuchsiaResourceDialect,
10896                0x299bc179aa54c6aa,
10897            >(_buf?)?;
10898            Ok(_response.resource)
10899        }
10900        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10901            (),
10902            0x299bc179aa54c6aa,
10903            fidl::encoding::DynamicFlags::empty(),
10904            _decode,
10905        )
10906    }
10907}
10908
10909pub struct TracingResourceEventStream {
10910    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10911}
10912
10913impl std::marker::Unpin for TracingResourceEventStream {}
10914
10915impl futures::stream::FusedStream for TracingResourceEventStream {
10916    fn is_terminated(&self) -> bool {
10917        self.event_receiver.is_terminated()
10918    }
10919}
10920
10921impl futures::Stream for TracingResourceEventStream {
10922    type Item = Result<TracingResourceEvent, fidl::Error>;
10923
10924    fn poll_next(
10925        mut self: std::pin::Pin<&mut Self>,
10926        cx: &mut std::task::Context<'_>,
10927    ) -> std::task::Poll<Option<Self::Item>> {
10928        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10929            &mut self.event_receiver,
10930            cx
10931        )?) {
10932            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
10933            None => std::task::Poll::Ready(None),
10934        }
10935    }
10936}
10937
10938#[derive(Debug)]
10939pub enum TracingResourceEvent {}
10940
10941impl TracingResourceEvent {
10942    /// Decodes a message buffer as a [`TracingResourceEvent`].
10943    fn decode(
10944        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10945    ) -> Result<TracingResourceEvent, fidl::Error> {
10946        let (bytes, _handles) = buf.split_mut();
10947        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10948        debug_assert_eq!(tx_header.tx_id, 0);
10949        match tx_header.ordinal {
10950            _ => Err(fidl::Error::UnknownOrdinal {
10951                ordinal: tx_header.ordinal,
10952                protocol_name:
10953                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10954            }),
10955        }
10956    }
10957}
10958
10959/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
10960pub struct TracingResourceRequestStream {
10961    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10962    is_terminated: bool,
10963}
10964
10965impl std::marker::Unpin for TracingResourceRequestStream {}
10966
10967impl futures::stream::FusedStream for TracingResourceRequestStream {
10968    fn is_terminated(&self) -> bool {
10969        self.is_terminated
10970    }
10971}
10972
10973impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
10974    type Protocol = TracingResourceMarker;
10975    type ControlHandle = TracingResourceControlHandle;
10976
10977    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10978        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10979    }
10980
10981    fn control_handle(&self) -> Self::ControlHandle {
10982        TracingResourceControlHandle { inner: self.inner.clone() }
10983    }
10984
10985    fn into_inner(
10986        self,
10987    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10988    {
10989        (self.inner, self.is_terminated)
10990    }
10991
10992    fn from_inner(
10993        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10994        is_terminated: bool,
10995    ) -> Self {
10996        Self { inner, is_terminated }
10997    }
10998}
10999
11000impl futures::Stream for TracingResourceRequestStream {
11001    type Item = Result<TracingResourceRequest, fidl::Error>;
11002
11003    fn poll_next(
11004        mut self: std::pin::Pin<&mut Self>,
11005        cx: &mut std::task::Context<'_>,
11006    ) -> std::task::Poll<Option<Self::Item>> {
11007        let this = &mut *self;
11008        if this.inner.check_shutdown(cx) {
11009            this.is_terminated = true;
11010            return std::task::Poll::Ready(None);
11011        }
11012        if this.is_terminated {
11013            panic!("polled TracingResourceRequestStream after completion");
11014        }
11015        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11016            |bytes, handles| {
11017                match this.inner.channel().read_etc(cx, bytes, handles) {
11018                    std::task::Poll::Ready(Ok(())) => {}
11019                    std::task::Poll::Pending => return std::task::Poll::Pending,
11020                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11021                        this.is_terminated = true;
11022                        return std::task::Poll::Ready(None);
11023                    }
11024                    std::task::Poll::Ready(Err(e)) => {
11025                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11026                            e.into(),
11027                        ))));
11028                    }
11029                }
11030
11031                // A message has been received from the channel
11032                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11033
11034                std::task::Poll::Ready(Some(match header.ordinal {
11035                    0x299bc179aa54c6aa => {
11036                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11037                        let mut req = fidl::new_empty!(
11038                            fidl::encoding::EmptyPayload,
11039                            fidl::encoding::DefaultFuchsiaResourceDialect
11040                        );
11041                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11042                        let control_handle =
11043                            TracingResourceControlHandle { inner: this.inner.clone() };
11044                        Ok(TracingResourceRequest::Get {
11045                            responder: TracingResourceGetResponder {
11046                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11047                                tx_id: header.tx_id,
11048                            },
11049                        })
11050                    }
11051                    _ => Err(fidl::Error::UnknownOrdinal {
11052                        ordinal: header.ordinal,
11053                        protocol_name:
11054                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11055                    }),
11056                }))
11057            },
11058        )
11059    }
11060}
11061
11062/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11063/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
11064#[derive(Debug)]
11065pub enum TracingResourceRequest {
11066    /// Get a tracing resource handle.
11067    Get { responder: TracingResourceGetResponder },
11068}
11069
11070impl TracingResourceRequest {
11071    #[allow(irrefutable_let_patterns)]
11072    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
11073        if let TracingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11074    }
11075
11076    /// Name of the method defined in FIDL
11077    pub fn method_name(&self) -> &'static str {
11078        match *self {
11079            TracingResourceRequest::Get { .. } => "get",
11080        }
11081    }
11082}
11083
11084#[derive(Debug, Clone)]
11085pub struct TracingResourceControlHandle {
11086    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11087}
11088
11089impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
11090    fn shutdown(&self) {
11091        self.inner.shutdown()
11092    }
11093
11094    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11095        self.inner.shutdown_with_epitaph(status)
11096    }
11097
11098    fn is_closed(&self) -> bool {
11099        self.inner.channel().is_closed()
11100    }
11101    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11102        self.inner.channel().on_closed()
11103    }
11104
11105    #[cfg(target_os = "fuchsia")]
11106    fn signal_peer(
11107        &self,
11108        clear_mask: zx::Signals,
11109        set_mask: zx::Signals,
11110    ) -> Result<(), zx_status::Status> {
11111        use fidl::Peered;
11112        self.inner.channel().signal_peer(clear_mask, set_mask)
11113    }
11114}
11115
11116impl TracingResourceControlHandle {}
11117
11118#[must_use = "FIDL methods require a response to be sent"]
11119#[derive(Debug)]
11120pub struct TracingResourceGetResponder {
11121    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
11122    tx_id: u32,
11123}
11124
11125/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
11126/// if the responder is dropped without sending a response, so that the client
11127/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11128impl std::ops::Drop for TracingResourceGetResponder {
11129    fn drop(&mut self) {
11130        self.control_handle.shutdown();
11131        // Safety: drops once, never accessed again
11132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11133    }
11134}
11135
11136impl fidl::endpoints::Responder for TracingResourceGetResponder {
11137    type ControlHandle = TracingResourceControlHandle;
11138
11139    fn control_handle(&self) -> &TracingResourceControlHandle {
11140        &self.control_handle
11141    }
11142
11143    fn drop_without_shutdown(mut self) {
11144        // Safety: drops once, never accessed again due to mem::forget
11145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11146        // Prevent Drop from running (which would shut down the channel)
11147        std::mem::forget(self);
11148    }
11149}
11150
11151impl TracingResourceGetResponder {
11152    /// Sends a response to the FIDL transaction.
11153    ///
11154    /// Sets the channel to shutdown if an error occurs.
11155    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11156        let _result = self.send_raw(resource);
11157        if _result.is_err() {
11158            self.control_handle.shutdown();
11159        }
11160        self.drop_without_shutdown();
11161        _result
11162    }
11163
11164    /// Similar to "send" but does not shutdown the channel if an error occurs.
11165    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11166        let _result = self.send_raw(resource);
11167        self.drop_without_shutdown();
11168        _result
11169    }
11170
11171    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11172        self.control_handle.inner.send::<TracingResourceGetResponse>(
11173            (resource,),
11174            self.tx_id,
11175            0x299bc179aa54c6aa,
11176            fidl::encoding::DynamicFlags::empty(),
11177        )
11178    }
11179}
11180
11181#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
11182pub struct VmexResourceMarker;
11183
11184impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
11185    type Proxy = VmexResourceProxy;
11186    type RequestStream = VmexResourceRequestStream;
11187    #[cfg(target_os = "fuchsia")]
11188    type SynchronousProxy = VmexResourceSynchronousProxy;
11189
11190    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
11191}
11192impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
11193
11194pub trait VmexResourceProxyInterface: Send + Sync {
11195    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
11196    fn r#get(&self) -> Self::GetResponseFut;
11197}
11198#[derive(Debug)]
11199#[cfg(target_os = "fuchsia")]
11200pub struct VmexResourceSynchronousProxy {
11201    client: fidl::client::sync::Client,
11202}
11203
11204#[cfg(target_os = "fuchsia")]
11205impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
11206    type Proxy = VmexResourceProxy;
11207    type Protocol = VmexResourceMarker;
11208
11209    fn from_channel(inner: fidl::Channel) -> Self {
11210        Self::new(inner)
11211    }
11212
11213    fn into_channel(self) -> fidl::Channel {
11214        self.client.into_channel()
11215    }
11216
11217    fn as_channel(&self) -> &fidl::Channel {
11218        self.client.as_channel()
11219    }
11220}
11221
11222#[cfg(target_os = "fuchsia")]
11223impl VmexResourceSynchronousProxy {
11224    pub fn new(channel: fidl::Channel) -> Self {
11225        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11226        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
11227    }
11228
11229    pub fn into_channel(self) -> fidl::Channel {
11230        self.client.into_channel()
11231    }
11232
11233    /// Waits until an event arrives and returns it. It is safe for other
11234    /// threads to make concurrent requests while waiting for an event.
11235    pub fn wait_for_event(
11236        &self,
11237        deadline: zx::MonotonicInstant,
11238    ) -> Result<VmexResourceEvent, fidl::Error> {
11239        VmexResourceEvent::decode(self.client.wait_for_event(deadline)?)
11240    }
11241
11242    /// Get a VMEX resource handle.
11243    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
11244        let _response =
11245            self.client.send_query::<fidl::encoding::EmptyPayload, VmexResourceGetResponse>(
11246                (),
11247                0x33db32deed650699,
11248                fidl::encoding::DynamicFlags::empty(),
11249                ___deadline,
11250            )?;
11251        Ok(_response.resource)
11252    }
11253}
11254
11255#[cfg(target_os = "fuchsia")]
11256impl From<VmexResourceSynchronousProxy> for zx::NullableHandle {
11257    fn from(value: VmexResourceSynchronousProxy) -> Self {
11258        value.into_channel().into()
11259    }
11260}
11261
11262#[cfg(target_os = "fuchsia")]
11263impl From<fidl::Channel> for VmexResourceSynchronousProxy {
11264    fn from(value: fidl::Channel) -> Self {
11265        Self::new(value)
11266    }
11267}
11268
11269#[cfg(target_os = "fuchsia")]
11270impl fidl::endpoints::FromClient for VmexResourceSynchronousProxy {
11271    type Protocol = VmexResourceMarker;
11272
11273    fn from_client(value: fidl::endpoints::ClientEnd<VmexResourceMarker>) -> Self {
11274        Self::new(value.into_channel())
11275    }
11276}
11277
11278#[derive(Debug, Clone)]
11279pub struct VmexResourceProxy {
11280    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11281}
11282
11283impl fidl::endpoints::Proxy for VmexResourceProxy {
11284    type Protocol = VmexResourceMarker;
11285
11286    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11287        Self::new(inner)
11288    }
11289
11290    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11291        self.client.into_channel().map_err(|client| Self { client })
11292    }
11293
11294    fn as_channel(&self) -> &::fidl::AsyncChannel {
11295        self.client.as_channel()
11296    }
11297}
11298
11299impl VmexResourceProxy {
11300    /// Create a new Proxy for fuchsia.kernel/VmexResource.
11301    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11302        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11303        Self { client: fidl::client::Client::new(channel, protocol_name) }
11304    }
11305
11306    /// Get a Stream of events from the remote end of the protocol.
11307    ///
11308    /// # Panics
11309    ///
11310    /// Panics if the event stream was already taken.
11311    pub fn take_event_stream(&self) -> VmexResourceEventStream {
11312        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
11313    }
11314
11315    /// Get a VMEX resource handle.
11316    pub fn r#get(
11317        &self,
11318    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
11319    {
11320        VmexResourceProxyInterface::r#get(self)
11321    }
11322}
11323
11324impl VmexResourceProxyInterface for VmexResourceProxy {
11325    type GetResponseFut = fidl::client::QueryResponseFut<
11326        fidl::Resource,
11327        fidl::encoding::DefaultFuchsiaResourceDialect,
11328    >;
11329    fn r#get(&self) -> Self::GetResponseFut {
11330        fn _decode(
11331            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11332        ) -> Result<fidl::Resource, fidl::Error> {
11333            let _response = fidl::client::decode_transaction_body::<
11334                VmexResourceGetResponse,
11335                fidl::encoding::DefaultFuchsiaResourceDialect,
11336                0x33db32deed650699,
11337            >(_buf?)?;
11338            Ok(_response.resource)
11339        }
11340        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
11341            (),
11342            0x33db32deed650699,
11343            fidl::encoding::DynamicFlags::empty(),
11344            _decode,
11345        )
11346    }
11347}
11348
11349pub struct VmexResourceEventStream {
11350    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11351}
11352
11353impl std::marker::Unpin for VmexResourceEventStream {}
11354
11355impl futures::stream::FusedStream for VmexResourceEventStream {
11356    fn is_terminated(&self) -> bool {
11357        self.event_receiver.is_terminated()
11358    }
11359}
11360
11361impl futures::Stream for VmexResourceEventStream {
11362    type Item = Result<VmexResourceEvent, fidl::Error>;
11363
11364    fn poll_next(
11365        mut self: std::pin::Pin<&mut Self>,
11366        cx: &mut std::task::Context<'_>,
11367    ) -> std::task::Poll<Option<Self::Item>> {
11368        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11369            &mut self.event_receiver,
11370            cx
11371        )?) {
11372            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
11373            None => std::task::Poll::Ready(None),
11374        }
11375    }
11376}
11377
11378#[derive(Debug)]
11379pub enum VmexResourceEvent {}
11380
11381impl VmexResourceEvent {
11382    /// Decodes a message buffer as a [`VmexResourceEvent`].
11383    fn decode(
11384        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11385    ) -> Result<VmexResourceEvent, fidl::Error> {
11386        let (bytes, _handles) = buf.split_mut();
11387        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11388        debug_assert_eq!(tx_header.tx_id, 0);
11389        match tx_header.ordinal {
11390            _ => Err(fidl::Error::UnknownOrdinal {
11391                ordinal: tx_header.ordinal,
11392                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11393            }),
11394        }
11395    }
11396}
11397
11398/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
11399pub struct VmexResourceRequestStream {
11400    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11401    is_terminated: bool,
11402}
11403
11404impl std::marker::Unpin for VmexResourceRequestStream {}
11405
11406impl futures::stream::FusedStream for VmexResourceRequestStream {
11407    fn is_terminated(&self) -> bool {
11408        self.is_terminated
11409    }
11410}
11411
11412impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
11413    type Protocol = VmexResourceMarker;
11414    type ControlHandle = VmexResourceControlHandle;
11415
11416    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11417        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11418    }
11419
11420    fn control_handle(&self) -> Self::ControlHandle {
11421        VmexResourceControlHandle { inner: self.inner.clone() }
11422    }
11423
11424    fn into_inner(
11425        self,
11426    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11427    {
11428        (self.inner, self.is_terminated)
11429    }
11430
11431    fn from_inner(
11432        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11433        is_terminated: bool,
11434    ) -> Self {
11435        Self { inner, is_terminated }
11436    }
11437}
11438
11439impl futures::Stream for VmexResourceRequestStream {
11440    type Item = Result<VmexResourceRequest, fidl::Error>;
11441
11442    fn poll_next(
11443        mut self: std::pin::Pin<&mut Self>,
11444        cx: &mut std::task::Context<'_>,
11445    ) -> std::task::Poll<Option<Self::Item>> {
11446        let this = &mut *self;
11447        if this.inner.check_shutdown(cx) {
11448            this.is_terminated = true;
11449            return std::task::Poll::Ready(None);
11450        }
11451        if this.is_terminated {
11452            panic!("polled VmexResourceRequestStream after completion");
11453        }
11454        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11455            |bytes, handles| {
11456                match this.inner.channel().read_etc(cx, bytes, handles) {
11457                    std::task::Poll::Ready(Ok(())) => {}
11458                    std::task::Poll::Pending => return std::task::Poll::Pending,
11459                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11460                        this.is_terminated = true;
11461                        return std::task::Poll::Ready(None);
11462                    }
11463                    std::task::Poll::Ready(Err(e)) => {
11464                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11465                            e.into(),
11466                        ))));
11467                    }
11468                }
11469
11470                // A message has been received from the channel
11471                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11472
11473                std::task::Poll::Ready(Some(match header.ordinal {
11474                    0x33db32deed650699 => {
11475                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11476                        let mut req = fidl::new_empty!(
11477                            fidl::encoding::EmptyPayload,
11478                            fidl::encoding::DefaultFuchsiaResourceDialect
11479                        );
11480                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11481                        let control_handle =
11482                            VmexResourceControlHandle { inner: this.inner.clone() };
11483                        Ok(VmexResourceRequest::Get {
11484                            responder: VmexResourceGetResponder {
11485                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11486                                tx_id: header.tx_id,
11487                            },
11488                        })
11489                    }
11490                    _ => Err(fidl::Error::UnknownOrdinal {
11491                        ordinal: header.ordinal,
11492                        protocol_name:
11493                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11494                    }),
11495                }))
11496            },
11497        )
11498    }
11499}
11500
11501/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11502/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
11503/// executable.
11504#[derive(Debug)]
11505pub enum VmexResourceRequest {
11506    /// Get a VMEX resource handle.
11507    Get { responder: VmexResourceGetResponder },
11508}
11509
11510impl VmexResourceRequest {
11511    #[allow(irrefutable_let_patterns)]
11512    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
11513        if let VmexResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11514    }
11515
11516    /// Name of the method defined in FIDL
11517    pub fn method_name(&self) -> &'static str {
11518        match *self {
11519            VmexResourceRequest::Get { .. } => "get",
11520        }
11521    }
11522}
11523
11524#[derive(Debug, Clone)]
11525pub struct VmexResourceControlHandle {
11526    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11527}
11528
11529impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
11530    fn shutdown(&self) {
11531        self.inner.shutdown()
11532    }
11533
11534    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
11535        self.inner.shutdown_with_epitaph(status)
11536    }
11537
11538    fn is_closed(&self) -> bool {
11539        self.inner.channel().is_closed()
11540    }
11541    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11542        self.inner.channel().on_closed()
11543    }
11544
11545    #[cfg(target_os = "fuchsia")]
11546    fn signal_peer(
11547        &self,
11548        clear_mask: zx::Signals,
11549        set_mask: zx::Signals,
11550    ) -> Result<(), zx_status::Status> {
11551        use fidl::Peered;
11552        self.inner.channel().signal_peer(clear_mask, set_mask)
11553    }
11554}
11555
11556impl VmexResourceControlHandle {}
11557
11558#[must_use = "FIDL methods require a response to be sent"]
11559#[derive(Debug)]
11560pub struct VmexResourceGetResponder {
11561    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
11562    tx_id: u32,
11563}
11564
11565/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
11566/// if the responder is dropped without sending a response, so that the client
11567/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11568impl std::ops::Drop for VmexResourceGetResponder {
11569    fn drop(&mut self) {
11570        self.control_handle.shutdown();
11571        // Safety: drops once, never accessed again
11572        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11573    }
11574}
11575
11576impl fidl::endpoints::Responder for VmexResourceGetResponder {
11577    type ControlHandle = VmexResourceControlHandle;
11578
11579    fn control_handle(&self) -> &VmexResourceControlHandle {
11580        &self.control_handle
11581    }
11582
11583    fn drop_without_shutdown(mut self) {
11584        // Safety: drops once, never accessed again due to mem::forget
11585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11586        // Prevent Drop from running (which would shut down the channel)
11587        std::mem::forget(self);
11588    }
11589}
11590
11591impl VmexResourceGetResponder {
11592    /// Sends a response to the FIDL transaction.
11593    ///
11594    /// Sets the channel to shutdown if an error occurs.
11595    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11596        let _result = self.send_raw(resource);
11597        if _result.is_err() {
11598            self.control_handle.shutdown();
11599        }
11600        self.drop_without_shutdown();
11601        _result
11602    }
11603
11604    /// Similar to "send" but does not shutdown the channel if an error occurs.
11605    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11606        let _result = self.send_raw(resource);
11607        self.drop_without_shutdown();
11608        _result
11609    }
11610
11611    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11612        self.control_handle.inner.send::<VmexResourceGetResponse>(
11613            (resource,),
11614            self.tx_id,
11615            0x33db32deed650699,
11616            fidl::encoding::DynamicFlags::empty(),
11617        )
11618    }
11619}
11620
11621mod internal {
11622    use super::*;
11623
11624    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
11625        type Borrowed<'a> = &'a mut Self;
11626        fn take_or_borrow<'a>(
11627            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11628        ) -> Self::Borrowed<'a> {
11629            value
11630        }
11631    }
11632
11633    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
11634        type Owned = Self;
11635
11636        #[inline(always)]
11637        fn inline_align(_context: fidl::encoding::Context) -> usize {
11638            8
11639        }
11640
11641        #[inline(always)]
11642        fn inline_size(_context: fidl::encoding::Context) -> usize {
11643            24
11644        }
11645    }
11646
11647    unsafe impl
11648        fidl::encoding::Encode<
11649            CounterGetInspectVmoResponse,
11650            fidl::encoding::DefaultFuchsiaResourceDialect,
11651        > for &mut CounterGetInspectVmoResponse
11652    {
11653        #[inline]
11654        unsafe fn encode(
11655            self,
11656            encoder: &mut fidl::encoding::Encoder<
11657                '_,
11658                fidl::encoding::DefaultFuchsiaResourceDialect,
11659            >,
11660            offset: usize,
11661            _depth: fidl::encoding::Depth,
11662        ) -> fidl::Result<()> {
11663            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11664            // Delegate to tuple encoding.
11665            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11666                (
11667                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
11668                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
11669                ),
11670                encoder, offset, _depth
11671            )
11672        }
11673    }
11674    unsafe impl<
11675        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11676        T1: fidl::encoding::Encode<
11677                fidl_fuchsia_mem::Buffer,
11678                fidl::encoding::DefaultFuchsiaResourceDialect,
11679            >,
11680    >
11681        fidl::encoding::Encode<
11682            CounterGetInspectVmoResponse,
11683            fidl::encoding::DefaultFuchsiaResourceDialect,
11684        > for (T0, T1)
11685    {
11686        #[inline]
11687        unsafe fn encode(
11688            self,
11689            encoder: &mut fidl::encoding::Encoder<
11690                '_,
11691                fidl::encoding::DefaultFuchsiaResourceDialect,
11692            >,
11693            offset: usize,
11694            depth: fidl::encoding::Depth,
11695        ) -> fidl::Result<()> {
11696            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11697            // Zero out padding regions. There's no need to apply masks
11698            // because the unmasked parts will be overwritten by fields.
11699            unsafe {
11700                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11701                (ptr as *mut u64).write_unaligned(0);
11702            }
11703            // Write the fields.
11704            self.0.encode(encoder, offset + 0, depth)?;
11705            self.1.encode(encoder, offset + 8, depth)?;
11706            Ok(())
11707        }
11708    }
11709
11710    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11711        for CounterGetInspectVmoResponse
11712    {
11713        #[inline(always)]
11714        fn new_empty() -> Self {
11715            Self {
11716                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
11717                buffer: fidl::new_empty!(
11718                    fidl_fuchsia_mem::Buffer,
11719                    fidl::encoding::DefaultFuchsiaResourceDialect
11720                ),
11721            }
11722        }
11723
11724        #[inline]
11725        unsafe fn decode(
11726            &mut self,
11727            decoder: &mut fidl::encoding::Decoder<
11728                '_,
11729                fidl::encoding::DefaultFuchsiaResourceDialect,
11730            >,
11731            offset: usize,
11732            _depth: fidl::encoding::Depth,
11733        ) -> fidl::Result<()> {
11734            decoder.debug_check_bounds::<Self>(offset);
11735            // Verify that padding bytes are zero.
11736            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11737            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11738            let mask = 0xffffffff00000000u64;
11739            let maskedval = padval & mask;
11740            if maskedval != 0 {
11741                return Err(fidl::Error::NonZeroPadding {
11742                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11743                });
11744            }
11745            fidl::decode!(
11746                i32,
11747                fidl::encoding::DefaultFuchsiaResourceDialect,
11748                &mut self.status,
11749                decoder,
11750                offset + 0,
11751                _depth
11752            )?;
11753            fidl::decode!(
11754                fidl_fuchsia_mem::Buffer,
11755                fidl::encoding::DefaultFuchsiaResourceDialect,
11756                &mut self.buffer,
11757                decoder,
11758                offset + 8,
11759                _depth
11760            )?;
11761            Ok(())
11762        }
11763    }
11764
11765    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
11766        type Borrowed<'a> = &'a mut Self;
11767        fn take_or_borrow<'a>(
11768            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11769        ) -> Self::Borrowed<'a> {
11770            value
11771        }
11772    }
11773
11774    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
11775        type Owned = Self;
11776
11777        #[inline(always)]
11778        fn inline_align(_context: fidl::encoding::Context) -> usize {
11779            4
11780        }
11781
11782        #[inline(always)]
11783        fn inline_size(_context: fidl::encoding::Context) -> usize {
11784            4
11785        }
11786    }
11787
11788    unsafe impl
11789        fidl::encoding::Encode<
11790            CpuResourceGetResponse,
11791            fidl::encoding::DefaultFuchsiaResourceDialect,
11792        > for &mut CpuResourceGetResponse
11793    {
11794        #[inline]
11795        unsafe fn encode(
11796            self,
11797            encoder: &mut fidl::encoding::Encoder<
11798                '_,
11799                fidl::encoding::DefaultFuchsiaResourceDialect,
11800            >,
11801            offset: usize,
11802            _depth: fidl::encoding::Depth,
11803        ) -> fidl::Result<()> {
11804            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11805            // Delegate to tuple encoding.
11806            fidl::encoding::Encode::<
11807                CpuResourceGetResponse,
11808                fidl::encoding::DefaultFuchsiaResourceDialect,
11809            >::encode(
11810                (<fidl::encoding::HandleType<
11811                    fidl::Resource,
11812                    { fidl::ObjectType::RESOURCE.into_raw() },
11813                    2147483648,
11814                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11815                    &mut self.resource
11816                ),),
11817                encoder,
11818                offset,
11819                _depth,
11820            )
11821        }
11822    }
11823    unsafe impl<
11824        T0: fidl::encoding::Encode<
11825                fidl::encoding::HandleType<
11826                    fidl::Resource,
11827                    { fidl::ObjectType::RESOURCE.into_raw() },
11828                    2147483648,
11829                >,
11830                fidl::encoding::DefaultFuchsiaResourceDialect,
11831            >,
11832    >
11833        fidl::encoding::Encode<
11834            CpuResourceGetResponse,
11835            fidl::encoding::DefaultFuchsiaResourceDialect,
11836        > for (T0,)
11837    {
11838        #[inline]
11839        unsafe fn encode(
11840            self,
11841            encoder: &mut fidl::encoding::Encoder<
11842                '_,
11843                fidl::encoding::DefaultFuchsiaResourceDialect,
11844            >,
11845            offset: usize,
11846            depth: fidl::encoding::Depth,
11847        ) -> fidl::Result<()> {
11848            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11849            // Zero out padding regions. There's no need to apply masks
11850            // because the unmasked parts will be overwritten by fields.
11851            // Write the fields.
11852            self.0.encode(encoder, offset + 0, depth)?;
11853            Ok(())
11854        }
11855    }
11856
11857    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11858        for CpuResourceGetResponse
11859    {
11860        #[inline(always)]
11861        fn new_empty() -> Self {
11862            Self {
11863                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11864            }
11865        }
11866
11867        #[inline]
11868        unsafe fn decode(
11869            &mut self,
11870            decoder: &mut fidl::encoding::Decoder<
11871                '_,
11872                fidl::encoding::DefaultFuchsiaResourceDialect,
11873            >,
11874            offset: usize,
11875            _depth: fidl::encoding::Depth,
11876        ) -> fidl::Result<()> {
11877            decoder.debug_check_bounds::<Self>(offset);
11878            // Verify that padding bytes are zero.
11879            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11880            Ok(())
11881        }
11882    }
11883
11884    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
11885        type Borrowed<'a> = &'a mut Self;
11886        fn take_or_borrow<'a>(
11887            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11888        ) -> Self::Borrowed<'a> {
11889            value
11890        }
11891    }
11892
11893    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
11894        type Owned = Self;
11895
11896        #[inline(always)]
11897        fn inline_align(_context: fidl::encoding::Context) -> usize {
11898            4
11899        }
11900
11901        #[inline(always)]
11902        fn inline_size(_context: fidl::encoding::Context) -> usize {
11903            4
11904        }
11905    }
11906
11907    unsafe impl
11908        fidl::encoding::Encode<
11909            DebugResourceGetResponse,
11910            fidl::encoding::DefaultFuchsiaResourceDialect,
11911        > for &mut DebugResourceGetResponse
11912    {
11913        #[inline]
11914        unsafe fn encode(
11915            self,
11916            encoder: &mut fidl::encoding::Encoder<
11917                '_,
11918                fidl::encoding::DefaultFuchsiaResourceDialect,
11919            >,
11920            offset: usize,
11921            _depth: fidl::encoding::Depth,
11922        ) -> fidl::Result<()> {
11923            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11924            // Delegate to tuple encoding.
11925            fidl::encoding::Encode::<
11926                DebugResourceGetResponse,
11927                fidl::encoding::DefaultFuchsiaResourceDialect,
11928            >::encode(
11929                (<fidl::encoding::HandleType<
11930                    fidl::Resource,
11931                    { fidl::ObjectType::RESOURCE.into_raw() },
11932                    2147483648,
11933                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11934                    &mut self.resource
11935                ),),
11936                encoder,
11937                offset,
11938                _depth,
11939            )
11940        }
11941    }
11942    unsafe impl<
11943        T0: fidl::encoding::Encode<
11944                fidl::encoding::HandleType<
11945                    fidl::Resource,
11946                    { fidl::ObjectType::RESOURCE.into_raw() },
11947                    2147483648,
11948                >,
11949                fidl::encoding::DefaultFuchsiaResourceDialect,
11950            >,
11951    >
11952        fidl::encoding::Encode<
11953            DebugResourceGetResponse,
11954            fidl::encoding::DefaultFuchsiaResourceDialect,
11955        > for (T0,)
11956    {
11957        #[inline]
11958        unsafe fn encode(
11959            self,
11960            encoder: &mut fidl::encoding::Encoder<
11961                '_,
11962                fidl::encoding::DefaultFuchsiaResourceDialect,
11963            >,
11964            offset: usize,
11965            depth: fidl::encoding::Depth,
11966        ) -> fidl::Result<()> {
11967            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11968            // Zero out padding regions. There's no need to apply masks
11969            // because the unmasked parts will be overwritten by fields.
11970            // Write the fields.
11971            self.0.encode(encoder, offset + 0, depth)?;
11972            Ok(())
11973        }
11974    }
11975
11976    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11977        for DebugResourceGetResponse
11978    {
11979        #[inline(always)]
11980        fn new_empty() -> Self {
11981            Self {
11982                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11983            }
11984        }
11985
11986        #[inline]
11987        unsafe fn decode(
11988            &mut self,
11989            decoder: &mut fidl::encoding::Decoder<
11990                '_,
11991                fidl::encoding::DefaultFuchsiaResourceDialect,
11992            >,
11993            offset: usize,
11994            _depth: fidl::encoding::Depth,
11995        ) -> fidl::Result<()> {
11996            decoder.debug_check_bounds::<Self>(offset);
11997            // Verify that padding bytes are zero.
11998            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11999            Ok(())
12000        }
12001    }
12002
12003    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
12004        type Borrowed<'a> = &'a mut Self;
12005        fn take_or_borrow<'a>(
12006            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12007        ) -> Self::Borrowed<'a> {
12008            value
12009        }
12010    }
12011
12012    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
12013        type Owned = Self;
12014
12015        #[inline(always)]
12016        fn inline_align(_context: fidl::encoding::Context) -> usize {
12017            4
12018        }
12019
12020        #[inline(always)]
12021        fn inline_size(_context: fidl::encoding::Context) -> usize {
12022            4
12023        }
12024    }
12025
12026    unsafe impl
12027        fidl::encoding::Encode<
12028            DebuglogResourceGetResponse,
12029            fidl::encoding::DefaultFuchsiaResourceDialect,
12030        > for &mut DebuglogResourceGetResponse
12031    {
12032        #[inline]
12033        unsafe fn encode(
12034            self,
12035            encoder: &mut fidl::encoding::Encoder<
12036                '_,
12037                fidl::encoding::DefaultFuchsiaResourceDialect,
12038            >,
12039            offset: usize,
12040            _depth: fidl::encoding::Depth,
12041        ) -> fidl::Result<()> {
12042            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
12043            // Delegate to tuple encoding.
12044            fidl::encoding::Encode::<
12045                DebuglogResourceGetResponse,
12046                fidl::encoding::DefaultFuchsiaResourceDialect,
12047            >::encode(
12048                (<fidl::encoding::HandleType<
12049                    fidl::Resource,
12050                    { fidl::ObjectType::RESOURCE.into_raw() },
12051                    2147483648,
12052                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12053                    &mut self.resource
12054                ),),
12055                encoder,
12056                offset,
12057                _depth,
12058            )
12059        }
12060    }
12061    unsafe impl<
12062        T0: fidl::encoding::Encode<
12063                fidl::encoding::HandleType<
12064                    fidl::Resource,
12065                    { fidl::ObjectType::RESOURCE.into_raw() },
12066                    2147483648,
12067                >,
12068                fidl::encoding::DefaultFuchsiaResourceDialect,
12069            >,
12070    >
12071        fidl::encoding::Encode<
12072            DebuglogResourceGetResponse,
12073            fidl::encoding::DefaultFuchsiaResourceDialect,
12074        > for (T0,)
12075    {
12076        #[inline]
12077        unsafe fn encode(
12078            self,
12079            encoder: &mut fidl::encoding::Encoder<
12080                '_,
12081                fidl::encoding::DefaultFuchsiaResourceDialect,
12082            >,
12083            offset: usize,
12084            depth: fidl::encoding::Depth,
12085        ) -> fidl::Result<()> {
12086            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
12087            // Zero out padding regions. There's no need to apply masks
12088            // because the unmasked parts will be overwritten by fields.
12089            // Write the fields.
12090            self.0.encode(encoder, offset + 0, depth)?;
12091            Ok(())
12092        }
12093    }
12094
12095    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12096        for DebuglogResourceGetResponse
12097    {
12098        #[inline(always)]
12099        fn new_empty() -> Self {
12100            Self {
12101                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12102            }
12103        }
12104
12105        #[inline]
12106        unsafe fn decode(
12107            &mut self,
12108            decoder: &mut fidl::encoding::Decoder<
12109                '_,
12110                fidl::encoding::DefaultFuchsiaResourceDialect,
12111            >,
12112            offset: usize,
12113            _depth: fidl::encoding::Depth,
12114        ) -> fidl::Result<()> {
12115            decoder.debug_check_bounds::<Self>(offset);
12116            // Verify that padding bytes are zero.
12117            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12118            Ok(())
12119        }
12120    }
12121
12122    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
12123        type Borrowed<'a> = &'a mut Self;
12124        fn take_or_borrow<'a>(
12125            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12126        ) -> Self::Borrowed<'a> {
12127            value
12128        }
12129    }
12130
12131    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
12132        type Owned = Self;
12133
12134        #[inline(always)]
12135        fn inline_align(_context: fidl::encoding::Context) -> usize {
12136            4
12137        }
12138
12139        #[inline(always)]
12140        fn inline_size(_context: fidl::encoding::Context) -> usize {
12141            4
12142        }
12143    }
12144
12145    unsafe impl
12146        fidl::encoding::Encode<
12147            EnergyInfoResourceGetResponse,
12148            fidl::encoding::DefaultFuchsiaResourceDialect,
12149        > for &mut EnergyInfoResourceGetResponse
12150    {
12151        #[inline]
12152        unsafe fn encode(
12153            self,
12154            encoder: &mut fidl::encoding::Encoder<
12155                '_,
12156                fidl::encoding::DefaultFuchsiaResourceDialect,
12157            >,
12158            offset: usize,
12159            _depth: fidl::encoding::Depth,
12160        ) -> fidl::Result<()> {
12161            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
12162            // Delegate to tuple encoding.
12163            fidl::encoding::Encode::<
12164                EnergyInfoResourceGetResponse,
12165                fidl::encoding::DefaultFuchsiaResourceDialect,
12166            >::encode(
12167                (<fidl::encoding::HandleType<
12168                    fidl::Resource,
12169                    { fidl::ObjectType::RESOURCE.into_raw() },
12170                    2147483648,
12171                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12172                    &mut self.resource
12173                ),),
12174                encoder,
12175                offset,
12176                _depth,
12177            )
12178        }
12179    }
12180    unsafe impl<
12181        T0: fidl::encoding::Encode<
12182                fidl::encoding::HandleType<
12183                    fidl::Resource,
12184                    { fidl::ObjectType::RESOURCE.into_raw() },
12185                    2147483648,
12186                >,
12187                fidl::encoding::DefaultFuchsiaResourceDialect,
12188            >,
12189    >
12190        fidl::encoding::Encode<
12191            EnergyInfoResourceGetResponse,
12192            fidl::encoding::DefaultFuchsiaResourceDialect,
12193        > for (T0,)
12194    {
12195        #[inline]
12196        unsafe fn encode(
12197            self,
12198            encoder: &mut fidl::encoding::Encoder<
12199                '_,
12200                fidl::encoding::DefaultFuchsiaResourceDialect,
12201            >,
12202            offset: usize,
12203            depth: fidl::encoding::Depth,
12204        ) -> fidl::Result<()> {
12205            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
12206            // Zero out padding regions. There's no need to apply masks
12207            // because the unmasked parts will be overwritten by fields.
12208            // Write the fields.
12209            self.0.encode(encoder, offset + 0, depth)?;
12210            Ok(())
12211        }
12212    }
12213
12214    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12215        for EnergyInfoResourceGetResponse
12216    {
12217        #[inline(always)]
12218        fn new_empty() -> Self {
12219            Self {
12220                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12221            }
12222        }
12223
12224        #[inline]
12225        unsafe fn decode(
12226            &mut self,
12227            decoder: &mut fidl::encoding::Decoder<
12228                '_,
12229                fidl::encoding::DefaultFuchsiaResourceDialect,
12230            >,
12231            offset: usize,
12232            _depth: fidl::encoding::Depth,
12233        ) -> fidl::Result<()> {
12234            decoder.debug_check_bounds::<Self>(offset);
12235            // Verify that padding bytes are zero.
12236            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12237            Ok(())
12238        }
12239    }
12240
12241    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
12242        type Borrowed<'a> = &'a mut Self;
12243        fn take_or_borrow<'a>(
12244            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12245        ) -> Self::Borrowed<'a> {
12246            value
12247        }
12248    }
12249
12250    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
12251        type Owned = Self;
12252
12253        #[inline(always)]
12254        fn inline_align(_context: fidl::encoding::Context) -> usize {
12255            4
12256        }
12257
12258        #[inline(always)]
12259        fn inline_size(_context: fidl::encoding::Context) -> usize {
12260            4
12261        }
12262    }
12263
12264    unsafe impl
12265        fidl::encoding::Encode<
12266            HypervisorResourceGetResponse,
12267            fidl::encoding::DefaultFuchsiaResourceDialect,
12268        > for &mut HypervisorResourceGetResponse
12269    {
12270        #[inline]
12271        unsafe fn encode(
12272            self,
12273            encoder: &mut fidl::encoding::Encoder<
12274                '_,
12275                fidl::encoding::DefaultFuchsiaResourceDialect,
12276            >,
12277            offset: usize,
12278            _depth: fidl::encoding::Depth,
12279        ) -> fidl::Result<()> {
12280            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12281            // Delegate to tuple encoding.
12282            fidl::encoding::Encode::<
12283                HypervisorResourceGetResponse,
12284                fidl::encoding::DefaultFuchsiaResourceDialect,
12285            >::encode(
12286                (<fidl::encoding::HandleType<
12287                    fidl::Resource,
12288                    { fidl::ObjectType::RESOURCE.into_raw() },
12289                    2147483648,
12290                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12291                    &mut self.resource
12292                ),),
12293                encoder,
12294                offset,
12295                _depth,
12296            )
12297        }
12298    }
12299    unsafe impl<
12300        T0: fidl::encoding::Encode<
12301                fidl::encoding::HandleType<
12302                    fidl::Resource,
12303                    { fidl::ObjectType::RESOURCE.into_raw() },
12304                    2147483648,
12305                >,
12306                fidl::encoding::DefaultFuchsiaResourceDialect,
12307            >,
12308    >
12309        fidl::encoding::Encode<
12310            HypervisorResourceGetResponse,
12311            fidl::encoding::DefaultFuchsiaResourceDialect,
12312        > for (T0,)
12313    {
12314        #[inline]
12315        unsafe fn encode(
12316            self,
12317            encoder: &mut fidl::encoding::Encoder<
12318                '_,
12319                fidl::encoding::DefaultFuchsiaResourceDialect,
12320            >,
12321            offset: usize,
12322            depth: fidl::encoding::Depth,
12323        ) -> fidl::Result<()> {
12324            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12325            // Zero out padding regions. There's no need to apply masks
12326            // because the unmasked parts will be overwritten by fields.
12327            // Write the fields.
12328            self.0.encode(encoder, offset + 0, depth)?;
12329            Ok(())
12330        }
12331    }
12332
12333    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12334        for HypervisorResourceGetResponse
12335    {
12336        #[inline(always)]
12337        fn new_empty() -> Self {
12338            Self {
12339                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12340            }
12341        }
12342
12343        #[inline]
12344        unsafe fn decode(
12345            &mut self,
12346            decoder: &mut fidl::encoding::Decoder<
12347                '_,
12348                fidl::encoding::DefaultFuchsiaResourceDialect,
12349            >,
12350            offset: usize,
12351            _depth: fidl::encoding::Depth,
12352        ) -> fidl::Result<()> {
12353            decoder.debug_check_bounds::<Self>(offset);
12354            // Verify that padding bytes are zero.
12355            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12356            Ok(())
12357        }
12358    }
12359
12360    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
12361        type Borrowed<'a> = &'a mut Self;
12362        fn take_or_borrow<'a>(
12363            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12364        ) -> Self::Borrowed<'a> {
12365            value
12366        }
12367    }
12368
12369    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
12370        type Owned = Self;
12371
12372        #[inline(always)]
12373        fn inline_align(_context: fidl::encoding::Context) -> usize {
12374            4
12375        }
12376
12377        #[inline(always)]
12378        fn inline_size(_context: fidl::encoding::Context) -> usize {
12379            4
12380        }
12381    }
12382
12383    unsafe impl
12384        fidl::encoding::Encode<
12385            InfoResourceGetResponse,
12386            fidl::encoding::DefaultFuchsiaResourceDialect,
12387        > for &mut InfoResourceGetResponse
12388    {
12389        #[inline]
12390        unsafe fn encode(
12391            self,
12392            encoder: &mut fidl::encoding::Encoder<
12393                '_,
12394                fidl::encoding::DefaultFuchsiaResourceDialect,
12395            >,
12396            offset: usize,
12397            _depth: fidl::encoding::Depth,
12398        ) -> fidl::Result<()> {
12399            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12400            // Delegate to tuple encoding.
12401            fidl::encoding::Encode::<
12402                InfoResourceGetResponse,
12403                fidl::encoding::DefaultFuchsiaResourceDialect,
12404            >::encode(
12405                (<fidl::encoding::HandleType<
12406                    fidl::Resource,
12407                    { fidl::ObjectType::RESOURCE.into_raw() },
12408                    2147483648,
12409                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12410                    &mut self.resource
12411                ),),
12412                encoder,
12413                offset,
12414                _depth,
12415            )
12416        }
12417    }
12418    unsafe impl<
12419        T0: fidl::encoding::Encode<
12420                fidl::encoding::HandleType<
12421                    fidl::Resource,
12422                    { fidl::ObjectType::RESOURCE.into_raw() },
12423                    2147483648,
12424                >,
12425                fidl::encoding::DefaultFuchsiaResourceDialect,
12426            >,
12427    >
12428        fidl::encoding::Encode<
12429            InfoResourceGetResponse,
12430            fidl::encoding::DefaultFuchsiaResourceDialect,
12431        > for (T0,)
12432    {
12433        #[inline]
12434        unsafe fn encode(
12435            self,
12436            encoder: &mut fidl::encoding::Encoder<
12437                '_,
12438                fidl::encoding::DefaultFuchsiaResourceDialect,
12439            >,
12440            offset: usize,
12441            depth: fidl::encoding::Depth,
12442        ) -> fidl::Result<()> {
12443            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12444            // Zero out padding regions. There's no need to apply masks
12445            // because the unmasked parts will be overwritten by fields.
12446            // Write the fields.
12447            self.0.encode(encoder, offset + 0, depth)?;
12448            Ok(())
12449        }
12450    }
12451
12452    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12453        for InfoResourceGetResponse
12454    {
12455        #[inline(always)]
12456        fn new_empty() -> Self {
12457            Self {
12458                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12459            }
12460        }
12461
12462        #[inline]
12463        unsafe fn decode(
12464            &mut self,
12465            decoder: &mut fidl::encoding::Decoder<
12466                '_,
12467                fidl::encoding::DefaultFuchsiaResourceDialect,
12468            >,
12469            offset: usize,
12470            _depth: fidl::encoding::Depth,
12471        ) -> fidl::Result<()> {
12472            decoder.debug_check_bounds::<Self>(offset);
12473            // Verify that padding bytes are zero.
12474            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12475            Ok(())
12476        }
12477    }
12478
12479    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
12480        type Borrowed<'a> = &'a mut Self;
12481        fn take_or_borrow<'a>(
12482            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12483        ) -> Self::Borrowed<'a> {
12484            value
12485        }
12486    }
12487
12488    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
12489        type Owned = Self;
12490
12491        #[inline(always)]
12492        fn inline_align(_context: fidl::encoding::Context) -> usize {
12493            4
12494        }
12495
12496        #[inline(always)]
12497        fn inline_size(_context: fidl::encoding::Context) -> usize {
12498            4
12499        }
12500    }
12501
12502    unsafe impl
12503        fidl::encoding::Encode<
12504            IommuResourceGetResponse,
12505            fidl::encoding::DefaultFuchsiaResourceDialect,
12506        > for &mut IommuResourceGetResponse
12507    {
12508        #[inline]
12509        unsafe fn encode(
12510            self,
12511            encoder: &mut fidl::encoding::Encoder<
12512                '_,
12513                fidl::encoding::DefaultFuchsiaResourceDialect,
12514            >,
12515            offset: usize,
12516            _depth: fidl::encoding::Depth,
12517        ) -> fidl::Result<()> {
12518            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12519            // Delegate to tuple encoding.
12520            fidl::encoding::Encode::<
12521                IommuResourceGetResponse,
12522                fidl::encoding::DefaultFuchsiaResourceDialect,
12523            >::encode(
12524                (<fidl::encoding::HandleType<
12525                    fidl::Resource,
12526                    { fidl::ObjectType::RESOURCE.into_raw() },
12527                    2147483648,
12528                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12529                    &mut self.resource
12530                ),),
12531                encoder,
12532                offset,
12533                _depth,
12534            )
12535        }
12536    }
12537    unsafe impl<
12538        T0: fidl::encoding::Encode<
12539                fidl::encoding::HandleType<
12540                    fidl::Resource,
12541                    { fidl::ObjectType::RESOURCE.into_raw() },
12542                    2147483648,
12543                >,
12544                fidl::encoding::DefaultFuchsiaResourceDialect,
12545            >,
12546    >
12547        fidl::encoding::Encode<
12548            IommuResourceGetResponse,
12549            fidl::encoding::DefaultFuchsiaResourceDialect,
12550        > for (T0,)
12551    {
12552        #[inline]
12553        unsafe fn encode(
12554            self,
12555            encoder: &mut fidl::encoding::Encoder<
12556                '_,
12557                fidl::encoding::DefaultFuchsiaResourceDialect,
12558            >,
12559            offset: usize,
12560            depth: fidl::encoding::Depth,
12561        ) -> fidl::Result<()> {
12562            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12563            // Zero out padding regions. There's no need to apply masks
12564            // because the unmasked parts will be overwritten by fields.
12565            // Write the fields.
12566            self.0.encode(encoder, offset + 0, depth)?;
12567            Ok(())
12568        }
12569    }
12570
12571    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12572        for IommuResourceGetResponse
12573    {
12574        #[inline(always)]
12575        fn new_empty() -> Self {
12576            Self {
12577                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12578            }
12579        }
12580
12581        #[inline]
12582        unsafe fn decode(
12583            &mut self,
12584            decoder: &mut fidl::encoding::Decoder<
12585                '_,
12586                fidl::encoding::DefaultFuchsiaResourceDialect,
12587            >,
12588            offset: usize,
12589            _depth: fidl::encoding::Depth,
12590        ) -> fidl::Result<()> {
12591            decoder.debug_check_bounds::<Self>(offset);
12592            // Verify that padding bytes are zero.
12593            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12594            Ok(())
12595        }
12596    }
12597
12598    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
12599        type Borrowed<'a> = &'a mut Self;
12600        fn take_or_borrow<'a>(
12601            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12602        ) -> Self::Borrowed<'a> {
12603            value
12604        }
12605    }
12606
12607    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
12608        type Owned = Self;
12609
12610        #[inline(always)]
12611        fn inline_align(_context: fidl::encoding::Context) -> usize {
12612            4
12613        }
12614
12615        #[inline(always)]
12616        fn inline_size(_context: fidl::encoding::Context) -> usize {
12617            4
12618        }
12619    }
12620
12621    unsafe impl
12622        fidl::encoding::Encode<
12623            IoportResourceGetResponse,
12624            fidl::encoding::DefaultFuchsiaResourceDialect,
12625        > for &mut IoportResourceGetResponse
12626    {
12627        #[inline]
12628        unsafe fn encode(
12629            self,
12630            encoder: &mut fidl::encoding::Encoder<
12631                '_,
12632                fidl::encoding::DefaultFuchsiaResourceDialect,
12633            >,
12634            offset: usize,
12635            _depth: fidl::encoding::Depth,
12636        ) -> fidl::Result<()> {
12637            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12638            // Delegate to tuple encoding.
12639            fidl::encoding::Encode::<
12640                IoportResourceGetResponse,
12641                fidl::encoding::DefaultFuchsiaResourceDialect,
12642            >::encode(
12643                (<fidl::encoding::HandleType<
12644                    fidl::Resource,
12645                    { fidl::ObjectType::RESOURCE.into_raw() },
12646                    2147483648,
12647                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12648                    &mut self.resource
12649                ),),
12650                encoder,
12651                offset,
12652                _depth,
12653            )
12654        }
12655    }
12656    unsafe impl<
12657        T0: fidl::encoding::Encode<
12658                fidl::encoding::HandleType<
12659                    fidl::Resource,
12660                    { fidl::ObjectType::RESOURCE.into_raw() },
12661                    2147483648,
12662                >,
12663                fidl::encoding::DefaultFuchsiaResourceDialect,
12664            >,
12665    >
12666        fidl::encoding::Encode<
12667            IoportResourceGetResponse,
12668            fidl::encoding::DefaultFuchsiaResourceDialect,
12669        > for (T0,)
12670    {
12671        #[inline]
12672        unsafe fn encode(
12673            self,
12674            encoder: &mut fidl::encoding::Encoder<
12675                '_,
12676                fidl::encoding::DefaultFuchsiaResourceDialect,
12677            >,
12678            offset: usize,
12679            depth: fidl::encoding::Depth,
12680        ) -> fidl::Result<()> {
12681            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12682            // Zero out padding regions. There's no need to apply masks
12683            // because the unmasked parts will be overwritten by fields.
12684            // Write the fields.
12685            self.0.encode(encoder, offset + 0, depth)?;
12686            Ok(())
12687        }
12688    }
12689
12690    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12691        for IoportResourceGetResponse
12692    {
12693        #[inline(always)]
12694        fn new_empty() -> Self {
12695            Self {
12696                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12697            }
12698        }
12699
12700        #[inline]
12701        unsafe fn decode(
12702            &mut self,
12703            decoder: &mut fidl::encoding::Decoder<
12704                '_,
12705                fidl::encoding::DefaultFuchsiaResourceDialect,
12706            >,
12707            offset: usize,
12708            _depth: fidl::encoding::Depth,
12709        ) -> fidl::Result<()> {
12710            decoder.debug_check_bounds::<Self>(offset);
12711            // Verify that padding bytes are zero.
12712            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12713            Ok(())
12714        }
12715    }
12716
12717    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
12718        type Borrowed<'a> = &'a mut Self;
12719        fn take_or_borrow<'a>(
12720            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12721        ) -> Self::Borrowed<'a> {
12722            value
12723        }
12724    }
12725
12726    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
12727        type Owned = Self;
12728
12729        #[inline(always)]
12730        fn inline_align(_context: fidl::encoding::Context) -> usize {
12731            4
12732        }
12733
12734        #[inline(always)]
12735        fn inline_size(_context: fidl::encoding::Context) -> usize {
12736            4
12737        }
12738    }
12739
12740    unsafe impl
12741        fidl::encoding::Encode<
12742            IrqResourceGetResponse,
12743            fidl::encoding::DefaultFuchsiaResourceDialect,
12744        > for &mut IrqResourceGetResponse
12745    {
12746        #[inline]
12747        unsafe fn encode(
12748            self,
12749            encoder: &mut fidl::encoding::Encoder<
12750                '_,
12751                fidl::encoding::DefaultFuchsiaResourceDialect,
12752            >,
12753            offset: usize,
12754            _depth: fidl::encoding::Depth,
12755        ) -> fidl::Result<()> {
12756            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12757            // Delegate to tuple encoding.
12758            fidl::encoding::Encode::<
12759                IrqResourceGetResponse,
12760                fidl::encoding::DefaultFuchsiaResourceDialect,
12761            >::encode(
12762                (<fidl::encoding::HandleType<
12763                    fidl::Resource,
12764                    { fidl::ObjectType::RESOURCE.into_raw() },
12765                    2147483648,
12766                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12767                    &mut self.resource
12768                ),),
12769                encoder,
12770                offset,
12771                _depth,
12772            )
12773        }
12774    }
12775    unsafe impl<
12776        T0: fidl::encoding::Encode<
12777                fidl::encoding::HandleType<
12778                    fidl::Resource,
12779                    { fidl::ObjectType::RESOURCE.into_raw() },
12780                    2147483648,
12781                >,
12782                fidl::encoding::DefaultFuchsiaResourceDialect,
12783            >,
12784    >
12785        fidl::encoding::Encode<
12786            IrqResourceGetResponse,
12787            fidl::encoding::DefaultFuchsiaResourceDialect,
12788        > for (T0,)
12789    {
12790        #[inline]
12791        unsafe fn encode(
12792            self,
12793            encoder: &mut fidl::encoding::Encoder<
12794                '_,
12795                fidl::encoding::DefaultFuchsiaResourceDialect,
12796            >,
12797            offset: usize,
12798            depth: fidl::encoding::Depth,
12799        ) -> fidl::Result<()> {
12800            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12801            // Zero out padding regions. There's no need to apply masks
12802            // because the unmasked parts will be overwritten by fields.
12803            // Write the fields.
12804            self.0.encode(encoder, offset + 0, depth)?;
12805            Ok(())
12806        }
12807    }
12808
12809    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12810        for IrqResourceGetResponse
12811    {
12812        #[inline(always)]
12813        fn new_empty() -> Self {
12814            Self {
12815                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12816            }
12817        }
12818
12819        #[inline]
12820        unsafe fn decode(
12821            &mut self,
12822            decoder: &mut fidl::encoding::Decoder<
12823                '_,
12824                fidl::encoding::DefaultFuchsiaResourceDialect,
12825            >,
12826            offset: usize,
12827            _depth: fidl::encoding::Depth,
12828        ) -> fidl::Result<()> {
12829            decoder.debug_check_bounds::<Self>(offset);
12830            // Verify that padding bytes are zero.
12831            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12832            Ok(())
12833        }
12834    }
12835
12836    impl fidl::encoding::ResourceTypeMarker for MexecResourceGetResponse {
12837        type Borrowed<'a> = &'a mut Self;
12838        fn take_or_borrow<'a>(
12839            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12840        ) -> Self::Borrowed<'a> {
12841            value
12842        }
12843    }
12844
12845    unsafe impl fidl::encoding::TypeMarker for MexecResourceGetResponse {
12846        type Owned = Self;
12847
12848        #[inline(always)]
12849        fn inline_align(_context: fidl::encoding::Context) -> usize {
12850            4
12851        }
12852
12853        #[inline(always)]
12854        fn inline_size(_context: fidl::encoding::Context) -> usize {
12855            4
12856        }
12857    }
12858
12859    unsafe impl
12860        fidl::encoding::Encode<
12861            MexecResourceGetResponse,
12862            fidl::encoding::DefaultFuchsiaResourceDialect,
12863        > for &mut MexecResourceGetResponse
12864    {
12865        #[inline]
12866        unsafe fn encode(
12867            self,
12868            encoder: &mut fidl::encoding::Encoder<
12869                '_,
12870                fidl::encoding::DefaultFuchsiaResourceDialect,
12871            >,
12872            offset: usize,
12873            _depth: fidl::encoding::Depth,
12874        ) -> fidl::Result<()> {
12875            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12876            // Delegate to tuple encoding.
12877            fidl::encoding::Encode::<
12878                MexecResourceGetResponse,
12879                fidl::encoding::DefaultFuchsiaResourceDialect,
12880            >::encode(
12881                (<fidl::encoding::HandleType<
12882                    fidl::Resource,
12883                    { fidl::ObjectType::RESOURCE.into_raw() },
12884                    2147483648,
12885                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12886                    &mut self.resource
12887                ),),
12888                encoder,
12889                offset,
12890                _depth,
12891            )
12892        }
12893    }
12894    unsafe impl<
12895        T0: fidl::encoding::Encode<
12896                fidl::encoding::HandleType<
12897                    fidl::Resource,
12898                    { fidl::ObjectType::RESOURCE.into_raw() },
12899                    2147483648,
12900                >,
12901                fidl::encoding::DefaultFuchsiaResourceDialect,
12902            >,
12903    >
12904        fidl::encoding::Encode<
12905            MexecResourceGetResponse,
12906            fidl::encoding::DefaultFuchsiaResourceDialect,
12907        > for (T0,)
12908    {
12909        #[inline]
12910        unsafe fn encode(
12911            self,
12912            encoder: &mut fidl::encoding::Encoder<
12913                '_,
12914                fidl::encoding::DefaultFuchsiaResourceDialect,
12915            >,
12916            offset: usize,
12917            depth: fidl::encoding::Depth,
12918        ) -> fidl::Result<()> {
12919            encoder.debug_check_bounds::<MexecResourceGetResponse>(offset);
12920            // Zero out padding regions. There's no need to apply masks
12921            // because the unmasked parts will be overwritten by fields.
12922            // Write the fields.
12923            self.0.encode(encoder, offset + 0, depth)?;
12924            Ok(())
12925        }
12926    }
12927
12928    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12929        for MexecResourceGetResponse
12930    {
12931        #[inline(always)]
12932        fn new_empty() -> Self {
12933            Self {
12934                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12935            }
12936        }
12937
12938        #[inline]
12939        unsafe fn decode(
12940            &mut self,
12941            decoder: &mut fidl::encoding::Decoder<
12942                '_,
12943                fidl::encoding::DefaultFuchsiaResourceDialect,
12944            >,
12945            offset: usize,
12946            _depth: fidl::encoding::Depth,
12947        ) -> fidl::Result<()> {
12948            decoder.debug_check_bounds::<Self>(offset);
12949            // Verify that padding bytes are zero.
12950            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12951            Ok(())
12952        }
12953    }
12954
12955    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
12956        type Borrowed<'a> = &'a mut Self;
12957        fn take_or_borrow<'a>(
12958            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12959        ) -> Self::Borrowed<'a> {
12960            value
12961        }
12962    }
12963
12964    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
12965        type Owned = Self;
12966
12967        #[inline(always)]
12968        fn inline_align(_context: fidl::encoding::Context) -> usize {
12969            4
12970        }
12971
12972        #[inline(always)]
12973        fn inline_size(_context: fidl::encoding::Context) -> usize {
12974            4
12975        }
12976    }
12977
12978    unsafe impl
12979        fidl::encoding::Encode<
12980            MmioResourceGetResponse,
12981            fidl::encoding::DefaultFuchsiaResourceDialect,
12982        > for &mut MmioResourceGetResponse
12983    {
12984        #[inline]
12985        unsafe fn encode(
12986            self,
12987            encoder: &mut fidl::encoding::Encoder<
12988                '_,
12989                fidl::encoding::DefaultFuchsiaResourceDialect,
12990            >,
12991            offset: usize,
12992            _depth: fidl::encoding::Depth,
12993        ) -> fidl::Result<()> {
12994            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12995            // Delegate to tuple encoding.
12996            fidl::encoding::Encode::<
12997                MmioResourceGetResponse,
12998                fidl::encoding::DefaultFuchsiaResourceDialect,
12999            >::encode(
13000                (<fidl::encoding::HandleType<
13001                    fidl::Resource,
13002                    { fidl::ObjectType::RESOURCE.into_raw() },
13003                    2147483648,
13004                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13005                    &mut self.resource
13006                ),),
13007                encoder,
13008                offset,
13009                _depth,
13010            )
13011        }
13012    }
13013    unsafe impl<
13014        T0: fidl::encoding::Encode<
13015                fidl::encoding::HandleType<
13016                    fidl::Resource,
13017                    { fidl::ObjectType::RESOURCE.into_raw() },
13018                    2147483648,
13019                >,
13020                fidl::encoding::DefaultFuchsiaResourceDialect,
13021            >,
13022    >
13023        fidl::encoding::Encode<
13024            MmioResourceGetResponse,
13025            fidl::encoding::DefaultFuchsiaResourceDialect,
13026        > for (T0,)
13027    {
13028        #[inline]
13029        unsafe fn encode(
13030            self,
13031            encoder: &mut fidl::encoding::Encoder<
13032                '_,
13033                fidl::encoding::DefaultFuchsiaResourceDialect,
13034            >,
13035            offset: usize,
13036            depth: fidl::encoding::Depth,
13037        ) -> fidl::Result<()> {
13038            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
13039            // Zero out padding regions. There's no need to apply masks
13040            // because the unmasked parts will be overwritten by fields.
13041            // Write the fields.
13042            self.0.encode(encoder, offset + 0, depth)?;
13043            Ok(())
13044        }
13045    }
13046
13047    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13048        for MmioResourceGetResponse
13049    {
13050        #[inline(always)]
13051        fn new_empty() -> Self {
13052            Self {
13053                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13054            }
13055        }
13056
13057        #[inline]
13058        unsafe fn decode(
13059            &mut self,
13060            decoder: &mut fidl::encoding::Decoder<
13061                '_,
13062                fidl::encoding::DefaultFuchsiaResourceDialect,
13063            >,
13064            offset: usize,
13065            _depth: fidl::encoding::Depth,
13066        ) -> fidl::Result<()> {
13067            decoder.debug_check_bounds::<Self>(offset);
13068            // Verify that padding bytes are zero.
13069            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13070            Ok(())
13071        }
13072    }
13073
13074    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
13075        type Borrowed<'a> = &'a mut Self;
13076        fn take_or_borrow<'a>(
13077            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13078        ) -> Self::Borrowed<'a> {
13079            value
13080        }
13081    }
13082
13083    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
13084        type Owned = Self;
13085
13086        #[inline(always)]
13087        fn inline_align(_context: fidl::encoding::Context) -> usize {
13088            4
13089        }
13090
13091        #[inline(always)]
13092        fn inline_size(_context: fidl::encoding::Context) -> usize {
13093            4
13094        }
13095    }
13096
13097    unsafe impl
13098        fidl::encoding::Encode<
13099            MsiResourceGetResponse,
13100            fidl::encoding::DefaultFuchsiaResourceDialect,
13101        > for &mut MsiResourceGetResponse
13102    {
13103        #[inline]
13104        unsafe fn encode(
13105            self,
13106            encoder: &mut fidl::encoding::Encoder<
13107                '_,
13108                fidl::encoding::DefaultFuchsiaResourceDialect,
13109            >,
13110            offset: usize,
13111            _depth: fidl::encoding::Depth,
13112        ) -> fidl::Result<()> {
13113            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
13114            // Delegate to tuple encoding.
13115            fidl::encoding::Encode::<
13116                MsiResourceGetResponse,
13117                fidl::encoding::DefaultFuchsiaResourceDialect,
13118            >::encode(
13119                (<fidl::encoding::HandleType<
13120                    fidl::Resource,
13121                    { fidl::ObjectType::RESOURCE.into_raw() },
13122                    2147483648,
13123                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13124                    &mut self.resource
13125                ),),
13126                encoder,
13127                offset,
13128                _depth,
13129            )
13130        }
13131    }
13132    unsafe impl<
13133        T0: fidl::encoding::Encode<
13134                fidl::encoding::HandleType<
13135                    fidl::Resource,
13136                    { fidl::ObjectType::RESOURCE.into_raw() },
13137                    2147483648,
13138                >,
13139                fidl::encoding::DefaultFuchsiaResourceDialect,
13140            >,
13141    >
13142        fidl::encoding::Encode<
13143            MsiResourceGetResponse,
13144            fidl::encoding::DefaultFuchsiaResourceDialect,
13145        > for (T0,)
13146    {
13147        #[inline]
13148        unsafe fn encode(
13149            self,
13150            encoder: &mut fidl::encoding::Encoder<
13151                '_,
13152                fidl::encoding::DefaultFuchsiaResourceDialect,
13153            >,
13154            offset: usize,
13155            depth: fidl::encoding::Depth,
13156        ) -> fidl::Result<()> {
13157            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
13158            // Zero out padding regions. There's no need to apply masks
13159            // because the unmasked parts will be overwritten by fields.
13160            // Write the fields.
13161            self.0.encode(encoder, offset + 0, depth)?;
13162            Ok(())
13163        }
13164    }
13165
13166    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13167        for MsiResourceGetResponse
13168    {
13169        #[inline(always)]
13170        fn new_empty() -> Self {
13171            Self {
13172                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13173            }
13174        }
13175
13176        #[inline]
13177        unsafe fn decode(
13178            &mut self,
13179            decoder: &mut fidl::encoding::Decoder<
13180                '_,
13181                fidl::encoding::DefaultFuchsiaResourceDialect,
13182            >,
13183            offset: usize,
13184            _depth: fidl::encoding::Depth,
13185        ) -> fidl::Result<()> {
13186            decoder.debug_check_bounds::<Self>(offset);
13187            // Verify that padding bytes are zero.
13188            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13189            Ok(())
13190        }
13191    }
13192
13193    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
13194        type Borrowed<'a> = &'a mut Self;
13195        fn take_or_borrow<'a>(
13196            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13197        ) -> Self::Borrowed<'a> {
13198            value
13199        }
13200    }
13201
13202    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
13203        type Owned = Self;
13204
13205        #[inline(always)]
13206        fn inline_align(_context: fidl::encoding::Context) -> usize {
13207            4
13208        }
13209
13210        #[inline(always)]
13211        fn inline_size(_context: fidl::encoding::Context) -> usize {
13212            4
13213        }
13214    }
13215
13216    unsafe impl
13217        fidl::encoding::Encode<
13218            PowerResourceGetResponse,
13219            fidl::encoding::DefaultFuchsiaResourceDialect,
13220        > for &mut PowerResourceGetResponse
13221    {
13222        #[inline]
13223        unsafe fn encode(
13224            self,
13225            encoder: &mut fidl::encoding::Encoder<
13226                '_,
13227                fidl::encoding::DefaultFuchsiaResourceDialect,
13228            >,
13229            offset: usize,
13230            _depth: fidl::encoding::Depth,
13231        ) -> fidl::Result<()> {
13232            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
13233            // Delegate to tuple encoding.
13234            fidl::encoding::Encode::<
13235                PowerResourceGetResponse,
13236                fidl::encoding::DefaultFuchsiaResourceDialect,
13237            >::encode(
13238                (<fidl::encoding::HandleType<
13239                    fidl::Resource,
13240                    { fidl::ObjectType::RESOURCE.into_raw() },
13241                    2147483648,
13242                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13243                    &mut self.resource
13244                ),),
13245                encoder,
13246                offset,
13247                _depth,
13248            )
13249        }
13250    }
13251    unsafe impl<
13252        T0: fidl::encoding::Encode<
13253                fidl::encoding::HandleType<
13254                    fidl::Resource,
13255                    { fidl::ObjectType::RESOURCE.into_raw() },
13256                    2147483648,
13257                >,
13258                fidl::encoding::DefaultFuchsiaResourceDialect,
13259            >,
13260    >
13261        fidl::encoding::Encode<
13262            PowerResourceGetResponse,
13263            fidl::encoding::DefaultFuchsiaResourceDialect,
13264        > for (T0,)
13265    {
13266        #[inline]
13267        unsafe fn encode(
13268            self,
13269            encoder: &mut fidl::encoding::Encoder<
13270                '_,
13271                fidl::encoding::DefaultFuchsiaResourceDialect,
13272            >,
13273            offset: usize,
13274            depth: fidl::encoding::Depth,
13275        ) -> fidl::Result<()> {
13276            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
13277            // Zero out padding regions. There's no need to apply masks
13278            // because the unmasked parts will be overwritten by fields.
13279            // Write the fields.
13280            self.0.encode(encoder, offset + 0, depth)?;
13281            Ok(())
13282        }
13283    }
13284
13285    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13286        for PowerResourceGetResponse
13287    {
13288        #[inline(always)]
13289        fn new_empty() -> Self {
13290            Self {
13291                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13292            }
13293        }
13294
13295        #[inline]
13296        unsafe fn decode(
13297            &mut self,
13298            decoder: &mut fidl::encoding::Decoder<
13299                '_,
13300                fidl::encoding::DefaultFuchsiaResourceDialect,
13301            >,
13302            offset: usize,
13303            _depth: fidl::encoding::Depth,
13304        ) -> fidl::Result<()> {
13305            decoder.debug_check_bounds::<Self>(offset);
13306            // Verify that padding bytes are zero.
13307            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13308            Ok(())
13309        }
13310    }
13311
13312    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
13313        type Borrowed<'a> = &'a mut Self;
13314        fn take_or_borrow<'a>(
13315            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13316        ) -> Self::Borrowed<'a> {
13317            value
13318        }
13319    }
13320
13321    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
13322        type Owned = Self;
13323
13324        #[inline(always)]
13325        fn inline_align(_context: fidl::encoding::Context) -> usize {
13326            4
13327        }
13328
13329        #[inline(always)]
13330        fn inline_size(_context: fidl::encoding::Context) -> usize {
13331            4
13332        }
13333    }
13334
13335    unsafe impl
13336        fidl::encoding::Encode<
13337            ProfileResourceGetResponse,
13338            fidl::encoding::DefaultFuchsiaResourceDialect,
13339        > for &mut ProfileResourceGetResponse
13340    {
13341        #[inline]
13342        unsafe fn encode(
13343            self,
13344            encoder: &mut fidl::encoding::Encoder<
13345                '_,
13346                fidl::encoding::DefaultFuchsiaResourceDialect,
13347            >,
13348            offset: usize,
13349            _depth: fidl::encoding::Depth,
13350        ) -> fidl::Result<()> {
13351            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13352            // Delegate to tuple encoding.
13353            fidl::encoding::Encode::<
13354                ProfileResourceGetResponse,
13355                fidl::encoding::DefaultFuchsiaResourceDialect,
13356            >::encode(
13357                (<fidl::encoding::HandleType<
13358                    fidl::Resource,
13359                    { fidl::ObjectType::RESOURCE.into_raw() },
13360                    2147483648,
13361                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13362                    &mut self.resource
13363                ),),
13364                encoder,
13365                offset,
13366                _depth,
13367            )
13368        }
13369    }
13370    unsafe impl<
13371        T0: fidl::encoding::Encode<
13372                fidl::encoding::HandleType<
13373                    fidl::Resource,
13374                    { fidl::ObjectType::RESOURCE.into_raw() },
13375                    2147483648,
13376                >,
13377                fidl::encoding::DefaultFuchsiaResourceDialect,
13378            >,
13379    >
13380        fidl::encoding::Encode<
13381            ProfileResourceGetResponse,
13382            fidl::encoding::DefaultFuchsiaResourceDialect,
13383        > for (T0,)
13384    {
13385        #[inline]
13386        unsafe fn encode(
13387            self,
13388            encoder: &mut fidl::encoding::Encoder<
13389                '_,
13390                fidl::encoding::DefaultFuchsiaResourceDialect,
13391            >,
13392            offset: usize,
13393            depth: fidl::encoding::Depth,
13394        ) -> fidl::Result<()> {
13395            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13396            // Zero out padding regions. There's no need to apply masks
13397            // because the unmasked parts will be overwritten by fields.
13398            // Write the fields.
13399            self.0.encode(encoder, offset + 0, depth)?;
13400            Ok(())
13401        }
13402    }
13403
13404    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13405        for ProfileResourceGetResponse
13406    {
13407        #[inline(always)]
13408        fn new_empty() -> Self {
13409            Self {
13410                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13411            }
13412        }
13413
13414        #[inline]
13415        unsafe fn decode(
13416            &mut self,
13417            decoder: &mut fidl::encoding::Decoder<
13418                '_,
13419                fidl::encoding::DefaultFuchsiaResourceDialect,
13420            >,
13421            offset: usize,
13422            _depth: fidl::encoding::Depth,
13423        ) -> fidl::Result<()> {
13424            decoder.debug_check_bounds::<Self>(offset);
13425            // Verify that padding bytes are zero.
13426            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13427            Ok(())
13428        }
13429    }
13430
13431    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
13432        type Borrowed<'a> = &'a mut Self;
13433        fn take_or_borrow<'a>(
13434            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13435        ) -> Self::Borrowed<'a> {
13436            value
13437        }
13438    }
13439
13440    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
13441        type Owned = Self;
13442
13443        #[inline(always)]
13444        fn inline_align(_context: fidl::encoding::Context) -> usize {
13445            4
13446        }
13447
13448        #[inline(always)]
13449        fn inline_size(_context: fidl::encoding::Context) -> usize {
13450            4
13451        }
13452    }
13453
13454    unsafe impl
13455        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13456        for &mut RootJobGetResponse
13457    {
13458        #[inline]
13459        unsafe fn encode(
13460            self,
13461            encoder: &mut fidl::encoding::Encoder<
13462                '_,
13463                fidl::encoding::DefaultFuchsiaResourceDialect,
13464            >,
13465            offset: usize,
13466            _depth: fidl::encoding::Depth,
13467        ) -> fidl::Result<()> {
13468            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13469            // Delegate to tuple encoding.
13470            fidl::encoding::Encode::<
13471                RootJobGetResponse,
13472                fidl::encoding::DefaultFuchsiaResourceDialect,
13473            >::encode(
13474                (<fidl::encoding::HandleType<
13475                    fidl::Job,
13476                    { fidl::ObjectType::JOB.into_raw() },
13477                    2147483648,
13478                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13479                    &mut self.job
13480                ),),
13481                encoder,
13482                offset,
13483                _depth,
13484            )
13485        }
13486    }
13487    unsafe impl<
13488        T0: fidl::encoding::Encode<
13489                fidl::encoding::HandleType<
13490                    fidl::Job,
13491                    { fidl::ObjectType::JOB.into_raw() },
13492                    2147483648,
13493                >,
13494                fidl::encoding::DefaultFuchsiaResourceDialect,
13495            >,
13496    > fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13497        for (T0,)
13498    {
13499        #[inline]
13500        unsafe fn encode(
13501            self,
13502            encoder: &mut fidl::encoding::Encoder<
13503                '_,
13504                fidl::encoding::DefaultFuchsiaResourceDialect,
13505            >,
13506            offset: usize,
13507            depth: fidl::encoding::Depth,
13508        ) -> fidl::Result<()> {
13509            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13510            // Zero out padding regions. There's no need to apply masks
13511            // because the unmasked parts will be overwritten by fields.
13512            // Write the fields.
13513            self.0.encode(encoder, offset + 0, depth)?;
13514            Ok(())
13515        }
13516    }
13517
13518    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13519        for RootJobGetResponse
13520    {
13521        #[inline(always)]
13522        fn new_empty() -> Self {
13523            Self {
13524                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13525            }
13526        }
13527
13528        #[inline]
13529        unsafe fn decode(
13530            &mut self,
13531            decoder: &mut fidl::encoding::Decoder<
13532                '_,
13533                fidl::encoding::DefaultFuchsiaResourceDialect,
13534            >,
13535            offset: usize,
13536            _depth: fidl::encoding::Depth,
13537        ) -> fidl::Result<()> {
13538            decoder.debug_check_bounds::<Self>(offset);
13539            // Verify that padding bytes are zero.
13540            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
13541            Ok(())
13542        }
13543    }
13544
13545    impl fidl::encoding::ResourceTypeMarker for SamplingResourceGetResponse {
13546        type Borrowed<'a> = &'a mut Self;
13547        fn take_or_borrow<'a>(
13548            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13549        ) -> Self::Borrowed<'a> {
13550            value
13551        }
13552    }
13553
13554    unsafe impl fidl::encoding::TypeMarker for SamplingResourceGetResponse {
13555        type Owned = Self;
13556
13557        #[inline(always)]
13558        fn inline_align(_context: fidl::encoding::Context) -> usize {
13559            4
13560        }
13561
13562        #[inline(always)]
13563        fn inline_size(_context: fidl::encoding::Context) -> usize {
13564            4
13565        }
13566    }
13567
13568    unsafe impl
13569        fidl::encoding::Encode<
13570            SamplingResourceGetResponse,
13571            fidl::encoding::DefaultFuchsiaResourceDialect,
13572        > for &mut SamplingResourceGetResponse
13573    {
13574        #[inline]
13575        unsafe fn encode(
13576            self,
13577            encoder: &mut fidl::encoding::Encoder<
13578                '_,
13579                fidl::encoding::DefaultFuchsiaResourceDialect,
13580            >,
13581            offset: usize,
13582            _depth: fidl::encoding::Depth,
13583        ) -> fidl::Result<()> {
13584            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13585            // Delegate to tuple encoding.
13586            fidl::encoding::Encode::<
13587                SamplingResourceGetResponse,
13588                fidl::encoding::DefaultFuchsiaResourceDialect,
13589            >::encode(
13590                (<fidl::encoding::HandleType<
13591                    fidl::Resource,
13592                    { fidl::ObjectType::RESOURCE.into_raw() },
13593                    2147483648,
13594                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13595                    &mut self.resource
13596                ),),
13597                encoder,
13598                offset,
13599                _depth,
13600            )
13601        }
13602    }
13603    unsafe impl<
13604        T0: fidl::encoding::Encode<
13605                fidl::encoding::HandleType<
13606                    fidl::Resource,
13607                    { fidl::ObjectType::RESOURCE.into_raw() },
13608                    2147483648,
13609                >,
13610                fidl::encoding::DefaultFuchsiaResourceDialect,
13611            >,
13612    >
13613        fidl::encoding::Encode<
13614            SamplingResourceGetResponse,
13615            fidl::encoding::DefaultFuchsiaResourceDialect,
13616        > for (T0,)
13617    {
13618        #[inline]
13619        unsafe fn encode(
13620            self,
13621            encoder: &mut fidl::encoding::Encoder<
13622                '_,
13623                fidl::encoding::DefaultFuchsiaResourceDialect,
13624            >,
13625            offset: usize,
13626            depth: fidl::encoding::Depth,
13627        ) -> fidl::Result<()> {
13628            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13629            // Zero out padding regions. There's no need to apply masks
13630            // because the unmasked parts will be overwritten by fields.
13631            // Write the fields.
13632            self.0.encode(encoder, offset + 0, depth)?;
13633            Ok(())
13634        }
13635    }
13636
13637    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13638        for SamplingResourceGetResponse
13639    {
13640        #[inline(always)]
13641        fn new_empty() -> Self {
13642            Self {
13643                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13644            }
13645        }
13646
13647        #[inline]
13648        unsafe fn decode(
13649            &mut self,
13650            decoder: &mut fidl::encoding::Decoder<
13651                '_,
13652                fidl::encoding::DefaultFuchsiaResourceDialect,
13653            >,
13654            offset: usize,
13655            _depth: fidl::encoding::Depth,
13656        ) -> fidl::Result<()> {
13657            decoder.debug_check_bounds::<Self>(offset);
13658            // Verify that padding bytes are zero.
13659            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13660            Ok(())
13661        }
13662    }
13663
13664    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
13665        type Borrowed<'a> = &'a mut Self;
13666        fn take_or_borrow<'a>(
13667            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13668        ) -> Self::Borrowed<'a> {
13669            value
13670        }
13671    }
13672
13673    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
13674        type Owned = Self;
13675
13676        #[inline(always)]
13677        fn inline_align(_context: fidl::encoding::Context) -> usize {
13678            4
13679        }
13680
13681        #[inline(always)]
13682        fn inline_size(_context: fidl::encoding::Context) -> usize {
13683            4
13684        }
13685    }
13686
13687    unsafe impl
13688        fidl::encoding::Encode<
13689            SmcResourceGetResponse,
13690            fidl::encoding::DefaultFuchsiaResourceDialect,
13691        > for &mut SmcResourceGetResponse
13692    {
13693        #[inline]
13694        unsafe fn encode(
13695            self,
13696            encoder: &mut fidl::encoding::Encoder<
13697                '_,
13698                fidl::encoding::DefaultFuchsiaResourceDialect,
13699            >,
13700            offset: usize,
13701            _depth: fidl::encoding::Depth,
13702        ) -> fidl::Result<()> {
13703            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13704            // Delegate to tuple encoding.
13705            fidl::encoding::Encode::<
13706                SmcResourceGetResponse,
13707                fidl::encoding::DefaultFuchsiaResourceDialect,
13708            >::encode(
13709                (<fidl::encoding::HandleType<
13710                    fidl::Resource,
13711                    { fidl::ObjectType::RESOURCE.into_raw() },
13712                    2147483648,
13713                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13714                    &mut self.resource
13715                ),),
13716                encoder,
13717                offset,
13718                _depth,
13719            )
13720        }
13721    }
13722    unsafe impl<
13723        T0: fidl::encoding::Encode<
13724                fidl::encoding::HandleType<
13725                    fidl::Resource,
13726                    { fidl::ObjectType::RESOURCE.into_raw() },
13727                    2147483648,
13728                >,
13729                fidl::encoding::DefaultFuchsiaResourceDialect,
13730            >,
13731    >
13732        fidl::encoding::Encode<
13733            SmcResourceGetResponse,
13734            fidl::encoding::DefaultFuchsiaResourceDialect,
13735        > for (T0,)
13736    {
13737        #[inline]
13738        unsafe fn encode(
13739            self,
13740            encoder: &mut fidl::encoding::Encoder<
13741                '_,
13742                fidl::encoding::DefaultFuchsiaResourceDialect,
13743            >,
13744            offset: usize,
13745            depth: fidl::encoding::Depth,
13746        ) -> fidl::Result<()> {
13747            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13748            // Zero out padding regions. There's no need to apply masks
13749            // because the unmasked parts will be overwritten by fields.
13750            // Write the fields.
13751            self.0.encode(encoder, offset + 0, depth)?;
13752            Ok(())
13753        }
13754    }
13755
13756    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13757        for SmcResourceGetResponse
13758    {
13759        #[inline(always)]
13760        fn new_empty() -> Self {
13761            Self {
13762                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13763            }
13764        }
13765
13766        #[inline]
13767        unsafe fn decode(
13768            &mut self,
13769            decoder: &mut fidl::encoding::Decoder<
13770                '_,
13771                fidl::encoding::DefaultFuchsiaResourceDialect,
13772            >,
13773            offset: usize,
13774            _depth: fidl::encoding::Depth,
13775        ) -> fidl::Result<()> {
13776            decoder.debug_check_bounds::<Self>(offset);
13777            // Verify that padding bytes are zero.
13778            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13779            Ok(())
13780        }
13781    }
13782
13783    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
13784        type Borrowed<'a> = &'a mut Self;
13785        fn take_or_borrow<'a>(
13786            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13787        ) -> Self::Borrowed<'a> {
13788            value
13789        }
13790    }
13791
13792    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
13793        type Owned = Self;
13794
13795        #[inline(always)]
13796        fn inline_align(_context: fidl::encoding::Context) -> usize {
13797            4
13798        }
13799
13800        #[inline(always)]
13801        fn inline_size(_context: fidl::encoding::Context) -> usize {
13802            4
13803        }
13804    }
13805
13806    unsafe impl
13807        fidl::encoding::Encode<
13808            StallResourceGetResponse,
13809            fidl::encoding::DefaultFuchsiaResourceDialect,
13810        > for &mut StallResourceGetResponse
13811    {
13812        #[inline]
13813        unsafe fn encode(
13814            self,
13815            encoder: &mut fidl::encoding::Encoder<
13816                '_,
13817                fidl::encoding::DefaultFuchsiaResourceDialect,
13818            >,
13819            offset: usize,
13820            _depth: fidl::encoding::Depth,
13821        ) -> fidl::Result<()> {
13822            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13823            // Delegate to tuple encoding.
13824            fidl::encoding::Encode::<
13825                StallResourceGetResponse,
13826                fidl::encoding::DefaultFuchsiaResourceDialect,
13827            >::encode(
13828                (<fidl::encoding::HandleType<
13829                    fidl::Resource,
13830                    { fidl::ObjectType::RESOURCE.into_raw() },
13831                    2147483648,
13832                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13833                    &mut self.resource
13834                ),),
13835                encoder,
13836                offset,
13837                _depth,
13838            )
13839        }
13840    }
13841    unsafe impl<
13842        T0: fidl::encoding::Encode<
13843                fidl::encoding::HandleType<
13844                    fidl::Resource,
13845                    { fidl::ObjectType::RESOURCE.into_raw() },
13846                    2147483648,
13847                >,
13848                fidl::encoding::DefaultFuchsiaResourceDialect,
13849            >,
13850    >
13851        fidl::encoding::Encode<
13852            StallResourceGetResponse,
13853            fidl::encoding::DefaultFuchsiaResourceDialect,
13854        > for (T0,)
13855    {
13856        #[inline]
13857        unsafe fn encode(
13858            self,
13859            encoder: &mut fidl::encoding::Encoder<
13860                '_,
13861                fidl::encoding::DefaultFuchsiaResourceDialect,
13862            >,
13863            offset: usize,
13864            depth: fidl::encoding::Depth,
13865        ) -> fidl::Result<()> {
13866            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13867            // Zero out padding regions. There's no need to apply masks
13868            // because the unmasked parts will be overwritten by fields.
13869            // Write the fields.
13870            self.0.encode(encoder, offset + 0, depth)?;
13871            Ok(())
13872        }
13873    }
13874
13875    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13876        for StallResourceGetResponse
13877    {
13878        #[inline(always)]
13879        fn new_empty() -> Self {
13880            Self {
13881                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13882            }
13883        }
13884
13885        #[inline]
13886        unsafe fn decode(
13887            &mut self,
13888            decoder: &mut fidl::encoding::Decoder<
13889                '_,
13890                fidl::encoding::DefaultFuchsiaResourceDialect,
13891            >,
13892            offset: usize,
13893            _depth: fidl::encoding::Depth,
13894        ) -> fidl::Result<()> {
13895            decoder.debug_check_bounds::<Self>(offset);
13896            // Verify that padding bytes are zero.
13897            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13898            Ok(())
13899        }
13900    }
13901
13902    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
13903        type Borrowed<'a> = &'a mut Self;
13904        fn take_or_borrow<'a>(
13905            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13906        ) -> Self::Borrowed<'a> {
13907            value
13908        }
13909    }
13910
13911    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
13912        type Owned = Self;
13913
13914        #[inline(always)]
13915        fn inline_align(_context: fidl::encoding::Context) -> usize {
13916            4
13917        }
13918
13919        #[inline(always)]
13920        fn inline_size(_context: fidl::encoding::Context) -> usize {
13921            4
13922        }
13923    }
13924
13925    unsafe impl
13926        fidl::encoding::Encode<
13927            TracingResourceGetResponse,
13928            fidl::encoding::DefaultFuchsiaResourceDialect,
13929        > for &mut TracingResourceGetResponse
13930    {
13931        #[inline]
13932        unsafe fn encode(
13933            self,
13934            encoder: &mut fidl::encoding::Encoder<
13935                '_,
13936                fidl::encoding::DefaultFuchsiaResourceDialect,
13937            >,
13938            offset: usize,
13939            _depth: fidl::encoding::Depth,
13940        ) -> fidl::Result<()> {
13941            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13942            // Delegate to tuple encoding.
13943            fidl::encoding::Encode::<
13944                TracingResourceGetResponse,
13945                fidl::encoding::DefaultFuchsiaResourceDialect,
13946            >::encode(
13947                (<fidl::encoding::HandleType<
13948                    fidl::Resource,
13949                    { fidl::ObjectType::RESOURCE.into_raw() },
13950                    2147483648,
13951                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13952                    &mut self.resource
13953                ),),
13954                encoder,
13955                offset,
13956                _depth,
13957            )
13958        }
13959    }
13960    unsafe impl<
13961        T0: fidl::encoding::Encode<
13962                fidl::encoding::HandleType<
13963                    fidl::Resource,
13964                    { fidl::ObjectType::RESOURCE.into_raw() },
13965                    2147483648,
13966                >,
13967                fidl::encoding::DefaultFuchsiaResourceDialect,
13968            >,
13969    >
13970        fidl::encoding::Encode<
13971            TracingResourceGetResponse,
13972            fidl::encoding::DefaultFuchsiaResourceDialect,
13973        > for (T0,)
13974    {
13975        #[inline]
13976        unsafe fn encode(
13977            self,
13978            encoder: &mut fidl::encoding::Encoder<
13979                '_,
13980                fidl::encoding::DefaultFuchsiaResourceDialect,
13981            >,
13982            offset: usize,
13983            depth: fidl::encoding::Depth,
13984        ) -> fidl::Result<()> {
13985            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13986            // Zero out padding regions. There's no need to apply masks
13987            // because the unmasked parts will be overwritten by fields.
13988            // Write the fields.
13989            self.0.encode(encoder, offset + 0, depth)?;
13990            Ok(())
13991        }
13992    }
13993
13994    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13995        for TracingResourceGetResponse
13996    {
13997        #[inline(always)]
13998        fn new_empty() -> Self {
13999            Self {
14000                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14001            }
14002        }
14003
14004        #[inline]
14005        unsafe fn decode(
14006            &mut self,
14007            decoder: &mut fidl::encoding::Decoder<
14008                '_,
14009                fidl::encoding::DefaultFuchsiaResourceDialect,
14010            >,
14011            offset: usize,
14012            _depth: fidl::encoding::Depth,
14013        ) -> fidl::Result<()> {
14014            decoder.debug_check_bounds::<Self>(offset);
14015            // Verify that padding bytes are zero.
14016            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14017            Ok(())
14018        }
14019    }
14020
14021    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
14022        type Borrowed<'a> = &'a mut Self;
14023        fn take_or_borrow<'a>(
14024            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14025        ) -> Self::Borrowed<'a> {
14026            value
14027        }
14028    }
14029
14030    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
14031        type Owned = Self;
14032
14033        #[inline(always)]
14034        fn inline_align(_context: fidl::encoding::Context) -> usize {
14035            4
14036        }
14037
14038        #[inline(always)]
14039        fn inline_size(_context: fidl::encoding::Context) -> usize {
14040            4
14041        }
14042    }
14043
14044    unsafe impl
14045        fidl::encoding::Encode<
14046            VmexResourceGetResponse,
14047            fidl::encoding::DefaultFuchsiaResourceDialect,
14048        > for &mut VmexResourceGetResponse
14049    {
14050        #[inline]
14051        unsafe fn encode(
14052            self,
14053            encoder: &mut fidl::encoding::Encoder<
14054                '_,
14055                fidl::encoding::DefaultFuchsiaResourceDialect,
14056            >,
14057            offset: usize,
14058            _depth: fidl::encoding::Depth,
14059        ) -> fidl::Result<()> {
14060            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
14061            // Delegate to tuple encoding.
14062            fidl::encoding::Encode::<
14063                VmexResourceGetResponse,
14064                fidl::encoding::DefaultFuchsiaResourceDialect,
14065            >::encode(
14066                (<fidl::encoding::HandleType<
14067                    fidl::Resource,
14068                    { fidl::ObjectType::RESOURCE.into_raw() },
14069                    2147483648,
14070                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
14071                    &mut self.resource
14072                ),),
14073                encoder,
14074                offset,
14075                _depth,
14076            )
14077        }
14078    }
14079    unsafe impl<
14080        T0: fidl::encoding::Encode<
14081                fidl::encoding::HandleType<
14082                    fidl::Resource,
14083                    { fidl::ObjectType::RESOURCE.into_raw() },
14084                    2147483648,
14085                >,
14086                fidl::encoding::DefaultFuchsiaResourceDialect,
14087            >,
14088    >
14089        fidl::encoding::Encode<
14090            VmexResourceGetResponse,
14091            fidl::encoding::DefaultFuchsiaResourceDialect,
14092        > for (T0,)
14093    {
14094        #[inline]
14095        unsafe fn encode(
14096            self,
14097            encoder: &mut fidl::encoding::Encoder<
14098                '_,
14099                fidl::encoding::DefaultFuchsiaResourceDialect,
14100            >,
14101            offset: usize,
14102            depth: fidl::encoding::Depth,
14103        ) -> fidl::Result<()> {
14104            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
14105            // Zero out padding regions. There's no need to apply masks
14106            // because the unmasked parts will be overwritten by fields.
14107            // Write the fields.
14108            self.0.encode(encoder, offset + 0, depth)?;
14109            Ok(())
14110        }
14111    }
14112
14113    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14114        for VmexResourceGetResponse
14115    {
14116        #[inline(always)]
14117        fn new_empty() -> Self {
14118            Self {
14119                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
14120            }
14121        }
14122
14123        #[inline]
14124        unsafe fn decode(
14125            &mut self,
14126            decoder: &mut fidl::encoding::Decoder<
14127                '_,
14128                fidl::encoding::DefaultFuchsiaResourceDialect,
14129            >,
14130            offset: usize,
14131            _depth: fidl::encoding::Depth,
14132        ) -> fidl::Result<()> {
14133            decoder.debug_check_bounds::<Self>(offset);
14134            // Verify that padding bytes are zero.
14135            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
14136            Ok(())
14137        }
14138    }
14139}