Skip to main content

fidl_fuchsia_kernel/
fidl_fuchsia_kernel.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_kernel_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct CounterGetInspectVmoResponse {
16    pub status: i32,
17    pub buffer: fidl_fuchsia_mem::Buffer,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for CounterGetInspectVmoResponse
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct CpuResourceGetResponse {
27    pub resource: fidl::Resource,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CpuResourceGetResponse {}
31
32#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33pub struct DebugResourceGetResponse {
34    pub resource: fidl::Resource,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DebugResourceGetResponse {}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct DebuglogResourceGetResponse {
41    pub resource: fidl::Resource,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for DebuglogResourceGetResponse
46{
47}
48
49#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
50pub struct EnergyInfoResourceGetResponse {
51    pub resource: fidl::Resource,
52}
53
54impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
55    for EnergyInfoResourceGetResponse
56{
57}
58
59#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
60pub struct HypervisorResourceGetResponse {
61    pub resource: fidl::Resource,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65    for HypervisorResourceGetResponse
66{
67}
68
69#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct InfoResourceGetResponse {
71    pub resource: fidl::Resource,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InfoResourceGetResponse {}
75
76#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
77pub struct IommuResourceGetResponse {
78    pub resource: fidl::Resource,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IommuResourceGetResponse {}
82
83#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
84pub struct IoportResourceGetResponse {
85    pub resource: fidl::Resource,
86}
87
88impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IoportResourceGetResponse {}
89
90#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct IrqResourceGetResponse {
92    pub resource: fidl::Resource,
93}
94
95impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IrqResourceGetResponse {}
96
97#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98pub struct MmioResourceGetResponse {
99    pub resource: fidl::Resource,
100}
101
102impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MmioResourceGetResponse {}
103
104#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
105pub struct MsiResourceGetResponse {
106    pub resource: fidl::Resource,
107}
108
109impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for MsiResourceGetResponse {}
110
111#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
112pub struct PowerResourceGetResponse {
113    pub resource: fidl::Resource,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerResourceGetResponse {}
117
118#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
119pub struct ProfileResourceGetResponse {
120    pub resource: fidl::Resource,
121}
122
123impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
124    for ProfileResourceGetResponse
125{
126}
127
128#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
129pub struct RootJobGetResponse {
130    pub job: fidl::Job,
131}
132
133impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RootJobGetResponse {}
134
135#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
136pub struct SamplingResourceGetResponse {
137    pub resource: fidl::Resource,
138}
139
140impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
141    for SamplingResourceGetResponse
142{
143}
144
145#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
146pub struct SmcResourceGetResponse {
147    pub resource: fidl::Resource,
148}
149
150impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SmcResourceGetResponse {}
151
152#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
153pub struct StallResourceGetResponse {
154    pub resource: fidl::Resource,
155}
156
157impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for StallResourceGetResponse {}
158
159#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
160pub struct TracingResourceGetResponse {
161    pub resource: fidl::Resource,
162}
163
164impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
165    for TracingResourceGetResponse
166{
167}
168
169#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
170pub struct VmexResourceGetResponse {
171    pub resource: fidl::Resource,
172}
173
174impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for VmexResourceGetResponse {}
175
176#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
177pub struct CounterMarker;
178
179impl fidl::endpoints::ProtocolMarker for CounterMarker {
180    type Proxy = CounterProxy;
181    type RequestStream = CounterRequestStream;
182    #[cfg(target_os = "fuchsia")]
183    type SynchronousProxy = CounterSynchronousProxy;
184
185    const DEBUG_NAME: &'static str = "fuchsia.kernel.Counter";
186}
187impl fidl::endpoints::DiscoverableProtocolMarker for CounterMarker {}
188
189pub trait CounterProxyInterface: Send + Sync {
190    type GetInspectVmoResponseFut: std::future::Future<Output = Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error>>
191        + Send;
192    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut;
193    type UpdateInspectVmoResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
194    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut;
195}
196#[derive(Debug)]
197#[cfg(target_os = "fuchsia")]
198pub struct CounterSynchronousProxy {
199    client: fidl::client::sync::Client,
200}
201
202#[cfg(target_os = "fuchsia")]
203impl fidl::endpoints::SynchronousProxy for CounterSynchronousProxy {
204    type Proxy = CounterProxy;
205    type Protocol = CounterMarker;
206
207    fn from_channel(inner: fidl::Channel) -> Self {
208        Self::new(inner)
209    }
210
211    fn into_channel(self) -> fidl::Channel {
212        self.client.into_channel()
213    }
214
215    fn as_channel(&self) -> &fidl::Channel {
216        self.client.as_channel()
217    }
218}
219
220#[cfg(target_os = "fuchsia")]
221impl CounterSynchronousProxy {
222    pub fn new(channel: fidl::Channel) -> Self {
223        Self { client: fidl::client::sync::Client::new(channel) }
224    }
225
226    pub fn into_channel(self) -> fidl::Channel {
227        self.client.into_channel()
228    }
229
230    /// Waits until an event arrives and returns it. It is safe for other
231    /// threads to make concurrent requests while waiting for an event.
232    pub fn wait_for_event(
233        &self,
234        deadline: zx::MonotonicInstant,
235    ) -> Result<CounterEvent, fidl::Error> {
236        CounterEvent::decode(self.client.wait_for_event::<CounterMarker>(deadline)?)
237    }
238
239    /// Retrives a VMO containining summarized kcounter data. The vmo returned
240    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
241    pub fn r#get_inspect_vmo(
242        &self,
243        ___deadline: zx::MonotonicInstant,
244    ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
245        let _response = self.client.send_query::<
246            fidl::encoding::EmptyPayload,
247            CounterGetInspectVmoResponse,
248            CounterMarker,
249        >(
250            (),
251            0x6ea9b2e6b2791b81,
252            fidl::encoding::DynamicFlags::empty(),
253            ___deadline,
254        )?;
255        Ok((_response.status, _response.buffer))
256    }
257
258    /// Request that the previously-returned VMO buffer's data be updated. The
259    /// data may not be updated if it was already recently updated (updates are
260    /// limited to an unspecified rate, but approximately every few seconds).
261    pub fn r#update_inspect_vmo(
262        &self,
263        ___deadline: zx::MonotonicInstant,
264    ) -> Result<i32, fidl::Error> {
265        let _response = self.client.send_query::<
266            fidl::encoding::EmptyPayload,
267            CounterUpdateInspectVmoResponse,
268            CounterMarker,
269        >(
270            (),
271            0x1d25eb7995a0539f,
272            fidl::encoding::DynamicFlags::empty(),
273            ___deadline,
274        )?;
275        Ok(_response.status)
276    }
277}
278
279#[cfg(target_os = "fuchsia")]
280impl From<CounterSynchronousProxy> for zx::NullableHandle {
281    fn from(value: CounterSynchronousProxy) -> Self {
282        value.into_channel().into()
283    }
284}
285
286#[cfg(target_os = "fuchsia")]
287impl From<fidl::Channel> for CounterSynchronousProxy {
288    fn from(value: fidl::Channel) -> Self {
289        Self::new(value)
290    }
291}
292
293#[cfg(target_os = "fuchsia")]
294impl fidl::endpoints::FromClient for CounterSynchronousProxy {
295    type Protocol = CounterMarker;
296
297    fn from_client(value: fidl::endpoints::ClientEnd<CounterMarker>) -> Self {
298        Self::new(value.into_channel())
299    }
300}
301
302#[derive(Debug, Clone)]
303pub struct CounterProxy {
304    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
305}
306
307impl fidl::endpoints::Proxy for CounterProxy {
308    type Protocol = CounterMarker;
309
310    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
311        Self::new(inner)
312    }
313
314    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
315        self.client.into_channel().map_err(|client| Self { client })
316    }
317
318    fn as_channel(&self) -> &::fidl::AsyncChannel {
319        self.client.as_channel()
320    }
321}
322
323impl CounterProxy {
324    /// Create a new Proxy for fuchsia.kernel/Counter.
325    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
326        let protocol_name = <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
327        Self { client: fidl::client::Client::new(channel, protocol_name) }
328    }
329
330    /// Get a Stream of events from the remote end of the protocol.
331    ///
332    /// # Panics
333    ///
334    /// Panics if the event stream was already taken.
335    pub fn take_event_stream(&self) -> CounterEventStream {
336        CounterEventStream { event_receiver: self.client.take_event_receiver() }
337    }
338
339    /// Retrives a VMO containining summarized kcounter data. The vmo returned
340    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
341    pub fn r#get_inspect_vmo(
342        &self,
343    ) -> fidl::client::QueryResponseFut<
344        (i32, fidl_fuchsia_mem::Buffer),
345        fidl::encoding::DefaultFuchsiaResourceDialect,
346    > {
347        CounterProxyInterface::r#get_inspect_vmo(self)
348    }
349
350    /// Request that the previously-returned VMO buffer's data be updated. The
351    /// data may not be updated if it was already recently updated (updates are
352    /// limited to an unspecified rate, but approximately every few seconds).
353    pub fn r#update_inspect_vmo(
354        &self,
355    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
356        CounterProxyInterface::r#update_inspect_vmo(self)
357    }
358}
359
360impl CounterProxyInterface for CounterProxy {
361    type GetInspectVmoResponseFut = fidl::client::QueryResponseFut<
362        (i32, fidl_fuchsia_mem::Buffer),
363        fidl::encoding::DefaultFuchsiaResourceDialect,
364    >;
365    fn r#get_inspect_vmo(&self) -> Self::GetInspectVmoResponseFut {
366        fn _decode(
367            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
368        ) -> Result<(i32, fidl_fuchsia_mem::Buffer), fidl::Error> {
369            let _response = fidl::client::decode_transaction_body::<
370                CounterGetInspectVmoResponse,
371                fidl::encoding::DefaultFuchsiaResourceDialect,
372                0x6ea9b2e6b2791b81,
373            >(_buf?)?;
374            Ok((_response.status, _response.buffer))
375        }
376        self.client
377            .send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, fidl_fuchsia_mem::Buffer)>(
378                (),
379                0x6ea9b2e6b2791b81,
380                fidl::encoding::DynamicFlags::empty(),
381                _decode,
382            )
383    }
384
385    type UpdateInspectVmoResponseFut =
386        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
387    fn r#update_inspect_vmo(&self) -> Self::UpdateInspectVmoResponseFut {
388        fn _decode(
389            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
390        ) -> Result<i32, fidl::Error> {
391            let _response = fidl::client::decode_transaction_body::<
392                CounterUpdateInspectVmoResponse,
393                fidl::encoding::DefaultFuchsiaResourceDialect,
394                0x1d25eb7995a0539f,
395            >(_buf?)?;
396            Ok(_response.status)
397        }
398        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
399            (),
400            0x1d25eb7995a0539f,
401            fidl::encoding::DynamicFlags::empty(),
402            _decode,
403        )
404    }
405}
406
407pub struct CounterEventStream {
408    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
409}
410
411impl std::marker::Unpin for CounterEventStream {}
412
413impl futures::stream::FusedStream for CounterEventStream {
414    fn is_terminated(&self) -> bool {
415        self.event_receiver.is_terminated()
416    }
417}
418
419impl futures::Stream for CounterEventStream {
420    type Item = Result<CounterEvent, fidl::Error>;
421
422    fn poll_next(
423        mut self: std::pin::Pin<&mut Self>,
424        cx: &mut std::task::Context<'_>,
425    ) -> std::task::Poll<Option<Self::Item>> {
426        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
427            &mut self.event_receiver,
428            cx
429        )?) {
430            Some(buf) => std::task::Poll::Ready(Some(CounterEvent::decode(buf))),
431            None => std::task::Poll::Ready(None),
432        }
433    }
434}
435
436#[derive(Debug)]
437pub enum CounterEvent {}
438
439impl CounterEvent {
440    /// Decodes a message buffer as a [`CounterEvent`].
441    fn decode(
442        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
443    ) -> Result<CounterEvent, fidl::Error> {
444        let (bytes, _handles) = buf.split_mut();
445        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
446        debug_assert_eq!(tx_header.tx_id, 0);
447        match tx_header.ordinal {
448            _ => Err(fidl::Error::UnknownOrdinal {
449                ordinal: tx_header.ordinal,
450                protocol_name: <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
451            }),
452        }
453    }
454}
455
456/// A Stream of incoming requests for fuchsia.kernel/Counter.
457pub struct CounterRequestStream {
458    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
459    is_terminated: bool,
460}
461
462impl std::marker::Unpin for CounterRequestStream {}
463
464impl futures::stream::FusedStream for CounterRequestStream {
465    fn is_terminated(&self) -> bool {
466        self.is_terminated
467    }
468}
469
470impl fidl::endpoints::RequestStream for CounterRequestStream {
471    type Protocol = CounterMarker;
472    type ControlHandle = CounterControlHandle;
473
474    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
475        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
476    }
477
478    fn control_handle(&self) -> Self::ControlHandle {
479        CounterControlHandle { inner: self.inner.clone() }
480    }
481
482    fn into_inner(
483        self,
484    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
485    {
486        (self.inner, self.is_terminated)
487    }
488
489    fn from_inner(
490        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
491        is_terminated: bool,
492    ) -> Self {
493        Self { inner, is_terminated }
494    }
495}
496
497impl futures::Stream for CounterRequestStream {
498    type Item = Result<CounterRequest, fidl::Error>;
499
500    fn poll_next(
501        mut self: std::pin::Pin<&mut Self>,
502        cx: &mut std::task::Context<'_>,
503    ) -> std::task::Poll<Option<Self::Item>> {
504        let this = &mut *self;
505        if this.inner.check_shutdown(cx) {
506            this.is_terminated = true;
507            return std::task::Poll::Ready(None);
508        }
509        if this.is_terminated {
510            panic!("polled CounterRequestStream after completion");
511        }
512        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
513            |bytes, handles| {
514                match this.inner.channel().read_etc(cx, bytes, handles) {
515                    std::task::Poll::Ready(Ok(())) => {}
516                    std::task::Poll::Pending => return std::task::Poll::Pending,
517                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
518                        this.is_terminated = true;
519                        return std::task::Poll::Ready(None);
520                    }
521                    std::task::Poll::Ready(Err(e)) => {
522                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
523                            e.into(),
524                        ))));
525                    }
526                }
527
528                // A message has been received from the channel
529                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
530
531                std::task::Poll::Ready(Some(match header.ordinal {
532                    0x6ea9b2e6b2791b81 => {
533                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
534                        let mut req = fidl::new_empty!(
535                            fidl::encoding::EmptyPayload,
536                            fidl::encoding::DefaultFuchsiaResourceDialect
537                        );
538                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
539                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
540                        Ok(CounterRequest::GetInspectVmo {
541                            responder: CounterGetInspectVmoResponder {
542                                control_handle: std::mem::ManuallyDrop::new(control_handle),
543                                tx_id: header.tx_id,
544                            },
545                        })
546                    }
547                    0x1d25eb7995a0539f => {
548                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
549                        let mut req = fidl::new_empty!(
550                            fidl::encoding::EmptyPayload,
551                            fidl::encoding::DefaultFuchsiaResourceDialect
552                        );
553                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
554                        let control_handle = CounterControlHandle { inner: this.inner.clone() };
555                        Ok(CounterRequest::UpdateInspectVmo {
556                            responder: CounterUpdateInspectVmoResponder {
557                                control_handle: std::mem::ManuallyDrop::new(control_handle),
558                                tx_id: header.tx_id,
559                            },
560                        })
561                    }
562                    _ => Err(fidl::Error::UnknownOrdinal {
563                        ordinal: header.ordinal,
564                        protocol_name:
565                            <CounterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
566                    }),
567                }))
568            },
569        )
570    }
571}
572
573/// Protocol for retrieving kcounter information.
574#[derive(Debug)]
575pub enum CounterRequest {
576    /// Retrives a VMO containining summarized kcounter data. The vmo returned
577    /// in `buffer` is in "inspect-vmo" format, documented elsewhere.
578    GetInspectVmo { responder: CounterGetInspectVmoResponder },
579    /// Request that the previously-returned VMO buffer's data be updated. The
580    /// data may not be updated if it was already recently updated (updates are
581    /// limited to an unspecified rate, but approximately every few seconds).
582    UpdateInspectVmo { responder: CounterUpdateInspectVmoResponder },
583}
584
585impl CounterRequest {
586    #[allow(irrefutable_let_patterns)]
587    pub fn into_get_inspect_vmo(self) -> Option<(CounterGetInspectVmoResponder)> {
588        if let CounterRequest::GetInspectVmo { responder } = self {
589            Some((responder))
590        } else {
591            None
592        }
593    }
594
595    #[allow(irrefutable_let_patterns)]
596    pub fn into_update_inspect_vmo(self) -> Option<(CounterUpdateInspectVmoResponder)> {
597        if let CounterRequest::UpdateInspectVmo { responder } = self {
598            Some((responder))
599        } else {
600            None
601        }
602    }
603
604    /// Name of the method defined in FIDL
605    pub fn method_name(&self) -> &'static str {
606        match *self {
607            CounterRequest::GetInspectVmo { .. } => "get_inspect_vmo",
608            CounterRequest::UpdateInspectVmo { .. } => "update_inspect_vmo",
609        }
610    }
611}
612
613#[derive(Debug, Clone)]
614pub struct CounterControlHandle {
615    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
616}
617
618impl CounterControlHandle {
619    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
620        self.inner.shutdown_with_epitaph(status.into())
621    }
622}
623
624impl fidl::endpoints::ControlHandle for CounterControlHandle {
625    fn shutdown(&self) {
626        self.inner.shutdown()
627    }
628
629    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
630        self.inner.shutdown_with_epitaph(status)
631    }
632
633    fn is_closed(&self) -> bool {
634        self.inner.channel().is_closed()
635    }
636    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
637        self.inner.channel().on_closed()
638    }
639
640    #[cfg(target_os = "fuchsia")]
641    fn signal_peer(
642        &self,
643        clear_mask: zx::Signals,
644        set_mask: zx::Signals,
645    ) -> Result<(), zx_status::Status> {
646        use fidl::Peered;
647        self.inner.channel().signal_peer(clear_mask, set_mask)
648    }
649}
650
651impl CounterControlHandle {}
652
653#[must_use = "FIDL methods require a response to be sent"]
654#[derive(Debug)]
655pub struct CounterGetInspectVmoResponder {
656    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
657    tx_id: u32,
658}
659
660/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
661/// if the responder is dropped without sending a response, so that the client
662/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
663impl std::ops::Drop for CounterGetInspectVmoResponder {
664    fn drop(&mut self) {
665        self.control_handle.shutdown();
666        // Safety: drops once, never accessed again
667        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
668    }
669}
670
671impl fidl::endpoints::Responder for CounterGetInspectVmoResponder {
672    type ControlHandle = CounterControlHandle;
673
674    fn control_handle(&self) -> &CounterControlHandle {
675        &self.control_handle
676    }
677
678    fn drop_without_shutdown(mut self) {
679        // Safety: drops once, never accessed again due to mem::forget
680        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
681        // Prevent Drop from running (which would shut down the channel)
682        std::mem::forget(self);
683    }
684}
685
686impl CounterGetInspectVmoResponder {
687    /// Sends a response to the FIDL transaction.
688    ///
689    /// Sets the channel to shutdown if an error occurs.
690    pub fn send(
691        self,
692        mut status: i32,
693        mut buffer: fidl_fuchsia_mem::Buffer,
694    ) -> Result<(), fidl::Error> {
695        let _result = self.send_raw(status, buffer);
696        if _result.is_err() {
697            self.control_handle.shutdown();
698        }
699        self.drop_without_shutdown();
700        _result
701    }
702
703    /// Similar to "send" but does not shutdown the channel if an error occurs.
704    pub fn send_no_shutdown_on_err(
705        self,
706        mut status: i32,
707        mut buffer: fidl_fuchsia_mem::Buffer,
708    ) -> Result<(), fidl::Error> {
709        let _result = self.send_raw(status, buffer);
710        self.drop_without_shutdown();
711        _result
712    }
713
714    fn send_raw(
715        &self,
716        mut status: i32,
717        mut buffer: fidl_fuchsia_mem::Buffer,
718    ) -> Result<(), fidl::Error> {
719        self.control_handle.inner.send::<CounterGetInspectVmoResponse>(
720            (status, &mut buffer),
721            self.tx_id,
722            0x6ea9b2e6b2791b81,
723            fidl::encoding::DynamicFlags::empty(),
724        )
725    }
726}
727
728#[must_use = "FIDL methods require a response to be sent"]
729#[derive(Debug)]
730pub struct CounterUpdateInspectVmoResponder {
731    control_handle: std::mem::ManuallyDrop<CounterControlHandle>,
732    tx_id: u32,
733}
734
735/// Set the the channel to be shutdown (see [`CounterControlHandle::shutdown`])
736/// if the responder is dropped without sending a response, so that the client
737/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
738impl std::ops::Drop for CounterUpdateInspectVmoResponder {
739    fn drop(&mut self) {
740        self.control_handle.shutdown();
741        // Safety: drops once, never accessed again
742        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
743    }
744}
745
746impl fidl::endpoints::Responder for CounterUpdateInspectVmoResponder {
747    type ControlHandle = CounterControlHandle;
748
749    fn control_handle(&self) -> &CounterControlHandle {
750        &self.control_handle
751    }
752
753    fn drop_without_shutdown(mut self) {
754        // Safety: drops once, never accessed again due to mem::forget
755        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
756        // Prevent Drop from running (which would shut down the channel)
757        std::mem::forget(self);
758    }
759}
760
761impl CounterUpdateInspectVmoResponder {
762    /// Sends a response to the FIDL transaction.
763    ///
764    /// Sets the channel to shutdown if an error occurs.
765    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
766        let _result = self.send_raw(status);
767        if _result.is_err() {
768            self.control_handle.shutdown();
769        }
770        self.drop_without_shutdown();
771        _result
772    }
773
774    /// Similar to "send" but does not shutdown the channel if an error occurs.
775    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
776        let _result = self.send_raw(status);
777        self.drop_without_shutdown();
778        _result
779    }
780
781    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
782        self.control_handle.inner.send::<CounterUpdateInspectVmoResponse>(
783            (status,),
784            self.tx_id,
785            0x1d25eb7995a0539f,
786            fidl::encoding::DynamicFlags::empty(),
787        )
788    }
789}
790
791#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
792pub struct CpuResourceMarker;
793
794impl fidl::endpoints::ProtocolMarker for CpuResourceMarker {
795    type Proxy = CpuResourceProxy;
796    type RequestStream = CpuResourceRequestStream;
797    #[cfg(target_os = "fuchsia")]
798    type SynchronousProxy = CpuResourceSynchronousProxy;
799
800    const DEBUG_NAME: &'static str = "fuchsia.kernel.CpuResource";
801}
802impl fidl::endpoints::DiscoverableProtocolMarker for CpuResourceMarker {}
803
804pub trait CpuResourceProxyInterface: Send + Sync {
805    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
806    fn r#get(&self) -> Self::GetResponseFut;
807}
808#[derive(Debug)]
809#[cfg(target_os = "fuchsia")]
810pub struct CpuResourceSynchronousProxy {
811    client: fidl::client::sync::Client,
812}
813
814#[cfg(target_os = "fuchsia")]
815impl fidl::endpoints::SynchronousProxy for CpuResourceSynchronousProxy {
816    type Proxy = CpuResourceProxy;
817    type Protocol = CpuResourceMarker;
818
819    fn from_channel(inner: fidl::Channel) -> Self {
820        Self::new(inner)
821    }
822
823    fn into_channel(self) -> fidl::Channel {
824        self.client.into_channel()
825    }
826
827    fn as_channel(&self) -> &fidl::Channel {
828        self.client.as_channel()
829    }
830}
831
832#[cfg(target_os = "fuchsia")]
833impl CpuResourceSynchronousProxy {
834    pub fn new(channel: fidl::Channel) -> Self {
835        Self { client: fidl::client::sync::Client::new(channel) }
836    }
837
838    pub fn into_channel(self) -> fidl::Channel {
839        self.client.into_channel()
840    }
841
842    /// Waits until an event arrives and returns it. It is safe for other
843    /// threads to make concurrent requests while waiting for an event.
844    pub fn wait_for_event(
845        &self,
846        deadline: zx::MonotonicInstant,
847    ) -> Result<CpuResourceEvent, fidl::Error> {
848        CpuResourceEvent::decode(self.client.wait_for_event::<CpuResourceMarker>(deadline)?)
849    }
850
851    /// Get a CPU resource handle.
852    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
853        let _response = self
854            .client
855            .send_query::<fidl::encoding::EmptyPayload, CpuResourceGetResponse, CpuResourceMarker>(
856                (),
857                0x41e1103acf4215e4,
858                fidl::encoding::DynamicFlags::empty(),
859                ___deadline,
860            )?;
861        Ok(_response.resource)
862    }
863}
864
865#[cfg(target_os = "fuchsia")]
866impl From<CpuResourceSynchronousProxy> for zx::NullableHandle {
867    fn from(value: CpuResourceSynchronousProxy) -> Self {
868        value.into_channel().into()
869    }
870}
871
872#[cfg(target_os = "fuchsia")]
873impl From<fidl::Channel> for CpuResourceSynchronousProxy {
874    fn from(value: fidl::Channel) -> Self {
875        Self::new(value)
876    }
877}
878
879#[cfg(target_os = "fuchsia")]
880impl fidl::endpoints::FromClient for CpuResourceSynchronousProxy {
881    type Protocol = CpuResourceMarker;
882
883    fn from_client(value: fidl::endpoints::ClientEnd<CpuResourceMarker>) -> Self {
884        Self::new(value.into_channel())
885    }
886}
887
888#[derive(Debug, Clone)]
889pub struct CpuResourceProxy {
890    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
891}
892
893impl fidl::endpoints::Proxy for CpuResourceProxy {
894    type Protocol = CpuResourceMarker;
895
896    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
897        Self::new(inner)
898    }
899
900    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
901        self.client.into_channel().map_err(|client| Self { client })
902    }
903
904    fn as_channel(&self) -> &::fidl::AsyncChannel {
905        self.client.as_channel()
906    }
907}
908
909impl CpuResourceProxy {
910    /// Create a new Proxy for fuchsia.kernel/CpuResource.
911    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
912        let protocol_name = <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
913        Self { client: fidl::client::Client::new(channel, protocol_name) }
914    }
915
916    /// Get a Stream of events from the remote end of the protocol.
917    ///
918    /// # Panics
919    ///
920    /// Panics if the event stream was already taken.
921    pub fn take_event_stream(&self) -> CpuResourceEventStream {
922        CpuResourceEventStream { event_receiver: self.client.take_event_receiver() }
923    }
924
925    /// Get a CPU resource handle.
926    pub fn r#get(
927        &self,
928    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
929    {
930        CpuResourceProxyInterface::r#get(self)
931    }
932}
933
934impl CpuResourceProxyInterface for CpuResourceProxy {
935    type GetResponseFut = fidl::client::QueryResponseFut<
936        fidl::Resource,
937        fidl::encoding::DefaultFuchsiaResourceDialect,
938    >;
939    fn r#get(&self) -> Self::GetResponseFut {
940        fn _decode(
941            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
942        ) -> Result<fidl::Resource, fidl::Error> {
943            let _response = fidl::client::decode_transaction_body::<
944                CpuResourceGetResponse,
945                fidl::encoding::DefaultFuchsiaResourceDialect,
946                0x41e1103acf4215e4,
947            >(_buf?)?;
948            Ok(_response.resource)
949        }
950        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
951            (),
952            0x41e1103acf4215e4,
953            fidl::encoding::DynamicFlags::empty(),
954            _decode,
955        )
956    }
957}
958
959pub struct CpuResourceEventStream {
960    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
961}
962
963impl std::marker::Unpin for CpuResourceEventStream {}
964
965impl futures::stream::FusedStream for CpuResourceEventStream {
966    fn is_terminated(&self) -> bool {
967        self.event_receiver.is_terminated()
968    }
969}
970
971impl futures::Stream for CpuResourceEventStream {
972    type Item = Result<CpuResourceEvent, fidl::Error>;
973
974    fn poll_next(
975        mut self: std::pin::Pin<&mut Self>,
976        cx: &mut std::task::Context<'_>,
977    ) -> std::task::Poll<Option<Self::Item>> {
978        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
979            &mut self.event_receiver,
980            cx
981        )?) {
982            Some(buf) => std::task::Poll::Ready(Some(CpuResourceEvent::decode(buf))),
983            None => std::task::Poll::Ready(None),
984        }
985    }
986}
987
988#[derive(Debug)]
989pub enum CpuResourceEvent {}
990
991impl CpuResourceEvent {
992    /// Decodes a message buffer as a [`CpuResourceEvent`].
993    fn decode(
994        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
995    ) -> Result<CpuResourceEvent, fidl::Error> {
996        let (bytes, _handles) = buf.split_mut();
997        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
998        debug_assert_eq!(tx_header.tx_id, 0);
999        match tx_header.ordinal {
1000            _ => Err(fidl::Error::UnknownOrdinal {
1001                ordinal: tx_header.ordinal,
1002                protocol_name: <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1003            }),
1004        }
1005    }
1006}
1007
1008/// A Stream of incoming requests for fuchsia.kernel/CpuResource.
1009pub struct CpuResourceRequestStream {
1010    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1011    is_terminated: bool,
1012}
1013
1014impl std::marker::Unpin for CpuResourceRequestStream {}
1015
1016impl futures::stream::FusedStream for CpuResourceRequestStream {
1017    fn is_terminated(&self) -> bool {
1018        self.is_terminated
1019    }
1020}
1021
1022impl fidl::endpoints::RequestStream for CpuResourceRequestStream {
1023    type Protocol = CpuResourceMarker;
1024    type ControlHandle = CpuResourceControlHandle;
1025
1026    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1027        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1028    }
1029
1030    fn control_handle(&self) -> Self::ControlHandle {
1031        CpuResourceControlHandle { inner: self.inner.clone() }
1032    }
1033
1034    fn into_inner(
1035        self,
1036    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1037    {
1038        (self.inner, self.is_terminated)
1039    }
1040
1041    fn from_inner(
1042        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1043        is_terminated: bool,
1044    ) -> Self {
1045        Self { inner, is_terminated }
1046    }
1047}
1048
1049impl futures::Stream for CpuResourceRequestStream {
1050    type Item = Result<CpuResourceRequest, fidl::Error>;
1051
1052    fn poll_next(
1053        mut self: std::pin::Pin<&mut Self>,
1054        cx: &mut std::task::Context<'_>,
1055    ) -> std::task::Poll<Option<Self::Item>> {
1056        let this = &mut *self;
1057        if this.inner.check_shutdown(cx) {
1058            this.is_terminated = true;
1059            return std::task::Poll::Ready(None);
1060        }
1061        if this.is_terminated {
1062            panic!("polled CpuResourceRequestStream after completion");
1063        }
1064        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1065            |bytes, handles| {
1066                match this.inner.channel().read_etc(cx, bytes, handles) {
1067                    std::task::Poll::Ready(Ok(())) => {}
1068                    std::task::Poll::Pending => return std::task::Poll::Pending,
1069                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1070                        this.is_terminated = true;
1071                        return std::task::Poll::Ready(None);
1072                    }
1073                    std::task::Poll::Ready(Err(e)) => {
1074                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1075                            e.into(),
1076                        ))));
1077                    }
1078                }
1079
1080                // A message has been received from the channel
1081                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1082
1083                std::task::Poll::Ready(Some(match header.ordinal {
1084                    0x41e1103acf4215e4 => {
1085                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1086                        let mut req = fidl::new_empty!(
1087                            fidl::encoding::EmptyPayload,
1088                            fidl::encoding::DefaultFuchsiaResourceDialect
1089                        );
1090                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1091                        let control_handle = CpuResourceControlHandle { inner: this.inner.clone() };
1092                        Ok(CpuResourceRequest::Get {
1093                            responder: CpuResourceGetResponder {
1094                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1095                                tx_id: header.tx_id,
1096                            },
1097                        })
1098                    }
1099                    _ => Err(fidl::Error::UnknownOrdinal {
1100                        ordinal: header.ordinal,
1101                        protocol_name:
1102                            <CpuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1103                    }),
1104                }))
1105            },
1106        )
1107    }
1108}
1109
1110/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
1111/// `ZX_RSRC_SYSTEM_CPU_BASE`.
1112#[derive(Debug)]
1113pub enum CpuResourceRequest {
1114    /// Get a CPU resource handle.
1115    Get { responder: CpuResourceGetResponder },
1116}
1117
1118impl CpuResourceRequest {
1119    #[allow(irrefutable_let_patterns)]
1120    pub fn into_get(self) -> Option<(CpuResourceGetResponder)> {
1121        if let CpuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
1122    }
1123
1124    /// Name of the method defined in FIDL
1125    pub fn method_name(&self) -> &'static str {
1126        match *self {
1127            CpuResourceRequest::Get { .. } => "get",
1128        }
1129    }
1130}
1131
1132#[derive(Debug, Clone)]
1133pub struct CpuResourceControlHandle {
1134    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1135}
1136
1137impl CpuResourceControlHandle {
1138    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1139        self.inner.shutdown_with_epitaph(status.into())
1140    }
1141}
1142
1143impl fidl::endpoints::ControlHandle for CpuResourceControlHandle {
1144    fn shutdown(&self) {
1145        self.inner.shutdown()
1146    }
1147
1148    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1149        self.inner.shutdown_with_epitaph(status)
1150    }
1151
1152    fn is_closed(&self) -> bool {
1153        self.inner.channel().is_closed()
1154    }
1155    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1156        self.inner.channel().on_closed()
1157    }
1158
1159    #[cfg(target_os = "fuchsia")]
1160    fn signal_peer(
1161        &self,
1162        clear_mask: zx::Signals,
1163        set_mask: zx::Signals,
1164    ) -> Result<(), zx_status::Status> {
1165        use fidl::Peered;
1166        self.inner.channel().signal_peer(clear_mask, set_mask)
1167    }
1168}
1169
1170impl CpuResourceControlHandle {}
1171
1172#[must_use = "FIDL methods require a response to be sent"]
1173#[derive(Debug)]
1174pub struct CpuResourceGetResponder {
1175    control_handle: std::mem::ManuallyDrop<CpuResourceControlHandle>,
1176    tx_id: u32,
1177}
1178
1179/// Set the the channel to be shutdown (see [`CpuResourceControlHandle::shutdown`])
1180/// if the responder is dropped without sending a response, so that the client
1181/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1182impl std::ops::Drop for CpuResourceGetResponder {
1183    fn drop(&mut self) {
1184        self.control_handle.shutdown();
1185        // Safety: drops once, never accessed again
1186        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1187    }
1188}
1189
1190impl fidl::endpoints::Responder for CpuResourceGetResponder {
1191    type ControlHandle = CpuResourceControlHandle;
1192
1193    fn control_handle(&self) -> &CpuResourceControlHandle {
1194        &self.control_handle
1195    }
1196
1197    fn drop_without_shutdown(mut self) {
1198        // Safety: drops once, never accessed again due to mem::forget
1199        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1200        // Prevent Drop from running (which would shut down the channel)
1201        std::mem::forget(self);
1202    }
1203}
1204
1205impl CpuResourceGetResponder {
1206    /// Sends a response to the FIDL transaction.
1207    ///
1208    /// Sets the channel to shutdown if an error occurs.
1209    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1210        let _result = self.send_raw(resource);
1211        if _result.is_err() {
1212            self.control_handle.shutdown();
1213        }
1214        self.drop_without_shutdown();
1215        _result
1216    }
1217
1218    /// Similar to "send" but does not shutdown the channel if an error occurs.
1219    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1220        let _result = self.send_raw(resource);
1221        self.drop_without_shutdown();
1222        _result
1223    }
1224
1225    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
1226        self.control_handle.inner.send::<CpuResourceGetResponse>(
1227            (resource,),
1228            self.tx_id,
1229            0x41e1103acf4215e4,
1230            fidl::encoding::DynamicFlags::empty(),
1231        )
1232    }
1233}
1234
1235#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1236pub struct DebugBrokerMarker;
1237
1238impl fidl::endpoints::ProtocolMarker for DebugBrokerMarker {
1239    type Proxy = DebugBrokerProxy;
1240    type RequestStream = DebugBrokerRequestStream;
1241    #[cfg(target_os = "fuchsia")]
1242    type SynchronousProxy = DebugBrokerSynchronousProxy;
1243
1244    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugBroker";
1245}
1246impl fidl::endpoints::DiscoverableProtocolMarker for DebugBrokerMarker {}
1247
1248pub trait DebugBrokerProxyInterface: Send + Sync {
1249    type SendDebugCommandResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1250    fn r#send_debug_command(&self, command: &str) -> Self::SendDebugCommandResponseFut;
1251    type SetTracingEnabledResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
1252    fn r#set_tracing_enabled(&self, enabled: bool) -> Self::SetTracingEnabledResponseFut;
1253}
1254#[derive(Debug)]
1255#[cfg(target_os = "fuchsia")]
1256pub struct DebugBrokerSynchronousProxy {
1257    client: fidl::client::sync::Client,
1258}
1259
1260#[cfg(target_os = "fuchsia")]
1261impl fidl::endpoints::SynchronousProxy for DebugBrokerSynchronousProxy {
1262    type Proxy = DebugBrokerProxy;
1263    type Protocol = DebugBrokerMarker;
1264
1265    fn from_channel(inner: fidl::Channel) -> Self {
1266        Self::new(inner)
1267    }
1268
1269    fn into_channel(self) -> fidl::Channel {
1270        self.client.into_channel()
1271    }
1272
1273    fn as_channel(&self) -> &fidl::Channel {
1274        self.client.as_channel()
1275    }
1276}
1277
1278#[cfg(target_os = "fuchsia")]
1279impl DebugBrokerSynchronousProxy {
1280    pub fn new(channel: fidl::Channel) -> Self {
1281        Self { client: fidl::client::sync::Client::new(channel) }
1282    }
1283
1284    pub fn into_channel(self) -> fidl::Channel {
1285        self.client.into_channel()
1286    }
1287
1288    /// Waits until an event arrives and returns it. It is safe for other
1289    /// threads to make concurrent requests while waiting for an event.
1290    pub fn wait_for_event(
1291        &self,
1292        deadline: zx::MonotonicInstant,
1293    ) -> Result<DebugBrokerEvent, fidl::Error> {
1294        DebugBrokerEvent::decode(self.client.wait_for_event::<DebugBrokerMarker>(deadline)?)
1295    }
1296
1297    /// Pass debug command through to the kernel shell.
1298    /// Look at zx_debug_send_command syscall handling to find valid values.
1299    pub fn r#send_debug_command(
1300        &self,
1301        mut command: &str,
1302        ___deadline: zx::MonotonicInstant,
1303    ) -> Result<i32, fidl::Error> {
1304        let _response = self.client.send_query::<
1305            DebugBrokerSendDebugCommandRequest,
1306            DebugBrokerSendDebugCommandResponse,
1307            DebugBrokerMarker,
1308        >(
1309            (command,),
1310            0x1ee270f83b5d6ff6,
1311            fidl::encoding::DynamicFlags::empty(),
1312            ___deadline,
1313        )?;
1314        Ok(_response.status)
1315    }
1316
1317    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1318    pub fn r#set_tracing_enabled(
1319        &self,
1320        mut enabled: bool,
1321        ___deadline: zx::MonotonicInstant,
1322    ) -> Result<i32, fidl::Error> {
1323        let _response = self.client.send_query::<
1324            DebugBrokerSetTracingEnabledRequest,
1325            DebugBrokerSetTracingEnabledResponse,
1326            DebugBrokerMarker,
1327        >(
1328            (enabled,),
1329            0x12e368d05329b30e,
1330            fidl::encoding::DynamicFlags::empty(),
1331            ___deadline,
1332        )?;
1333        Ok(_response.status)
1334    }
1335}
1336
1337#[cfg(target_os = "fuchsia")]
1338impl From<DebugBrokerSynchronousProxy> for zx::NullableHandle {
1339    fn from(value: DebugBrokerSynchronousProxy) -> Self {
1340        value.into_channel().into()
1341    }
1342}
1343
1344#[cfg(target_os = "fuchsia")]
1345impl From<fidl::Channel> for DebugBrokerSynchronousProxy {
1346    fn from(value: fidl::Channel) -> Self {
1347        Self::new(value)
1348    }
1349}
1350
1351#[cfg(target_os = "fuchsia")]
1352impl fidl::endpoints::FromClient for DebugBrokerSynchronousProxy {
1353    type Protocol = DebugBrokerMarker;
1354
1355    fn from_client(value: fidl::endpoints::ClientEnd<DebugBrokerMarker>) -> Self {
1356        Self::new(value.into_channel())
1357    }
1358}
1359
1360#[derive(Debug, Clone)]
1361pub struct DebugBrokerProxy {
1362    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1363}
1364
1365impl fidl::endpoints::Proxy for DebugBrokerProxy {
1366    type Protocol = DebugBrokerMarker;
1367
1368    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1369        Self::new(inner)
1370    }
1371
1372    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1373        self.client.into_channel().map_err(|client| Self { client })
1374    }
1375
1376    fn as_channel(&self) -> &::fidl::AsyncChannel {
1377        self.client.as_channel()
1378    }
1379}
1380
1381impl DebugBrokerProxy {
1382    /// Create a new Proxy for fuchsia.kernel/DebugBroker.
1383    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1384        let protocol_name = <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1385        Self { client: fidl::client::Client::new(channel, protocol_name) }
1386    }
1387
1388    /// Get a Stream of events from the remote end of the protocol.
1389    ///
1390    /// # Panics
1391    ///
1392    /// Panics if the event stream was already taken.
1393    pub fn take_event_stream(&self) -> DebugBrokerEventStream {
1394        DebugBrokerEventStream { event_receiver: self.client.take_event_receiver() }
1395    }
1396
1397    /// Pass debug command through to the kernel shell.
1398    /// Look at zx_debug_send_command syscall handling to find valid values.
1399    pub fn r#send_debug_command(
1400        &self,
1401        mut command: &str,
1402    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1403        DebugBrokerProxyInterface::r#send_debug_command(self, command)
1404    }
1405
1406    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1407    pub fn r#set_tracing_enabled(
1408        &self,
1409        mut enabled: bool,
1410    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
1411        DebugBrokerProxyInterface::r#set_tracing_enabled(self, enabled)
1412    }
1413}
1414
1415impl DebugBrokerProxyInterface for DebugBrokerProxy {
1416    type SendDebugCommandResponseFut =
1417        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1418    fn r#send_debug_command(&self, mut command: &str) -> Self::SendDebugCommandResponseFut {
1419        fn _decode(
1420            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1421        ) -> Result<i32, fidl::Error> {
1422            let _response = fidl::client::decode_transaction_body::<
1423                DebugBrokerSendDebugCommandResponse,
1424                fidl::encoding::DefaultFuchsiaResourceDialect,
1425                0x1ee270f83b5d6ff6,
1426            >(_buf?)?;
1427            Ok(_response.status)
1428        }
1429        self.client.send_query_and_decode::<DebugBrokerSendDebugCommandRequest, i32>(
1430            (command,),
1431            0x1ee270f83b5d6ff6,
1432            fidl::encoding::DynamicFlags::empty(),
1433            _decode,
1434        )
1435    }
1436
1437    type SetTracingEnabledResponseFut =
1438        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
1439    fn r#set_tracing_enabled(&self, mut enabled: bool) -> Self::SetTracingEnabledResponseFut {
1440        fn _decode(
1441            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1442        ) -> Result<i32, fidl::Error> {
1443            let _response = fidl::client::decode_transaction_body::<
1444                DebugBrokerSetTracingEnabledResponse,
1445                fidl::encoding::DefaultFuchsiaResourceDialect,
1446                0x12e368d05329b30e,
1447            >(_buf?)?;
1448            Ok(_response.status)
1449        }
1450        self.client.send_query_and_decode::<DebugBrokerSetTracingEnabledRequest, i32>(
1451            (enabled,),
1452            0x12e368d05329b30e,
1453            fidl::encoding::DynamicFlags::empty(),
1454            _decode,
1455        )
1456    }
1457}
1458
1459pub struct DebugBrokerEventStream {
1460    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1461}
1462
1463impl std::marker::Unpin for DebugBrokerEventStream {}
1464
1465impl futures::stream::FusedStream for DebugBrokerEventStream {
1466    fn is_terminated(&self) -> bool {
1467        self.event_receiver.is_terminated()
1468    }
1469}
1470
1471impl futures::Stream for DebugBrokerEventStream {
1472    type Item = Result<DebugBrokerEvent, fidl::Error>;
1473
1474    fn poll_next(
1475        mut self: std::pin::Pin<&mut Self>,
1476        cx: &mut std::task::Context<'_>,
1477    ) -> std::task::Poll<Option<Self::Item>> {
1478        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1479            &mut self.event_receiver,
1480            cx
1481        )?) {
1482            Some(buf) => std::task::Poll::Ready(Some(DebugBrokerEvent::decode(buf))),
1483            None => std::task::Poll::Ready(None),
1484        }
1485    }
1486}
1487
1488#[derive(Debug)]
1489pub enum DebugBrokerEvent {}
1490
1491impl DebugBrokerEvent {
1492    /// Decodes a message buffer as a [`DebugBrokerEvent`].
1493    fn decode(
1494        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1495    ) -> Result<DebugBrokerEvent, fidl::Error> {
1496        let (bytes, _handles) = buf.split_mut();
1497        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1498        debug_assert_eq!(tx_header.tx_id, 0);
1499        match tx_header.ordinal {
1500            _ => Err(fidl::Error::UnknownOrdinal {
1501                ordinal: tx_header.ordinal,
1502                protocol_name: <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1503            }),
1504        }
1505    }
1506}
1507
1508/// A Stream of incoming requests for fuchsia.kernel/DebugBroker.
1509pub struct DebugBrokerRequestStream {
1510    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1511    is_terminated: bool,
1512}
1513
1514impl std::marker::Unpin for DebugBrokerRequestStream {}
1515
1516impl futures::stream::FusedStream for DebugBrokerRequestStream {
1517    fn is_terminated(&self) -> bool {
1518        self.is_terminated
1519    }
1520}
1521
1522impl fidl::endpoints::RequestStream for DebugBrokerRequestStream {
1523    type Protocol = DebugBrokerMarker;
1524    type ControlHandle = DebugBrokerControlHandle;
1525
1526    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1527        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1528    }
1529
1530    fn control_handle(&self) -> Self::ControlHandle {
1531        DebugBrokerControlHandle { inner: self.inner.clone() }
1532    }
1533
1534    fn into_inner(
1535        self,
1536    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1537    {
1538        (self.inner, self.is_terminated)
1539    }
1540
1541    fn from_inner(
1542        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1543        is_terminated: bool,
1544    ) -> Self {
1545        Self { inner, is_terminated }
1546    }
1547}
1548
1549impl futures::Stream for DebugBrokerRequestStream {
1550    type Item = Result<DebugBrokerRequest, fidl::Error>;
1551
1552    fn poll_next(
1553        mut self: std::pin::Pin<&mut Self>,
1554        cx: &mut std::task::Context<'_>,
1555    ) -> std::task::Poll<Option<Self::Item>> {
1556        let this = &mut *self;
1557        if this.inner.check_shutdown(cx) {
1558            this.is_terminated = true;
1559            return std::task::Poll::Ready(None);
1560        }
1561        if this.is_terminated {
1562            panic!("polled DebugBrokerRequestStream after completion");
1563        }
1564        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1565            |bytes, handles| {
1566                match this.inner.channel().read_etc(cx, bytes, handles) {
1567                    std::task::Poll::Ready(Ok(())) => {}
1568                    std::task::Poll::Pending => return std::task::Poll::Pending,
1569                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1570                        this.is_terminated = true;
1571                        return std::task::Poll::Ready(None);
1572                    }
1573                    std::task::Poll::Ready(Err(e)) => {
1574                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1575                            e.into(),
1576                        ))));
1577                    }
1578                }
1579
1580                // A message has been received from the channel
1581                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1582
1583                std::task::Poll::Ready(Some(match header.ordinal {
1584                    0x1ee270f83b5d6ff6 => {
1585                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1586                        let mut req = fidl::new_empty!(
1587                            DebugBrokerSendDebugCommandRequest,
1588                            fidl::encoding::DefaultFuchsiaResourceDialect
1589                        );
1590                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSendDebugCommandRequest>(&header, _body_bytes, handles, &mut req)?;
1591                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1592                        Ok(DebugBrokerRequest::SendDebugCommand {
1593                            command: req.command,
1594
1595                            responder: DebugBrokerSendDebugCommandResponder {
1596                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1597                                tx_id: header.tx_id,
1598                            },
1599                        })
1600                    }
1601                    0x12e368d05329b30e => {
1602                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1603                        let mut req = fidl::new_empty!(
1604                            DebugBrokerSetTracingEnabledRequest,
1605                            fidl::encoding::DefaultFuchsiaResourceDialect
1606                        );
1607                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugBrokerSetTracingEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1608                        let control_handle = DebugBrokerControlHandle { inner: this.inner.clone() };
1609                        Ok(DebugBrokerRequest::SetTracingEnabled {
1610                            enabled: req.enabled,
1611
1612                            responder: DebugBrokerSetTracingEnabledResponder {
1613                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1614                                tx_id: header.tx_id,
1615                            },
1616                        })
1617                    }
1618                    _ => Err(fidl::Error::UnknownOrdinal {
1619                        ordinal: header.ordinal,
1620                        protocol_name:
1621                            <DebugBrokerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1622                    }),
1623                }))
1624            },
1625        )
1626    }
1627}
1628
1629/// Acts on behalf of the caller to interact with privileged debug system calls.
1630#[derive(Debug)]
1631pub enum DebugBrokerRequest {
1632    /// Pass debug command through to the kernel shell.
1633    /// Look at zx_debug_send_command syscall handling to find valid values.
1634    SendDebugCommand { command: String, responder: DebugBrokerSendDebugCommandResponder },
1635    /// Sets whether kernel tracing (ktrace) is enabled or disabled.
1636    SetTracingEnabled { enabled: bool, responder: DebugBrokerSetTracingEnabledResponder },
1637}
1638
1639impl DebugBrokerRequest {
1640    #[allow(irrefutable_let_patterns)]
1641    pub fn into_send_debug_command(self) -> Option<(String, DebugBrokerSendDebugCommandResponder)> {
1642        if let DebugBrokerRequest::SendDebugCommand { command, responder } = self {
1643            Some((command, responder))
1644        } else {
1645            None
1646        }
1647    }
1648
1649    #[allow(irrefutable_let_patterns)]
1650    pub fn into_set_tracing_enabled(self) -> Option<(bool, DebugBrokerSetTracingEnabledResponder)> {
1651        if let DebugBrokerRequest::SetTracingEnabled { enabled, responder } = self {
1652            Some((enabled, responder))
1653        } else {
1654            None
1655        }
1656    }
1657
1658    /// Name of the method defined in FIDL
1659    pub fn method_name(&self) -> &'static str {
1660        match *self {
1661            DebugBrokerRequest::SendDebugCommand { .. } => "send_debug_command",
1662            DebugBrokerRequest::SetTracingEnabled { .. } => "set_tracing_enabled",
1663        }
1664    }
1665}
1666
1667#[derive(Debug, Clone)]
1668pub struct DebugBrokerControlHandle {
1669    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1670}
1671
1672impl DebugBrokerControlHandle {
1673    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1674        self.inner.shutdown_with_epitaph(status.into())
1675    }
1676}
1677
1678impl fidl::endpoints::ControlHandle for DebugBrokerControlHandle {
1679    fn shutdown(&self) {
1680        self.inner.shutdown()
1681    }
1682
1683    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1684        self.inner.shutdown_with_epitaph(status)
1685    }
1686
1687    fn is_closed(&self) -> bool {
1688        self.inner.channel().is_closed()
1689    }
1690    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1691        self.inner.channel().on_closed()
1692    }
1693
1694    #[cfg(target_os = "fuchsia")]
1695    fn signal_peer(
1696        &self,
1697        clear_mask: zx::Signals,
1698        set_mask: zx::Signals,
1699    ) -> Result<(), zx_status::Status> {
1700        use fidl::Peered;
1701        self.inner.channel().signal_peer(clear_mask, set_mask)
1702    }
1703}
1704
1705impl DebugBrokerControlHandle {}
1706
1707#[must_use = "FIDL methods require a response to be sent"]
1708#[derive(Debug)]
1709pub struct DebugBrokerSendDebugCommandResponder {
1710    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1711    tx_id: u32,
1712}
1713
1714/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1715/// if the responder is dropped without sending a response, so that the client
1716/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1717impl std::ops::Drop for DebugBrokerSendDebugCommandResponder {
1718    fn drop(&mut self) {
1719        self.control_handle.shutdown();
1720        // Safety: drops once, never accessed again
1721        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1722    }
1723}
1724
1725impl fidl::endpoints::Responder for DebugBrokerSendDebugCommandResponder {
1726    type ControlHandle = DebugBrokerControlHandle;
1727
1728    fn control_handle(&self) -> &DebugBrokerControlHandle {
1729        &self.control_handle
1730    }
1731
1732    fn drop_without_shutdown(mut self) {
1733        // Safety: drops once, never accessed again due to mem::forget
1734        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1735        // Prevent Drop from running (which would shut down the channel)
1736        std::mem::forget(self);
1737    }
1738}
1739
1740impl DebugBrokerSendDebugCommandResponder {
1741    /// Sends a response to the FIDL transaction.
1742    ///
1743    /// Sets the channel to shutdown if an error occurs.
1744    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1745        let _result = self.send_raw(status);
1746        if _result.is_err() {
1747            self.control_handle.shutdown();
1748        }
1749        self.drop_without_shutdown();
1750        _result
1751    }
1752
1753    /// Similar to "send" but does not shutdown the channel if an error occurs.
1754    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1755        let _result = self.send_raw(status);
1756        self.drop_without_shutdown();
1757        _result
1758    }
1759
1760    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1761        self.control_handle.inner.send::<DebugBrokerSendDebugCommandResponse>(
1762            (status,),
1763            self.tx_id,
1764            0x1ee270f83b5d6ff6,
1765            fidl::encoding::DynamicFlags::empty(),
1766        )
1767    }
1768}
1769
1770#[must_use = "FIDL methods require a response to be sent"]
1771#[derive(Debug)]
1772pub struct DebugBrokerSetTracingEnabledResponder {
1773    control_handle: std::mem::ManuallyDrop<DebugBrokerControlHandle>,
1774    tx_id: u32,
1775}
1776
1777/// Set the the channel to be shutdown (see [`DebugBrokerControlHandle::shutdown`])
1778/// if the responder is dropped without sending a response, so that the client
1779/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1780impl std::ops::Drop for DebugBrokerSetTracingEnabledResponder {
1781    fn drop(&mut self) {
1782        self.control_handle.shutdown();
1783        // Safety: drops once, never accessed again
1784        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1785    }
1786}
1787
1788impl fidl::endpoints::Responder for DebugBrokerSetTracingEnabledResponder {
1789    type ControlHandle = DebugBrokerControlHandle;
1790
1791    fn control_handle(&self) -> &DebugBrokerControlHandle {
1792        &self.control_handle
1793    }
1794
1795    fn drop_without_shutdown(mut self) {
1796        // Safety: drops once, never accessed again due to mem::forget
1797        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1798        // Prevent Drop from running (which would shut down the channel)
1799        std::mem::forget(self);
1800    }
1801}
1802
1803impl DebugBrokerSetTracingEnabledResponder {
1804    /// Sends a response to the FIDL transaction.
1805    ///
1806    /// Sets the channel to shutdown if an error occurs.
1807    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1808        let _result = self.send_raw(status);
1809        if _result.is_err() {
1810            self.control_handle.shutdown();
1811        }
1812        self.drop_without_shutdown();
1813        _result
1814    }
1815
1816    /// Similar to "send" but does not shutdown the channel if an error occurs.
1817    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1818        let _result = self.send_raw(status);
1819        self.drop_without_shutdown();
1820        _result
1821    }
1822
1823    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1824        self.control_handle.inner.send::<DebugBrokerSetTracingEnabledResponse>(
1825            (status,),
1826            self.tx_id,
1827            0x12e368d05329b30e,
1828            fidl::encoding::DynamicFlags::empty(),
1829        )
1830    }
1831}
1832
1833#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1834pub struct DebugResourceMarker;
1835
1836impl fidl::endpoints::ProtocolMarker for DebugResourceMarker {
1837    type Proxy = DebugResourceProxy;
1838    type RequestStream = DebugResourceRequestStream;
1839    #[cfg(target_os = "fuchsia")]
1840    type SynchronousProxy = DebugResourceSynchronousProxy;
1841
1842    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebugResource";
1843}
1844impl fidl::endpoints::DiscoverableProtocolMarker for DebugResourceMarker {}
1845
1846pub trait DebugResourceProxyInterface: Send + Sync {
1847    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
1848    fn r#get(&self) -> Self::GetResponseFut;
1849}
1850#[derive(Debug)]
1851#[cfg(target_os = "fuchsia")]
1852pub struct DebugResourceSynchronousProxy {
1853    client: fidl::client::sync::Client,
1854}
1855
1856#[cfg(target_os = "fuchsia")]
1857impl fidl::endpoints::SynchronousProxy for DebugResourceSynchronousProxy {
1858    type Proxy = DebugResourceProxy;
1859    type Protocol = DebugResourceMarker;
1860
1861    fn from_channel(inner: fidl::Channel) -> Self {
1862        Self::new(inner)
1863    }
1864
1865    fn into_channel(self) -> fidl::Channel {
1866        self.client.into_channel()
1867    }
1868
1869    fn as_channel(&self) -> &fidl::Channel {
1870        self.client.as_channel()
1871    }
1872}
1873
1874#[cfg(target_os = "fuchsia")]
1875impl DebugResourceSynchronousProxy {
1876    pub fn new(channel: fidl::Channel) -> Self {
1877        Self { client: fidl::client::sync::Client::new(channel) }
1878    }
1879
1880    pub fn into_channel(self) -> fidl::Channel {
1881        self.client.into_channel()
1882    }
1883
1884    /// Waits until an event arrives and returns it. It is safe for other
1885    /// threads to make concurrent requests while waiting for an event.
1886    pub fn wait_for_event(
1887        &self,
1888        deadline: zx::MonotonicInstant,
1889    ) -> Result<DebugResourceEvent, fidl::Error> {
1890        DebugResourceEvent::decode(self.client.wait_for_event::<DebugResourceMarker>(deadline)?)
1891    }
1892
1893    /// Get a debug resource handle.
1894    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
1895        let _response = self.client.send_query::<
1896            fidl::encoding::EmptyPayload,
1897            DebugResourceGetResponse,
1898            DebugResourceMarker,
1899        >(
1900            (),
1901            0x1d79d77ea12a6474,
1902            fidl::encoding::DynamicFlags::empty(),
1903            ___deadline,
1904        )?;
1905        Ok(_response.resource)
1906    }
1907}
1908
1909#[cfg(target_os = "fuchsia")]
1910impl From<DebugResourceSynchronousProxy> for zx::NullableHandle {
1911    fn from(value: DebugResourceSynchronousProxy) -> Self {
1912        value.into_channel().into()
1913    }
1914}
1915
1916#[cfg(target_os = "fuchsia")]
1917impl From<fidl::Channel> for DebugResourceSynchronousProxy {
1918    fn from(value: fidl::Channel) -> Self {
1919        Self::new(value)
1920    }
1921}
1922
1923#[cfg(target_os = "fuchsia")]
1924impl fidl::endpoints::FromClient for DebugResourceSynchronousProxy {
1925    type Protocol = DebugResourceMarker;
1926
1927    fn from_client(value: fidl::endpoints::ClientEnd<DebugResourceMarker>) -> Self {
1928        Self::new(value.into_channel())
1929    }
1930}
1931
1932#[derive(Debug, Clone)]
1933pub struct DebugResourceProxy {
1934    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1935}
1936
1937impl fidl::endpoints::Proxy for DebugResourceProxy {
1938    type Protocol = DebugResourceMarker;
1939
1940    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1941        Self::new(inner)
1942    }
1943
1944    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1945        self.client.into_channel().map_err(|client| Self { client })
1946    }
1947
1948    fn as_channel(&self) -> &::fidl::AsyncChannel {
1949        self.client.as_channel()
1950    }
1951}
1952
1953impl DebugResourceProxy {
1954    /// Create a new Proxy for fuchsia.kernel/DebugResource.
1955    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1956        let protocol_name = <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1957        Self { client: fidl::client::Client::new(channel, protocol_name) }
1958    }
1959
1960    /// Get a Stream of events from the remote end of the protocol.
1961    ///
1962    /// # Panics
1963    ///
1964    /// Panics if the event stream was already taken.
1965    pub fn take_event_stream(&self) -> DebugResourceEventStream {
1966        DebugResourceEventStream { event_receiver: self.client.take_event_receiver() }
1967    }
1968
1969    /// Get a debug resource handle.
1970    pub fn r#get(
1971        &self,
1972    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
1973    {
1974        DebugResourceProxyInterface::r#get(self)
1975    }
1976}
1977
1978impl DebugResourceProxyInterface for DebugResourceProxy {
1979    type GetResponseFut = fidl::client::QueryResponseFut<
1980        fidl::Resource,
1981        fidl::encoding::DefaultFuchsiaResourceDialect,
1982    >;
1983    fn r#get(&self) -> Self::GetResponseFut {
1984        fn _decode(
1985            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1986        ) -> Result<fidl::Resource, fidl::Error> {
1987            let _response = fidl::client::decode_transaction_body::<
1988                DebugResourceGetResponse,
1989                fidl::encoding::DefaultFuchsiaResourceDialect,
1990                0x1d79d77ea12a6474,
1991            >(_buf?)?;
1992            Ok(_response.resource)
1993        }
1994        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
1995            (),
1996            0x1d79d77ea12a6474,
1997            fidl::encoding::DynamicFlags::empty(),
1998            _decode,
1999        )
2000    }
2001}
2002
2003pub struct DebugResourceEventStream {
2004    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2005}
2006
2007impl std::marker::Unpin for DebugResourceEventStream {}
2008
2009impl futures::stream::FusedStream for DebugResourceEventStream {
2010    fn is_terminated(&self) -> bool {
2011        self.event_receiver.is_terminated()
2012    }
2013}
2014
2015impl futures::Stream for DebugResourceEventStream {
2016    type Item = Result<DebugResourceEvent, fidl::Error>;
2017
2018    fn poll_next(
2019        mut self: std::pin::Pin<&mut Self>,
2020        cx: &mut std::task::Context<'_>,
2021    ) -> std::task::Poll<Option<Self::Item>> {
2022        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2023            &mut self.event_receiver,
2024            cx
2025        )?) {
2026            Some(buf) => std::task::Poll::Ready(Some(DebugResourceEvent::decode(buf))),
2027            None => std::task::Poll::Ready(None),
2028        }
2029    }
2030}
2031
2032#[derive(Debug)]
2033pub enum DebugResourceEvent {}
2034
2035impl DebugResourceEvent {
2036    /// Decodes a message buffer as a [`DebugResourceEvent`].
2037    fn decode(
2038        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2039    ) -> Result<DebugResourceEvent, fidl::Error> {
2040        let (bytes, _handles) = buf.split_mut();
2041        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2042        debug_assert_eq!(tx_header.tx_id, 0);
2043        match tx_header.ordinal {
2044            _ => Err(fidl::Error::UnknownOrdinal {
2045                ordinal: tx_header.ordinal,
2046                protocol_name: <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2047            }),
2048        }
2049    }
2050}
2051
2052/// A Stream of incoming requests for fuchsia.kernel/DebugResource.
2053pub struct DebugResourceRequestStream {
2054    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2055    is_terminated: bool,
2056}
2057
2058impl std::marker::Unpin for DebugResourceRequestStream {}
2059
2060impl futures::stream::FusedStream for DebugResourceRequestStream {
2061    fn is_terminated(&self) -> bool {
2062        self.is_terminated
2063    }
2064}
2065
2066impl fidl::endpoints::RequestStream for DebugResourceRequestStream {
2067    type Protocol = DebugResourceMarker;
2068    type ControlHandle = DebugResourceControlHandle;
2069
2070    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2071        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2072    }
2073
2074    fn control_handle(&self) -> Self::ControlHandle {
2075        DebugResourceControlHandle { inner: self.inner.clone() }
2076    }
2077
2078    fn into_inner(
2079        self,
2080    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2081    {
2082        (self.inner, self.is_terminated)
2083    }
2084
2085    fn from_inner(
2086        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2087        is_terminated: bool,
2088    ) -> Self {
2089        Self { inner, is_terminated }
2090    }
2091}
2092
2093impl futures::Stream for DebugResourceRequestStream {
2094    type Item = Result<DebugResourceRequest, fidl::Error>;
2095
2096    fn poll_next(
2097        mut self: std::pin::Pin<&mut Self>,
2098        cx: &mut std::task::Context<'_>,
2099    ) -> std::task::Poll<Option<Self::Item>> {
2100        let this = &mut *self;
2101        if this.inner.check_shutdown(cx) {
2102            this.is_terminated = true;
2103            return std::task::Poll::Ready(None);
2104        }
2105        if this.is_terminated {
2106            panic!("polled DebugResourceRequestStream after completion");
2107        }
2108        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2109            |bytes, handles| {
2110                match this.inner.channel().read_etc(cx, bytes, handles) {
2111                    std::task::Poll::Ready(Ok(())) => {}
2112                    std::task::Poll::Pending => return std::task::Poll::Pending,
2113                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2114                        this.is_terminated = true;
2115                        return std::task::Poll::Ready(None);
2116                    }
2117                    std::task::Poll::Ready(Err(e)) => {
2118                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2119                            e.into(),
2120                        ))));
2121                    }
2122                }
2123
2124                // A message has been received from the channel
2125                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2126
2127                std::task::Poll::Ready(Some(match header.ordinal {
2128                    0x1d79d77ea12a6474 => {
2129                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2130                        let mut req = fidl::new_empty!(
2131                            fidl::encoding::EmptyPayload,
2132                            fidl::encoding::DefaultFuchsiaResourceDialect
2133                        );
2134                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2135                        let control_handle =
2136                            DebugResourceControlHandle { inner: this.inner.clone() };
2137                        Ok(DebugResourceRequest::Get {
2138                            responder: DebugResourceGetResponder {
2139                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2140                                tx_id: header.tx_id,
2141                            },
2142                        })
2143                    }
2144                    _ => Err(fidl::Error::UnknownOrdinal {
2145                        ordinal: header.ordinal,
2146                        protocol_name:
2147                            <DebugResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2148                    }),
2149                }))
2150            },
2151        )
2152    }
2153}
2154
2155/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2156/// `ZX_RSRC_SYSTEM_DEBUG_BASE`.
2157#[derive(Debug)]
2158pub enum DebugResourceRequest {
2159    /// Get a debug resource handle.
2160    Get { responder: DebugResourceGetResponder },
2161}
2162
2163impl DebugResourceRequest {
2164    #[allow(irrefutable_let_patterns)]
2165    pub fn into_get(self) -> Option<(DebugResourceGetResponder)> {
2166        if let DebugResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2167    }
2168
2169    /// Name of the method defined in FIDL
2170    pub fn method_name(&self) -> &'static str {
2171        match *self {
2172            DebugResourceRequest::Get { .. } => "get",
2173        }
2174    }
2175}
2176
2177#[derive(Debug, Clone)]
2178pub struct DebugResourceControlHandle {
2179    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2180}
2181
2182impl DebugResourceControlHandle {
2183    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2184        self.inner.shutdown_with_epitaph(status.into())
2185    }
2186}
2187
2188impl fidl::endpoints::ControlHandle for DebugResourceControlHandle {
2189    fn shutdown(&self) {
2190        self.inner.shutdown()
2191    }
2192
2193    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2194        self.inner.shutdown_with_epitaph(status)
2195    }
2196
2197    fn is_closed(&self) -> bool {
2198        self.inner.channel().is_closed()
2199    }
2200    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2201        self.inner.channel().on_closed()
2202    }
2203
2204    #[cfg(target_os = "fuchsia")]
2205    fn signal_peer(
2206        &self,
2207        clear_mask: zx::Signals,
2208        set_mask: zx::Signals,
2209    ) -> Result<(), zx_status::Status> {
2210        use fidl::Peered;
2211        self.inner.channel().signal_peer(clear_mask, set_mask)
2212    }
2213}
2214
2215impl DebugResourceControlHandle {}
2216
2217#[must_use = "FIDL methods require a response to be sent"]
2218#[derive(Debug)]
2219pub struct DebugResourceGetResponder {
2220    control_handle: std::mem::ManuallyDrop<DebugResourceControlHandle>,
2221    tx_id: u32,
2222}
2223
2224/// Set the the channel to be shutdown (see [`DebugResourceControlHandle::shutdown`])
2225/// if the responder is dropped without sending a response, so that the client
2226/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2227impl std::ops::Drop for DebugResourceGetResponder {
2228    fn drop(&mut self) {
2229        self.control_handle.shutdown();
2230        // Safety: drops once, never accessed again
2231        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2232    }
2233}
2234
2235impl fidl::endpoints::Responder for DebugResourceGetResponder {
2236    type ControlHandle = DebugResourceControlHandle;
2237
2238    fn control_handle(&self) -> &DebugResourceControlHandle {
2239        &self.control_handle
2240    }
2241
2242    fn drop_without_shutdown(mut self) {
2243        // Safety: drops once, never accessed again due to mem::forget
2244        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2245        // Prevent Drop from running (which would shut down the channel)
2246        std::mem::forget(self);
2247    }
2248}
2249
2250impl DebugResourceGetResponder {
2251    /// Sends a response to the FIDL transaction.
2252    ///
2253    /// Sets the channel to shutdown if an error occurs.
2254    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2255        let _result = self.send_raw(resource);
2256        if _result.is_err() {
2257            self.control_handle.shutdown();
2258        }
2259        self.drop_without_shutdown();
2260        _result
2261    }
2262
2263    /// Similar to "send" but does not shutdown the channel if an error occurs.
2264    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2265        let _result = self.send_raw(resource);
2266        self.drop_without_shutdown();
2267        _result
2268    }
2269
2270    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2271        self.control_handle.inner.send::<DebugResourceGetResponse>(
2272            (resource,),
2273            self.tx_id,
2274            0x1d79d77ea12a6474,
2275            fidl::encoding::DynamicFlags::empty(),
2276        )
2277    }
2278}
2279
2280#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2281pub struct DebuglogResourceMarker;
2282
2283impl fidl::endpoints::ProtocolMarker for DebuglogResourceMarker {
2284    type Proxy = DebuglogResourceProxy;
2285    type RequestStream = DebuglogResourceRequestStream;
2286    #[cfg(target_os = "fuchsia")]
2287    type SynchronousProxy = DebuglogResourceSynchronousProxy;
2288
2289    const DEBUG_NAME: &'static str = "fuchsia.kernel.DebuglogResource";
2290}
2291impl fidl::endpoints::DiscoverableProtocolMarker for DebuglogResourceMarker {}
2292
2293pub trait DebuglogResourceProxyInterface: Send + Sync {
2294    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2295    fn r#get(&self) -> Self::GetResponseFut;
2296}
2297#[derive(Debug)]
2298#[cfg(target_os = "fuchsia")]
2299pub struct DebuglogResourceSynchronousProxy {
2300    client: fidl::client::sync::Client,
2301}
2302
2303#[cfg(target_os = "fuchsia")]
2304impl fidl::endpoints::SynchronousProxy for DebuglogResourceSynchronousProxy {
2305    type Proxy = DebuglogResourceProxy;
2306    type Protocol = DebuglogResourceMarker;
2307
2308    fn from_channel(inner: fidl::Channel) -> Self {
2309        Self::new(inner)
2310    }
2311
2312    fn into_channel(self) -> fidl::Channel {
2313        self.client.into_channel()
2314    }
2315
2316    fn as_channel(&self) -> &fidl::Channel {
2317        self.client.as_channel()
2318    }
2319}
2320
2321#[cfg(target_os = "fuchsia")]
2322impl DebuglogResourceSynchronousProxy {
2323    pub fn new(channel: fidl::Channel) -> Self {
2324        Self { client: fidl::client::sync::Client::new(channel) }
2325    }
2326
2327    pub fn into_channel(self) -> fidl::Channel {
2328        self.client.into_channel()
2329    }
2330
2331    /// Waits until an event arrives and returns it. It is safe for other
2332    /// threads to make concurrent requests while waiting for an event.
2333    pub fn wait_for_event(
2334        &self,
2335        deadline: zx::MonotonicInstant,
2336    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2337        DebuglogResourceEvent::decode(
2338            self.client.wait_for_event::<DebuglogResourceMarker>(deadline)?,
2339        )
2340    }
2341
2342    /// Get a debuglog resource handle.
2343    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2344        let _response = self.client.send_query::<
2345            fidl::encoding::EmptyPayload,
2346            DebuglogResourceGetResponse,
2347            DebuglogResourceMarker,
2348        >(
2349            (),
2350            0x6e78c1ff74765225,
2351            fidl::encoding::DynamicFlags::empty(),
2352            ___deadline,
2353        )?;
2354        Ok(_response.resource)
2355    }
2356}
2357
2358#[cfg(target_os = "fuchsia")]
2359impl From<DebuglogResourceSynchronousProxy> for zx::NullableHandle {
2360    fn from(value: DebuglogResourceSynchronousProxy) -> Self {
2361        value.into_channel().into()
2362    }
2363}
2364
2365#[cfg(target_os = "fuchsia")]
2366impl From<fidl::Channel> for DebuglogResourceSynchronousProxy {
2367    fn from(value: fidl::Channel) -> Self {
2368        Self::new(value)
2369    }
2370}
2371
2372#[cfg(target_os = "fuchsia")]
2373impl fidl::endpoints::FromClient for DebuglogResourceSynchronousProxy {
2374    type Protocol = DebuglogResourceMarker;
2375
2376    fn from_client(value: fidl::endpoints::ClientEnd<DebuglogResourceMarker>) -> Self {
2377        Self::new(value.into_channel())
2378    }
2379}
2380
2381#[derive(Debug, Clone)]
2382pub struct DebuglogResourceProxy {
2383    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2384}
2385
2386impl fidl::endpoints::Proxy for DebuglogResourceProxy {
2387    type Protocol = DebuglogResourceMarker;
2388
2389    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2390        Self::new(inner)
2391    }
2392
2393    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2394        self.client.into_channel().map_err(|client| Self { client })
2395    }
2396
2397    fn as_channel(&self) -> &::fidl::AsyncChannel {
2398        self.client.as_channel()
2399    }
2400}
2401
2402impl DebuglogResourceProxy {
2403    /// Create a new Proxy for fuchsia.kernel/DebuglogResource.
2404    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2405        let protocol_name = <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2406        Self { client: fidl::client::Client::new(channel, protocol_name) }
2407    }
2408
2409    /// Get a Stream of events from the remote end of the protocol.
2410    ///
2411    /// # Panics
2412    ///
2413    /// Panics if the event stream was already taken.
2414    pub fn take_event_stream(&self) -> DebuglogResourceEventStream {
2415        DebuglogResourceEventStream { event_receiver: self.client.take_event_receiver() }
2416    }
2417
2418    /// Get a debuglog resource handle.
2419    pub fn r#get(
2420        &self,
2421    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2422    {
2423        DebuglogResourceProxyInterface::r#get(self)
2424    }
2425}
2426
2427impl DebuglogResourceProxyInterface for DebuglogResourceProxy {
2428    type GetResponseFut = fidl::client::QueryResponseFut<
2429        fidl::Resource,
2430        fidl::encoding::DefaultFuchsiaResourceDialect,
2431    >;
2432    fn r#get(&self) -> Self::GetResponseFut {
2433        fn _decode(
2434            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2435        ) -> Result<fidl::Resource, fidl::Error> {
2436            let _response = fidl::client::decode_transaction_body::<
2437                DebuglogResourceGetResponse,
2438                fidl::encoding::DefaultFuchsiaResourceDialect,
2439                0x6e78c1ff74765225,
2440            >(_buf?)?;
2441            Ok(_response.resource)
2442        }
2443        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2444            (),
2445            0x6e78c1ff74765225,
2446            fidl::encoding::DynamicFlags::empty(),
2447            _decode,
2448        )
2449    }
2450}
2451
2452pub struct DebuglogResourceEventStream {
2453    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2454}
2455
2456impl std::marker::Unpin for DebuglogResourceEventStream {}
2457
2458impl futures::stream::FusedStream for DebuglogResourceEventStream {
2459    fn is_terminated(&self) -> bool {
2460        self.event_receiver.is_terminated()
2461    }
2462}
2463
2464impl futures::Stream for DebuglogResourceEventStream {
2465    type Item = Result<DebuglogResourceEvent, fidl::Error>;
2466
2467    fn poll_next(
2468        mut self: std::pin::Pin<&mut Self>,
2469        cx: &mut std::task::Context<'_>,
2470    ) -> std::task::Poll<Option<Self::Item>> {
2471        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2472            &mut self.event_receiver,
2473            cx
2474        )?) {
2475            Some(buf) => std::task::Poll::Ready(Some(DebuglogResourceEvent::decode(buf))),
2476            None => std::task::Poll::Ready(None),
2477        }
2478    }
2479}
2480
2481#[derive(Debug)]
2482pub enum DebuglogResourceEvent {}
2483
2484impl DebuglogResourceEvent {
2485    /// Decodes a message buffer as a [`DebuglogResourceEvent`].
2486    fn decode(
2487        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2488    ) -> Result<DebuglogResourceEvent, fidl::Error> {
2489        let (bytes, _handles) = buf.split_mut();
2490        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2491        debug_assert_eq!(tx_header.tx_id, 0);
2492        match tx_header.ordinal {
2493            _ => Err(fidl::Error::UnknownOrdinal {
2494                ordinal: tx_header.ordinal,
2495                protocol_name:
2496                    <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2497            }),
2498        }
2499    }
2500}
2501
2502/// A Stream of incoming requests for fuchsia.kernel/DebuglogResource.
2503pub struct DebuglogResourceRequestStream {
2504    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2505    is_terminated: bool,
2506}
2507
2508impl std::marker::Unpin for DebuglogResourceRequestStream {}
2509
2510impl futures::stream::FusedStream for DebuglogResourceRequestStream {
2511    fn is_terminated(&self) -> bool {
2512        self.is_terminated
2513    }
2514}
2515
2516impl fidl::endpoints::RequestStream for DebuglogResourceRequestStream {
2517    type Protocol = DebuglogResourceMarker;
2518    type ControlHandle = DebuglogResourceControlHandle;
2519
2520    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2521        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2522    }
2523
2524    fn control_handle(&self) -> Self::ControlHandle {
2525        DebuglogResourceControlHandle { inner: self.inner.clone() }
2526    }
2527
2528    fn into_inner(
2529        self,
2530    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2531    {
2532        (self.inner, self.is_terminated)
2533    }
2534
2535    fn from_inner(
2536        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2537        is_terminated: bool,
2538    ) -> Self {
2539        Self { inner, is_terminated }
2540    }
2541}
2542
2543impl futures::Stream for DebuglogResourceRequestStream {
2544    type Item = Result<DebuglogResourceRequest, fidl::Error>;
2545
2546    fn poll_next(
2547        mut self: std::pin::Pin<&mut Self>,
2548        cx: &mut std::task::Context<'_>,
2549    ) -> std::task::Poll<Option<Self::Item>> {
2550        let this = &mut *self;
2551        if this.inner.check_shutdown(cx) {
2552            this.is_terminated = true;
2553            return std::task::Poll::Ready(None);
2554        }
2555        if this.is_terminated {
2556            panic!("polled DebuglogResourceRequestStream after completion");
2557        }
2558        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2559            |bytes, handles| {
2560                match this.inner.channel().read_etc(cx, bytes, handles) {
2561                    std::task::Poll::Ready(Ok(())) => {}
2562                    std::task::Poll::Pending => return std::task::Poll::Pending,
2563                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2564                        this.is_terminated = true;
2565                        return std::task::Poll::Ready(None);
2566                    }
2567                    std::task::Poll::Ready(Err(e)) => {
2568                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2569                            e.into(),
2570                        ))));
2571                    }
2572                }
2573
2574                // A message has been received from the channel
2575                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2576
2577                std::task::Poll::Ready(Some(match header.ordinal {
2578                    0x6e78c1ff74765225 => {
2579                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2580                        let mut req = fidl::new_empty!(
2581                            fidl::encoding::EmptyPayload,
2582                            fidl::encoding::DefaultFuchsiaResourceDialect
2583                        );
2584                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2585                        let control_handle =
2586                            DebuglogResourceControlHandle { inner: this.inner.clone() };
2587                        Ok(DebuglogResourceRequest::Get {
2588                            responder: DebuglogResourceGetResponder {
2589                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2590                                tx_id: header.tx_id,
2591                            },
2592                        })
2593                    }
2594                    _ => Err(fidl::Error::UnknownOrdinal {
2595                        ordinal: header.ordinal,
2596                        protocol_name:
2597                            <DebuglogResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2598                    }),
2599                }))
2600            },
2601        )
2602    }
2603}
2604
2605/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
2606/// `ZX_RSRC_SYSTEM_DEBUGLOG_BASE`.
2607#[derive(Debug)]
2608pub enum DebuglogResourceRequest {
2609    /// Get a debuglog resource handle.
2610    Get { responder: DebuglogResourceGetResponder },
2611}
2612
2613impl DebuglogResourceRequest {
2614    #[allow(irrefutable_let_patterns)]
2615    pub fn into_get(self) -> Option<(DebuglogResourceGetResponder)> {
2616        if let DebuglogResourceRequest::Get { responder } = self { Some((responder)) } else { None }
2617    }
2618
2619    /// Name of the method defined in FIDL
2620    pub fn method_name(&self) -> &'static str {
2621        match *self {
2622            DebuglogResourceRequest::Get { .. } => "get",
2623        }
2624    }
2625}
2626
2627#[derive(Debug, Clone)]
2628pub struct DebuglogResourceControlHandle {
2629    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2630}
2631
2632impl DebuglogResourceControlHandle {
2633    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2634        self.inner.shutdown_with_epitaph(status.into())
2635    }
2636}
2637
2638impl fidl::endpoints::ControlHandle for DebuglogResourceControlHandle {
2639    fn shutdown(&self) {
2640        self.inner.shutdown()
2641    }
2642
2643    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2644        self.inner.shutdown_with_epitaph(status)
2645    }
2646
2647    fn is_closed(&self) -> bool {
2648        self.inner.channel().is_closed()
2649    }
2650    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2651        self.inner.channel().on_closed()
2652    }
2653
2654    #[cfg(target_os = "fuchsia")]
2655    fn signal_peer(
2656        &self,
2657        clear_mask: zx::Signals,
2658        set_mask: zx::Signals,
2659    ) -> Result<(), zx_status::Status> {
2660        use fidl::Peered;
2661        self.inner.channel().signal_peer(clear_mask, set_mask)
2662    }
2663}
2664
2665impl DebuglogResourceControlHandle {}
2666
2667#[must_use = "FIDL methods require a response to be sent"]
2668#[derive(Debug)]
2669pub struct DebuglogResourceGetResponder {
2670    control_handle: std::mem::ManuallyDrop<DebuglogResourceControlHandle>,
2671    tx_id: u32,
2672}
2673
2674/// Set the the channel to be shutdown (see [`DebuglogResourceControlHandle::shutdown`])
2675/// if the responder is dropped without sending a response, so that the client
2676/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2677impl std::ops::Drop for DebuglogResourceGetResponder {
2678    fn drop(&mut self) {
2679        self.control_handle.shutdown();
2680        // Safety: drops once, never accessed again
2681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2682    }
2683}
2684
2685impl fidl::endpoints::Responder for DebuglogResourceGetResponder {
2686    type ControlHandle = DebuglogResourceControlHandle;
2687
2688    fn control_handle(&self) -> &DebuglogResourceControlHandle {
2689        &self.control_handle
2690    }
2691
2692    fn drop_without_shutdown(mut self) {
2693        // Safety: drops once, never accessed again due to mem::forget
2694        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2695        // Prevent Drop from running (which would shut down the channel)
2696        std::mem::forget(self);
2697    }
2698}
2699
2700impl DebuglogResourceGetResponder {
2701    /// Sends a response to the FIDL transaction.
2702    ///
2703    /// Sets the channel to shutdown if an error occurs.
2704    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2705        let _result = self.send_raw(resource);
2706        if _result.is_err() {
2707            self.control_handle.shutdown();
2708        }
2709        self.drop_without_shutdown();
2710        _result
2711    }
2712
2713    /// Similar to "send" but does not shutdown the channel if an error occurs.
2714    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2715        let _result = self.send_raw(resource);
2716        self.drop_without_shutdown();
2717        _result
2718    }
2719
2720    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
2721        self.control_handle.inner.send::<DebuglogResourceGetResponse>(
2722            (resource,),
2723            self.tx_id,
2724            0x6e78c1ff74765225,
2725            fidl::encoding::DynamicFlags::empty(),
2726        )
2727    }
2728}
2729
2730#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2731pub struct EnergyInfoResourceMarker;
2732
2733impl fidl::endpoints::ProtocolMarker for EnergyInfoResourceMarker {
2734    type Proxy = EnergyInfoResourceProxy;
2735    type RequestStream = EnergyInfoResourceRequestStream;
2736    #[cfg(target_os = "fuchsia")]
2737    type SynchronousProxy = EnergyInfoResourceSynchronousProxy;
2738
2739    const DEBUG_NAME: &'static str = "fuchsia.kernel.EnergyInfoResource";
2740}
2741impl fidl::endpoints::DiscoverableProtocolMarker for EnergyInfoResourceMarker {}
2742
2743pub trait EnergyInfoResourceProxyInterface: Send + Sync {
2744    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
2745    fn r#get(&self) -> Self::GetResponseFut;
2746}
2747#[derive(Debug)]
2748#[cfg(target_os = "fuchsia")]
2749pub struct EnergyInfoResourceSynchronousProxy {
2750    client: fidl::client::sync::Client,
2751}
2752
2753#[cfg(target_os = "fuchsia")]
2754impl fidl::endpoints::SynchronousProxy for EnergyInfoResourceSynchronousProxy {
2755    type Proxy = EnergyInfoResourceProxy;
2756    type Protocol = EnergyInfoResourceMarker;
2757
2758    fn from_channel(inner: fidl::Channel) -> Self {
2759        Self::new(inner)
2760    }
2761
2762    fn into_channel(self) -> fidl::Channel {
2763        self.client.into_channel()
2764    }
2765
2766    fn as_channel(&self) -> &fidl::Channel {
2767        self.client.as_channel()
2768    }
2769}
2770
2771#[cfg(target_os = "fuchsia")]
2772impl EnergyInfoResourceSynchronousProxy {
2773    pub fn new(channel: fidl::Channel) -> Self {
2774        Self { client: fidl::client::sync::Client::new(channel) }
2775    }
2776
2777    pub fn into_channel(self) -> fidl::Channel {
2778        self.client.into_channel()
2779    }
2780
2781    /// Waits until an event arrives and returns it. It is safe for other
2782    /// threads to make concurrent requests while waiting for an event.
2783    pub fn wait_for_event(
2784        &self,
2785        deadline: zx::MonotonicInstant,
2786    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2787        EnergyInfoResourceEvent::decode(
2788            self.client.wait_for_event::<EnergyInfoResourceMarker>(deadline)?,
2789        )
2790    }
2791
2792    /// Get an EnergyInfo resource handle.
2793    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
2794        let _response = self.client.send_query::<
2795            fidl::encoding::EmptyPayload,
2796            EnergyInfoResourceGetResponse,
2797            EnergyInfoResourceMarker,
2798        >(
2799            (),
2800            0x5f5cc9f0745f61d0,
2801            fidl::encoding::DynamicFlags::empty(),
2802            ___deadline,
2803        )?;
2804        Ok(_response.resource)
2805    }
2806}
2807
2808#[cfg(target_os = "fuchsia")]
2809impl From<EnergyInfoResourceSynchronousProxy> for zx::NullableHandle {
2810    fn from(value: EnergyInfoResourceSynchronousProxy) -> Self {
2811        value.into_channel().into()
2812    }
2813}
2814
2815#[cfg(target_os = "fuchsia")]
2816impl From<fidl::Channel> for EnergyInfoResourceSynchronousProxy {
2817    fn from(value: fidl::Channel) -> Self {
2818        Self::new(value)
2819    }
2820}
2821
2822#[cfg(target_os = "fuchsia")]
2823impl fidl::endpoints::FromClient for EnergyInfoResourceSynchronousProxy {
2824    type Protocol = EnergyInfoResourceMarker;
2825
2826    fn from_client(value: fidl::endpoints::ClientEnd<EnergyInfoResourceMarker>) -> Self {
2827        Self::new(value.into_channel())
2828    }
2829}
2830
2831#[derive(Debug, Clone)]
2832pub struct EnergyInfoResourceProxy {
2833    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2834}
2835
2836impl fidl::endpoints::Proxy for EnergyInfoResourceProxy {
2837    type Protocol = EnergyInfoResourceMarker;
2838
2839    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2840        Self::new(inner)
2841    }
2842
2843    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2844        self.client.into_channel().map_err(|client| Self { client })
2845    }
2846
2847    fn as_channel(&self) -> &::fidl::AsyncChannel {
2848        self.client.as_channel()
2849    }
2850}
2851
2852impl EnergyInfoResourceProxy {
2853    /// Create a new Proxy for fuchsia.kernel/EnergyInfoResource.
2854    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2855        let protocol_name =
2856            <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2857        Self { client: fidl::client::Client::new(channel, protocol_name) }
2858    }
2859
2860    /// Get a Stream of events from the remote end of the protocol.
2861    ///
2862    /// # Panics
2863    ///
2864    /// Panics if the event stream was already taken.
2865    pub fn take_event_stream(&self) -> EnergyInfoResourceEventStream {
2866        EnergyInfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
2867    }
2868
2869    /// Get an EnergyInfo resource handle.
2870    pub fn r#get(
2871        &self,
2872    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
2873    {
2874        EnergyInfoResourceProxyInterface::r#get(self)
2875    }
2876}
2877
2878impl EnergyInfoResourceProxyInterface for EnergyInfoResourceProxy {
2879    type GetResponseFut = fidl::client::QueryResponseFut<
2880        fidl::Resource,
2881        fidl::encoding::DefaultFuchsiaResourceDialect,
2882    >;
2883    fn r#get(&self) -> Self::GetResponseFut {
2884        fn _decode(
2885            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2886        ) -> Result<fidl::Resource, fidl::Error> {
2887            let _response = fidl::client::decode_transaction_body::<
2888                EnergyInfoResourceGetResponse,
2889                fidl::encoding::DefaultFuchsiaResourceDialect,
2890                0x5f5cc9f0745f61d0,
2891            >(_buf?)?;
2892            Ok(_response.resource)
2893        }
2894        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
2895            (),
2896            0x5f5cc9f0745f61d0,
2897            fidl::encoding::DynamicFlags::empty(),
2898            _decode,
2899        )
2900    }
2901}
2902
2903pub struct EnergyInfoResourceEventStream {
2904    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2905}
2906
2907impl std::marker::Unpin for EnergyInfoResourceEventStream {}
2908
2909impl futures::stream::FusedStream for EnergyInfoResourceEventStream {
2910    fn is_terminated(&self) -> bool {
2911        self.event_receiver.is_terminated()
2912    }
2913}
2914
2915impl futures::Stream for EnergyInfoResourceEventStream {
2916    type Item = Result<EnergyInfoResourceEvent, fidl::Error>;
2917
2918    fn poll_next(
2919        mut self: std::pin::Pin<&mut Self>,
2920        cx: &mut std::task::Context<'_>,
2921    ) -> std::task::Poll<Option<Self::Item>> {
2922        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2923            &mut self.event_receiver,
2924            cx
2925        )?) {
2926            Some(buf) => std::task::Poll::Ready(Some(EnergyInfoResourceEvent::decode(buf))),
2927            None => std::task::Poll::Ready(None),
2928        }
2929    }
2930}
2931
2932#[derive(Debug)]
2933pub enum EnergyInfoResourceEvent {}
2934
2935impl EnergyInfoResourceEvent {
2936    /// Decodes a message buffer as a [`EnergyInfoResourceEvent`].
2937    fn decode(
2938        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2939    ) -> Result<EnergyInfoResourceEvent, fidl::Error> {
2940        let (bytes, _handles) = buf.split_mut();
2941        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2942        debug_assert_eq!(tx_header.tx_id, 0);
2943        match tx_header.ordinal {
2944            _ => Err(fidl::Error::UnknownOrdinal {
2945                ordinal: tx_header.ordinal,
2946                protocol_name:
2947                    <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2948            }),
2949        }
2950    }
2951}
2952
2953/// A Stream of incoming requests for fuchsia.kernel/EnergyInfoResource.
2954pub struct EnergyInfoResourceRequestStream {
2955    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2956    is_terminated: bool,
2957}
2958
2959impl std::marker::Unpin for EnergyInfoResourceRequestStream {}
2960
2961impl futures::stream::FusedStream for EnergyInfoResourceRequestStream {
2962    fn is_terminated(&self) -> bool {
2963        self.is_terminated
2964    }
2965}
2966
2967impl fidl::endpoints::RequestStream for EnergyInfoResourceRequestStream {
2968    type Protocol = EnergyInfoResourceMarker;
2969    type ControlHandle = EnergyInfoResourceControlHandle;
2970
2971    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2972        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2973    }
2974
2975    fn control_handle(&self) -> Self::ControlHandle {
2976        EnergyInfoResourceControlHandle { inner: self.inner.clone() }
2977    }
2978
2979    fn into_inner(
2980        self,
2981    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2982    {
2983        (self.inner, self.is_terminated)
2984    }
2985
2986    fn from_inner(
2987        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2988        is_terminated: bool,
2989    ) -> Self {
2990        Self { inner, is_terminated }
2991    }
2992}
2993
2994impl futures::Stream for EnergyInfoResourceRequestStream {
2995    type Item = Result<EnergyInfoResourceRequest, fidl::Error>;
2996
2997    fn poll_next(
2998        mut self: std::pin::Pin<&mut Self>,
2999        cx: &mut std::task::Context<'_>,
3000    ) -> std::task::Poll<Option<Self::Item>> {
3001        let this = &mut *self;
3002        if this.inner.check_shutdown(cx) {
3003            this.is_terminated = true;
3004            return std::task::Poll::Ready(None);
3005        }
3006        if this.is_terminated {
3007            panic!("polled EnergyInfoResourceRequestStream after completion");
3008        }
3009        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3010            |bytes, handles| {
3011                match this.inner.channel().read_etc(cx, bytes, handles) {
3012                    std::task::Poll::Ready(Ok(())) => {}
3013                    std::task::Poll::Pending => return std::task::Poll::Pending,
3014                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3015                        this.is_terminated = true;
3016                        return std::task::Poll::Ready(None);
3017                    }
3018                    std::task::Poll::Ready(Err(e)) => {
3019                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3020                            e.into(),
3021                        ))));
3022                    }
3023                }
3024
3025                // A message has been received from the channel
3026                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3027
3028                std::task::Poll::Ready(Some(match header.ordinal {
3029                0x5f5cc9f0745f61d0 => {
3030                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3031                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3032                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3033                    let control_handle = EnergyInfoResourceControlHandle {
3034                        inner: this.inner.clone(),
3035                    };
3036                    Ok(EnergyInfoResourceRequest::Get {
3037                        responder: EnergyInfoResourceGetResponder {
3038                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3039                            tx_id: header.tx_id,
3040                        },
3041                    })
3042                }
3043                _ => Err(fidl::Error::UnknownOrdinal {
3044                    ordinal: header.ordinal,
3045                    protocol_name: <EnergyInfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3046                }),
3047            }))
3048            },
3049        )
3050    }
3051}
3052
3053/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3054/// `ZX_RSRC_SYSTEM_ENERGY_INFO_BASE`.
3055#[derive(Debug)]
3056pub enum EnergyInfoResourceRequest {
3057    /// Get an EnergyInfo resource handle.
3058    Get { responder: EnergyInfoResourceGetResponder },
3059}
3060
3061impl EnergyInfoResourceRequest {
3062    #[allow(irrefutable_let_patterns)]
3063    pub fn into_get(self) -> Option<(EnergyInfoResourceGetResponder)> {
3064        if let EnergyInfoResourceRequest::Get { responder } = self {
3065            Some((responder))
3066        } else {
3067            None
3068        }
3069    }
3070
3071    /// Name of the method defined in FIDL
3072    pub fn method_name(&self) -> &'static str {
3073        match *self {
3074            EnergyInfoResourceRequest::Get { .. } => "get",
3075        }
3076    }
3077}
3078
3079#[derive(Debug, Clone)]
3080pub struct EnergyInfoResourceControlHandle {
3081    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3082}
3083
3084impl EnergyInfoResourceControlHandle {
3085    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3086        self.inner.shutdown_with_epitaph(status.into())
3087    }
3088}
3089
3090impl fidl::endpoints::ControlHandle for EnergyInfoResourceControlHandle {
3091    fn shutdown(&self) {
3092        self.inner.shutdown()
3093    }
3094
3095    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3096        self.inner.shutdown_with_epitaph(status)
3097    }
3098
3099    fn is_closed(&self) -> bool {
3100        self.inner.channel().is_closed()
3101    }
3102    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3103        self.inner.channel().on_closed()
3104    }
3105
3106    #[cfg(target_os = "fuchsia")]
3107    fn signal_peer(
3108        &self,
3109        clear_mask: zx::Signals,
3110        set_mask: zx::Signals,
3111    ) -> Result<(), zx_status::Status> {
3112        use fidl::Peered;
3113        self.inner.channel().signal_peer(clear_mask, set_mask)
3114    }
3115}
3116
3117impl EnergyInfoResourceControlHandle {}
3118
3119#[must_use = "FIDL methods require a response to be sent"]
3120#[derive(Debug)]
3121pub struct EnergyInfoResourceGetResponder {
3122    control_handle: std::mem::ManuallyDrop<EnergyInfoResourceControlHandle>,
3123    tx_id: u32,
3124}
3125
3126/// Set the the channel to be shutdown (see [`EnergyInfoResourceControlHandle::shutdown`])
3127/// if the responder is dropped without sending a response, so that the client
3128/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3129impl std::ops::Drop for EnergyInfoResourceGetResponder {
3130    fn drop(&mut self) {
3131        self.control_handle.shutdown();
3132        // Safety: drops once, never accessed again
3133        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3134    }
3135}
3136
3137impl fidl::endpoints::Responder for EnergyInfoResourceGetResponder {
3138    type ControlHandle = EnergyInfoResourceControlHandle;
3139
3140    fn control_handle(&self) -> &EnergyInfoResourceControlHandle {
3141        &self.control_handle
3142    }
3143
3144    fn drop_without_shutdown(mut self) {
3145        // Safety: drops once, never accessed again due to mem::forget
3146        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3147        // Prevent Drop from running (which would shut down the channel)
3148        std::mem::forget(self);
3149    }
3150}
3151
3152impl EnergyInfoResourceGetResponder {
3153    /// Sends a response to the FIDL transaction.
3154    ///
3155    /// Sets the channel to shutdown if an error occurs.
3156    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3157        let _result = self.send_raw(resource);
3158        if _result.is_err() {
3159            self.control_handle.shutdown();
3160        }
3161        self.drop_without_shutdown();
3162        _result
3163    }
3164
3165    /// Similar to "send" but does not shutdown the channel if an error occurs.
3166    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3167        let _result = self.send_raw(resource);
3168        self.drop_without_shutdown();
3169        _result
3170    }
3171
3172    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3173        self.control_handle.inner.send::<EnergyInfoResourceGetResponse>(
3174            (resource,),
3175            self.tx_id,
3176            0x5f5cc9f0745f61d0,
3177            fidl::encoding::DynamicFlags::empty(),
3178        )
3179    }
3180}
3181
3182#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3183pub struct HypervisorResourceMarker;
3184
3185impl fidl::endpoints::ProtocolMarker for HypervisorResourceMarker {
3186    type Proxy = HypervisorResourceProxy;
3187    type RequestStream = HypervisorResourceRequestStream;
3188    #[cfg(target_os = "fuchsia")]
3189    type SynchronousProxy = HypervisorResourceSynchronousProxy;
3190
3191    const DEBUG_NAME: &'static str = "fuchsia.kernel.HypervisorResource";
3192}
3193impl fidl::endpoints::DiscoverableProtocolMarker for HypervisorResourceMarker {}
3194
3195pub trait HypervisorResourceProxyInterface: Send + Sync {
3196    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3197    fn r#get(&self) -> Self::GetResponseFut;
3198}
3199#[derive(Debug)]
3200#[cfg(target_os = "fuchsia")]
3201pub struct HypervisorResourceSynchronousProxy {
3202    client: fidl::client::sync::Client,
3203}
3204
3205#[cfg(target_os = "fuchsia")]
3206impl fidl::endpoints::SynchronousProxy for HypervisorResourceSynchronousProxy {
3207    type Proxy = HypervisorResourceProxy;
3208    type Protocol = HypervisorResourceMarker;
3209
3210    fn from_channel(inner: fidl::Channel) -> Self {
3211        Self::new(inner)
3212    }
3213
3214    fn into_channel(self) -> fidl::Channel {
3215        self.client.into_channel()
3216    }
3217
3218    fn as_channel(&self) -> &fidl::Channel {
3219        self.client.as_channel()
3220    }
3221}
3222
3223#[cfg(target_os = "fuchsia")]
3224impl HypervisorResourceSynchronousProxy {
3225    pub fn new(channel: fidl::Channel) -> Self {
3226        Self { client: fidl::client::sync::Client::new(channel) }
3227    }
3228
3229    pub fn into_channel(self) -> fidl::Channel {
3230        self.client.into_channel()
3231    }
3232
3233    /// Waits until an event arrives and returns it. It is safe for other
3234    /// threads to make concurrent requests while waiting for an event.
3235    pub fn wait_for_event(
3236        &self,
3237        deadline: zx::MonotonicInstant,
3238    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3239        HypervisorResourceEvent::decode(
3240            self.client.wait_for_event::<HypervisorResourceMarker>(deadline)?,
3241        )
3242    }
3243
3244    /// Get a hypervisor resource handle.
3245    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3246        let _response = self.client.send_query::<
3247            fidl::encoding::EmptyPayload,
3248            HypervisorResourceGetResponse,
3249            HypervisorResourceMarker,
3250        >(
3251            (),
3252            0x1c312131d3b824a2,
3253            fidl::encoding::DynamicFlags::empty(),
3254            ___deadline,
3255        )?;
3256        Ok(_response.resource)
3257    }
3258}
3259
3260#[cfg(target_os = "fuchsia")]
3261impl From<HypervisorResourceSynchronousProxy> for zx::NullableHandle {
3262    fn from(value: HypervisorResourceSynchronousProxy) -> Self {
3263        value.into_channel().into()
3264    }
3265}
3266
3267#[cfg(target_os = "fuchsia")]
3268impl From<fidl::Channel> for HypervisorResourceSynchronousProxy {
3269    fn from(value: fidl::Channel) -> Self {
3270        Self::new(value)
3271    }
3272}
3273
3274#[cfg(target_os = "fuchsia")]
3275impl fidl::endpoints::FromClient for HypervisorResourceSynchronousProxy {
3276    type Protocol = HypervisorResourceMarker;
3277
3278    fn from_client(value: fidl::endpoints::ClientEnd<HypervisorResourceMarker>) -> Self {
3279        Self::new(value.into_channel())
3280    }
3281}
3282
3283#[derive(Debug, Clone)]
3284pub struct HypervisorResourceProxy {
3285    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3286}
3287
3288impl fidl::endpoints::Proxy for HypervisorResourceProxy {
3289    type Protocol = HypervisorResourceMarker;
3290
3291    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3292        Self::new(inner)
3293    }
3294
3295    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3296        self.client.into_channel().map_err(|client| Self { client })
3297    }
3298
3299    fn as_channel(&self) -> &::fidl::AsyncChannel {
3300        self.client.as_channel()
3301    }
3302}
3303
3304impl HypervisorResourceProxy {
3305    /// Create a new Proxy for fuchsia.kernel/HypervisorResource.
3306    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3307        let protocol_name =
3308            <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3309        Self { client: fidl::client::Client::new(channel, protocol_name) }
3310    }
3311
3312    /// Get a Stream of events from the remote end of the protocol.
3313    ///
3314    /// # Panics
3315    ///
3316    /// Panics if the event stream was already taken.
3317    pub fn take_event_stream(&self) -> HypervisorResourceEventStream {
3318        HypervisorResourceEventStream { event_receiver: self.client.take_event_receiver() }
3319    }
3320
3321    /// Get a hypervisor resource handle.
3322    pub fn r#get(
3323        &self,
3324    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3325    {
3326        HypervisorResourceProxyInterface::r#get(self)
3327    }
3328}
3329
3330impl HypervisorResourceProxyInterface for HypervisorResourceProxy {
3331    type GetResponseFut = fidl::client::QueryResponseFut<
3332        fidl::Resource,
3333        fidl::encoding::DefaultFuchsiaResourceDialect,
3334    >;
3335    fn r#get(&self) -> Self::GetResponseFut {
3336        fn _decode(
3337            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3338        ) -> Result<fidl::Resource, fidl::Error> {
3339            let _response = fidl::client::decode_transaction_body::<
3340                HypervisorResourceGetResponse,
3341                fidl::encoding::DefaultFuchsiaResourceDialect,
3342                0x1c312131d3b824a2,
3343            >(_buf?)?;
3344            Ok(_response.resource)
3345        }
3346        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3347            (),
3348            0x1c312131d3b824a2,
3349            fidl::encoding::DynamicFlags::empty(),
3350            _decode,
3351        )
3352    }
3353}
3354
3355pub struct HypervisorResourceEventStream {
3356    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3357}
3358
3359impl std::marker::Unpin for HypervisorResourceEventStream {}
3360
3361impl futures::stream::FusedStream for HypervisorResourceEventStream {
3362    fn is_terminated(&self) -> bool {
3363        self.event_receiver.is_terminated()
3364    }
3365}
3366
3367impl futures::Stream for HypervisorResourceEventStream {
3368    type Item = Result<HypervisorResourceEvent, fidl::Error>;
3369
3370    fn poll_next(
3371        mut self: std::pin::Pin<&mut Self>,
3372        cx: &mut std::task::Context<'_>,
3373    ) -> std::task::Poll<Option<Self::Item>> {
3374        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3375            &mut self.event_receiver,
3376            cx
3377        )?) {
3378            Some(buf) => std::task::Poll::Ready(Some(HypervisorResourceEvent::decode(buf))),
3379            None => std::task::Poll::Ready(None),
3380        }
3381    }
3382}
3383
3384#[derive(Debug)]
3385pub enum HypervisorResourceEvent {}
3386
3387impl HypervisorResourceEvent {
3388    /// Decodes a message buffer as a [`HypervisorResourceEvent`].
3389    fn decode(
3390        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3391    ) -> Result<HypervisorResourceEvent, fidl::Error> {
3392        let (bytes, _handles) = buf.split_mut();
3393        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3394        debug_assert_eq!(tx_header.tx_id, 0);
3395        match tx_header.ordinal {
3396            _ => Err(fidl::Error::UnknownOrdinal {
3397                ordinal: tx_header.ordinal,
3398                protocol_name:
3399                    <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3400            }),
3401        }
3402    }
3403}
3404
3405/// A Stream of incoming requests for fuchsia.kernel/HypervisorResource.
3406pub struct HypervisorResourceRequestStream {
3407    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3408    is_terminated: bool,
3409}
3410
3411impl std::marker::Unpin for HypervisorResourceRequestStream {}
3412
3413impl futures::stream::FusedStream for HypervisorResourceRequestStream {
3414    fn is_terminated(&self) -> bool {
3415        self.is_terminated
3416    }
3417}
3418
3419impl fidl::endpoints::RequestStream for HypervisorResourceRequestStream {
3420    type Protocol = HypervisorResourceMarker;
3421    type ControlHandle = HypervisorResourceControlHandle;
3422
3423    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3424        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3425    }
3426
3427    fn control_handle(&self) -> Self::ControlHandle {
3428        HypervisorResourceControlHandle { inner: self.inner.clone() }
3429    }
3430
3431    fn into_inner(
3432        self,
3433    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3434    {
3435        (self.inner, self.is_terminated)
3436    }
3437
3438    fn from_inner(
3439        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3440        is_terminated: bool,
3441    ) -> Self {
3442        Self { inner, is_terminated }
3443    }
3444}
3445
3446impl futures::Stream for HypervisorResourceRequestStream {
3447    type Item = Result<HypervisorResourceRequest, fidl::Error>;
3448
3449    fn poll_next(
3450        mut self: std::pin::Pin<&mut Self>,
3451        cx: &mut std::task::Context<'_>,
3452    ) -> std::task::Poll<Option<Self::Item>> {
3453        let this = &mut *self;
3454        if this.inner.check_shutdown(cx) {
3455            this.is_terminated = true;
3456            return std::task::Poll::Ready(None);
3457        }
3458        if this.is_terminated {
3459            panic!("polled HypervisorResourceRequestStream after completion");
3460        }
3461        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3462            |bytes, handles| {
3463                match this.inner.channel().read_etc(cx, bytes, handles) {
3464                    std::task::Poll::Ready(Ok(())) => {}
3465                    std::task::Poll::Pending => return std::task::Poll::Pending,
3466                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3467                        this.is_terminated = true;
3468                        return std::task::Poll::Ready(None);
3469                    }
3470                    std::task::Poll::Ready(Err(e)) => {
3471                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3472                            e.into(),
3473                        ))));
3474                    }
3475                }
3476
3477                // A message has been received from the channel
3478                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3479
3480                std::task::Poll::Ready(Some(match header.ordinal {
3481                0x1c312131d3b824a2 => {
3482                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3483                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3484                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3485                    let control_handle = HypervisorResourceControlHandle {
3486                        inner: this.inner.clone(),
3487                    };
3488                    Ok(HypervisorResourceRequest::Get {
3489                        responder: HypervisorResourceGetResponder {
3490                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3491                            tx_id: header.tx_id,
3492                        },
3493                    })
3494                }
3495                _ => Err(fidl::Error::UnknownOrdinal {
3496                    ordinal: header.ordinal,
3497                    protocol_name: <HypervisorResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3498                }),
3499            }))
3500            },
3501        )
3502    }
3503}
3504
3505/// Protocol for providing the hypervisor resource.
3506#[derive(Debug)]
3507pub enum HypervisorResourceRequest {
3508    /// Get a hypervisor resource handle.
3509    Get { responder: HypervisorResourceGetResponder },
3510}
3511
3512impl HypervisorResourceRequest {
3513    #[allow(irrefutable_let_patterns)]
3514    pub fn into_get(self) -> Option<(HypervisorResourceGetResponder)> {
3515        if let HypervisorResourceRequest::Get { responder } = self {
3516            Some((responder))
3517        } else {
3518            None
3519        }
3520    }
3521
3522    /// Name of the method defined in FIDL
3523    pub fn method_name(&self) -> &'static str {
3524        match *self {
3525            HypervisorResourceRequest::Get { .. } => "get",
3526        }
3527    }
3528}
3529
3530#[derive(Debug, Clone)]
3531pub struct HypervisorResourceControlHandle {
3532    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3533}
3534
3535impl HypervisorResourceControlHandle {
3536    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3537        self.inner.shutdown_with_epitaph(status.into())
3538    }
3539}
3540
3541impl fidl::endpoints::ControlHandle for HypervisorResourceControlHandle {
3542    fn shutdown(&self) {
3543        self.inner.shutdown()
3544    }
3545
3546    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3547        self.inner.shutdown_with_epitaph(status)
3548    }
3549
3550    fn is_closed(&self) -> bool {
3551        self.inner.channel().is_closed()
3552    }
3553    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3554        self.inner.channel().on_closed()
3555    }
3556
3557    #[cfg(target_os = "fuchsia")]
3558    fn signal_peer(
3559        &self,
3560        clear_mask: zx::Signals,
3561        set_mask: zx::Signals,
3562    ) -> Result<(), zx_status::Status> {
3563        use fidl::Peered;
3564        self.inner.channel().signal_peer(clear_mask, set_mask)
3565    }
3566}
3567
3568impl HypervisorResourceControlHandle {}
3569
3570#[must_use = "FIDL methods require a response to be sent"]
3571#[derive(Debug)]
3572pub struct HypervisorResourceGetResponder {
3573    control_handle: std::mem::ManuallyDrop<HypervisorResourceControlHandle>,
3574    tx_id: u32,
3575}
3576
3577/// Set the the channel to be shutdown (see [`HypervisorResourceControlHandle::shutdown`])
3578/// if the responder is dropped without sending a response, so that the client
3579/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3580impl std::ops::Drop for HypervisorResourceGetResponder {
3581    fn drop(&mut self) {
3582        self.control_handle.shutdown();
3583        // Safety: drops once, never accessed again
3584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3585    }
3586}
3587
3588impl fidl::endpoints::Responder for HypervisorResourceGetResponder {
3589    type ControlHandle = HypervisorResourceControlHandle;
3590
3591    fn control_handle(&self) -> &HypervisorResourceControlHandle {
3592        &self.control_handle
3593    }
3594
3595    fn drop_without_shutdown(mut self) {
3596        // Safety: drops once, never accessed again due to mem::forget
3597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3598        // Prevent Drop from running (which would shut down the channel)
3599        std::mem::forget(self);
3600    }
3601}
3602
3603impl HypervisorResourceGetResponder {
3604    /// Sends a response to the FIDL transaction.
3605    ///
3606    /// Sets the channel to shutdown if an error occurs.
3607    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3608        let _result = self.send_raw(resource);
3609        if _result.is_err() {
3610            self.control_handle.shutdown();
3611        }
3612        self.drop_without_shutdown();
3613        _result
3614    }
3615
3616    /// Similar to "send" but does not shutdown the channel if an error occurs.
3617    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3618        let _result = self.send_raw(resource);
3619        self.drop_without_shutdown();
3620        _result
3621    }
3622
3623    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
3624        self.control_handle.inner.send::<HypervisorResourceGetResponse>(
3625            (resource,),
3626            self.tx_id,
3627            0x1c312131d3b824a2,
3628            fidl::encoding::DynamicFlags::empty(),
3629        )
3630    }
3631}
3632
3633#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3634pub struct InfoResourceMarker;
3635
3636impl fidl::endpoints::ProtocolMarker for InfoResourceMarker {
3637    type Proxy = InfoResourceProxy;
3638    type RequestStream = InfoResourceRequestStream;
3639    #[cfg(target_os = "fuchsia")]
3640    type SynchronousProxy = InfoResourceSynchronousProxy;
3641
3642    const DEBUG_NAME: &'static str = "fuchsia.kernel.InfoResource";
3643}
3644impl fidl::endpoints::DiscoverableProtocolMarker for InfoResourceMarker {}
3645
3646pub trait InfoResourceProxyInterface: Send + Sync {
3647    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
3648    fn r#get(&self) -> Self::GetResponseFut;
3649}
3650#[derive(Debug)]
3651#[cfg(target_os = "fuchsia")]
3652pub struct InfoResourceSynchronousProxy {
3653    client: fidl::client::sync::Client,
3654}
3655
3656#[cfg(target_os = "fuchsia")]
3657impl fidl::endpoints::SynchronousProxy for InfoResourceSynchronousProxy {
3658    type Proxy = InfoResourceProxy;
3659    type Protocol = InfoResourceMarker;
3660
3661    fn from_channel(inner: fidl::Channel) -> Self {
3662        Self::new(inner)
3663    }
3664
3665    fn into_channel(self) -> fidl::Channel {
3666        self.client.into_channel()
3667    }
3668
3669    fn as_channel(&self) -> &fidl::Channel {
3670        self.client.as_channel()
3671    }
3672}
3673
3674#[cfg(target_os = "fuchsia")]
3675impl InfoResourceSynchronousProxy {
3676    pub fn new(channel: fidl::Channel) -> Self {
3677        Self { client: fidl::client::sync::Client::new(channel) }
3678    }
3679
3680    pub fn into_channel(self) -> fidl::Channel {
3681        self.client.into_channel()
3682    }
3683
3684    /// Waits until an event arrives and returns it. It is safe for other
3685    /// threads to make concurrent requests while waiting for an event.
3686    pub fn wait_for_event(
3687        &self,
3688        deadline: zx::MonotonicInstant,
3689    ) -> Result<InfoResourceEvent, fidl::Error> {
3690        InfoResourceEvent::decode(self.client.wait_for_event::<InfoResourceMarker>(deadline)?)
3691    }
3692
3693    /// Get an info resource handle.
3694    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
3695        let _response = self.client.send_query::<
3696            fidl::encoding::EmptyPayload,
3697            InfoResourceGetResponse,
3698            InfoResourceMarker,
3699        >(
3700            (),
3701            0x1de8edcb4abc2067,
3702            fidl::encoding::DynamicFlags::empty(),
3703            ___deadline,
3704        )?;
3705        Ok(_response.resource)
3706    }
3707}
3708
3709#[cfg(target_os = "fuchsia")]
3710impl From<InfoResourceSynchronousProxy> for zx::NullableHandle {
3711    fn from(value: InfoResourceSynchronousProxy) -> Self {
3712        value.into_channel().into()
3713    }
3714}
3715
3716#[cfg(target_os = "fuchsia")]
3717impl From<fidl::Channel> for InfoResourceSynchronousProxy {
3718    fn from(value: fidl::Channel) -> Self {
3719        Self::new(value)
3720    }
3721}
3722
3723#[cfg(target_os = "fuchsia")]
3724impl fidl::endpoints::FromClient for InfoResourceSynchronousProxy {
3725    type Protocol = InfoResourceMarker;
3726
3727    fn from_client(value: fidl::endpoints::ClientEnd<InfoResourceMarker>) -> Self {
3728        Self::new(value.into_channel())
3729    }
3730}
3731
3732#[derive(Debug, Clone)]
3733pub struct InfoResourceProxy {
3734    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3735}
3736
3737impl fidl::endpoints::Proxy for InfoResourceProxy {
3738    type Protocol = InfoResourceMarker;
3739
3740    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3741        Self::new(inner)
3742    }
3743
3744    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3745        self.client.into_channel().map_err(|client| Self { client })
3746    }
3747
3748    fn as_channel(&self) -> &::fidl::AsyncChannel {
3749        self.client.as_channel()
3750    }
3751}
3752
3753impl InfoResourceProxy {
3754    /// Create a new Proxy for fuchsia.kernel/InfoResource.
3755    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3756        let protocol_name = <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3757        Self { client: fidl::client::Client::new(channel, protocol_name) }
3758    }
3759
3760    /// Get a Stream of events from the remote end of the protocol.
3761    ///
3762    /// # Panics
3763    ///
3764    /// Panics if the event stream was already taken.
3765    pub fn take_event_stream(&self) -> InfoResourceEventStream {
3766        InfoResourceEventStream { event_receiver: self.client.take_event_receiver() }
3767    }
3768
3769    /// Get an info resource handle.
3770    pub fn r#get(
3771        &self,
3772    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
3773    {
3774        InfoResourceProxyInterface::r#get(self)
3775    }
3776}
3777
3778impl InfoResourceProxyInterface for InfoResourceProxy {
3779    type GetResponseFut = fidl::client::QueryResponseFut<
3780        fidl::Resource,
3781        fidl::encoding::DefaultFuchsiaResourceDialect,
3782    >;
3783    fn r#get(&self) -> Self::GetResponseFut {
3784        fn _decode(
3785            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3786        ) -> Result<fidl::Resource, fidl::Error> {
3787            let _response = fidl::client::decode_transaction_body::<
3788                InfoResourceGetResponse,
3789                fidl::encoding::DefaultFuchsiaResourceDialect,
3790                0x1de8edcb4abc2067,
3791            >(_buf?)?;
3792            Ok(_response.resource)
3793        }
3794        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
3795            (),
3796            0x1de8edcb4abc2067,
3797            fidl::encoding::DynamicFlags::empty(),
3798            _decode,
3799        )
3800    }
3801}
3802
3803pub struct InfoResourceEventStream {
3804    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3805}
3806
3807impl std::marker::Unpin for InfoResourceEventStream {}
3808
3809impl futures::stream::FusedStream for InfoResourceEventStream {
3810    fn is_terminated(&self) -> bool {
3811        self.event_receiver.is_terminated()
3812    }
3813}
3814
3815impl futures::Stream for InfoResourceEventStream {
3816    type Item = Result<InfoResourceEvent, fidl::Error>;
3817
3818    fn poll_next(
3819        mut self: std::pin::Pin<&mut Self>,
3820        cx: &mut std::task::Context<'_>,
3821    ) -> std::task::Poll<Option<Self::Item>> {
3822        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3823            &mut self.event_receiver,
3824            cx
3825        )?) {
3826            Some(buf) => std::task::Poll::Ready(Some(InfoResourceEvent::decode(buf))),
3827            None => std::task::Poll::Ready(None),
3828        }
3829    }
3830}
3831
3832#[derive(Debug)]
3833pub enum InfoResourceEvent {}
3834
3835impl InfoResourceEvent {
3836    /// Decodes a message buffer as a [`InfoResourceEvent`].
3837    fn decode(
3838        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3839    ) -> Result<InfoResourceEvent, fidl::Error> {
3840        let (bytes, _handles) = buf.split_mut();
3841        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3842        debug_assert_eq!(tx_header.tx_id, 0);
3843        match tx_header.ordinal {
3844            _ => Err(fidl::Error::UnknownOrdinal {
3845                ordinal: tx_header.ordinal,
3846                protocol_name: <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3847            }),
3848        }
3849    }
3850}
3851
3852/// A Stream of incoming requests for fuchsia.kernel/InfoResource.
3853pub struct InfoResourceRequestStream {
3854    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3855    is_terminated: bool,
3856}
3857
3858impl std::marker::Unpin for InfoResourceRequestStream {}
3859
3860impl futures::stream::FusedStream for InfoResourceRequestStream {
3861    fn is_terminated(&self) -> bool {
3862        self.is_terminated
3863    }
3864}
3865
3866impl fidl::endpoints::RequestStream for InfoResourceRequestStream {
3867    type Protocol = InfoResourceMarker;
3868    type ControlHandle = InfoResourceControlHandle;
3869
3870    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3871        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3872    }
3873
3874    fn control_handle(&self) -> Self::ControlHandle {
3875        InfoResourceControlHandle { inner: self.inner.clone() }
3876    }
3877
3878    fn into_inner(
3879        self,
3880    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3881    {
3882        (self.inner, self.is_terminated)
3883    }
3884
3885    fn from_inner(
3886        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3887        is_terminated: bool,
3888    ) -> Self {
3889        Self { inner, is_terminated }
3890    }
3891}
3892
3893impl futures::Stream for InfoResourceRequestStream {
3894    type Item = Result<InfoResourceRequest, fidl::Error>;
3895
3896    fn poll_next(
3897        mut self: std::pin::Pin<&mut Self>,
3898        cx: &mut std::task::Context<'_>,
3899    ) -> std::task::Poll<Option<Self::Item>> {
3900        let this = &mut *self;
3901        if this.inner.check_shutdown(cx) {
3902            this.is_terminated = true;
3903            return std::task::Poll::Ready(None);
3904        }
3905        if this.is_terminated {
3906            panic!("polled InfoResourceRequestStream after completion");
3907        }
3908        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3909            |bytes, handles| {
3910                match this.inner.channel().read_etc(cx, bytes, handles) {
3911                    std::task::Poll::Ready(Ok(())) => {}
3912                    std::task::Poll::Pending => return std::task::Poll::Pending,
3913                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3914                        this.is_terminated = true;
3915                        return std::task::Poll::Ready(None);
3916                    }
3917                    std::task::Poll::Ready(Err(e)) => {
3918                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3919                            e.into(),
3920                        ))));
3921                    }
3922                }
3923
3924                // A message has been received from the channel
3925                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3926
3927                std::task::Poll::Ready(Some(match header.ordinal {
3928                    0x1de8edcb4abc2067 => {
3929                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3930                        let mut req = fidl::new_empty!(
3931                            fidl::encoding::EmptyPayload,
3932                            fidl::encoding::DefaultFuchsiaResourceDialect
3933                        );
3934                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3935                        let control_handle =
3936                            InfoResourceControlHandle { inner: this.inner.clone() };
3937                        Ok(InfoResourceRequest::Get {
3938                            responder: InfoResourceGetResponder {
3939                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3940                                tx_id: header.tx_id,
3941                            },
3942                        })
3943                    }
3944                    _ => Err(fidl::Error::UnknownOrdinal {
3945                        ordinal: header.ordinal,
3946                        protocol_name:
3947                            <InfoResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3948                    }),
3949                }))
3950            },
3951        )
3952    }
3953}
3954
3955/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
3956/// `ZX_RSRC_SYSTEM_INFO_BASE`.
3957#[derive(Debug)]
3958pub enum InfoResourceRequest {
3959    /// Get an info resource handle.
3960    Get { responder: InfoResourceGetResponder },
3961}
3962
3963impl InfoResourceRequest {
3964    #[allow(irrefutable_let_patterns)]
3965    pub fn into_get(self) -> Option<(InfoResourceGetResponder)> {
3966        if let InfoResourceRequest::Get { responder } = self { Some((responder)) } else { None }
3967    }
3968
3969    /// Name of the method defined in FIDL
3970    pub fn method_name(&self) -> &'static str {
3971        match *self {
3972            InfoResourceRequest::Get { .. } => "get",
3973        }
3974    }
3975}
3976
3977#[derive(Debug, Clone)]
3978pub struct InfoResourceControlHandle {
3979    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3980}
3981
3982impl InfoResourceControlHandle {
3983    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3984        self.inner.shutdown_with_epitaph(status.into())
3985    }
3986}
3987
3988impl fidl::endpoints::ControlHandle for InfoResourceControlHandle {
3989    fn shutdown(&self) {
3990        self.inner.shutdown()
3991    }
3992
3993    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3994        self.inner.shutdown_with_epitaph(status)
3995    }
3996
3997    fn is_closed(&self) -> bool {
3998        self.inner.channel().is_closed()
3999    }
4000    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4001        self.inner.channel().on_closed()
4002    }
4003
4004    #[cfg(target_os = "fuchsia")]
4005    fn signal_peer(
4006        &self,
4007        clear_mask: zx::Signals,
4008        set_mask: zx::Signals,
4009    ) -> Result<(), zx_status::Status> {
4010        use fidl::Peered;
4011        self.inner.channel().signal_peer(clear_mask, set_mask)
4012    }
4013}
4014
4015impl InfoResourceControlHandle {}
4016
4017#[must_use = "FIDL methods require a response to be sent"]
4018#[derive(Debug)]
4019pub struct InfoResourceGetResponder {
4020    control_handle: std::mem::ManuallyDrop<InfoResourceControlHandle>,
4021    tx_id: u32,
4022}
4023
4024/// Set the the channel to be shutdown (see [`InfoResourceControlHandle::shutdown`])
4025/// if the responder is dropped without sending a response, so that the client
4026/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4027impl std::ops::Drop for InfoResourceGetResponder {
4028    fn drop(&mut self) {
4029        self.control_handle.shutdown();
4030        // Safety: drops once, never accessed again
4031        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4032    }
4033}
4034
4035impl fidl::endpoints::Responder for InfoResourceGetResponder {
4036    type ControlHandle = InfoResourceControlHandle;
4037
4038    fn control_handle(&self) -> &InfoResourceControlHandle {
4039        &self.control_handle
4040    }
4041
4042    fn drop_without_shutdown(mut self) {
4043        // Safety: drops once, never accessed again due to mem::forget
4044        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4045        // Prevent Drop from running (which would shut down the channel)
4046        std::mem::forget(self);
4047    }
4048}
4049
4050impl InfoResourceGetResponder {
4051    /// Sends a response to the FIDL transaction.
4052    ///
4053    /// Sets the channel to shutdown if an error occurs.
4054    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4055        let _result = self.send_raw(resource);
4056        if _result.is_err() {
4057            self.control_handle.shutdown();
4058        }
4059        self.drop_without_shutdown();
4060        _result
4061    }
4062
4063    /// Similar to "send" but does not shutdown the channel if an error occurs.
4064    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4065        let _result = self.send_raw(resource);
4066        self.drop_without_shutdown();
4067        _result
4068    }
4069
4070    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4071        self.control_handle.inner.send::<InfoResourceGetResponse>(
4072            (resource,),
4073            self.tx_id,
4074            0x1de8edcb4abc2067,
4075            fidl::encoding::DynamicFlags::empty(),
4076        )
4077    }
4078}
4079
4080#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4081pub struct IommuResourceMarker;
4082
4083impl fidl::endpoints::ProtocolMarker for IommuResourceMarker {
4084    type Proxy = IommuResourceProxy;
4085    type RequestStream = IommuResourceRequestStream;
4086    #[cfg(target_os = "fuchsia")]
4087    type SynchronousProxy = IommuResourceSynchronousProxy;
4088
4089    const DEBUG_NAME: &'static str = "fuchsia.kernel.IommuResource";
4090}
4091impl fidl::endpoints::DiscoverableProtocolMarker for IommuResourceMarker {}
4092
4093pub trait IommuResourceProxyInterface: Send + Sync {
4094    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4095    fn r#get(&self) -> Self::GetResponseFut;
4096}
4097#[derive(Debug)]
4098#[cfg(target_os = "fuchsia")]
4099pub struct IommuResourceSynchronousProxy {
4100    client: fidl::client::sync::Client,
4101}
4102
4103#[cfg(target_os = "fuchsia")]
4104impl fidl::endpoints::SynchronousProxy for IommuResourceSynchronousProxy {
4105    type Proxy = IommuResourceProxy;
4106    type Protocol = IommuResourceMarker;
4107
4108    fn from_channel(inner: fidl::Channel) -> Self {
4109        Self::new(inner)
4110    }
4111
4112    fn into_channel(self) -> fidl::Channel {
4113        self.client.into_channel()
4114    }
4115
4116    fn as_channel(&self) -> &fidl::Channel {
4117        self.client.as_channel()
4118    }
4119}
4120
4121#[cfg(target_os = "fuchsia")]
4122impl IommuResourceSynchronousProxy {
4123    pub fn new(channel: fidl::Channel) -> Self {
4124        Self { client: fidl::client::sync::Client::new(channel) }
4125    }
4126
4127    pub fn into_channel(self) -> fidl::Channel {
4128        self.client.into_channel()
4129    }
4130
4131    /// Waits until an event arrives and returns it. It is safe for other
4132    /// threads to make concurrent requests while waiting for an event.
4133    pub fn wait_for_event(
4134        &self,
4135        deadline: zx::MonotonicInstant,
4136    ) -> Result<IommuResourceEvent, fidl::Error> {
4137        IommuResourceEvent::decode(self.client.wait_for_event::<IommuResourceMarker>(deadline)?)
4138    }
4139
4140    /// Get an iommu resource handle.
4141    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4142        let _response = self.client.send_query::<
4143            fidl::encoding::EmptyPayload,
4144            IommuResourceGetResponse,
4145            IommuResourceMarker,
4146        >(
4147            (),
4148            0x5af309b619aa7c5b,
4149            fidl::encoding::DynamicFlags::empty(),
4150            ___deadline,
4151        )?;
4152        Ok(_response.resource)
4153    }
4154}
4155
4156#[cfg(target_os = "fuchsia")]
4157impl From<IommuResourceSynchronousProxy> for zx::NullableHandle {
4158    fn from(value: IommuResourceSynchronousProxy) -> Self {
4159        value.into_channel().into()
4160    }
4161}
4162
4163#[cfg(target_os = "fuchsia")]
4164impl From<fidl::Channel> for IommuResourceSynchronousProxy {
4165    fn from(value: fidl::Channel) -> Self {
4166        Self::new(value)
4167    }
4168}
4169
4170#[cfg(target_os = "fuchsia")]
4171impl fidl::endpoints::FromClient for IommuResourceSynchronousProxy {
4172    type Protocol = IommuResourceMarker;
4173
4174    fn from_client(value: fidl::endpoints::ClientEnd<IommuResourceMarker>) -> Self {
4175        Self::new(value.into_channel())
4176    }
4177}
4178
4179#[derive(Debug, Clone)]
4180pub struct IommuResourceProxy {
4181    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4182}
4183
4184impl fidl::endpoints::Proxy for IommuResourceProxy {
4185    type Protocol = IommuResourceMarker;
4186
4187    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4188        Self::new(inner)
4189    }
4190
4191    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4192        self.client.into_channel().map_err(|client| Self { client })
4193    }
4194
4195    fn as_channel(&self) -> &::fidl::AsyncChannel {
4196        self.client.as_channel()
4197    }
4198}
4199
4200impl IommuResourceProxy {
4201    /// Create a new Proxy for fuchsia.kernel/IommuResource.
4202    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4203        let protocol_name = <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4204        Self { client: fidl::client::Client::new(channel, protocol_name) }
4205    }
4206
4207    /// Get a Stream of events from the remote end of the protocol.
4208    ///
4209    /// # Panics
4210    ///
4211    /// Panics if the event stream was already taken.
4212    pub fn take_event_stream(&self) -> IommuResourceEventStream {
4213        IommuResourceEventStream { event_receiver: self.client.take_event_receiver() }
4214    }
4215
4216    /// Get an iommu resource handle.
4217    pub fn r#get(
4218        &self,
4219    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4220    {
4221        IommuResourceProxyInterface::r#get(self)
4222    }
4223}
4224
4225impl IommuResourceProxyInterface for IommuResourceProxy {
4226    type GetResponseFut = fidl::client::QueryResponseFut<
4227        fidl::Resource,
4228        fidl::encoding::DefaultFuchsiaResourceDialect,
4229    >;
4230    fn r#get(&self) -> Self::GetResponseFut {
4231        fn _decode(
4232            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4233        ) -> Result<fidl::Resource, fidl::Error> {
4234            let _response = fidl::client::decode_transaction_body::<
4235                IommuResourceGetResponse,
4236                fidl::encoding::DefaultFuchsiaResourceDialect,
4237                0x5af309b619aa7c5b,
4238            >(_buf?)?;
4239            Ok(_response.resource)
4240        }
4241        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4242            (),
4243            0x5af309b619aa7c5b,
4244            fidl::encoding::DynamicFlags::empty(),
4245            _decode,
4246        )
4247    }
4248}
4249
4250pub struct IommuResourceEventStream {
4251    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4252}
4253
4254impl std::marker::Unpin for IommuResourceEventStream {}
4255
4256impl futures::stream::FusedStream for IommuResourceEventStream {
4257    fn is_terminated(&self) -> bool {
4258        self.event_receiver.is_terminated()
4259    }
4260}
4261
4262impl futures::Stream for IommuResourceEventStream {
4263    type Item = Result<IommuResourceEvent, fidl::Error>;
4264
4265    fn poll_next(
4266        mut self: std::pin::Pin<&mut Self>,
4267        cx: &mut std::task::Context<'_>,
4268    ) -> std::task::Poll<Option<Self::Item>> {
4269        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4270            &mut self.event_receiver,
4271            cx
4272        )?) {
4273            Some(buf) => std::task::Poll::Ready(Some(IommuResourceEvent::decode(buf))),
4274            None => std::task::Poll::Ready(None),
4275        }
4276    }
4277}
4278
4279#[derive(Debug)]
4280pub enum IommuResourceEvent {}
4281
4282impl IommuResourceEvent {
4283    /// Decodes a message buffer as a [`IommuResourceEvent`].
4284    fn decode(
4285        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4286    ) -> Result<IommuResourceEvent, fidl::Error> {
4287        let (bytes, _handles) = buf.split_mut();
4288        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4289        debug_assert_eq!(tx_header.tx_id, 0);
4290        match tx_header.ordinal {
4291            _ => Err(fidl::Error::UnknownOrdinal {
4292                ordinal: tx_header.ordinal,
4293                protocol_name: <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4294            }),
4295        }
4296    }
4297}
4298
4299/// A Stream of incoming requests for fuchsia.kernel/IommuResource.
4300pub struct IommuResourceRequestStream {
4301    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4302    is_terminated: bool,
4303}
4304
4305impl std::marker::Unpin for IommuResourceRequestStream {}
4306
4307impl futures::stream::FusedStream for IommuResourceRequestStream {
4308    fn is_terminated(&self) -> bool {
4309        self.is_terminated
4310    }
4311}
4312
4313impl fidl::endpoints::RequestStream for IommuResourceRequestStream {
4314    type Protocol = IommuResourceMarker;
4315    type ControlHandle = IommuResourceControlHandle;
4316
4317    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4318        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4319    }
4320
4321    fn control_handle(&self) -> Self::ControlHandle {
4322        IommuResourceControlHandle { inner: self.inner.clone() }
4323    }
4324
4325    fn into_inner(
4326        self,
4327    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4328    {
4329        (self.inner, self.is_terminated)
4330    }
4331
4332    fn from_inner(
4333        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4334        is_terminated: bool,
4335    ) -> Self {
4336        Self { inner, is_terminated }
4337    }
4338}
4339
4340impl futures::Stream for IommuResourceRequestStream {
4341    type Item = Result<IommuResourceRequest, fidl::Error>;
4342
4343    fn poll_next(
4344        mut self: std::pin::Pin<&mut Self>,
4345        cx: &mut std::task::Context<'_>,
4346    ) -> std::task::Poll<Option<Self::Item>> {
4347        let this = &mut *self;
4348        if this.inner.check_shutdown(cx) {
4349            this.is_terminated = true;
4350            return std::task::Poll::Ready(None);
4351        }
4352        if this.is_terminated {
4353            panic!("polled IommuResourceRequestStream after completion");
4354        }
4355        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4356            |bytes, handles| {
4357                match this.inner.channel().read_etc(cx, bytes, handles) {
4358                    std::task::Poll::Ready(Ok(())) => {}
4359                    std::task::Poll::Pending => return std::task::Poll::Pending,
4360                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4361                        this.is_terminated = true;
4362                        return std::task::Poll::Ready(None);
4363                    }
4364                    std::task::Poll::Ready(Err(e)) => {
4365                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4366                            e.into(),
4367                        ))));
4368                    }
4369                }
4370
4371                // A message has been received from the channel
4372                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4373
4374                std::task::Poll::Ready(Some(match header.ordinal {
4375                    0x5af309b619aa7c5b => {
4376                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4377                        let mut req = fidl::new_empty!(
4378                            fidl::encoding::EmptyPayload,
4379                            fidl::encoding::DefaultFuchsiaResourceDialect
4380                        );
4381                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4382                        let control_handle =
4383                            IommuResourceControlHandle { inner: this.inner.clone() };
4384                        Ok(IommuResourceRequest::Get {
4385                            responder: IommuResourceGetResponder {
4386                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4387                                tx_id: header.tx_id,
4388                            },
4389                        })
4390                    }
4391                    _ => Err(fidl::Error::UnknownOrdinal {
4392                        ordinal: header.ordinal,
4393                        protocol_name:
4394                            <IommuResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4395                    }),
4396                }))
4397            },
4398        )
4399    }
4400}
4401
4402/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
4403/// `ZX_RSRC_SYSTEM_IOMMU_BASE`.
4404#[derive(Debug)]
4405pub enum IommuResourceRequest {
4406    /// Get an iommu resource handle.
4407    Get { responder: IommuResourceGetResponder },
4408}
4409
4410impl IommuResourceRequest {
4411    #[allow(irrefutable_let_patterns)]
4412    pub fn into_get(self) -> Option<(IommuResourceGetResponder)> {
4413        if let IommuResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4414    }
4415
4416    /// Name of the method defined in FIDL
4417    pub fn method_name(&self) -> &'static str {
4418        match *self {
4419            IommuResourceRequest::Get { .. } => "get",
4420        }
4421    }
4422}
4423
4424#[derive(Debug, Clone)]
4425pub struct IommuResourceControlHandle {
4426    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4427}
4428
4429impl IommuResourceControlHandle {
4430    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4431        self.inner.shutdown_with_epitaph(status.into())
4432    }
4433}
4434
4435impl fidl::endpoints::ControlHandle for IommuResourceControlHandle {
4436    fn shutdown(&self) {
4437        self.inner.shutdown()
4438    }
4439
4440    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4441        self.inner.shutdown_with_epitaph(status)
4442    }
4443
4444    fn is_closed(&self) -> bool {
4445        self.inner.channel().is_closed()
4446    }
4447    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4448        self.inner.channel().on_closed()
4449    }
4450
4451    #[cfg(target_os = "fuchsia")]
4452    fn signal_peer(
4453        &self,
4454        clear_mask: zx::Signals,
4455        set_mask: zx::Signals,
4456    ) -> Result<(), zx_status::Status> {
4457        use fidl::Peered;
4458        self.inner.channel().signal_peer(clear_mask, set_mask)
4459    }
4460}
4461
4462impl IommuResourceControlHandle {}
4463
4464#[must_use = "FIDL methods require a response to be sent"]
4465#[derive(Debug)]
4466pub struct IommuResourceGetResponder {
4467    control_handle: std::mem::ManuallyDrop<IommuResourceControlHandle>,
4468    tx_id: u32,
4469}
4470
4471/// Set the the channel to be shutdown (see [`IommuResourceControlHandle::shutdown`])
4472/// if the responder is dropped without sending a response, so that the client
4473/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4474impl std::ops::Drop for IommuResourceGetResponder {
4475    fn drop(&mut self) {
4476        self.control_handle.shutdown();
4477        // Safety: drops once, never accessed again
4478        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4479    }
4480}
4481
4482impl fidl::endpoints::Responder for IommuResourceGetResponder {
4483    type ControlHandle = IommuResourceControlHandle;
4484
4485    fn control_handle(&self) -> &IommuResourceControlHandle {
4486        &self.control_handle
4487    }
4488
4489    fn drop_without_shutdown(mut self) {
4490        // Safety: drops once, never accessed again due to mem::forget
4491        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4492        // Prevent Drop from running (which would shut down the channel)
4493        std::mem::forget(self);
4494    }
4495}
4496
4497impl IommuResourceGetResponder {
4498    /// Sends a response to the FIDL transaction.
4499    ///
4500    /// Sets the channel to shutdown if an error occurs.
4501    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4502        let _result = self.send_raw(resource);
4503        if _result.is_err() {
4504            self.control_handle.shutdown();
4505        }
4506        self.drop_without_shutdown();
4507        _result
4508    }
4509
4510    /// Similar to "send" but does not shutdown the channel if an error occurs.
4511    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4512        let _result = self.send_raw(resource);
4513        self.drop_without_shutdown();
4514        _result
4515    }
4516
4517    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4518        self.control_handle.inner.send::<IommuResourceGetResponse>(
4519            (resource,),
4520            self.tx_id,
4521            0x5af309b619aa7c5b,
4522            fidl::encoding::DynamicFlags::empty(),
4523        )
4524    }
4525}
4526
4527#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4528pub struct IoportResourceMarker;
4529
4530impl fidl::endpoints::ProtocolMarker for IoportResourceMarker {
4531    type Proxy = IoportResourceProxy;
4532    type RequestStream = IoportResourceRequestStream;
4533    #[cfg(target_os = "fuchsia")]
4534    type SynchronousProxy = IoportResourceSynchronousProxy;
4535
4536    const DEBUG_NAME: &'static str = "fuchsia.kernel.IoportResource";
4537}
4538impl fidl::endpoints::DiscoverableProtocolMarker for IoportResourceMarker {}
4539
4540pub trait IoportResourceProxyInterface: Send + Sync {
4541    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4542    fn r#get(&self) -> Self::GetResponseFut;
4543}
4544#[derive(Debug)]
4545#[cfg(target_os = "fuchsia")]
4546pub struct IoportResourceSynchronousProxy {
4547    client: fidl::client::sync::Client,
4548}
4549
4550#[cfg(target_os = "fuchsia")]
4551impl fidl::endpoints::SynchronousProxy for IoportResourceSynchronousProxy {
4552    type Proxy = IoportResourceProxy;
4553    type Protocol = IoportResourceMarker;
4554
4555    fn from_channel(inner: fidl::Channel) -> Self {
4556        Self::new(inner)
4557    }
4558
4559    fn into_channel(self) -> fidl::Channel {
4560        self.client.into_channel()
4561    }
4562
4563    fn as_channel(&self) -> &fidl::Channel {
4564        self.client.as_channel()
4565    }
4566}
4567
4568#[cfg(target_os = "fuchsia")]
4569impl IoportResourceSynchronousProxy {
4570    pub fn new(channel: fidl::Channel) -> Self {
4571        Self { client: fidl::client::sync::Client::new(channel) }
4572    }
4573
4574    pub fn into_channel(self) -> fidl::Channel {
4575        self.client.into_channel()
4576    }
4577
4578    /// Waits until an event arrives and returns it. It is safe for other
4579    /// threads to make concurrent requests while waiting for an event.
4580    pub fn wait_for_event(
4581        &self,
4582        deadline: zx::MonotonicInstant,
4583    ) -> Result<IoportResourceEvent, fidl::Error> {
4584        IoportResourceEvent::decode(self.client.wait_for_event::<IoportResourceMarker>(deadline)?)
4585    }
4586
4587    /// Get an IO Port resource handle.
4588    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
4589        let _response = self.client.send_query::<
4590            fidl::encoding::EmptyPayload,
4591            IoportResourceGetResponse,
4592            IoportResourceMarker,
4593        >(
4594            (),
4595            0x4db20876b537c52b,
4596            fidl::encoding::DynamicFlags::empty(),
4597            ___deadline,
4598        )?;
4599        Ok(_response.resource)
4600    }
4601}
4602
4603#[cfg(target_os = "fuchsia")]
4604impl From<IoportResourceSynchronousProxy> for zx::NullableHandle {
4605    fn from(value: IoportResourceSynchronousProxy) -> Self {
4606        value.into_channel().into()
4607    }
4608}
4609
4610#[cfg(target_os = "fuchsia")]
4611impl From<fidl::Channel> for IoportResourceSynchronousProxy {
4612    fn from(value: fidl::Channel) -> Self {
4613        Self::new(value)
4614    }
4615}
4616
4617#[cfg(target_os = "fuchsia")]
4618impl fidl::endpoints::FromClient for IoportResourceSynchronousProxy {
4619    type Protocol = IoportResourceMarker;
4620
4621    fn from_client(value: fidl::endpoints::ClientEnd<IoportResourceMarker>) -> Self {
4622        Self::new(value.into_channel())
4623    }
4624}
4625
4626#[derive(Debug, Clone)]
4627pub struct IoportResourceProxy {
4628    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4629}
4630
4631impl fidl::endpoints::Proxy for IoportResourceProxy {
4632    type Protocol = IoportResourceMarker;
4633
4634    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4635        Self::new(inner)
4636    }
4637
4638    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4639        self.client.into_channel().map_err(|client| Self { client })
4640    }
4641
4642    fn as_channel(&self) -> &::fidl::AsyncChannel {
4643        self.client.as_channel()
4644    }
4645}
4646
4647impl IoportResourceProxy {
4648    /// Create a new Proxy for fuchsia.kernel/IoportResource.
4649    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4650        let protocol_name = <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4651        Self { client: fidl::client::Client::new(channel, protocol_name) }
4652    }
4653
4654    /// Get a Stream of events from the remote end of the protocol.
4655    ///
4656    /// # Panics
4657    ///
4658    /// Panics if the event stream was already taken.
4659    pub fn take_event_stream(&self) -> IoportResourceEventStream {
4660        IoportResourceEventStream { event_receiver: self.client.take_event_receiver() }
4661    }
4662
4663    /// Get an IO Port resource handle.
4664    pub fn r#get(
4665        &self,
4666    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
4667    {
4668        IoportResourceProxyInterface::r#get(self)
4669    }
4670}
4671
4672impl IoportResourceProxyInterface for IoportResourceProxy {
4673    type GetResponseFut = fidl::client::QueryResponseFut<
4674        fidl::Resource,
4675        fidl::encoding::DefaultFuchsiaResourceDialect,
4676    >;
4677    fn r#get(&self) -> Self::GetResponseFut {
4678        fn _decode(
4679            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4680        ) -> Result<fidl::Resource, fidl::Error> {
4681            let _response = fidl::client::decode_transaction_body::<
4682                IoportResourceGetResponse,
4683                fidl::encoding::DefaultFuchsiaResourceDialect,
4684                0x4db20876b537c52b,
4685            >(_buf?)?;
4686            Ok(_response.resource)
4687        }
4688        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
4689            (),
4690            0x4db20876b537c52b,
4691            fidl::encoding::DynamicFlags::empty(),
4692            _decode,
4693        )
4694    }
4695}
4696
4697pub struct IoportResourceEventStream {
4698    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4699}
4700
4701impl std::marker::Unpin for IoportResourceEventStream {}
4702
4703impl futures::stream::FusedStream for IoportResourceEventStream {
4704    fn is_terminated(&self) -> bool {
4705        self.event_receiver.is_terminated()
4706    }
4707}
4708
4709impl futures::Stream for IoportResourceEventStream {
4710    type Item = Result<IoportResourceEvent, fidl::Error>;
4711
4712    fn poll_next(
4713        mut self: std::pin::Pin<&mut Self>,
4714        cx: &mut std::task::Context<'_>,
4715    ) -> std::task::Poll<Option<Self::Item>> {
4716        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4717            &mut self.event_receiver,
4718            cx
4719        )?) {
4720            Some(buf) => std::task::Poll::Ready(Some(IoportResourceEvent::decode(buf))),
4721            None => std::task::Poll::Ready(None),
4722        }
4723    }
4724}
4725
4726#[derive(Debug)]
4727pub enum IoportResourceEvent {}
4728
4729impl IoportResourceEvent {
4730    /// Decodes a message buffer as a [`IoportResourceEvent`].
4731    fn decode(
4732        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4733    ) -> Result<IoportResourceEvent, fidl::Error> {
4734        let (bytes, _handles) = buf.split_mut();
4735        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4736        debug_assert_eq!(tx_header.tx_id, 0);
4737        match tx_header.ordinal {
4738            _ => Err(fidl::Error::UnknownOrdinal {
4739                ordinal: tx_header.ordinal,
4740                protocol_name:
4741                    <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4742            }),
4743        }
4744    }
4745}
4746
4747/// A Stream of incoming requests for fuchsia.kernel/IoportResource.
4748pub struct IoportResourceRequestStream {
4749    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4750    is_terminated: bool,
4751}
4752
4753impl std::marker::Unpin for IoportResourceRequestStream {}
4754
4755impl futures::stream::FusedStream for IoportResourceRequestStream {
4756    fn is_terminated(&self) -> bool {
4757        self.is_terminated
4758    }
4759}
4760
4761impl fidl::endpoints::RequestStream for IoportResourceRequestStream {
4762    type Protocol = IoportResourceMarker;
4763    type ControlHandle = IoportResourceControlHandle;
4764
4765    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4766        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4767    }
4768
4769    fn control_handle(&self) -> Self::ControlHandle {
4770        IoportResourceControlHandle { inner: self.inner.clone() }
4771    }
4772
4773    fn into_inner(
4774        self,
4775    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4776    {
4777        (self.inner, self.is_terminated)
4778    }
4779
4780    fn from_inner(
4781        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4782        is_terminated: bool,
4783    ) -> Self {
4784        Self { inner, is_terminated }
4785    }
4786}
4787
4788impl futures::Stream for IoportResourceRequestStream {
4789    type Item = Result<IoportResourceRequest, fidl::Error>;
4790
4791    fn poll_next(
4792        mut self: std::pin::Pin<&mut Self>,
4793        cx: &mut std::task::Context<'_>,
4794    ) -> std::task::Poll<Option<Self::Item>> {
4795        let this = &mut *self;
4796        if this.inner.check_shutdown(cx) {
4797            this.is_terminated = true;
4798            return std::task::Poll::Ready(None);
4799        }
4800        if this.is_terminated {
4801            panic!("polled IoportResourceRequestStream after completion");
4802        }
4803        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4804            |bytes, handles| {
4805                match this.inner.channel().read_etc(cx, bytes, handles) {
4806                    std::task::Poll::Ready(Ok(())) => {}
4807                    std::task::Poll::Pending => return std::task::Poll::Pending,
4808                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4809                        this.is_terminated = true;
4810                        return std::task::Poll::Ready(None);
4811                    }
4812                    std::task::Poll::Ready(Err(e)) => {
4813                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4814                            e.into(),
4815                        ))));
4816                    }
4817                }
4818
4819                // A message has been received from the channel
4820                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4821
4822                std::task::Poll::Ready(Some(match header.ordinal {
4823                    0x4db20876b537c52b => {
4824                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4825                        let mut req = fidl::new_empty!(
4826                            fidl::encoding::EmptyPayload,
4827                            fidl::encoding::DefaultFuchsiaResourceDialect
4828                        );
4829                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4830                        let control_handle =
4831                            IoportResourceControlHandle { inner: this.inner.clone() };
4832                        Ok(IoportResourceRequest::Get {
4833                            responder: IoportResourceGetResponder {
4834                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4835                                tx_id: header.tx_id,
4836                            },
4837                        })
4838                    }
4839                    _ => Err(fidl::Error::UnknownOrdinal {
4840                        ordinal: header.ordinal,
4841                        protocol_name:
4842                            <IoportResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4843                    }),
4844                }))
4845            },
4846        )
4847    }
4848}
4849
4850/// Protocol for providing an IO Port resource with access to all valid ranges.
4851#[derive(Debug)]
4852pub enum IoportResourceRequest {
4853    /// Get an IO Port resource handle.
4854    Get { responder: IoportResourceGetResponder },
4855}
4856
4857impl IoportResourceRequest {
4858    #[allow(irrefutable_let_patterns)]
4859    pub fn into_get(self) -> Option<(IoportResourceGetResponder)> {
4860        if let IoportResourceRequest::Get { responder } = self { Some((responder)) } else { None }
4861    }
4862
4863    /// Name of the method defined in FIDL
4864    pub fn method_name(&self) -> &'static str {
4865        match *self {
4866            IoportResourceRequest::Get { .. } => "get",
4867        }
4868    }
4869}
4870
4871#[derive(Debug, Clone)]
4872pub struct IoportResourceControlHandle {
4873    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4874}
4875
4876impl IoportResourceControlHandle {
4877    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4878        self.inner.shutdown_with_epitaph(status.into())
4879    }
4880}
4881
4882impl fidl::endpoints::ControlHandle for IoportResourceControlHandle {
4883    fn shutdown(&self) {
4884        self.inner.shutdown()
4885    }
4886
4887    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4888        self.inner.shutdown_with_epitaph(status)
4889    }
4890
4891    fn is_closed(&self) -> bool {
4892        self.inner.channel().is_closed()
4893    }
4894    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4895        self.inner.channel().on_closed()
4896    }
4897
4898    #[cfg(target_os = "fuchsia")]
4899    fn signal_peer(
4900        &self,
4901        clear_mask: zx::Signals,
4902        set_mask: zx::Signals,
4903    ) -> Result<(), zx_status::Status> {
4904        use fidl::Peered;
4905        self.inner.channel().signal_peer(clear_mask, set_mask)
4906    }
4907}
4908
4909impl IoportResourceControlHandle {}
4910
4911#[must_use = "FIDL methods require a response to be sent"]
4912#[derive(Debug)]
4913pub struct IoportResourceGetResponder {
4914    control_handle: std::mem::ManuallyDrop<IoportResourceControlHandle>,
4915    tx_id: u32,
4916}
4917
4918/// Set the the channel to be shutdown (see [`IoportResourceControlHandle::shutdown`])
4919/// if the responder is dropped without sending a response, so that the client
4920/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4921impl std::ops::Drop for IoportResourceGetResponder {
4922    fn drop(&mut self) {
4923        self.control_handle.shutdown();
4924        // Safety: drops once, never accessed again
4925        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4926    }
4927}
4928
4929impl fidl::endpoints::Responder for IoportResourceGetResponder {
4930    type ControlHandle = IoportResourceControlHandle;
4931
4932    fn control_handle(&self) -> &IoportResourceControlHandle {
4933        &self.control_handle
4934    }
4935
4936    fn drop_without_shutdown(mut self) {
4937        // Safety: drops once, never accessed again due to mem::forget
4938        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4939        // Prevent Drop from running (which would shut down the channel)
4940        std::mem::forget(self);
4941    }
4942}
4943
4944impl IoportResourceGetResponder {
4945    /// Sends a response to the FIDL transaction.
4946    ///
4947    /// Sets the channel to shutdown if an error occurs.
4948    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4949        let _result = self.send_raw(resource);
4950        if _result.is_err() {
4951            self.control_handle.shutdown();
4952        }
4953        self.drop_without_shutdown();
4954        _result
4955    }
4956
4957    /// Similar to "send" but does not shutdown the channel if an error occurs.
4958    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4959        let _result = self.send_raw(resource);
4960        self.drop_without_shutdown();
4961        _result
4962    }
4963
4964    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
4965        self.control_handle.inner.send::<IoportResourceGetResponse>(
4966            (resource,),
4967            self.tx_id,
4968            0x4db20876b537c52b,
4969            fidl::encoding::DynamicFlags::empty(),
4970        )
4971    }
4972}
4973
4974#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4975pub struct IrqResourceMarker;
4976
4977impl fidl::endpoints::ProtocolMarker for IrqResourceMarker {
4978    type Proxy = IrqResourceProxy;
4979    type RequestStream = IrqResourceRequestStream;
4980    #[cfg(target_os = "fuchsia")]
4981    type SynchronousProxy = IrqResourceSynchronousProxy;
4982
4983    const DEBUG_NAME: &'static str = "fuchsia.kernel.IrqResource";
4984}
4985impl fidl::endpoints::DiscoverableProtocolMarker for IrqResourceMarker {}
4986
4987pub trait IrqResourceProxyInterface: Send + Sync {
4988    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
4989    fn r#get(&self) -> Self::GetResponseFut;
4990}
4991#[derive(Debug)]
4992#[cfg(target_os = "fuchsia")]
4993pub struct IrqResourceSynchronousProxy {
4994    client: fidl::client::sync::Client,
4995}
4996
4997#[cfg(target_os = "fuchsia")]
4998impl fidl::endpoints::SynchronousProxy for IrqResourceSynchronousProxy {
4999    type Proxy = IrqResourceProxy;
5000    type Protocol = IrqResourceMarker;
5001
5002    fn from_channel(inner: fidl::Channel) -> Self {
5003        Self::new(inner)
5004    }
5005
5006    fn into_channel(self) -> fidl::Channel {
5007        self.client.into_channel()
5008    }
5009
5010    fn as_channel(&self) -> &fidl::Channel {
5011        self.client.as_channel()
5012    }
5013}
5014
5015#[cfg(target_os = "fuchsia")]
5016impl IrqResourceSynchronousProxy {
5017    pub fn new(channel: fidl::Channel) -> Self {
5018        Self { client: fidl::client::sync::Client::new(channel) }
5019    }
5020
5021    pub fn into_channel(self) -> fidl::Channel {
5022        self.client.into_channel()
5023    }
5024
5025    /// Waits until an event arrives and returns it. It is safe for other
5026    /// threads to make concurrent requests while waiting for an event.
5027    pub fn wait_for_event(
5028        &self,
5029        deadline: zx::MonotonicInstant,
5030    ) -> Result<IrqResourceEvent, fidl::Error> {
5031        IrqResourceEvent::decode(self.client.wait_for_event::<IrqResourceMarker>(deadline)?)
5032    }
5033
5034    /// Get an IRQ resource handle.
5035    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5036        let _response = self
5037            .client
5038            .send_query::<fidl::encoding::EmptyPayload, IrqResourceGetResponse, IrqResourceMarker>(
5039                (),
5040                0x491be54504b041e9,
5041                fidl::encoding::DynamicFlags::empty(),
5042                ___deadline,
5043            )?;
5044        Ok(_response.resource)
5045    }
5046}
5047
5048#[cfg(target_os = "fuchsia")]
5049impl From<IrqResourceSynchronousProxy> for zx::NullableHandle {
5050    fn from(value: IrqResourceSynchronousProxy) -> Self {
5051        value.into_channel().into()
5052    }
5053}
5054
5055#[cfg(target_os = "fuchsia")]
5056impl From<fidl::Channel> for IrqResourceSynchronousProxy {
5057    fn from(value: fidl::Channel) -> Self {
5058        Self::new(value)
5059    }
5060}
5061
5062#[cfg(target_os = "fuchsia")]
5063impl fidl::endpoints::FromClient for IrqResourceSynchronousProxy {
5064    type Protocol = IrqResourceMarker;
5065
5066    fn from_client(value: fidl::endpoints::ClientEnd<IrqResourceMarker>) -> Self {
5067        Self::new(value.into_channel())
5068    }
5069}
5070
5071#[derive(Debug, Clone)]
5072pub struct IrqResourceProxy {
5073    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5074}
5075
5076impl fidl::endpoints::Proxy for IrqResourceProxy {
5077    type Protocol = IrqResourceMarker;
5078
5079    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5080        Self::new(inner)
5081    }
5082
5083    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5084        self.client.into_channel().map_err(|client| Self { client })
5085    }
5086
5087    fn as_channel(&self) -> &::fidl::AsyncChannel {
5088        self.client.as_channel()
5089    }
5090}
5091
5092impl IrqResourceProxy {
5093    /// Create a new Proxy for fuchsia.kernel/IrqResource.
5094    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5095        let protocol_name = <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5096        Self { client: fidl::client::Client::new(channel, protocol_name) }
5097    }
5098
5099    /// Get a Stream of events from the remote end of the protocol.
5100    ///
5101    /// # Panics
5102    ///
5103    /// Panics if the event stream was already taken.
5104    pub fn take_event_stream(&self) -> IrqResourceEventStream {
5105        IrqResourceEventStream { event_receiver: self.client.take_event_receiver() }
5106    }
5107
5108    /// Get an IRQ resource handle.
5109    pub fn r#get(
5110        &self,
5111    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5112    {
5113        IrqResourceProxyInterface::r#get(self)
5114    }
5115}
5116
5117impl IrqResourceProxyInterface for IrqResourceProxy {
5118    type GetResponseFut = fidl::client::QueryResponseFut<
5119        fidl::Resource,
5120        fidl::encoding::DefaultFuchsiaResourceDialect,
5121    >;
5122    fn r#get(&self) -> Self::GetResponseFut {
5123        fn _decode(
5124            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5125        ) -> Result<fidl::Resource, fidl::Error> {
5126            let _response = fidl::client::decode_transaction_body::<
5127                IrqResourceGetResponse,
5128                fidl::encoding::DefaultFuchsiaResourceDialect,
5129                0x491be54504b041e9,
5130            >(_buf?)?;
5131            Ok(_response.resource)
5132        }
5133        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5134            (),
5135            0x491be54504b041e9,
5136            fidl::encoding::DynamicFlags::empty(),
5137            _decode,
5138        )
5139    }
5140}
5141
5142pub struct IrqResourceEventStream {
5143    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5144}
5145
5146impl std::marker::Unpin for IrqResourceEventStream {}
5147
5148impl futures::stream::FusedStream for IrqResourceEventStream {
5149    fn is_terminated(&self) -> bool {
5150        self.event_receiver.is_terminated()
5151    }
5152}
5153
5154impl futures::Stream for IrqResourceEventStream {
5155    type Item = Result<IrqResourceEvent, fidl::Error>;
5156
5157    fn poll_next(
5158        mut self: std::pin::Pin<&mut Self>,
5159        cx: &mut std::task::Context<'_>,
5160    ) -> std::task::Poll<Option<Self::Item>> {
5161        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5162            &mut self.event_receiver,
5163            cx
5164        )?) {
5165            Some(buf) => std::task::Poll::Ready(Some(IrqResourceEvent::decode(buf))),
5166            None => std::task::Poll::Ready(None),
5167        }
5168    }
5169}
5170
5171#[derive(Debug)]
5172pub enum IrqResourceEvent {}
5173
5174impl IrqResourceEvent {
5175    /// Decodes a message buffer as a [`IrqResourceEvent`].
5176    fn decode(
5177        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5178    ) -> Result<IrqResourceEvent, fidl::Error> {
5179        let (bytes, _handles) = buf.split_mut();
5180        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5181        debug_assert_eq!(tx_header.tx_id, 0);
5182        match tx_header.ordinal {
5183            _ => Err(fidl::Error::UnknownOrdinal {
5184                ordinal: tx_header.ordinal,
5185                protocol_name: <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5186            }),
5187        }
5188    }
5189}
5190
5191/// A Stream of incoming requests for fuchsia.kernel/IrqResource.
5192pub struct IrqResourceRequestStream {
5193    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5194    is_terminated: bool,
5195}
5196
5197impl std::marker::Unpin for IrqResourceRequestStream {}
5198
5199impl futures::stream::FusedStream for IrqResourceRequestStream {
5200    fn is_terminated(&self) -> bool {
5201        self.is_terminated
5202    }
5203}
5204
5205impl fidl::endpoints::RequestStream for IrqResourceRequestStream {
5206    type Protocol = IrqResourceMarker;
5207    type ControlHandle = IrqResourceControlHandle;
5208
5209    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5210        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5211    }
5212
5213    fn control_handle(&self) -> Self::ControlHandle {
5214        IrqResourceControlHandle { inner: self.inner.clone() }
5215    }
5216
5217    fn into_inner(
5218        self,
5219    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5220    {
5221        (self.inner, self.is_terminated)
5222    }
5223
5224    fn from_inner(
5225        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5226        is_terminated: bool,
5227    ) -> Self {
5228        Self { inner, is_terminated }
5229    }
5230}
5231
5232impl futures::Stream for IrqResourceRequestStream {
5233    type Item = Result<IrqResourceRequest, fidl::Error>;
5234
5235    fn poll_next(
5236        mut self: std::pin::Pin<&mut Self>,
5237        cx: &mut std::task::Context<'_>,
5238    ) -> std::task::Poll<Option<Self::Item>> {
5239        let this = &mut *self;
5240        if this.inner.check_shutdown(cx) {
5241            this.is_terminated = true;
5242            return std::task::Poll::Ready(None);
5243        }
5244        if this.is_terminated {
5245            panic!("polled IrqResourceRequestStream after completion");
5246        }
5247        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5248            |bytes, handles| {
5249                match this.inner.channel().read_etc(cx, bytes, handles) {
5250                    std::task::Poll::Ready(Ok(())) => {}
5251                    std::task::Poll::Pending => return std::task::Poll::Pending,
5252                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5253                        this.is_terminated = true;
5254                        return std::task::Poll::Ready(None);
5255                    }
5256                    std::task::Poll::Ready(Err(e)) => {
5257                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5258                            e.into(),
5259                        ))));
5260                    }
5261                }
5262
5263                // A message has been received from the channel
5264                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5265
5266                std::task::Poll::Ready(Some(match header.ordinal {
5267                    0x491be54504b041e9 => {
5268                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5269                        let mut req = fidl::new_empty!(
5270                            fidl::encoding::EmptyPayload,
5271                            fidl::encoding::DefaultFuchsiaResourceDialect
5272                        );
5273                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5274                        let control_handle = IrqResourceControlHandle { inner: this.inner.clone() };
5275                        Ok(IrqResourceRequest::Get {
5276                            responder: IrqResourceGetResponder {
5277                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5278                                tx_id: header.tx_id,
5279                            },
5280                        })
5281                    }
5282                    _ => Err(fidl::Error::UnknownOrdinal {
5283                        ordinal: header.ordinal,
5284                        protocol_name:
5285                            <IrqResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5286                    }),
5287                }))
5288            },
5289        )
5290    }
5291}
5292
5293/// Protocol for providing an IRQ resource with access to all valid ranges.
5294#[derive(Debug)]
5295pub enum IrqResourceRequest {
5296    /// Get an IRQ resource handle.
5297    Get { responder: IrqResourceGetResponder },
5298}
5299
5300impl IrqResourceRequest {
5301    #[allow(irrefutable_let_patterns)]
5302    pub fn into_get(self) -> Option<(IrqResourceGetResponder)> {
5303        if let IrqResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5304    }
5305
5306    /// Name of the method defined in FIDL
5307    pub fn method_name(&self) -> &'static str {
5308        match *self {
5309            IrqResourceRequest::Get { .. } => "get",
5310        }
5311    }
5312}
5313
5314#[derive(Debug, Clone)]
5315pub struct IrqResourceControlHandle {
5316    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5317}
5318
5319impl IrqResourceControlHandle {
5320    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5321        self.inner.shutdown_with_epitaph(status.into())
5322    }
5323}
5324
5325impl fidl::endpoints::ControlHandle for IrqResourceControlHandle {
5326    fn shutdown(&self) {
5327        self.inner.shutdown()
5328    }
5329
5330    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5331        self.inner.shutdown_with_epitaph(status)
5332    }
5333
5334    fn is_closed(&self) -> bool {
5335        self.inner.channel().is_closed()
5336    }
5337    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5338        self.inner.channel().on_closed()
5339    }
5340
5341    #[cfg(target_os = "fuchsia")]
5342    fn signal_peer(
5343        &self,
5344        clear_mask: zx::Signals,
5345        set_mask: zx::Signals,
5346    ) -> Result<(), zx_status::Status> {
5347        use fidl::Peered;
5348        self.inner.channel().signal_peer(clear_mask, set_mask)
5349    }
5350}
5351
5352impl IrqResourceControlHandle {}
5353
5354#[must_use = "FIDL methods require a response to be sent"]
5355#[derive(Debug)]
5356pub struct IrqResourceGetResponder {
5357    control_handle: std::mem::ManuallyDrop<IrqResourceControlHandle>,
5358    tx_id: u32,
5359}
5360
5361/// Set the the channel to be shutdown (see [`IrqResourceControlHandle::shutdown`])
5362/// if the responder is dropped without sending a response, so that the client
5363/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5364impl std::ops::Drop for IrqResourceGetResponder {
5365    fn drop(&mut self) {
5366        self.control_handle.shutdown();
5367        // Safety: drops once, never accessed again
5368        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5369    }
5370}
5371
5372impl fidl::endpoints::Responder for IrqResourceGetResponder {
5373    type ControlHandle = IrqResourceControlHandle;
5374
5375    fn control_handle(&self) -> &IrqResourceControlHandle {
5376        &self.control_handle
5377    }
5378
5379    fn drop_without_shutdown(mut self) {
5380        // Safety: drops once, never accessed again due to mem::forget
5381        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5382        // Prevent Drop from running (which would shut down the channel)
5383        std::mem::forget(self);
5384    }
5385}
5386
5387impl IrqResourceGetResponder {
5388    /// Sends a response to the FIDL transaction.
5389    ///
5390    /// Sets the channel to shutdown if an error occurs.
5391    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5392        let _result = self.send_raw(resource);
5393        if _result.is_err() {
5394            self.control_handle.shutdown();
5395        }
5396        self.drop_without_shutdown();
5397        _result
5398    }
5399
5400    /// Similar to "send" but does not shutdown the channel if an error occurs.
5401    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5402        let _result = self.send_raw(resource);
5403        self.drop_without_shutdown();
5404        _result
5405    }
5406
5407    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5408        self.control_handle.inner.send::<IrqResourceGetResponse>(
5409            (resource,),
5410            self.tx_id,
5411            0x491be54504b041e9,
5412            fidl::encoding::DynamicFlags::empty(),
5413        )
5414    }
5415}
5416
5417#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5418pub struct MmioResourceMarker;
5419
5420impl fidl::endpoints::ProtocolMarker for MmioResourceMarker {
5421    type Proxy = MmioResourceProxy;
5422    type RequestStream = MmioResourceRequestStream;
5423    #[cfg(target_os = "fuchsia")]
5424    type SynchronousProxy = MmioResourceSynchronousProxy;
5425
5426    const DEBUG_NAME: &'static str = "fuchsia.kernel.MmioResource";
5427}
5428impl fidl::endpoints::DiscoverableProtocolMarker for MmioResourceMarker {}
5429
5430pub trait MmioResourceProxyInterface: Send + Sync {
5431    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5432    fn r#get(&self) -> Self::GetResponseFut;
5433}
5434#[derive(Debug)]
5435#[cfg(target_os = "fuchsia")]
5436pub struct MmioResourceSynchronousProxy {
5437    client: fidl::client::sync::Client,
5438}
5439
5440#[cfg(target_os = "fuchsia")]
5441impl fidl::endpoints::SynchronousProxy for MmioResourceSynchronousProxy {
5442    type Proxy = MmioResourceProxy;
5443    type Protocol = MmioResourceMarker;
5444
5445    fn from_channel(inner: fidl::Channel) -> Self {
5446        Self::new(inner)
5447    }
5448
5449    fn into_channel(self) -> fidl::Channel {
5450        self.client.into_channel()
5451    }
5452
5453    fn as_channel(&self) -> &fidl::Channel {
5454        self.client.as_channel()
5455    }
5456}
5457
5458#[cfg(target_os = "fuchsia")]
5459impl MmioResourceSynchronousProxy {
5460    pub fn new(channel: fidl::Channel) -> Self {
5461        Self { client: fidl::client::sync::Client::new(channel) }
5462    }
5463
5464    pub fn into_channel(self) -> fidl::Channel {
5465        self.client.into_channel()
5466    }
5467
5468    /// Waits until an event arrives and returns it. It is safe for other
5469    /// threads to make concurrent requests while waiting for an event.
5470    pub fn wait_for_event(
5471        &self,
5472        deadline: zx::MonotonicInstant,
5473    ) -> Result<MmioResourceEvent, fidl::Error> {
5474        MmioResourceEvent::decode(self.client.wait_for_event::<MmioResourceMarker>(deadline)?)
5475    }
5476
5477    /// Get an MMIO resource handle.
5478    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5479        let _response = self.client.send_query::<
5480            fidl::encoding::EmptyPayload,
5481            MmioResourceGetResponse,
5482            MmioResourceMarker,
5483        >(
5484            (),
5485            0x66747b9c5a6dfe7b,
5486            fidl::encoding::DynamicFlags::empty(),
5487            ___deadline,
5488        )?;
5489        Ok(_response.resource)
5490    }
5491}
5492
5493#[cfg(target_os = "fuchsia")]
5494impl From<MmioResourceSynchronousProxy> for zx::NullableHandle {
5495    fn from(value: MmioResourceSynchronousProxy) -> Self {
5496        value.into_channel().into()
5497    }
5498}
5499
5500#[cfg(target_os = "fuchsia")]
5501impl From<fidl::Channel> for MmioResourceSynchronousProxy {
5502    fn from(value: fidl::Channel) -> Self {
5503        Self::new(value)
5504    }
5505}
5506
5507#[cfg(target_os = "fuchsia")]
5508impl fidl::endpoints::FromClient for MmioResourceSynchronousProxy {
5509    type Protocol = MmioResourceMarker;
5510
5511    fn from_client(value: fidl::endpoints::ClientEnd<MmioResourceMarker>) -> Self {
5512        Self::new(value.into_channel())
5513    }
5514}
5515
5516#[derive(Debug, Clone)]
5517pub struct MmioResourceProxy {
5518    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5519}
5520
5521impl fidl::endpoints::Proxy for MmioResourceProxy {
5522    type Protocol = MmioResourceMarker;
5523
5524    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5525        Self::new(inner)
5526    }
5527
5528    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5529        self.client.into_channel().map_err(|client| Self { client })
5530    }
5531
5532    fn as_channel(&self) -> &::fidl::AsyncChannel {
5533        self.client.as_channel()
5534    }
5535}
5536
5537impl MmioResourceProxy {
5538    /// Create a new Proxy for fuchsia.kernel/MmioResource.
5539    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5540        let protocol_name = <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5541        Self { client: fidl::client::Client::new(channel, protocol_name) }
5542    }
5543
5544    /// Get a Stream of events from the remote end of the protocol.
5545    ///
5546    /// # Panics
5547    ///
5548    /// Panics if the event stream was already taken.
5549    pub fn take_event_stream(&self) -> MmioResourceEventStream {
5550        MmioResourceEventStream { event_receiver: self.client.take_event_receiver() }
5551    }
5552
5553    /// Get an MMIO resource handle.
5554    pub fn r#get(
5555        &self,
5556    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
5557    {
5558        MmioResourceProxyInterface::r#get(self)
5559    }
5560}
5561
5562impl MmioResourceProxyInterface for MmioResourceProxy {
5563    type GetResponseFut = fidl::client::QueryResponseFut<
5564        fidl::Resource,
5565        fidl::encoding::DefaultFuchsiaResourceDialect,
5566    >;
5567    fn r#get(&self) -> Self::GetResponseFut {
5568        fn _decode(
5569            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5570        ) -> Result<fidl::Resource, fidl::Error> {
5571            let _response = fidl::client::decode_transaction_body::<
5572                MmioResourceGetResponse,
5573                fidl::encoding::DefaultFuchsiaResourceDialect,
5574                0x66747b9c5a6dfe7b,
5575            >(_buf?)?;
5576            Ok(_response.resource)
5577        }
5578        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
5579            (),
5580            0x66747b9c5a6dfe7b,
5581            fidl::encoding::DynamicFlags::empty(),
5582            _decode,
5583        )
5584    }
5585}
5586
5587pub struct MmioResourceEventStream {
5588    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5589}
5590
5591impl std::marker::Unpin for MmioResourceEventStream {}
5592
5593impl futures::stream::FusedStream for MmioResourceEventStream {
5594    fn is_terminated(&self) -> bool {
5595        self.event_receiver.is_terminated()
5596    }
5597}
5598
5599impl futures::Stream for MmioResourceEventStream {
5600    type Item = Result<MmioResourceEvent, fidl::Error>;
5601
5602    fn poll_next(
5603        mut self: std::pin::Pin<&mut Self>,
5604        cx: &mut std::task::Context<'_>,
5605    ) -> std::task::Poll<Option<Self::Item>> {
5606        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5607            &mut self.event_receiver,
5608            cx
5609        )?) {
5610            Some(buf) => std::task::Poll::Ready(Some(MmioResourceEvent::decode(buf))),
5611            None => std::task::Poll::Ready(None),
5612        }
5613    }
5614}
5615
5616#[derive(Debug)]
5617pub enum MmioResourceEvent {}
5618
5619impl MmioResourceEvent {
5620    /// Decodes a message buffer as a [`MmioResourceEvent`].
5621    fn decode(
5622        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5623    ) -> Result<MmioResourceEvent, fidl::Error> {
5624        let (bytes, _handles) = buf.split_mut();
5625        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5626        debug_assert_eq!(tx_header.tx_id, 0);
5627        match tx_header.ordinal {
5628            _ => Err(fidl::Error::UnknownOrdinal {
5629                ordinal: tx_header.ordinal,
5630                protocol_name: <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5631            }),
5632        }
5633    }
5634}
5635
5636/// A Stream of incoming requests for fuchsia.kernel/MmioResource.
5637pub struct MmioResourceRequestStream {
5638    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5639    is_terminated: bool,
5640}
5641
5642impl std::marker::Unpin for MmioResourceRequestStream {}
5643
5644impl futures::stream::FusedStream for MmioResourceRequestStream {
5645    fn is_terminated(&self) -> bool {
5646        self.is_terminated
5647    }
5648}
5649
5650impl fidl::endpoints::RequestStream for MmioResourceRequestStream {
5651    type Protocol = MmioResourceMarker;
5652    type ControlHandle = MmioResourceControlHandle;
5653
5654    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5655        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5656    }
5657
5658    fn control_handle(&self) -> Self::ControlHandle {
5659        MmioResourceControlHandle { inner: self.inner.clone() }
5660    }
5661
5662    fn into_inner(
5663        self,
5664    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5665    {
5666        (self.inner, self.is_terminated)
5667    }
5668
5669    fn from_inner(
5670        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5671        is_terminated: bool,
5672    ) -> Self {
5673        Self { inner, is_terminated }
5674    }
5675}
5676
5677impl futures::Stream for MmioResourceRequestStream {
5678    type Item = Result<MmioResourceRequest, fidl::Error>;
5679
5680    fn poll_next(
5681        mut self: std::pin::Pin<&mut Self>,
5682        cx: &mut std::task::Context<'_>,
5683    ) -> std::task::Poll<Option<Self::Item>> {
5684        let this = &mut *self;
5685        if this.inner.check_shutdown(cx) {
5686            this.is_terminated = true;
5687            return std::task::Poll::Ready(None);
5688        }
5689        if this.is_terminated {
5690            panic!("polled MmioResourceRequestStream after completion");
5691        }
5692        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5693            |bytes, handles| {
5694                match this.inner.channel().read_etc(cx, bytes, handles) {
5695                    std::task::Poll::Ready(Ok(())) => {}
5696                    std::task::Poll::Pending => return std::task::Poll::Pending,
5697                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5698                        this.is_terminated = true;
5699                        return std::task::Poll::Ready(None);
5700                    }
5701                    std::task::Poll::Ready(Err(e)) => {
5702                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5703                            e.into(),
5704                        ))));
5705                    }
5706                }
5707
5708                // A message has been received from the channel
5709                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5710
5711                std::task::Poll::Ready(Some(match header.ordinal {
5712                    0x66747b9c5a6dfe7b => {
5713                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5714                        let mut req = fidl::new_empty!(
5715                            fidl::encoding::EmptyPayload,
5716                            fidl::encoding::DefaultFuchsiaResourceDialect
5717                        );
5718                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5719                        let control_handle =
5720                            MmioResourceControlHandle { inner: this.inner.clone() };
5721                        Ok(MmioResourceRequest::Get {
5722                            responder: MmioResourceGetResponder {
5723                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5724                                tx_id: header.tx_id,
5725                            },
5726                        })
5727                    }
5728                    _ => Err(fidl::Error::UnknownOrdinal {
5729                        ordinal: header.ordinal,
5730                        protocol_name:
5731                            <MmioResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5732                    }),
5733                }))
5734            },
5735        )
5736    }
5737}
5738
5739/// Protocol for providing an MMIO resource with access to all valid ranges.
5740#[derive(Debug)]
5741pub enum MmioResourceRequest {
5742    /// Get an MMIO resource handle.
5743    Get { responder: MmioResourceGetResponder },
5744}
5745
5746impl MmioResourceRequest {
5747    #[allow(irrefutable_let_patterns)]
5748    pub fn into_get(self) -> Option<(MmioResourceGetResponder)> {
5749        if let MmioResourceRequest::Get { responder } = self { Some((responder)) } else { None }
5750    }
5751
5752    /// Name of the method defined in FIDL
5753    pub fn method_name(&self) -> &'static str {
5754        match *self {
5755            MmioResourceRequest::Get { .. } => "get",
5756        }
5757    }
5758}
5759
5760#[derive(Debug, Clone)]
5761pub struct MmioResourceControlHandle {
5762    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5763}
5764
5765impl MmioResourceControlHandle {
5766    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5767        self.inner.shutdown_with_epitaph(status.into())
5768    }
5769}
5770
5771impl fidl::endpoints::ControlHandle for MmioResourceControlHandle {
5772    fn shutdown(&self) {
5773        self.inner.shutdown()
5774    }
5775
5776    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5777        self.inner.shutdown_with_epitaph(status)
5778    }
5779
5780    fn is_closed(&self) -> bool {
5781        self.inner.channel().is_closed()
5782    }
5783    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5784        self.inner.channel().on_closed()
5785    }
5786
5787    #[cfg(target_os = "fuchsia")]
5788    fn signal_peer(
5789        &self,
5790        clear_mask: zx::Signals,
5791        set_mask: zx::Signals,
5792    ) -> Result<(), zx_status::Status> {
5793        use fidl::Peered;
5794        self.inner.channel().signal_peer(clear_mask, set_mask)
5795    }
5796}
5797
5798impl MmioResourceControlHandle {}
5799
5800#[must_use = "FIDL methods require a response to be sent"]
5801#[derive(Debug)]
5802pub struct MmioResourceGetResponder {
5803    control_handle: std::mem::ManuallyDrop<MmioResourceControlHandle>,
5804    tx_id: u32,
5805}
5806
5807/// Set the the channel to be shutdown (see [`MmioResourceControlHandle::shutdown`])
5808/// if the responder is dropped without sending a response, so that the client
5809/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5810impl std::ops::Drop for MmioResourceGetResponder {
5811    fn drop(&mut self) {
5812        self.control_handle.shutdown();
5813        // Safety: drops once, never accessed again
5814        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5815    }
5816}
5817
5818impl fidl::endpoints::Responder for MmioResourceGetResponder {
5819    type ControlHandle = MmioResourceControlHandle;
5820
5821    fn control_handle(&self) -> &MmioResourceControlHandle {
5822        &self.control_handle
5823    }
5824
5825    fn drop_without_shutdown(mut self) {
5826        // Safety: drops once, never accessed again due to mem::forget
5827        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5828        // Prevent Drop from running (which would shut down the channel)
5829        std::mem::forget(self);
5830    }
5831}
5832
5833impl MmioResourceGetResponder {
5834    /// Sends a response to the FIDL transaction.
5835    ///
5836    /// Sets the channel to shutdown if an error occurs.
5837    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5838        let _result = self.send_raw(resource);
5839        if _result.is_err() {
5840            self.control_handle.shutdown();
5841        }
5842        self.drop_without_shutdown();
5843        _result
5844    }
5845
5846    /// Similar to "send" but does not shutdown the channel if an error occurs.
5847    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5848        let _result = self.send_raw(resource);
5849        self.drop_without_shutdown();
5850        _result
5851    }
5852
5853    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
5854        self.control_handle.inner.send::<MmioResourceGetResponse>(
5855            (resource,),
5856            self.tx_id,
5857            0x66747b9c5a6dfe7b,
5858            fidl::encoding::DynamicFlags::empty(),
5859        )
5860    }
5861}
5862
5863#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5864pub struct MsiResourceMarker;
5865
5866impl fidl::endpoints::ProtocolMarker for MsiResourceMarker {
5867    type Proxy = MsiResourceProxy;
5868    type RequestStream = MsiResourceRequestStream;
5869    #[cfg(target_os = "fuchsia")]
5870    type SynchronousProxy = MsiResourceSynchronousProxy;
5871
5872    const DEBUG_NAME: &'static str = "fuchsia.kernel.MsiResource";
5873}
5874impl fidl::endpoints::DiscoverableProtocolMarker for MsiResourceMarker {}
5875
5876pub trait MsiResourceProxyInterface: Send + Sync {
5877    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
5878    fn r#get(&self) -> Self::GetResponseFut;
5879}
5880#[derive(Debug)]
5881#[cfg(target_os = "fuchsia")]
5882pub struct MsiResourceSynchronousProxy {
5883    client: fidl::client::sync::Client,
5884}
5885
5886#[cfg(target_os = "fuchsia")]
5887impl fidl::endpoints::SynchronousProxy for MsiResourceSynchronousProxy {
5888    type Proxy = MsiResourceProxy;
5889    type Protocol = MsiResourceMarker;
5890
5891    fn from_channel(inner: fidl::Channel) -> Self {
5892        Self::new(inner)
5893    }
5894
5895    fn into_channel(self) -> fidl::Channel {
5896        self.client.into_channel()
5897    }
5898
5899    fn as_channel(&self) -> &fidl::Channel {
5900        self.client.as_channel()
5901    }
5902}
5903
5904#[cfg(target_os = "fuchsia")]
5905impl MsiResourceSynchronousProxy {
5906    pub fn new(channel: fidl::Channel) -> Self {
5907        Self { client: fidl::client::sync::Client::new(channel) }
5908    }
5909
5910    pub fn into_channel(self) -> fidl::Channel {
5911        self.client.into_channel()
5912    }
5913
5914    /// Waits until an event arrives and returns it. It is safe for other
5915    /// threads to make concurrent requests while waiting for an event.
5916    pub fn wait_for_event(
5917        &self,
5918        deadline: zx::MonotonicInstant,
5919    ) -> Result<MsiResourceEvent, fidl::Error> {
5920        MsiResourceEvent::decode(self.client.wait_for_event::<MsiResourceMarker>(deadline)?)
5921    }
5922
5923    /// Get an msi resource handle.
5924    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
5925        let _response = self
5926            .client
5927            .send_query::<fidl::encoding::EmptyPayload, MsiResourceGetResponse, MsiResourceMarker>(
5928                (),
5929                0x360a97e47e8c4f1f,
5930                fidl::encoding::DynamicFlags::empty(),
5931                ___deadline,
5932            )?;
5933        Ok(_response.resource)
5934    }
5935}
5936
5937#[cfg(target_os = "fuchsia")]
5938impl From<MsiResourceSynchronousProxy> for zx::NullableHandle {
5939    fn from(value: MsiResourceSynchronousProxy) -> Self {
5940        value.into_channel().into()
5941    }
5942}
5943
5944#[cfg(target_os = "fuchsia")]
5945impl From<fidl::Channel> for MsiResourceSynchronousProxy {
5946    fn from(value: fidl::Channel) -> Self {
5947        Self::new(value)
5948    }
5949}
5950
5951#[cfg(target_os = "fuchsia")]
5952impl fidl::endpoints::FromClient for MsiResourceSynchronousProxy {
5953    type Protocol = MsiResourceMarker;
5954
5955    fn from_client(value: fidl::endpoints::ClientEnd<MsiResourceMarker>) -> Self {
5956        Self::new(value.into_channel())
5957    }
5958}
5959
5960#[derive(Debug, Clone)]
5961pub struct MsiResourceProxy {
5962    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5963}
5964
5965impl fidl::endpoints::Proxy for MsiResourceProxy {
5966    type Protocol = MsiResourceMarker;
5967
5968    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5969        Self::new(inner)
5970    }
5971
5972    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5973        self.client.into_channel().map_err(|client| Self { client })
5974    }
5975
5976    fn as_channel(&self) -> &::fidl::AsyncChannel {
5977        self.client.as_channel()
5978    }
5979}
5980
5981impl MsiResourceProxy {
5982    /// Create a new Proxy for fuchsia.kernel/MsiResource.
5983    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5984        let protocol_name = <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5985        Self { client: fidl::client::Client::new(channel, protocol_name) }
5986    }
5987
5988    /// Get a Stream of events from the remote end of the protocol.
5989    ///
5990    /// # Panics
5991    ///
5992    /// Panics if the event stream was already taken.
5993    pub fn take_event_stream(&self) -> MsiResourceEventStream {
5994        MsiResourceEventStream { event_receiver: self.client.take_event_receiver() }
5995    }
5996
5997    /// Get an msi resource handle.
5998    pub fn r#get(
5999        &self,
6000    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6001    {
6002        MsiResourceProxyInterface::r#get(self)
6003    }
6004}
6005
6006impl MsiResourceProxyInterface for MsiResourceProxy {
6007    type GetResponseFut = fidl::client::QueryResponseFut<
6008        fidl::Resource,
6009        fidl::encoding::DefaultFuchsiaResourceDialect,
6010    >;
6011    fn r#get(&self) -> Self::GetResponseFut {
6012        fn _decode(
6013            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6014        ) -> Result<fidl::Resource, fidl::Error> {
6015            let _response = fidl::client::decode_transaction_body::<
6016                MsiResourceGetResponse,
6017                fidl::encoding::DefaultFuchsiaResourceDialect,
6018                0x360a97e47e8c4f1f,
6019            >(_buf?)?;
6020            Ok(_response.resource)
6021        }
6022        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6023            (),
6024            0x360a97e47e8c4f1f,
6025            fidl::encoding::DynamicFlags::empty(),
6026            _decode,
6027        )
6028    }
6029}
6030
6031pub struct MsiResourceEventStream {
6032    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6033}
6034
6035impl std::marker::Unpin for MsiResourceEventStream {}
6036
6037impl futures::stream::FusedStream for MsiResourceEventStream {
6038    fn is_terminated(&self) -> bool {
6039        self.event_receiver.is_terminated()
6040    }
6041}
6042
6043impl futures::Stream for MsiResourceEventStream {
6044    type Item = Result<MsiResourceEvent, fidl::Error>;
6045
6046    fn poll_next(
6047        mut self: std::pin::Pin<&mut Self>,
6048        cx: &mut std::task::Context<'_>,
6049    ) -> std::task::Poll<Option<Self::Item>> {
6050        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6051            &mut self.event_receiver,
6052            cx
6053        )?) {
6054            Some(buf) => std::task::Poll::Ready(Some(MsiResourceEvent::decode(buf))),
6055            None => std::task::Poll::Ready(None),
6056        }
6057    }
6058}
6059
6060#[derive(Debug)]
6061pub enum MsiResourceEvent {}
6062
6063impl MsiResourceEvent {
6064    /// Decodes a message buffer as a [`MsiResourceEvent`].
6065    fn decode(
6066        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6067    ) -> Result<MsiResourceEvent, fidl::Error> {
6068        let (bytes, _handles) = buf.split_mut();
6069        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6070        debug_assert_eq!(tx_header.tx_id, 0);
6071        match tx_header.ordinal {
6072            _ => Err(fidl::Error::UnknownOrdinal {
6073                ordinal: tx_header.ordinal,
6074                protocol_name: <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6075            }),
6076        }
6077    }
6078}
6079
6080/// A Stream of incoming requests for fuchsia.kernel/MsiResource.
6081pub struct MsiResourceRequestStream {
6082    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6083    is_terminated: bool,
6084}
6085
6086impl std::marker::Unpin for MsiResourceRequestStream {}
6087
6088impl futures::stream::FusedStream for MsiResourceRequestStream {
6089    fn is_terminated(&self) -> bool {
6090        self.is_terminated
6091    }
6092}
6093
6094impl fidl::endpoints::RequestStream for MsiResourceRequestStream {
6095    type Protocol = MsiResourceMarker;
6096    type ControlHandle = MsiResourceControlHandle;
6097
6098    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6099        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6100    }
6101
6102    fn control_handle(&self) -> Self::ControlHandle {
6103        MsiResourceControlHandle { inner: self.inner.clone() }
6104    }
6105
6106    fn into_inner(
6107        self,
6108    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6109    {
6110        (self.inner, self.is_terminated)
6111    }
6112
6113    fn from_inner(
6114        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6115        is_terminated: bool,
6116    ) -> Self {
6117        Self { inner, is_terminated }
6118    }
6119}
6120
6121impl futures::Stream for MsiResourceRequestStream {
6122    type Item = Result<MsiResourceRequest, fidl::Error>;
6123
6124    fn poll_next(
6125        mut self: std::pin::Pin<&mut Self>,
6126        cx: &mut std::task::Context<'_>,
6127    ) -> std::task::Poll<Option<Self::Item>> {
6128        let this = &mut *self;
6129        if this.inner.check_shutdown(cx) {
6130            this.is_terminated = true;
6131            return std::task::Poll::Ready(None);
6132        }
6133        if this.is_terminated {
6134            panic!("polled MsiResourceRequestStream after completion");
6135        }
6136        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6137            |bytes, handles| {
6138                match this.inner.channel().read_etc(cx, bytes, handles) {
6139                    std::task::Poll::Ready(Ok(())) => {}
6140                    std::task::Poll::Pending => return std::task::Poll::Pending,
6141                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6142                        this.is_terminated = true;
6143                        return std::task::Poll::Ready(None);
6144                    }
6145                    std::task::Poll::Ready(Err(e)) => {
6146                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6147                            e.into(),
6148                        ))));
6149                    }
6150                }
6151
6152                // A message has been received from the channel
6153                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6154
6155                std::task::Poll::Ready(Some(match header.ordinal {
6156                    0x360a97e47e8c4f1f => {
6157                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6158                        let mut req = fidl::new_empty!(
6159                            fidl::encoding::EmptyPayload,
6160                            fidl::encoding::DefaultFuchsiaResourceDialect
6161                        );
6162                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6163                        let control_handle = MsiResourceControlHandle { inner: this.inner.clone() };
6164                        Ok(MsiResourceRequest::Get {
6165                            responder: MsiResourceGetResponder {
6166                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6167                                tx_id: header.tx_id,
6168                            },
6169                        })
6170                    }
6171                    _ => Err(fidl::Error::UnknownOrdinal {
6172                        ordinal: header.ordinal,
6173                        protocol_name:
6174                            <MsiResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6175                    }),
6176                }))
6177            },
6178        )
6179    }
6180}
6181
6182/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6183/// `ZX_RSRC_SYSTEM_MSI_BASE`.
6184#[derive(Debug)]
6185pub enum MsiResourceRequest {
6186    /// Get an msi resource handle.
6187    Get { responder: MsiResourceGetResponder },
6188}
6189
6190impl MsiResourceRequest {
6191    #[allow(irrefutable_let_patterns)]
6192    pub fn into_get(self) -> Option<(MsiResourceGetResponder)> {
6193        if let MsiResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6194    }
6195
6196    /// Name of the method defined in FIDL
6197    pub fn method_name(&self) -> &'static str {
6198        match *self {
6199            MsiResourceRequest::Get { .. } => "get",
6200        }
6201    }
6202}
6203
6204#[derive(Debug, Clone)]
6205pub struct MsiResourceControlHandle {
6206    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6207}
6208
6209impl MsiResourceControlHandle {
6210    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6211        self.inner.shutdown_with_epitaph(status.into())
6212    }
6213}
6214
6215impl fidl::endpoints::ControlHandle for MsiResourceControlHandle {
6216    fn shutdown(&self) {
6217        self.inner.shutdown()
6218    }
6219
6220    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6221        self.inner.shutdown_with_epitaph(status)
6222    }
6223
6224    fn is_closed(&self) -> bool {
6225        self.inner.channel().is_closed()
6226    }
6227    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6228        self.inner.channel().on_closed()
6229    }
6230
6231    #[cfg(target_os = "fuchsia")]
6232    fn signal_peer(
6233        &self,
6234        clear_mask: zx::Signals,
6235        set_mask: zx::Signals,
6236    ) -> Result<(), zx_status::Status> {
6237        use fidl::Peered;
6238        self.inner.channel().signal_peer(clear_mask, set_mask)
6239    }
6240}
6241
6242impl MsiResourceControlHandle {}
6243
6244#[must_use = "FIDL methods require a response to be sent"]
6245#[derive(Debug)]
6246pub struct MsiResourceGetResponder {
6247    control_handle: std::mem::ManuallyDrop<MsiResourceControlHandle>,
6248    tx_id: u32,
6249}
6250
6251/// Set the the channel to be shutdown (see [`MsiResourceControlHandle::shutdown`])
6252/// if the responder is dropped without sending a response, so that the client
6253/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6254impl std::ops::Drop for MsiResourceGetResponder {
6255    fn drop(&mut self) {
6256        self.control_handle.shutdown();
6257        // Safety: drops once, never accessed again
6258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6259    }
6260}
6261
6262impl fidl::endpoints::Responder for MsiResourceGetResponder {
6263    type ControlHandle = MsiResourceControlHandle;
6264
6265    fn control_handle(&self) -> &MsiResourceControlHandle {
6266        &self.control_handle
6267    }
6268
6269    fn drop_without_shutdown(mut self) {
6270        // Safety: drops once, never accessed again due to mem::forget
6271        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6272        // Prevent Drop from running (which would shut down the channel)
6273        std::mem::forget(self);
6274    }
6275}
6276
6277impl MsiResourceGetResponder {
6278    /// Sends a response to the FIDL transaction.
6279    ///
6280    /// Sets the channel to shutdown if an error occurs.
6281    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6282        let _result = self.send_raw(resource);
6283        if _result.is_err() {
6284            self.control_handle.shutdown();
6285        }
6286        self.drop_without_shutdown();
6287        _result
6288    }
6289
6290    /// Similar to "send" but does not shutdown the channel if an error occurs.
6291    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6292        let _result = self.send_raw(resource);
6293        self.drop_without_shutdown();
6294        _result
6295    }
6296
6297    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6298        self.control_handle.inner.send::<MsiResourceGetResponse>(
6299            (resource,),
6300            self.tx_id,
6301            0x360a97e47e8c4f1f,
6302            fidl::encoding::DynamicFlags::empty(),
6303        )
6304    }
6305}
6306
6307#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6308pub struct PowerResourceMarker;
6309
6310impl fidl::endpoints::ProtocolMarker for PowerResourceMarker {
6311    type Proxy = PowerResourceProxy;
6312    type RequestStream = PowerResourceRequestStream;
6313    #[cfg(target_os = "fuchsia")]
6314    type SynchronousProxy = PowerResourceSynchronousProxy;
6315
6316    const DEBUG_NAME: &'static str = "fuchsia.kernel.PowerResource";
6317}
6318impl fidl::endpoints::DiscoverableProtocolMarker for PowerResourceMarker {}
6319
6320pub trait PowerResourceProxyInterface: Send + Sync {
6321    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6322    fn r#get(&self) -> Self::GetResponseFut;
6323}
6324#[derive(Debug)]
6325#[cfg(target_os = "fuchsia")]
6326pub struct PowerResourceSynchronousProxy {
6327    client: fidl::client::sync::Client,
6328}
6329
6330#[cfg(target_os = "fuchsia")]
6331impl fidl::endpoints::SynchronousProxy for PowerResourceSynchronousProxy {
6332    type Proxy = PowerResourceProxy;
6333    type Protocol = PowerResourceMarker;
6334
6335    fn from_channel(inner: fidl::Channel) -> Self {
6336        Self::new(inner)
6337    }
6338
6339    fn into_channel(self) -> fidl::Channel {
6340        self.client.into_channel()
6341    }
6342
6343    fn as_channel(&self) -> &fidl::Channel {
6344        self.client.as_channel()
6345    }
6346}
6347
6348#[cfg(target_os = "fuchsia")]
6349impl PowerResourceSynchronousProxy {
6350    pub fn new(channel: fidl::Channel) -> Self {
6351        Self { client: fidl::client::sync::Client::new(channel) }
6352    }
6353
6354    pub fn into_channel(self) -> fidl::Channel {
6355        self.client.into_channel()
6356    }
6357
6358    /// Waits until an event arrives and returns it. It is safe for other
6359    /// threads to make concurrent requests while waiting for an event.
6360    pub fn wait_for_event(
6361        &self,
6362        deadline: zx::MonotonicInstant,
6363    ) -> Result<PowerResourceEvent, fidl::Error> {
6364        PowerResourceEvent::decode(self.client.wait_for_event::<PowerResourceMarker>(deadline)?)
6365    }
6366
6367    /// Get a power resource handle.
6368    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6369        let _response = self.client.send_query::<
6370            fidl::encoding::EmptyPayload,
6371            PowerResourceGetResponse,
6372            PowerResourceMarker,
6373        >(
6374            (),
6375            0x2b8df8ca24d1e866,
6376            fidl::encoding::DynamicFlags::empty(),
6377            ___deadline,
6378        )?;
6379        Ok(_response.resource)
6380    }
6381}
6382
6383#[cfg(target_os = "fuchsia")]
6384impl From<PowerResourceSynchronousProxy> for zx::NullableHandle {
6385    fn from(value: PowerResourceSynchronousProxy) -> Self {
6386        value.into_channel().into()
6387    }
6388}
6389
6390#[cfg(target_os = "fuchsia")]
6391impl From<fidl::Channel> for PowerResourceSynchronousProxy {
6392    fn from(value: fidl::Channel) -> Self {
6393        Self::new(value)
6394    }
6395}
6396
6397#[cfg(target_os = "fuchsia")]
6398impl fidl::endpoints::FromClient for PowerResourceSynchronousProxy {
6399    type Protocol = PowerResourceMarker;
6400
6401    fn from_client(value: fidl::endpoints::ClientEnd<PowerResourceMarker>) -> Self {
6402        Self::new(value.into_channel())
6403    }
6404}
6405
6406#[derive(Debug, Clone)]
6407pub struct PowerResourceProxy {
6408    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6409}
6410
6411impl fidl::endpoints::Proxy for PowerResourceProxy {
6412    type Protocol = PowerResourceMarker;
6413
6414    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6415        Self::new(inner)
6416    }
6417
6418    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6419        self.client.into_channel().map_err(|client| Self { client })
6420    }
6421
6422    fn as_channel(&self) -> &::fidl::AsyncChannel {
6423        self.client.as_channel()
6424    }
6425}
6426
6427impl PowerResourceProxy {
6428    /// Create a new Proxy for fuchsia.kernel/PowerResource.
6429    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6430        let protocol_name = <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6431        Self { client: fidl::client::Client::new(channel, protocol_name) }
6432    }
6433
6434    /// Get a Stream of events from the remote end of the protocol.
6435    ///
6436    /// # Panics
6437    ///
6438    /// Panics if the event stream was already taken.
6439    pub fn take_event_stream(&self) -> PowerResourceEventStream {
6440        PowerResourceEventStream { event_receiver: self.client.take_event_receiver() }
6441    }
6442
6443    /// Get a power resource handle.
6444    pub fn r#get(
6445        &self,
6446    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6447    {
6448        PowerResourceProxyInterface::r#get(self)
6449    }
6450}
6451
6452impl PowerResourceProxyInterface for PowerResourceProxy {
6453    type GetResponseFut = fidl::client::QueryResponseFut<
6454        fidl::Resource,
6455        fidl::encoding::DefaultFuchsiaResourceDialect,
6456    >;
6457    fn r#get(&self) -> Self::GetResponseFut {
6458        fn _decode(
6459            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6460        ) -> Result<fidl::Resource, fidl::Error> {
6461            let _response = fidl::client::decode_transaction_body::<
6462                PowerResourceGetResponse,
6463                fidl::encoding::DefaultFuchsiaResourceDialect,
6464                0x2b8df8ca24d1e866,
6465            >(_buf?)?;
6466            Ok(_response.resource)
6467        }
6468        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6469            (),
6470            0x2b8df8ca24d1e866,
6471            fidl::encoding::DynamicFlags::empty(),
6472            _decode,
6473        )
6474    }
6475}
6476
6477pub struct PowerResourceEventStream {
6478    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6479}
6480
6481impl std::marker::Unpin for PowerResourceEventStream {}
6482
6483impl futures::stream::FusedStream for PowerResourceEventStream {
6484    fn is_terminated(&self) -> bool {
6485        self.event_receiver.is_terminated()
6486    }
6487}
6488
6489impl futures::Stream for PowerResourceEventStream {
6490    type Item = Result<PowerResourceEvent, fidl::Error>;
6491
6492    fn poll_next(
6493        mut self: std::pin::Pin<&mut Self>,
6494        cx: &mut std::task::Context<'_>,
6495    ) -> std::task::Poll<Option<Self::Item>> {
6496        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6497            &mut self.event_receiver,
6498            cx
6499        )?) {
6500            Some(buf) => std::task::Poll::Ready(Some(PowerResourceEvent::decode(buf))),
6501            None => std::task::Poll::Ready(None),
6502        }
6503    }
6504}
6505
6506#[derive(Debug)]
6507pub enum PowerResourceEvent {}
6508
6509impl PowerResourceEvent {
6510    /// Decodes a message buffer as a [`PowerResourceEvent`].
6511    fn decode(
6512        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6513    ) -> Result<PowerResourceEvent, fidl::Error> {
6514        let (bytes, _handles) = buf.split_mut();
6515        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6516        debug_assert_eq!(tx_header.tx_id, 0);
6517        match tx_header.ordinal {
6518            _ => Err(fidl::Error::UnknownOrdinal {
6519                ordinal: tx_header.ordinal,
6520                protocol_name: <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6521            }),
6522        }
6523    }
6524}
6525
6526/// A Stream of incoming requests for fuchsia.kernel/PowerResource.
6527pub struct PowerResourceRequestStream {
6528    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6529    is_terminated: bool,
6530}
6531
6532impl std::marker::Unpin for PowerResourceRequestStream {}
6533
6534impl futures::stream::FusedStream for PowerResourceRequestStream {
6535    fn is_terminated(&self) -> bool {
6536        self.is_terminated
6537    }
6538}
6539
6540impl fidl::endpoints::RequestStream for PowerResourceRequestStream {
6541    type Protocol = PowerResourceMarker;
6542    type ControlHandle = PowerResourceControlHandle;
6543
6544    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6545        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6546    }
6547
6548    fn control_handle(&self) -> Self::ControlHandle {
6549        PowerResourceControlHandle { inner: self.inner.clone() }
6550    }
6551
6552    fn into_inner(
6553        self,
6554    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6555    {
6556        (self.inner, self.is_terminated)
6557    }
6558
6559    fn from_inner(
6560        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6561        is_terminated: bool,
6562    ) -> Self {
6563        Self { inner, is_terminated }
6564    }
6565}
6566
6567impl futures::Stream for PowerResourceRequestStream {
6568    type Item = Result<PowerResourceRequest, fidl::Error>;
6569
6570    fn poll_next(
6571        mut self: std::pin::Pin<&mut Self>,
6572        cx: &mut std::task::Context<'_>,
6573    ) -> std::task::Poll<Option<Self::Item>> {
6574        let this = &mut *self;
6575        if this.inner.check_shutdown(cx) {
6576            this.is_terminated = true;
6577            return std::task::Poll::Ready(None);
6578        }
6579        if this.is_terminated {
6580            panic!("polled PowerResourceRequestStream after completion");
6581        }
6582        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6583            |bytes, handles| {
6584                match this.inner.channel().read_etc(cx, bytes, handles) {
6585                    std::task::Poll::Ready(Ok(())) => {}
6586                    std::task::Poll::Pending => return std::task::Poll::Pending,
6587                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6588                        this.is_terminated = true;
6589                        return std::task::Poll::Ready(None);
6590                    }
6591                    std::task::Poll::Ready(Err(e)) => {
6592                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6593                            e.into(),
6594                        ))));
6595                    }
6596                }
6597
6598                // A message has been received from the channel
6599                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6600
6601                std::task::Poll::Ready(Some(match header.ordinal {
6602                    0x2b8df8ca24d1e866 => {
6603                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6604                        let mut req = fidl::new_empty!(
6605                            fidl::encoding::EmptyPayload,
6606                            fidl::encoding::DefaultFuchsiaResourceDialect
6607                        );
6608                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6609                        let control_handle =
6610                            PowerResourceControlHandle { inner: this.inner.clone() };
6611                        Ok(PowerResourceRequest::Get {
6612                            responder: PowerResourceGetResponder {
6613                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6614                                tx_id: header.tx_id,
6615                            },
6616                        })
6617                    }
6618                    _ => Err(fidl::Error::UnknownOrdinal {
6619                        ordinal: header.ordinal,
6620                        protocol_name:
6621                            <PowerResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6622                    }),
6623                }))
6624            },
6625        )
6626    }
6627}
6628
6629/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
6630/// `ZX_RSRC_SYSTEM_POWER_BASE`.
6631#[derive(Debug)]
6632pub enum PowerResourceRequest {
6633    /// Get a power resource handle.
6634    Get { responder: PowerResourceGetResponder },
6635}
6636
6637impl PowerResourceRequest {
6638    #[allow(irrefutable_let_patterns)]
6639    pub fn into_get(self) -> Option<(PowerResourceGetResponder)> {
6640        if let PowerResourceRequest::Get { responder } = self { Some((responder)) } else { None }
6641    }
6642
6643    /// Name of the method defined in FIDL
6644    pub fn method_name(&self) -> &'static str {
6645        match *self {
6646            PowerResourceRequest::Get { .. } => "get",
6647        }
6648    }
6649}
6650
6651#[derive(Debug, Clone)]
6652pub struct PowerResourceControlHandle {
6653    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6654}
6655
6656impl PowerResourceControlHandle {
6657    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6658        self.inner.shutdown_with_epitaph(status.into())
6659    }
6660}
6661
6662impl fidl::endpoints::ControlHandle for PowerResourceControlHandle {
6663    fn shutdown(&self) {
6664        self.inner.shutdown()
6665    }
6666
6667    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6668        self.inner.shutdown_with_epitaph(status)
6669    }
6670
6671    fn is_closed(&self) -> bool {
6672        self.inner.channel().is_closed()
6673    }
6674    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6675        self.inner.channel().on_closed()
6676    }
6677
6678    #[cfg(target_os = "fuchsia")]
6679    fn signal_peer(
6680        &self,
6681        clear_mask: zx::Signals,
6682        set_mask: zx::Signals,
6683    ) -> Result<(), zx_status::Status> {
6684        use fidl::Peered;
6685        self.inner.channel().signal_peer(clear_mask, set_mask)
6686    }
6687}
6688
6689impl PowerResourceControlHandle {}
6690
6691#[must_use = "FIDL methods require a response to be sent"]
6692#[derive(Debug)]
6693pub struct PowerResourceGetResponder {
6694    control_handle: std::mem::ManuallyDrop<PowerResourceControlHandle>,
6695    tx_id: u32,
6696}
6697
6698/// Set the the channel to be shutdown (see [`PowerResourceControlHandle::shutdown`])
6699/// if the responder is dropped without sending a response, so that the client
6700/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6701impl std::ops::Drop for PowerResourceGetResponder {
6702    fn drop(&mut self) {
6703        self.control_handle.shutdown();
6704        // Safety: drops once, never accessed again
6705        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6706    }
6707}
6708
6709impl fidl::endpoints::Responder for PowerResourceGetResponder {
6710    type ControlHandle = PowerResourceControlHandle;
6711
6712    fn control_handle(&self) -> &PowerResourceControlHandle {
6713        &self.control_handle
6714    }
6715
6716    fn drop_without_shutdown(mut self) {
6717        // Safety: drops once, never accessed again due to mem::forget
6718        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6719        // Prevent Drop from running (which would shut down the channel)
6720        std::mem::forget(self);
6721    }
6722}
6723
6724impl PowerResourceGetResponder {
6725    /// Sends a response to the FIDL transaction.
6726    ///
6727    /// Sets the channel to shutdown if an error occurs.
6728    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6729        let _result = self.send_raw(resource);
6730        if _result.is_err() {
6731            self.control_handle.shutdown();
6732        }
6733        self.drop_without_shutdown();
6734        _result
6735    }
6736
6737    /// Similar to "send" but does not shutdown the channel if an error occurs.
6738    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6739        let _result = self.send_raw(resource);
6740        self.drop_without_shutdown();
6741        _result
6742    }
6743
6744    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
6745        self.control_handle.inner.send::<PowerResourceGetResponse>(
6746            (resource,),
6747            self.tx_id,
6748            0x2b8df8ca24d1e866,
6749            fidl::encoding::DynamicFlags::empty(),
6750        )
6751    }
6752}
6753
6754#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6755pub struct ProfileResourceMarker;
6756
6757impl fidl::endpoints::ProtocolMarker for ProfileResourceMarker {
6758    type Proxy = ProfileResourceProxy;
6759    type RequestStream = ProfileResourceRequestStream;
6760    #[cfg(target_os = "fuchsia")]
6761    type SynchronousProxy = ProfileResourceSynchronousProxy;
6762
6763    const DEBUG_NAME: &'static str = "fuchsia.kernel.ProfileResource";
6764}
6765impl fidl::endpoints::DiscoverableProtocolMarker for ProfileResourceMarker {}
6766
6767pub trait ProfileResourceProxyInterface: Send + Sync {
6768    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
6769    fn r#get(&self) -> Self::GetResponseFut;
6770}
6771#[derive(Debug)]
6772#[cfg(target_os = "fuchsia")]
6773pub struct ProfileResourceSynchronousProxy {
6774    client: fidl::client::sync::Client,
6775}
6776
6777#[cfg(target_os = "fuchsia")]
6778impl fidl::endpoints::SynchronousProxy for ProfileResourceSynchronousProxy {
6779    type Proxy = ProfileResourceProxy;
6780    type Protocol = ProfileResourceMarker;
6781
6782    fn from_channel(inner: fidl::Channel) -> Self {
6783        Self::new(inner)
6784    }
6785
6786    fn into_channel(self) -> fidl::Channel {
6787        self.client.into_channel()
6788    }
6789
6790    fn as_channel(&self) -> &fidl::Channel {
6791        self.client.as_channel()
6792    }
6793}
6794
6795#[cfg(target_os = "fuchsia")]
6796impl ProfileResourceSynchronousProxy {
6797    pub fn new(channel: fidl::Channel) -> Self {
6798        Self { client: fidl::client::sync::Client::new(channel) }
6799    }
6800
6801    pub fn into_channel(self) -> fidl::Channel {
6802        self.client.into_channel()
6803    }
6804
6805    /// Waits until an event arrives and returns it. It is safe for other
6806    /// threads to make concurrent requests while waiting for an event.
6807    pub fn wait_for_event(
6808        &self,
6809        deadline: zx::MonotonicInstant,
6810    ) -> Result<ProfileResourceEvent, fidl::Error> {
6811        ProfileResourceEvent::decode(self.client.wait_for_event::<ProfileResourceMarker>(deadline)?)
6812    }
6813
6814    /// Get a profile resource handle.
6815    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
6816        let _response = self.client.send_query::<
6817            fidl::encoding::EmptyPayload,
6818            ProfileResourceGetResponse,
6819            ProfileResourceMarker,
6820        >(
6821            (),
6822            0x3003a0c14de1fa86,
6823            fidl::encoding::DynamicFlags::empty(),
6824            ___deadline,
6825        )?;
6826        Ok(_response.resource)
6827    }
6828}
6829
6830#[cfg(target_os = "fuchsia")]
6831impl From<ProfileResourceSynchronousProxy> for zx::NullableHandle {
6832    fn from(value: ProfileResourceSynchronousProxy) -> Self {
6833        value.into_channel().into()
6834    }
6835}
6836
6837#[cfg(target_os = "fuchsia")]
6838impl From<fidl::Channel> for ProfileResourceSynchronousProxy {
6839    fn from(value: fidl::Channel) -> Self {
6840        Self::new(value)
6841    }
6842}
6843
6844#[cfg(target_os = "fuchsia")]
6845impl fidl::endpoints::FromClient for ProfileResourceSynchronousProxy {
6846    type Protocol = ProfileResourceMarker;
6847
6848    fn from_client(value: fidl::endpoints::ClientEnd<ProfileResourceMarker>) -> Self {
6849        Self::new(value.into_channel())
6850    }
6851}
6852
6853#[derive(Debug, Clone)]
6854pub struct ProfileResourceProxy {
6855    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6856}
6857
6858impl fidl::endpoints::Proxy for ProfileResourceProxy {
6859    type Protocol = ProfileResourceMarker;
6860
6861    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6862        Self::new(inner)
6863    }
6864
6865    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6866        self.client.into_channel().map_err(|client| Self { client })
6867    }
6868
6869    fn as_channel(&self) -> &::fidl::AsyncChannel {
6870        self.client.as_channel()
6871    }
6872}
6873
6874impl ProfileResourceProxy {
6875    /// Create a new Proxy for fuchsia.kernel/ProfileResource.
6876    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6877        let protocol_name = <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6878        Self { client: fidl::client::Client::new(channel, protocol_name) }
6879    }
6880
6881    /// Get a Stream of events from the remote end of the protocol.
6882    ///
6883    /// # Panics
6884    ///
6885    /// Panics if the event stream was already taken.
6886    pub fn take_event_stream(&self) -> ProfileResourceEventStream {
6887        ProfileResourceEventStream { event_receiver: self.client.take_event_receiver() }
6888    }
6889
6890    /// Get a profile resource handle.
6891    pub fn r#get(
6892        &self,
6893    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
6894    {
6895        ProfileResourceProxyInterface::r#get(self)
6896    }
6897}
6898
6899impl ProfileResourceProxyInterface for ProfileResourceProxy {
6900    type GetResponseFut = fidl::client::QueryResponseFut<
6901        fidl::Resource,
6902        fidl::encoding::DefaultFuchsiaResourceDialect,
6903    >;
6904    fn r#get(&self) -> Self::GetResponseFut {
6905        fn _decode(
6906            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6907        ) -> Result<fidl::Resource, fidl::Error> {
6908            let _response = fidl::client::decode_transaction_body::<
6909                ProfileResourceGetResponse,
6910                fidl::encoding::DefaultFuchsiaResourceDialect,
6911                0x3003a0c14de1fa86,
6912            >(_buf?)?;
6913            Ok(_response.resource)
6914        }
6915        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
6916            (),
6917            0x3003a0c14de1fa86,
6918            fidl::encoding::DynamicFlags::empty(),
6919            _decode,
6920        )
6921    }
6922}
6923
6924pub struct ProfileResourceEventStream {
6925    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6926}
6927
6928impl std::marker::Unpin for ProfileResourceEventStream {}
6929
6930impl futures::stream::FusedStream for ProfileResourceEventStream {
6931    fn is_terminated(&self) -> bool {
6932        self.event_receiver.is_terminated()
6933    }
6934}
6935
6936impl futures::Stream for ProfileResourceEventStream {
6937    type Item = Result<ProfileResourceEvent, fidl::Error>;
6938
6939    fn poll_next(
6940        mut self: std::pin::Pin<&mut Self>,
6941        cx: &mut std::task::Context<'_>,
6942    ) -> std::task::Poll<Option<Self::Item>> {
6943        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6944            &mut self.event_receiver,
6945            cx
6946        )?) {
6947            Some(buf) => std::task::Poll::Ready(Some(ProfileResourceEvent::decode(buf))),
6948            None => std::task::Poll::Ready(None),
6949        }
6950    }
6951}
6952
6953#[derive(Debug)]
6954pub enum ProfileResourceEvent {}
6955
6956impl ProfileResourceEvent {
6957    /// Decodes a message buffer as a [`ProfileResourceEvent`].
6958    fn decode(
6959        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6960    ) -> Result<ProfileResourceEvent, fidl::Error> {
6961        let (bytes, _handles) = buf.split_mut();
6962        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6963        debug_assert_eq!(tx_header.tx_id, 0);
6964        match tx_header.ordinal {
6965            _ => Err(fidl::Error::UnknownOrdinal {
6966                ordinal: tx_header.ordinal,
6967                protocol_name:
6968                    <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6969            }),
6970        }
6971    }
6972}
6973
6974/// A Stream of incoming requests for fuchsia.kernel/ProfileResource.
6975pub struct ProfileResourceRequestStream {
6976    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6977    is_terminated: bool,
6978}
6979
6980impl std::marker::Unpin for ProfileResourceRequestStream {}
6981
6982impl futures::stream::FusedStream for ProfileResourceRequestStream {
6983    fn is_terminated(&self) -> bool {
6984        self.is_terminated
6985    }
6986}
6987
6988impl fidl::endpoints::RequestStream for ProfileResourceRequestStream {
6989    type Protocol = ProfileResourceMarker;
6990    type ControlHandle = ProfileResourceControlHandle;
6991
6992    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6993        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6994    }
6995
6996    fn control_handle(&self) -> Self::ControlHandle {
6997        ProfileResourceControlHandle { inner: self.inner.clone() }
6998    }
6999
7000    fn into_inner(
7001        self,
7002    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7003    {
7004        (self.inner, self.is_terminated)
7005    }
7006
7007    fn from_inner(
7008        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7009        is_terminated: bool,
7010    ) -> Self {
7011        Self { inner, is_terminated }
7012    }
7013}
7014
7015impl futures::Stream for ProfileResourceRequestStream {
7016    type Item = Result<ProfileResourceRequest, fidl::Error>;
7017
7018    fn poll_next(
7019        mut self: std::pin::Pin<&mut Self>,
7020        cx: &mut std::task::Context<'_>,
7021    ) -> std::task::Poll<Option<Self::Item>> {
7022        let this = &mut *self;
7023        if this.inner.check_shutdown(cx) {
7024            this.is_terminated = true;
7025            return std::task::Poll::Ready(None);
7026        }
7027        if this.is_terminated {
7028            panic!("polled ProfileResourceRequestStream after completion");
7029        }
7030        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7031            |bytes, handles| {
7032                match this.inner.channel().read_etc(cx, bytes, handles) {
7033                    std::task::Poll::Ready(Ok(())) => {}
7034                    std::task::Poll::Pending => return std::task::Poll::Pending,
7035                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7036                        this.is_terminated = true;
7037                        return std::task::Poll::Ready(None);
7038                    }
7039                    std::task::Poll::Ready(Err(e)) => {
7040                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7041                            e.into(),
7042                        ))));
7043                    }
7044                }
7045
7046                // A message has been received from the channel
7047                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7048
7049                std::task::Poll::Ready(Some(match header.ordinal {
7050                    0x3003a0c14de1fa86 => {
7051                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7052                        let mut req = fidl::new_empty!(
7053                            fidl::encoding::EmptyPayload,
7054                            fidl::encoding::DefaultFuchsiaResourceDialect
7055                        );
7056                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7057                        let control_handle =
7058                            ProfileResourceControlHandle { inner: this.inner.clone() };
7059                        Ok(ProfileResourceRequest::Get {
7060                            responder: ProfileResourceGetResponder {
7061                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7062                                tx_id: header.tx_id,
7063                            },
7064                        })
7065                    }
7066                    _ => Err(fidl::Error::UnknownOrdinal {
7067                        ordinal: header.ordinal,
7068                        protocol_name:
7069                            <ProfileResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7070                    }),
7071                }))
7072            },
7073        )
7074    }
7075}
7076
7077/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
7078/// `ZX_RSRC_SYSTEM_PROFILE_BASE`.
7079#[derive(Debug)]
7080pub enum ProfileResourceRequest {
7081    /// Get a profile resource handle.
7082    Get { responder: ProfileResourceGetResponder },
7083}
7084
7085impl ProfileResourceRequest {
7086    #[allow(irrefutable_let_patterns)]
7087    pub fn into_get(self) -> Option<(ProfileResourceGetResponder)> {
7088        if let ProfileResourceRequest::Get { responder } = self { Some((responder)) } else { None }
7089    }
7090
7091    /// Name of the method defined in FIDL
7092    pub fn method_name(&self) -> &'static str {
7093        match *self {
7094            ProfileResourceRequest::Get { .. } => "get",
7095        }
7096    }
7097}
7098
7099#[derive(Debug, Clone)]
7100pub struct ProfileResourceControlHandle {
7101    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7102}
7103
7104impl ProfileResourceControlHandle {
7105    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7106        self.inner.shutdown_with_epitaph(status.into())
7107    }
7108}
7109
7110impl fidl::endpoints::ControlHandle for ProfileResourceControlHandle {
7111    fn shutdown(&self) {
7112        self.inner.shutdown()
7113    }
7114
7115    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7116        self.inner.shutdown_with_epitaph(status)
7117    }
7118
7119    fn is_closed(&self) -> bool {
7120        self.inner.channel().is_closed()
7121    }
7122    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7123        self.inner.channel().on_closed()
7124    }
7125
7126    #[cfg(target_os = "fuchsia")]
7127    fn signal_peer(
7128        &self,
7129        clear_mask: zx::Signals,
7130        set_mask: zx::Signals,
7131    ) -> Result<(), zx_status::Status> {
7132        use fidl::Peered;
7133        self.inner.channel().signal_peer(clear_mask, set_mask)
7134    }
7135}
7136
7137impl ProfileResourceControlHandle {}
7138
7139#[must_use = "FIDL methods require a response to be sent"]
7140#[derive(Debug)]
7141pub struct ProfileResourceGetResponder {
7142    control_handle: std::mem::ManuallyDrop<ProfileResourceControlHandle>,
7143    tx_id: u32,
7144}
7145
7146/// Set the the channel to be shutdown (see [`ProfileResourceControlHandle::shutdown`])
7147/// if the responder is dropped without sending a response, so that the client
7148/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7149impl std::ops::Drop for ProfileResourceGetResponder {
7150    fn drop(&mut self) {
7151        self.control_handle.shutdown();
7152        // Safety: drops once, never accessed again
7153        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7154    }
7155}
7156
7157impl fidl::endpoints::Responder for ProfileResourceGetResponder {
7158    type ControlHandle = ProfileResourceControlHandle;
7159
7160    fn control_handle(&self) -> &ProfileResourceControlHandle {
7161        &self.control_handle
7162    }
7163
7164    fn drop_without_shutdown(mut self) {
7165        // Safety: drops once, never accessed again due to mem::forget
7166        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7167        // Prevent Drop from running (which would shut down the channel)
7168        std::mem::forget(self);
7169    }
7170}
7171
7172impl ProfileResourceGetResponder {
7173    /// Sends a response to the FIDL transaction.
7174    ///
7175    /// Sets the channel to shutdown if an error occurs.
7176    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7177        let _result = self.send_raw(resource);
7178        if _result.is_err() {
7179            self.control_handle.shutdown();
7180        }
7181        self.drop_without_shutdown();
7182        _result
7183    }
7184
7185    /// Similar to "send" but does not shutdown the channel if an error occurs.
7186    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7187        let _result = self.send_raw(resource);
7188        self.drop_without_shutdown();
7189        _result
7190    }
7191
7192    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
7193        self.control_handle.inner.send::<ProfileResourceGetResponse>(
7194            (resource,),
7195            self.tx_id,
7196            0x3003a0c14de1fa86,
7197            fidl::encoding::DynamicFlags::empty(),
7198        )
7199    }
7200}
7201
7202#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7203pub struct RootJobMarker;
7204
7205impl fidl::endpoints::ProtocolMarker for RootJobMarker {
7206    type Proxy = RootJobProxy;
7207    type RequestStream = RootJobRequestStream;
7208    #[cfg(target_os = "fuchsia")]
7209    type SynchronousProxy = RootJobSynchronousProxy;
7210
7211    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJob";
7212}
7213impl fidl::endpoints::DiscoverableProtocolMarker for RootJobMarker {}
7214
7215pub trait RootJobProxyInterface: Send + Sync {
7216    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7217    fn r#get(&self) -> Self::GetResponseFut;
7218}
7219#[derive(Debug)]
7220#[cfg(target_os = "fuchsia")]
7221pub struct RootJobSynchronousProxy {
7222    client: fidl::client::sync::Client,
7223}
7224
7225#[cfg(target_os = "fuchsia")]
7226impl fidl::endpoints::SynchronousProxy for RootJobSynchronousProxy {
7227    type Proxy = RootJobProxy;
7228    type Protocol = RootJobMarker;
7229
7230    fn from_channel(inner: fidl::Channel) -> Self {
7231        Self::new(inner)
7232    }
7233
7234    fn into_channel(self) -> fidl::Channel {
7235        self.client.into_channel()
7236    }
7237
7238    fn as_channel(&self) -> &fidl::Channel {
7239        self.client.as_channel()
7240    }
7241}
7242
7243#[cfg(target_os = "fuchsia")]
7244impl RootJobSynchronousProxy {
7245    pub fn new(channel: fidl::Channel) -> Self {
7246        Self { client: fidl::client::sync::Client::new(channel) }
7247    }
7248
7249    pub fn into_channel(self) -> fidl::Channel {
7250        self.client.into_channel()
7251    }
7252
7253    /// Waits until an event arrives and returns it. It is safe for other
7254    /// threads to make concurrent requests while waiting for an event.
7255    pub fn wait_for_event(
7256        &self,
7257        deadline: zx::MonotonicInstant,
7258    ) -> Result<RootJobEvent, fidl::Error> {
7259        RootJobEvent::decode(self.client.wait_for_event::<RootJobMarker>(deadline)?)
7260    }
7261
7262    /// Get the root `job`.
7263    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7264        let _response = self
7265            .client
7266            .send_query::<fidl::encoding::EmptyPayload, RootJobGetResponse, RootJobMarker>(
7267                (),
7268                0x73acb63f93d53eac,
7269                fidl::encoding::DynamicFlags::empty(),
7270                ___deadline,
7271            )?;
7272        Ok(_response.job)
7273    }
7274}
7275
7276#[cfg(target_os = "fuchsia")]
7277impl From<RootJobSynchronousProxy> for zx::NullableHandle {
7278    fn from(value: RootJobSynchronousProxy) -> Self {
7279        value.into_channel().into()
7280    }
7281}
7282
7283#[cfg(target_os = "fuchsia")]
7284impl From<fidl::Channel> for RootJobSynchronousProxy {
7285    fn from(value: fidl::Channel) -> Self {
7286        Self::new(value)
7287    }
7288}
7289
7290#[cfg(target_os = "fuchsia")]
7291impl fidl::endpoints::FromClient for RootJobSynchronousProxy {
7292    type Protocol = RootJobMarker;
7293
7294    fn from_client(value: fidl::endpoints::ClientEnd<RootJobMarker>) -> Self {
7295        Self::new(value.into_channel())
7296    }
7297}
7298
7299#[derive(Debug, Clone)]
7300pub struct RootJobProxy {
7301    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7302}
7303
7304impl fidl::endpoints::Proxy for RootJobProxy {
7305    type Protocol = RootJobMarker;
7306
7307    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7308        Self::new(inner)
7309    }
7310
7311    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7312        self.client.into_channel().map_err(|client| Self { client })
7313    }
7314
7315    fn as_channel(&self) -> &::fidl::AsyncChannel {
7316        self.client.as_channel()
7317    }
7318}
7319
7320impl RootJobProxy {
7321    /// Create a new Proxy for fuchsia.kernel/RootJob.
7322    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7323        let protocol_name = <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7324        Self { client: fidl::client::Client::new(channel, protocol_name) }
7325    }
7326
7327    /// Get a Stream of events from the remote end of the protocol.
7328    ///
7329    /// # Panics
7330    ///
7331    /// Panics if the event stream was already taken.
7332    pub fn take_event_stream(&self) -> RootJobEventStream {
7333        RootJobEventStream { event_receiver: self.client.take_event_receiver() }
7334    }
7335
7336    /// Get the root `job`.
7337    pub fn r#get(
7338        &self,
7339    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7340    {
7341        RootJobProxyInterface::r#get(self)
7342    }
7343}
7344
7345impl RootJobProxyInterface for RootJobProxy {
7346    type GetResponseFut =
7347        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7348    fn r#get(&self) -> Self::GetResponseFut {
7349        fn _decode(
7350            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7351        ) -> Result<fidl::Job, fidl::Error> {
7352            let _response = fidl::client::decode_transaction_body::<
7353                RootJobGetResponse,
7354                fidl::encoding::DefaultFuchsiaResourceDialect,
7355                0x73acb63f93d53eac,
7356            >(_buf?)?;
7357            Ok(_response.job)
7358        }
7359        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7360            (),
7361            0x73acb63f93d53eac,
7362            fidl::encoding::DynamicFlags::empty(),
7363            _decode,
7364        )
7365    }
7366}
7367
7368pub struct RootJobEventStream {
7369    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7370}
7371
7372impl std::marker::Unpin for RootJobEventStream {}
7373
7374impl futures::stream::FusedStream for RootJobEventStream {
7375    fn is_terminated(&self) -> bool {
7376        self.event_receiver.is_terminated()
7377    }
7378}
7379
7380impl futures::Stream for RootJobEventStream {
7381    type Item = Result<RootJobEvent, fidl::Error>;
7382
7383    fn poll_next(
7384        mut self: std::pin::Pin<&mut Self>,
7385        cx: &mut std::task::Context<'_>,
7386    ) -> std::task::Poll<Option<Self::Item>> {
7387        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7388            &mut self.event_receiver,
7389            cx
7390        )?) {
7391            Some(buf) => std::task::Poll::Ready(Some(RootJobEvent::decode(buf))),
7392            None => std::task::Poll::Ready(None),
7393        }
7394    }
7395}
7396
7397#[derive(Debug)]
7398pub enum RootJobEvent {}
7399
7400impl RootJobEvent {
7401    /// Decodes a message buffer as a [`RootJobEvent`].
7402    fn decode(
7403        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7404    ) -> Result<RootJobEvent, fidl::Error> {
7405        let (bytes, _handles) = buf.split_mut();
7406        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7407        debug_assert_eq!(tx_header.tx_id, 0);
7408        match tx_header.ordinal {
7409            _ => Err(fidl::Error::UnknownOrdinal {
7410                ordinal: tx_header.ordinal,
7411                protocol_name: <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7412            }),
7413        }
7414    }
7415}
7416
7417/// A Stream of incoming requests for fuchsia.kernel/RootJob.
7418pub struct RootJobRequestStream {
7419    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7420    is_terminated: bool,
7421}
7422
7423impl std::marker::Unpin for RootJobRequestStream {}
7424
7425impl futures::stream::FusedStream for RootJobRequestStream {
7426    fn is_terminated(&self) -> bool {
7427        self.is_terminated
7428    }
7429}
7430
7431impl fidl::endpoints::RequestStream for RootJobRequestStream {
7432    type Protocol = RootJobMarker;
7433    type ControlHandle = RootJobControlHandle;
7434
7435    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7436        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7437    }
7438
7439    fn control_handle(&self) -> Self::ControlHandle {
7440        RootJobControlHandle { inner: self.inner.clone() }
7441    }
7442
7443    fn into_inner(
7444        self,
7445    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7446    {
7447        (self.inner, self.is_terminated)
7448    }
7449
7450    fn from_inner(
7451        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7452        is_terminated: bool,
7453    ) -> Self {
7454        Self { inner, is_terminated }
7455    }
7456}
7457
7458impl futures::Stream for RootJobRequestStream {
7459    type Item = Result<RootJobRequest, fidl::Error>;
7460
7461    fn poll_next(
7462        mut self: std::pin::Pin<&mut Self>,
7463        cx: &mut std::task::Context<'_>,
7464    ) -> std::task::Poll<Option<Self::Item>> {
7465        let this = &mut *self;
7466        if this.inner.check_shutdown(cx) {
7467            this.is_terminated = true;
7468            return std::task::Poll::Ready(None);
7469        }
7470        if this.is_terminated {
7471            panic!("polled RootJobRequestStream after completion");
7472        }
7473        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7474            |bytes, handles| {
7475                match this.inner.channel().read_etc(cx, bytes, handles) {
7476                    std::task::Poll::Ready(Ok(())) => {}
7477                    std::task::Poll::Pending => return std::task::Poll::Pending,
7478                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7479                        this.is_terminated = true;
7480                        return std::task::Poll::Ready(None);
7481                    }
7482                    std::task::Poll::Ready(Err(e)) => {
7483                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7484                            e.into(),
7485                        ))));
7486                    }
7487                }
7488
7489                // A message has been received from the channel
7490                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7491
7492                std::task::Poll::Ready(Some(match header.ordinal {
7493                    0x73acb63f93d53eac => {
7494                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7495                        let mut req = fidl::new_empty!(
7496                            fidl::encoding::EmptyPayload,
7497                            fidl::encoding::DefaultFuchsiaResourceDialect
7498                        );
7499                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7500                        let control_handle = RootJobControlHandle { inner: this.inner.clone() };
7501                        Ok(RootJobRequest::Get {
7502                            responder: RootJobGetResponder {
7503                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7504                                tx_id: header.tx_id,
7505                            },
7506                        })
7507                    }
7508                    _ => Err(fidl::Error::UnknownOrdinal {
7509                        ordinal: header.ordinal,
7510                        protocol_name:
7511                            <RootJobMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7512                    }),
7513                }))
7514            },
7515        )
7516    }
7517}
7518
7519/// Protocol for providing the root job.
7520///
7521/// TODO(https://fxbug.dev/42109098): Do not use this without first consulting the Zircon team.
7522#[derive(Debug)]
7523pub enum RootJobRequest {
7524    /// Get the root `job`.
7525    Get { responder: RootJobGetResponder },
7526}
7527
7528impl RootJobRequest {
7529    #[allow(irrefutable_let_patterns)]
7530    pub fn into_get(self) -> Option<(RootJobGetResponder)> {
7531        if let RootJobRequest::Get { responder } = self { Some((responder)) } else { None }
7532    }
7533
7534    /// Name of the method defined in FIDL
7535    pub fn method_name(&self) -> &'static str {
7536        match *self {
7537            RootJobRequest::Get { .. } => "get",
7538        }
7539    }
7540}
7541
7542#[derive(Debug, Clone)]
7543pub struct RootJobControlHandle {
7544    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7545}
7546
7547impl RootJobControlHandle {
7548    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7549        self.inner.shutdown_with_epitaph(status.into())
7550    }
7551}
7552
7553impl fidl::endpoints::ControlHandle for RootJobControlHandle {
7554    fn shutdown(&self) {
7555        self.inner.shutdown()
7556    }
7557
7558    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7559        self.inner.shutdown_with_epitaph(status)
7560    }
7561
7562    fn is_closed(&self) -> bool {
7563        self.inner.channel().is_closed()
7564    }
7565    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7566        self.inner.channel().on_closed()
7567    }
7568
7569    #[cfg(target_os = "fuchsia")]
7570    fn signal_peer(
7571        &self,
7572        clear_mask: zx::Signals,
7573        set_mask: zx::Signals,
7574    ) -> Result<(), zx_status::Status> {
7575        use fidl::Peered;
7576        self.inner.channel().signal_peer(clear_mask, set_mask)
7577    }
7578}
7579
7580impl RootJobControlHandle {}
7581
7582#[must_use = "FIDL methods require a response to be sent"]
7583#[derive(Debug)]
7584pub struct RootJobGetResponder {
7585    control_handle: std::mem::ManuallyDrop<RootJobControlHandle>,
7586    tx_id: u32,
7587}
7588
7589/// Set the the channel to be shutdown (see [`RootJobControlHandle::shutdown`])
7590/// if the responder is dropped without sending a response, so that the client
7591/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7592impl std::ops::Drop for RootJobGetResponder {
7593    fn drop(&mut self) {
7594        self.control_handle.shutdown();
7595        // Safety: drops once, never accessed again
7596        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7597    }
7598}
7599
7600impl fidl::endpoints::Responder for RootJobGetResponder {
7601    type ControlHandle = RootJobControlHandle;
7602
7603    fn control_handle(&self) -> &RootJobControlHandle {
7604        &self.control_handle
7605    }
7606
7607    fn drop_without_shutdown(mut self) {
7608        // Safety: drops once, never accessed again due to mem::forget
7609        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7610        // Prevent Drop from running (which would shut down the channel)
7611        std::mem::forget(self);
7612    }
7613}
7614
7615impl RootJobGetResponder {
7616    /// Sends a response to the FIDL transaction.
7617    ///
7618    /// Sets the channel to shutdown if an error occurs.
7619    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7620        let _result = self.send_raw(job);
7621        if _result.is_err() {
7622            self.control_handle.shutdown();
7623        }
7624        self.drop_without_shutdown();
7625        _result
7626    }
7627
7628    /// Similar to "send" but does not shutdown the channel if an error occurs.
7629    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7630        let _result = self.send_raw(job);
7631        self.drop_without_shutdown();
7632        _result
7633    }
7634
7635    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
7636        self.control_handle.inner.send::<RootJobGetResponse>(
7637            (job,),
7638            self.tx_id,
7639            0x73acb63f93d53eac,
7640            fidl::encoding::DynamicFlags::empty(),
7641        )
7642    }
7643}
7644
7645#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7646pub struct RootJobForInspectMarker;
7647
7648impl fidl::endpoints::ProtocolMarker for RootJobForInspectMarker {
7649    type Proxy = RootJobForInspectProxy;
7650    type RequestStream = RootJobForInspectRequestStream;
7651    #[cfg(target_os = "fuchsia")]
7652    type SynchronousProxy = RootJobForInspectSynchronousProxy;
7653
7654    const DEBUG_NAME: &'static str = "fuchsia.kernel.RootJobForInspect";
7655}
7656impl fidl::endpoints::DiscoverableProtocolMarker for RootJobForInspectMarker {}
7657
7658pub trait RootJobForInspectProxyInterface: Send + Sync {
7659    type GetResponseFut: std::future::Future<Output = Result<fidl::Job, fidl::Error>> + Send;
7660    fn r#get(&self) -> Self::GetResponseFut;
7661}
7662#[derive(Debug)]
7663#[cfg(target_os = "fuchsia")]
7664pub struct RootJobForInspectSynchronousProxy {
7665    client: fidl::client::sync::Client,
7666}
7667
7668#[cfg(target_os = "fuchsia")]
7669impl fidl::endpoints::SynchronousProxy for RootJobForInspectSynchronousProxy {
7670    type Proxy = RootJobForInspectProxy;
7671    type Protocol = RootJobForInspectMarker;
7672
7673    fn from_channel(inner: fidl::Channel) -> Self {
7674        Self::new(inner)
7675    }
7676
7677    fn into_channel(self) -> fidl::Channel {
7678        self.client.into_channel()
7679    }
7680
7681    fn as_channel(&self) -> &fidl::Channel {
7682        self.client.as_channel()
7683    }
7684}
7685
7686#[cfg(target_os = "fuchsia")]
7687impl RootJobForInspectSynchronousProxy {
7688    pub fn new(channel: fidl::Channel) -> Self {
7689        Self { client: fidl::client::sync::Client::new(channel) }
7690    }
7691
7692    pub fn into_channel(self) -> fidl::Channel {
7693        self.client.into_channel()
7694    }
7695
7696    /// Waits until an event arrives and returns it. It is safe for other
7697    /// threads to make concurrent requests while waiting for an event.
7698    pub fn wait_for_event(
7699        &self,
7700        deadline: zx::MonotonicInstant,
7701    ) -> Result<RootJobForInspectEvent, fidl::Error> {
7702        RootJobForInspectEvent::decode(
7703            self.client.wait_for_event::<RootJobForInspectMarker>(deadline)?,
7704        )
7705    }
7706
7707    /// Get the root `job`.
7708    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Job, fidl::Error> {
7709        let _response = self.client.send_query::<
7710            fidl::encoding::EmptyPayload,
7711            RootJobGetResponse,
7712            RootJobForInspectMarker,
7713        >(
7714            (),
7715            0x73acb63f93d53eac,
7716            fidl::encoding::DynamicFlags::empty(),
7717            ___deadline,
7718        )?;
7719        Ok(_response.job)
7720    }
7721}
7722
7723#[cfg(target_os = "fuchsia")]
7724impl From<RootJobForInspectSynchronousProxy> for zx::NullableHandle {
7725    fn from(value: RootJobForInspectSynchronousProxy) -> Self {
7726        value.into_channel().into()
7727    }
7728}
7729
7730#[cfg(target_os = "fuchsia")]
7731impl From<fidl::Channel> for RootJobForInspectSynchronousProxy {
7732    fn from(value: fidl::Channel) -> Self {
7733        Self::new(value)
7734    }
7735}
7736
7737#[cfg(target_os = "fuchsia")]
7738impl fidl::endpoints::FromClient for RootJobForInspectSynchronousProxy {
7739    type Protocol = RootJobForInspectMarker;
7740
7741    fn from_client(value: fidl::endpoints::ClientEnd<RootJobForInspectMarker>) -> Self {
7742        Self::new(value.into_channel())
7743    }
7744}
7745
7746#[derive(Debug, Clone)]
7747pub struct RootJobForInspectProxy {
7748    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7749}
7750
7751impl fidl::endpoints::Proxy for RootJobForInspectProxy {
7752    type Protocol = RootJobForInspectMarker;
7753
7754    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7755        Self::new(inner)
7756    }
7757
7758    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7759        self.client.into_channel().map_err(|client| Self { client })
7760    }
7761
7762    fn as_channel(&self) -> &::fidl::AsyncChannel {
7763        self.client.as_channel()
7764    }
7765}
7766
7767impl RootJobForInspectProxy {
7768    /// Create a new Proxy for fuchsia.kernel/RootJobForInspect.
7769    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7770        let protocol_name =
7771            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7772        Self { client: fidl::client::Client::new(channel, protocol_name) }
7773    }
7774
7775    /// Get a Stream of events from the remote end of the protocol.
7776    ///
7777    /// # Panics
7778    ///
7779    /// Panics if the event stream was already taken.
7780    pub fn take_event_stream(&self) -> RootJobForInspectEventStream {
7781        RootJobForInspectEventStream { event_receiver: self.client.take_event_receiver() }
7782    }
7783
7784    /// Get the root `job`.
7785    pub fn r#get(
7786        &self,
7787    ) -> fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>
7788    {
7789        RootJobForInspectProxyInterface::r#get(self)
7790    }
7791}
7792
7793impl RootJobForInspectProxyInterface for RootJobForInspectProxy {
7794    type GetResponseFut =
7795        fidl::client::QueryResponseFut<fidl::Job, fidl::encoding::DefaultFuchsiaResourceDialect>;
7796    fn r#get(&self) -> Self::GetResponseFut {
7797        fn _decode(
7798            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7799        ) -> Result<fidl::Job, fidl::Error> {
7800            let _response = fidl::client::decode_transaction_body::<
7801                RootJobGetResponse,
7802                fidl::encoding::DefaultFuchsiaResourceDialect,
7803                0x73acb63f93d53eac,
7804            >(_buf?)?;
7805            Ok(_response.job)
7806        }
7807        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Job>(
7808            (),
7809            0x73acb63f93d53eac,
7810            fidl::encoding::DynamicFlags::empty(),
7811            _decode,
7812        )
7813    }
7814}
7815
7816pub struct RootJobForInspectEventStream {
7817    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7818}
7819
7820impl std::marker::Unpin for RootJobForInspectEventStream {}
7821
7822impl futures::stream::FusedStream for RootJobForInspectEventStream {
7823    fn is_terminated(&self) -> bool {
7824        self.event_receiver.is_terminated()
7825    }
7826}
7827
7828impl futures::Stream for RootJobForInspectEventStream {
7829    type Item = Result<RootJobForInspectEvent, fidl::Error>;
7830
7831    fn poll_next(
7832        mut self: std::pin::Pin<&mut Self>,
7833        cx: &mut std::task::Context<'_>,
7834    ) -> std::task::Poll<Option<Self::Item>> {
7835        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7836            &mut self.event_receiver,
7837            cx
7838        )?) {
7839            Some(buf) => std::task::Poll::Ready(Some(RootJobForInspectEvent::decode(buf))),
7840            None => std::task::Poll::Ready(None),
7841        }
7842    }
7843}
7844
7845#[derive(Debug)]
7846pub enum RootJobForInspectEvent {}
7847
7848impl RootJobForInspectEvent {
7849    /// Decodes a message buffer as a [`RootJobForInspectEvent`].
7850    fn decode(
7851        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7852    ) -> Result<RootJobForInspectEvent, fidl::Error> {
7853        let (bytes, _handles) = buf.split_mut();
7854        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7855        debug_assert_eq!(tx_header.tx_id, 0);
7856        match tx_header.ordinal {
7857            _ => Err(fidl::Error::UnknownOrdinal {
7858                ordinal: tx_header.ordinal,
7859                protocol_name:
7860                    <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7861            }),
7862        }
7863    }
7864}
7865
7866/// A Stream of incoming requests for fuchsia.kernel/RootJobForInspect.
7867pub struct RootJobForInspectRequestStream {
7868    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7869    is_terminated: bool,
7870}
7871
7872impl std::marker::Unpin for RootJobForInspectRequestStream {}
7873
7874impl futures::stream::FusedStream for RootJobForInspectRequestStream {
7875    fn is_terminated(&self) -> bool {
7876        self.is_terminated
7877    }
7878}
7879
7880impl fidl::endpoints::RequestStream for RootJobForInspectRequestStream {
7881    type Protocol = RootJobForInspectMarker;
7882    type ControlHandle = RootJobForInspectControlHandle;
7883
7884    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7885        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7886    }
7887
7888    fn control_handle(&self) -> Self::ControlHandle {
7889        RootJobForInspectControlHandle { inner: self.inner.clone() }
7890    }
7891
7892    fn into_inner(
7893        self,
7894    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7895    {
7896        (self.inner, self.is_terminated)
7897    }
7898
7899    fn from_inner(
7900        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7901        is_terminated: bool,
7902    ) -> Self {
7903        Self { inner, is_terminated }
7904    }
7905}
7906
7907impl futures::Stream for RootJobForInspectRequestStream {
7908    type Item = Result<RootJobForInspectRequest, fidl::Error>;
7909
7910    fn poll_next(
7911        mut self: std::pin::Pin<&mut Self>,
7912        cx: &mut std::task::Context<'_>,
7913    ) -> std::task::Poll<Option<Self::Item>> {
7914        let this = &mut *self;
7915        if this.inner.check_shutdown(cx) {
7916            this.is_terminated = true;
7917            return std::task::Poll::Ready(None);
7918        }
7919        if this.is_terminated {
7920            panic!("polled RootJobForInspectRequestStream after completion");
7921        }
7922        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7923            |bytes, handles| {
7924                match this.inner.channel().read_etc(cx, bytes, handles) {
7925                    std::task::Poll::Ready(Ok(())) => {}
7926                    std::task::Poll::Pending => return std::task::Poll::Pending,
7927                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7928                        this.is_terminated = true;
7929                        return std::task::Poll::Ready(None);
7930                    }
7931                    std::task::Poll::Ready(Err(e)) => {
7932                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7933                            e.into(),
7934                        ))));
7935                    }
7936                }
7937
7938                // A message has been received from the channel
7939                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7940
7941                std::task::Poll::Ready(Some(match header.ordinal {
7942                    0x73acb63f93d53eac => {
7943                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7944                        let mut req = fidl::new_empty!(
7945                            fidl::encoding::EmptyPayload,
7946                            fidl::encoding::DefaultFuchsiaResourceDialect
7947                        );
7948                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7949                        let control_handle =
7950                            RootJobForInspectControlHandle { inner: this.inner.clone() };
7951                        Ok(RootJobForInspectRequest::Get {
7952                            responder: RootJobForInspectGetResponder {
7953                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7954                                tx_id: header.tx_id,
7955                            },
7956                        })
7957                    }
7958                    _ => Err(fidl::Error::UnknownOrdinal {
7959                        ordinal: header.ordinal,
7960                        protocol_name:
7961                            <RootJobForInspectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7962                    }),
7963                }))
7964            },
7965        )
7966    }
7967}
7968
7969/// Protocol for providing the root job with restricted rights, specifically:
7970/// INSPECT | ENUMERATE | DUPLICATE | TRANSFER
7971#[derive(Debug)]
7972pub enum RootJobForInspectRequest {
7973    /// Get the root `job`.
7974    Get { responder: RootJobForInspectGetResponder },
7975}
7976
7977impl RootJobForInspectRequest {
7978    #[allow(irrefutable_let_patterns)]
7979    pub fn into_get(self) -> Option<(RootJobForInspectGetResponder)> {
7980        if let RootJobForInspectRequest::Get { responder } = self {
7981            Some((responder))
7982        } else {
7983            None
7984        }
7985    }
7986
7987    /// Name of the method defined in FIDL
7988    pub fn method_name(&self) -> &'static str {
7989        match *self {
7990            RootJobForInspectRequest::Get { .. } => "get",
7991        }
7992    }
7993}
7994
7995#[derive(Debug, Clone)]
7996pub struct RootJobForInspectControlHandle {
7997    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7998}
7999
8000impl RootJobForInspectControlHandle {
8001    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8002        self.inner.shutdown_with_epitaph(status.into())
8003    }
8004}
8005
8006impl fidl::endpoints::ControlHandle for RootJobForInspectControlHandle {
8007    fn shutdown(&self) {
8008        self.inner.shutdown()
8009    }
8010
8011    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8012        self.inner.shutdown_with_epitaph(status)
8013    }
8014
8015    fn is_closed(&self) -> bool {
8016        self.inner.channel().is_closed()
8017    }
8018    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8019        self.inner.channel().on_closed()
8020    }
8021
8022    #[cfg(target_os = "fuchsia")]
8023    fn signal_peer(
8024        &self,
8025        clear_mask: zx::Signals,
8026        set_mask: zx::Signals,
8027    ) -> Result<(), zx_status::Status> {
8028        use fidl::Peered;
8029        self.inner.channel().signal_peer(clear_mask, set_mask)
8030    }
8031}
8032
8033impl RootJobForInspectControlHandle {}
8034
8035#[must_use = "FIDL methods require a response to be sent"]
8036#[derive(Debug)]
8037pub struct RootJobForInspectGetResponder {
8038    control_handle: std::mem::ManuallyDrop<RootJobForInspectControlHandle>,
8039    tx_id: u32,
8040}
8041
8042/// Set the the channel to be shutdown (see [`RootJobForInspectControlHandle::shutdown`])
8043/// if the responder is dropped without sending a response, so that the client
8044/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8045impl std::ops::Drop for RootJobForInspectGetResponder {
8046    fn drop(&mut self) {
8047        self.control_handle.shutdown();
8048        // Safety: drops once, never accessed again
8049        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8050    }
8051}
8052
8053impl fidl::endpoints::Responder for RootJobForInspectGetResponder {
8054    type ControlHandle = RootJobForInspectControlHandle;
8055
8056    fn control_handle(&self) -> &RootJobForInspectControlHandle {
8057        &self.control_handle
8058    }
8059
8060    fn drop_without_shutdown(mut self) {
8061        // Safety: drops once, never accessed again due to mem::forget
8062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8063        // Prevent Drop from running (which would shut down the channel)
8064        std::mem::forget(self);
8065    }
8066}
8067
8068impl RootJobForInspectGetResponder {
8069    /// Sends a response to the FIDL transaction.
8070    ///
8071    /// Sets the channel to shutdown if an error occurs.
8072    pub fn send(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8073        let _result = self.send_raw(job);
8074        if _result.is_err() {
8075            self.control_handle.shutdown();
8076        }
8077        self.drop_without_shutdown();
8078        _result
8079    }
8080
8081    /// Similar to "send" but does not shutdown the channel if an error occurs.
8082    pub fn send_no_shutdown_on_err(self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8083        let _result = self.send_raw(job);
8084        self.drop_without_shutdown();
8085        _result
8086    }
8087
8088    fn send_raw(&self, mut job: fidl::Job) -> Result<(), fidl::Error> {
8089        self.control_handle.inner.send::<RootJobGetResponse>(
8090            (job,),
8091            self.tx_id,
8092            0x73acb63f93d53eac,
8093            fidl::encoding::DynamicFlags::empty(),
8094        )
8095    }
8096}
8097
8098#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8099pub struct SamplingResourceMarker;
8100
8101impl fidl::endpoints::ProtocolMarker for SamplingResourceMarker {
8102    type Proxy = SamplingResourceProxy;
8103    type RequestStream = SamplingResourceRequestStream;
8104    #[cfg(target_os = "fuchsia")]
8105    type SynchronousProxy = SamplingResourceSynchronousProxy;
8106
8107    const DEBUG_NAME: &'static str = "fuchsia.kernel.SamplingResource";
8108}
8109impl fidl::endpoints::DiscoverableProtocolMarker for SamplingResourceMarker {}
8110
8111pub trait SamplingResourceProxyInterface: Send + Sync {
8112    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8113    fn r#get(&self) -> Self::GetResponseFut;
8114}
8115#[derive(Debug)]
8116#[cfg(target_os = "fuchsia")]
8117pub struct SamplingResourceSynchronousProxy {
8118    client: fidl::client::sync::Client,
8119}
8120
8121#[cfg(target_os = "fuchsia")]
8122impl fidl::endpoints::SynchronousProxy for SamplingResourceSynchronousProxy {
8123    type Proxy = SamplingResourceProxy;
8124    type Protocol = SamplingResourceMarker;
8125
8126    fn from_channel(inner: fidl::Channel) -> Self {
8127        Self::new(inner)
8128    }
8129
8130    fn into_channel(self) -> fidl::Channel {
8131        self.client.into_channel()
8132    }
8133
8134    fn as_channel(&self) -> &fidl::Channel {
8135        self.client.as_channel()
8136    }
8137}
8138
8139#[cfg(target_os = "fuchsia")]
8140impl SamplingResourceSynchronousProxy {
8141    pub fn new(channel: fidl::Channel) -> Self {
8142        Self { client: fidl::client::sync::Client::new(channel) }
8143    }
8144
8145    pub fn into_channel(self) -> fidl::Channel {
8146        self.client.into_channel()
8147    }
8148
8149    /// Waits until an event arrives and returns it. It is safe for other
8150    /// threads to make concurrent requests while waiting for an event.
8151    pub fn wait_for_event(
8152        &self,
8153        deadline: zx::MonotonicInstant,
8154    ) -> Result<SamplingResourceEvent, fidl::Error> {
8155        SamplingResourceEvent::decode(
8156            self.client.wait_for_event::<SamplingResourceMarker>(deadline)?,
8157        )
8158    }
8159
8160    /// Get a sampling resource handle.
8161    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8162        let _response = self.client.send_query::<
8163            fidl::encoding::EmptyPayload,
8164            SamplingResourceGetResponse,
8165            SamplingResourceMarker,
8166        >(
8167            (),
8168            0x51c41ab037e99824,
8169            fidl::encoding::DynamicFlags::empty(),
8170            ___deadline,
8171        )?;
8172        Ok(_response.resource)
8173    }
8174}
8175
8176#[cfg(target_os = "fuchsia")]
8177impl From<SamplingResourceSynchronousProxy> for zx::NullableHandle {
8178    fn from(value: SamplingResourceSynchronousProxy) -> Self {
8179        value.into_channel().into()
8180    }
8181}
8182
8183#[cfg(target_os = "fuchsia")]
8184impl From<fidl::Channel> for SamplingResourceSynchronousProxy {
8185    fn from(value: fidl::Channel) -> Self {
8186        Self::new(value)
8187    }
8188}
8189
8190#[cfg(target_os = "fuchsia")]
8191impl fidl::endpoints::FromClient for SamplingResourceSynchronousProxy {
8192    type Protocol = SamplingResourceMarker;
8193
8194    fn from_client(value: fidl::endpoints::ClientEnd<SamplingResourceMarker>) -> Self {
8195        Self::new(value.into_channel())
8196    }
8197}
8198
8199#[derive(Debug, Clone)]
8200pub struct SamplingResourceProxy {
8201    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8202}
8203
8204impl fidl::endpoints::Proxy for SamplingResourceProxy {
8205    type Protocol = SamplingResourceMarker;
8206
8207    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8208        Self::new(inner)
8209    }
8210
8211    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8212        self.client.into_channel().map_err(|client| Self { client })
8213    }
8214
8215    fn as_channel(&self) -> &::fidl::AsyncChannel {
8216        self.client.as_channel()
8217    }
8218}
8219
8220impl SamplingResourceProxy {
8221    /// Create a new Proxy for fuchsia.kernel/SamplingResource.
8222    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8223        let protocol_name = <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8224        Self { client: fidl::client::Client::new(channel, protocol_name) }
8225    }
8226
8227    /// Get a Stream of events from the remote end of the protocol.
8228    ///
8229    /// # Panics
8230    ///
8231    /// Panics if the event stream was already taken.
8232    pub fn take_event_stream(&self) -> SamplingResourceEventStream {
8233        SamplingResourceEventStream { event_receiver: self.client.take_event_receiver() }
8234    }
8235
8236    /// Get a sampling resource handle.
8237    pub fn r#get(
8238        &self,
8239    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8240    {
8241        SamplingResourceProxyInterface::r#get(self)
8242    }
8243}
8244
8245impl SamplingResourceProxyInterface for SamplingResourceProxy {
8246    type GetResponseFut = fidl::client::QueryResponseFut<
8247        fidl::Resource,
8248        fidl::encoding::DefaultFuchsiaResourceDialect,
8249    >;
8250    fn r#get(&self) -> Self::GetResponseFut {
8251        fn _decode(
8252            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8253        ) -> Result<fidl::Resource, fidl::Error> {
8254            let _response = fidl::client::decode_transaction_body::<
8255                SamplingResourceGetResponse,
8256                fidl::encoding::DefaultFuchsiaResourceDialect,
8257                0x51c41ab037e99824,
8258            >(_buf?)?;
8259            Ok(_response.resource)
8260        }
8261        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8262            (),
8263            0x51c41ab037e99824,
8264            fidl::encoding::DynamicFlags::empty(),
8265            _decode,
8266        )
8267    }
8268}
8269
8270pub struct SamplingResourceEventStream {
8271    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8272}
8273
8274impl std::marker::Unpin for SamplingResourceEventStream {}
8275
8276impl futures::stream::FusedStream for SamplingResourceEventStream {
8277    fn is_terminated(&self) -> bool {
8278        self.event_receiver.is_terminated()
8279    }
8280}
8281
8282impl futures::Stream for SamplingResourceEventStream {
8283    type Item = Result<SamplingResourceEvent, fidl::Error>;
8284
8285    fn poll_next(
8286        mut self: std::pin::Pin<&mut Self>,
8287        cx: &mut std::task::Context<'_>,
8288    ) -> std::task::Poll<Option<Self::Item>> {
8289        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8290            &mut self.event_receiver,
8291            cx
8292        )?) {
8293            Some(buf) => std::task::Poll::Ready(Some(SamplingResourceEvent::decode(buf))),
8294            None => std::task::Poll::Ready(None),
8295        }
8296    }
8297}
8298
8299#[derive(Debug)]
8300pub enum SamplingResourceEvent {}
8301
8302impl SamplingResourceEvent {
8303    /// Decodes a message buffer as a [`SamplingResourceEvent`].
8304    fn decode(
8305        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8306    ) -> Result<SamplingResourceEvent, fidl::Error> {
8307        let (bytes, _handles) = buf.split_mut();
8308        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8309        debug_assert_eq!(tx_header.tx_id, 0);
8310        match tx_header.ordinal {
8311            _ => Err(fidl::Error::UnknownOrdinal {
8312                ordinal: tx_header.ordinal,
8313                protocol_name:
8314                    <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8315            }),
8316        }
8317    }
8318}
8319
8320/// A Stream of incoming requests for fuchsia.kernel/SamplingResource.
8321pub struct SamplingResourceRequestStream {
8322    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8323    is_terminated: bool,
8324}
8325
8326impl std::marker::Unpin for SamplingResourceRequestStream {}
8327
8328impl futures::stream::FusedStream for SamplingResourceRequestStream {
8329    fn is_terminated(&self) -> bool {
8330        self.is_terminated
8331    }
8332}
8333
8334impl fidl::endpoints::RequestStream for SamplingResourceRequestStream {
8335    type Protocol = SamplingResourceMarker;
8336    type ControlHandle = SamplingResourceControlHandle;
8337
8338    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8339        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8340    }
8341
8342    fn control_handle(&self) -> Self::ControlHandle {
8343        SamplingResourceControlHandle { inner: self.inner.clone() }
8344    }
8345
8346    fn into_inner(
8347        self,
8348    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8349    {
8350        (self.inner, self.is_terminated)
8351    }
8352
8353    fn from_inner(
8354        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8355        is_terminated: bool,
8356    ) -> Self {
8357        Self { inner, is_terminated }
8358    }
8359}
8360
8361impl futures::Stream for SamplingResourceRequestStream {
8362    type Item = Result<SamplingResourceRequest, fidl::Error>;
8363
8364    fn poll_next(
8365        mut self: std::pin::Pin<&mut Self>,
8366        cx: &mut std::task::Context<'_>,
8367    ) -> std::task::Poll<Option<Self::Item>> {
8368        let this = &mut *self;
8369        if this.inner.check_shutdown(cx) {
8370            this.is_terminated = true;
8371            return std::task::Poll::Ready(None);
8372        }
8373        if this.is_terminated {
8374            panic!("polled SamplingResourceRequestStream after completion");
8375        }
8376        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8377            |bytes, handles| {
8378                match this.inner.channel().read_etc(cx, bytes, handles) {
8379                    std::task::Poll::Ready(Ok(())) => {}
8380                    std::task::Poll::Pending => return std::task::Poll::Pending,
8381                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8382                        this.is_terminated = true;
8383                        return std::task::Poll::Ready(None);
8384                    }
8385                    std::task::Poll::Ready(Err(e)) => {
8386                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8387                            e.into(),
8388                        ))));
8389                    }
8390                }
8391
8392                // A message has been received from the channel
8393                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8394
8395                std::task::Poll::Ready(Some(match header.ordinal {
8396                    0x51c41ab037e99824 => {
8397                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8398                        let mut req = fidl::new_empty!(
8399                            fidl::encoding::EmptyPayload,
8400                            fidl::encoding::DefaultFuchsiaResourceDialect
8401                        );
8402                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8403                        let control_handle =
8404                            SamplingResourceControlHandle { inner: this.inner.clone() };
8405                        Ok(SamplingResourceRequest::Get {
8406                            responder: SamplingResourceGetResponder {
8407                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8408                                tx_id: header.tx_id,
8409                            },
8410                        })
8411                    }
8412                    _ => Err(fidl::Error::UnknownOrdinal {
8413                        ordinal: header.ordinal,
8414                        protocol_name:
8415                            <SamplingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8416                    }),
8417                }))
8418            },
8419        )
8420    }
8421}
8422
8423/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
8424/// `ZX_RSRC_SYSTEM_SAMPLING_BASE`.
8425#[derive(Debug)]
8426pub enum SamplingResourceRequest {
8427    /// Get a sampling resource handle.
8428    Get { responder: SamplingResourceGetResponder },
8429}
8430
8431impl SamplingResourceRequest {
8432    #[allow(irrefutable_let_patterns)]
8433    pub fn into_get(self) -> Option<(SamplingResourceGetResponder)> {
8434        if let SamplingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
8435    }
8436
8437    /// Name of the method defined in FIDL
8438    pub fn method_name(&self) -> &'static str {
8439        match *self {
8440            SamplingResourceRequest::Get { .. } => "get",
8441        }
8442    }
8443}
8444
8445#[derive(Debug, Clone)]
8446pub struct SamplingResourceControlHandle {
8447    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8448}
8449
8450impl SamplingResourceControlHandle {
8451    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8452        self.inner.shutdown_with_epitaph(status.into())
8453    }
8454}
8455
8456impl fidl::endpoints::ControlHandle for SamplingResourceControlHandle {
8457    fn shutdown(&self) {
8458        self.inner.shutdown()
8459    }
8460
8461    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8462        self.inner.shutdown_with_epitaph(status)
8463    }
8464
8465    fn is_closed(&self) -> bool {
8466        self.inner.channel().is_closed()
8467    }
8468    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8469        self.inner.channel().on_closed()
8470    }
8471
8472    #[cfg(target_os = "fuchsia")]
8473    fn signal_peer(
8474        &self,
8475        clear_mask: zx::Signals,
8476        set_mask: zx::Signals,
8477    ) -> Result<(), zx_status::Status> {
8478        use fidl::Peered;
8479        self.inner.channel().signal_peer(clear_mask, set_mask)
8480    }
8481}
8482
8483impl SamplingResourceControlHandle {}
8484
8485#[must_use = "FIDL methods require a response to be sent"]
8486#[derive(Debug)]
8487pub struct SamplingResourceGetResponder {
8488    control_handle: std::mem::ManuallyDrop<SamplingResourceControlHandle>,
8489    tx_id: u32,
8490}
8491
8492/// Set the the channel to be shutdown (see [`SamplingResourceControlHandle::shutdown`])
8493/// if the responder is dropped without sending a response, so that the client
8494/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8495impl std::ops::Drop for SamplingResourceGetResponder {
8496    fn drop(&mut self) {
8497        self.control_handle.shutdown();
8498        // Safety: drops once, never accessed again
8499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8500    }
8501}
8502
8503impl fidl::endpoints::Responder for SamplingResourceGetResponder {
8504    type ControlHandle = SamplingResourceControlHandle;
8505
8506    fn control_handle(&self) -> &SamplingResourceControlHandle {
8507        &self.control_handle
8508    }
8509
8510    fn drop_without_shutdown(mut self) {
8511        // Safety: drops once, never accessed again due to mem::forget
8512        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8513        // Prevent Drop from running (which would shut down the channel)
8514        std::mem::forget(self);
8515    }
8516}
8517
8518impl SamplingResourceGetResponder {
8519    /// Sends a response to the FIDL transaction.
8520    ///
8521    /// Sets the channel to shutdown if an error occurs.
8522    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8523        let _result = self.send_raw(resource);
8524        if _result.is_err() {
8525            self.control_handle.shutdown();
8526        }
8527        self.drop_without_shutdown();
8528        _result
8529    }
8530
8531    /// Similar to "send" but does not shutdown the channel if an error occurs.
8532    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8533        let _result = self.send_raw(resource);
8534        self.drop_without_shutdown();
8535        _result
8536    }
8537
8538    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8539        self.control_handle.inner.send::<SamplingResourceGetResponse>(
8540            (resource,),
8541            self.tx_id,
8542            0x51c41ab037e99824,
8543            fidl::encoding::DynamicFlags::empty(),
8544        )
8545    }
8546}
8547
8548#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8549pub struct SmcResourceMarker;
8550
8551impl fidl::endpoints::ProtocolMarker for SmcResourceMarker {
8552    type Proxy = SmcResourceProxy;
8553    type RequestStream = SmcResourceRequestStream;
8554    #[cfg(target_os = "fuchsia")]
8555    type SynchronousProxy = SmcResourceSynchronousProxy;
8556
8557    const DEBUG_NAME: &'static str = "fuchsia.kernel.SmcResource";
8558}
8559impl fidl::endpoints::DiscoverableProtocolMarker for SmcResourceMarker {}
8560
8561pub trait SmcResourceProxyInterface: Send + Sync {
8562    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
8563    fn r#get(&self) -> Self::GetResponseFut;
8564}
8565#[derive(Debug)]
8566#[cfg(target_os = "fuchsia")]
8567pub struct SmcResourceSynchronousProxy {
8568    client: fidl::client::sync::Client,
8569}
8570
8571#[cfg(target_os = "fuchsia")]
8572impl fidl::endpoints::SynchronousProxy for SmcResourceSynchronousProxy {
8573    type Proxy = SmcResourceProxy;
8574    type Protocol = SmcResourceMarker;
8575
8576    fn from_channel(inner: fidl::Channel) -> Self {
8577        Self::new(inner)
8578    }
8579
8580    fn into_channel(self) -> fidl::Channel {
8581        self.client.into_channel()
8582    }
8583
8584    fn as_channel(&self) -> &fidl::Channel {
8585        self.client.as_channel()
8586    }
8587}
8588
8589#[cfg(target_os = "fuchsia")]
8590impl SmcResourceSynchronousProxy {
8591    pub fn new(channel: fidl::Channel) -> Self {
8592        Self { client: fidl::client::sync::Client::new(channel) }
8593    }
8594
8595    pub fn into_channel(self) -> fidl::Channel {
8596        self.client.into_channel()
8597    }
8598
8599    /// Waits until an event arrives and returns it. It is safe for other
8600    /// threads to make concurrent requests while waiting for an event.
8601    pub fn wait_for_event(
8602        &self,
8603        deadline: zx::MonotonicInstant,
8604    ) -> Result<SmcResourceEvent, fidl::Error> {
8605        SmcResourceEvent::decode(self.client.wait_for_event::<SmcResourceMarker>(deadline)?)
8606    }
8607
8608    /// Get an SMC resource handle.
8609    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
8610        let _response = self
8611            .client
8612            .send_query::<fidl::encoding::EmptyPayload, SmcResourceGetResponse, SmcResourceMarker>(
8613                (),
8614                0x392cbd495b84ede7,
8615                fidl::encoding::DynamicFlags::empty(),
8616                ___deadline,
8617            )?;
8618        Ok(_response.resource)
8619    }
8620}
8621
8622#[cfg(target_os = "fuchsia")]
8623impl From<SmcResourceSynchronousProxy> for zx::NullableHandle {
8624    fn from(value: SmcResourceSynchronousProxy) -> Self {
8625        value.into_channel().into()
8626    }
8627}
8628
8629#[cfg(target_os = "fuchsia")]
8630impl From<fidl::Channel> for SmcResourceSynchronousProxy {
8631    fn from(value: fidl::Channel) -> Self {
8632        Self::new(value)
8633    }
8634}
8635
8636#[cfg(target_os = "fuchsia")]
8637impl fidl::endpoints::FromClient for SmcResourceSynchronousProxy {
8638    type Protocol = SmcResourceMarker;
8639
8640    fn from_client(value: fidl::endpoints::ClientEnd<SmcResourceMarker>) -> Self {
8641        Self::new(value.into_channel())
8642    }
8643}
8644
8645#[derive(Debug, Clone)]
8646pub struct SmcResourceProxy {
8647    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8648}
8649
8650impl fidl::endpoints::Proxy for SmcResourceProxy {
8651    type Protocol = SmcResourceMarker;
8652
8653    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8654        Self::new(inner)
8655    }
8656
8657    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8658        self.client.into_channel().map_err(|client| Self { client })
8659    }
8660
8661    fn as_channel(&self) -> &::fidl::AsyncChannel {
8662        self.client.as_channel()
8663    }
8664}
8665
8666impl SmcResourceProxy {
8667    /// Create a new Proxy for fuchsia.kernel/SmcResource.
8668    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8669        let protocol_name = <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8670        Self { client: fidl::client::Client::new(channel, protocol_name) }
8671    }
8672
8673    /// Get a Stream of events from the remote end of the protocol.
8674    ///
8675    /// # Panics
8676    ///
8677    /// Panics if the event stream was already taken.
8678    pub fn take_event_stream(&self) -> SmcResourceEventStream {
8679        SmcResourceEventStream { event_receiver: self.client.take_event_receiver() }
8680    }
8681
8682    /// Get an SMC resource handle.
8683    pub fn r#get(
8684        &self,
8685    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
8686    {
8687        SmcResourceProxyInterface::r#get(self)
8688    }
8689}
8690
8691impl SmcResourceProxyInterface for SmcResourceProxy {
8692    type GetResponseFut = fidl::client::QueryResponseFut<
8693        fidl::Resource,
8694        fidl::encoding::DefaultFuchsiaResourceDialect,
8695    >;
8696    fn r#get(&self) -> Self::GetResponseFut {
8697        fn _decode(
8698            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8699        ) -> Result<fidl::Resource, fidl::Error> {
8700            let _response = fidl::client::decode_transaction_body::<
8701                SmcResourceGetResponse,
8702                fidl::encoding::DefaultFuchsiaResourceDialect,
8703                0x392cbd495b84ede7,
8704            >(_buf?)?;
8705            Ok(_response.resource)
8706        }
8707        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
8708            (),
8709            0x392cbd495b84ede7,
8710            fidl::encoding::DynamicFlags::empty(),
8711            _decode,
8712        )
8713    }
8714}
8715
8716pub struct SmcResourceEventStream {
8717    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8718}
8719
8720impl std::marker::Unpin for SmcResourceEventStream {}
8721
8722impl futures::stream::FusedStream for SmcResourceEventStream {
8723    fn is_terminated(&self) -> bool {
8724        self.event_receiver.is_terminated()
8725    }
8726}
8727
8728impl futures::Stream for SmcResourceEventStream {
8729    type Item = Result<SmcResourceEvent, fidl::Error>;
8730
8731    fn poll_next(
8732        mut self: std::pin::Pin<&mut Self>,
8733        cx: &mut std::task::Context<'_>,
8734    ) -> std::task::Poll<Option<Self::Item>> {
8735        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8736            &mut self.event_receiver,
8737            cx
8738        )?) {
8739            Some(buf) => std::task::Poll::Ready(Some(SmcResourceEvent::decode(buf))),
8740            None => std::task::Poll::Ready(None),
8741        }
8742    }
8743}
8744
8745#[derive(Debug)]
8746pub enum SmcResourceEvent {}
8747
8748impl SmcResourceEvent {
8749    /// Decodes a message buffer as a [`SmcResourceEvent`].
8750    fn decode(
8751        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8752    ) -> Result<SmcResourceEvent, fidl::Error> {
8753        let (bytes, _handles) = buf.split_mut();
8754        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8755        debug_assert_eq!(tx_header.tx_id, 0);
8756        match tx_header.ordinal {
8757            _ => Err(fidl::Error::UnknownOrdinal {
8758                ordinal: tx_header.ordinal,
8759                protocol_name: <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8760            }),
8761        }
8762    }
8763}
8764
8765/// A Stream of incoming requests for fuchsia.kernel/SmcResource.
8766pub struct SmcResourceRequestStream {
8767    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8768    is_terminated: bool,
8769}
8770
8771impl std::marker::Unpin for SmcResourceRequestStream {}
8772
8773impl futures::stream::FusedStream for SmcResourceRequestStream {
8774    fn is_terminated(&self) -> bool {
8775        self.is_terminated
8776    }
8777}
8778
8779impl fidl::endpoints::RequestStream for SmcResourceRequestStream {
8780    type Protocol = SmcResourceMarker;
8781    type ControlHandle = SmcResourceControlHandle;
8782
8783    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8784        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8785    }
8786
8787    fn control_handle(&self) -> Self::ControlHandle {
8788        SmcResourceControlHandle { inner: self.inner.clone() }
8789    }
8790
8791    fn into_inner(
8792        self,
8793    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8794    {
8795        (self.inner, self.is_terminated)
8796    }
8797
8798    fn from_inner(
8799        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8800        is_terminated: bool,
8801    ) -> Self {
8802        Self { inner, is_terminated }
8803    }
8804}
8805
8806impl futures::Stream for SmcResourceRequestStream {
8807    type Item = Result<SmcResourceRequest, fidl::Error>;
8808
8809    fn poll_next(
8810        mut self: std::pin::Pin<&mut Self>,
8811        cx: &mut std::task::Context<'_>,
8812    ) -> std::task::Poll<Option<Self::Item>> {
8813        let this = &mut *self;
8814        if this.inner.check_shutdown(cx) {
8815            this.is_terminated = true;
8816            return std::task::Poll::Ready(None);
8817        }
8818        if this.is_terminated {
8819            panic!("polled SmcResourceRequestStream after completion");
8820        }
8821        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8822            |bytes, handles| {
8823                match this.inner.channel().read_etc(cx, bytes, handles) {
8824                    std::task::Poll::Ready(Ok(())) => {}
8825                    std::task::Poll::Pending => return std::task::Poll::Pending,
8826                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8827                        this.is_terminated = true;
8828                        return std::task::Poll::Ready(None);
8829                    }
8830                    std::task::Poll::Ready(Err(e)) => {
8831                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8832                            e.into(),
8833                        ))));
8834                    }
8835                }
8836
8837                // A message has been received from the channel
8838                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8839
8840                std::task::Poll::Ready(Some(match header.ordinal {
8841                    0x392cbd495b84ede7 => {
8842                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8843                        let mut req = fidl::new_empty!(
8844                            fidl::encoding::EmptyPayload,
8845                            fidl::encoding::DefaultFuchsiaResourceDialect
8846                        );
8847                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8848                        let control_handle = SmcResourceControlHandle { inner: this.inner.clone() };
8849                        Ok(SmcResourceRequest::Get {
8850                            responder: SmcResourceGetResponder {
8851                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8852                                tx_id: header.tx_id,
8853                            },
8854                        })
8855                    }
8856                    _ => Err(fidl::Error::UnknownOrdinal {
8857                        ordinal: header.ordinal,
8858                        protocol_name:
8859                            <SmcResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8860                    }),
8861                }))
8862            },
8863        )
8864    }
8865}
8866
8867/// Protocol for providing an SMC resource with access to all valid ranges.
8868#[derive(Debug)]
8869pub enum SmcResourceRequest {
8870    /// Get an SMC resource handle.
8871    Get { responder: SmcResourceGetResponder },
8872}
8873
8874impl SmcResourceRequest {
8875    #[allow(irrefutable_let_patterns)]
8876    pub fn into_get(self) -> Option<(SmcResourceGetResponder)> {
8877        if let SmcResourceRequest::Get { responder } = self { Some((responder)) } else { None }
8878    }
8879
8880    /// Name of the method defined in FIDL
8881    pub fn method_name(&self) -> &'static str {
8882        match *self {
8883            SmcResourceRequest::Get { .. } => "get",
8884        }
8885    }
8886}
8887
8888#[derive(Debug, Clone)]
8889pub struct SmcResourceControlHandle {
8890    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8891}
8892
8893impl SmcResourceControlHandle {
8894    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
8895        self.inner.shutdown_with_epitaph(status.into())
8896    }
8897}
8898
8899impl fidl::endpoints::ControlHandle for SmcResourceControlHandle {
8900    fn shutdown(&self) {
8901        self.inner.shutdown()
8902    }
8903
8904    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
8905        self.inner.shutdown_with_epitaph(status)
8906    }
8907
8908    fn is_closed(&self) -> bool {
8909        self.inner.channel().is_closed()
8910    }
8911    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8912        self.inner.channel().on_closed()
8913    }
8914
8915    #[cfg(target_os = "fuchsia")]
8916    fn signal_peer(
8917        &self,
8918        clear_mask: zx::Signals,
8919        set_mask: zx::Signals,
8920    ) -> Result<(), zx_status::Status> {
8921        use fidl::Peered;
8922        self.inner.channel().signal_peer(clear_mask, set_mask)
8923    }
8924}
8925
8926impl SmcResourceControlHandle {}
8927
8928#[must_use = "FIDL methods require a response to be sent"]
8929#[derive(Debug)]
8930pub struct SmcResourceGetResponder {
8931    control_handle: std::mem::ManuallyDrop<SmcResourceControlHandle>,
8932    tx_id: u32,
8933}
8934
8935/// Set the the channel to be shutdown (see [`SmcResourceControlHandle::shutdown`])
8936/// if the responder is dropped without sending a response, so that the client
8937/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8938impl std::ops::Drop for SmcResourceGetResponder {
8939    fn drop(&mut self) {
8940        self.control_handle.shutdown();
8941        // Safety: drops once, never accessed again
8942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8943    }
8944}
8945
8946impl fidl::endpoints::Responder for SmcResourceGetResponder {
8947    type ControlHandle = SmcResourceControlHandle;
8948
8949    fn control_handle(&self) -> &SmcResourceControlHandle {
8950        &self.control_handle
8951    }
8952
8953    fn drop_without_shutdown(mut self) {
8954        // Safety: drops once, never accessed again due to mem::forget
8955        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8956        // Prevent Drop from running (which would shut down the channel)
8957        std::mem::forget(self);
8958    }
8959}
8960
8961impl SmcResourceGetResponder {
8962    /// Sends a response to the FIDL transaction.
8963    ///
8964    /// Sets the channel to shutdown if an error occurs.
8965    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8966        let _result = self.send_raw(resource);
8967        if _result.is_err() {
8968            self.control_handle.shutdown();
8969        }
8970        self.drop_without_shutdown();
8971        _result
8972    }
8973
8974    /// Similar to "send" but does not shutdown the channel if an error occurs.
8975    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8976        let _result = self.send_raw(resource);
8977        self.drop_without_shutdown();
8978        _result
8979    }
8980
8981    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
8982        self.control_handle.inner.send::<SmcResourceGetResponse>(
8983            (resource,),
8984            self.tx_id,
8985            0x392cbd495b84ede7,
8986            fidl::encoding::DynamicFlags::empty(),
8987        )
8988    }
8989}
8990
8991#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8992pub struct StallResourceMarker;
8993
8994impl fidl::endpoints::ProtocolMarker for StallResourceMarker {
8995    type Proxy = StallResourceProxy;
8996    type RequestStream = StallResourceRequestStream;
8997    #[cfg(target_os = "fuchsia")]
8998    type SynchronousProxy = StallResourceSynchronousProxy;
8999
9000    const DEBUG_NAME: &'static str = "fuchsia.kernel.StallResource";
9001}
9002impl fidl::endpoints::DiscoverableProtocolMarker for StallResourceMarker {}
9003
9004pub trait StallResourceProxyInterface: Send + Sync {
9005    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
9006    fn r#get(&self) -> Self::GetResponseFut;
9007}
9008#[derive(Debug)]
9009#[cfg(target_os = "fuchsia")]
9010pub struct StallResourceSynchronousProxy {
9011    client: fidl::client::sync::Client,
9012}
9013
9014#[cfg(target_os = "fuchsia")]
9015impl fidl::endpoints::SynchronousProxy for StallResourceSynchronousProxy {
9016    type Proxy = StallResourceProxy;
9017    type Protocol = StallResourceMarker;
9018
9019    fn from_channel(inner: fidl::Channel) -> Self {
9020        Self::new(inner)
9021    }
9022
9023    fn into_channel(self) -> fidl::Channel {
9024        self.client.into_channel()
9025    }
9026
9027    fn as_channel(&self) -> &fidl::Channel {
9028        self.client.as_channel()
9029    }
9030}
9031
9032#[cfg(target_os = "fuchsia")]
9033impl StallResourceSynchronousProxy {
9034    pub fn new(channel: fidl::Channel) -> Self {
9035        Self { client: fidl::client::sync::Client::new(channel) }
9036    }
9037
9038    pub fn into_channel(self) -> fidl::Channel {
9039        self.client.into_channel()
9040    }
9041
9042    /// Waits until an event arrives and returns it. It is safe for other
9043    /// threads to make concurrent requests while waiting for an event.
9044    pub fn wait_for_event(
9045        &self,
9046        deadline: zx::MonotonicInstant,
9047    ) -> Result<StallResourceEvent, fidl::Error> {
9048        StallResourceEvent::decode(self.client.wait_for_event::<StallResourceMarker>(deadline)?)
9049    }
9050
9051    /// Get a stall resource handle.
9052    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
9053        let _response = self.client.send_query::<
9054            fidl::encoding::EmptyPayload,
9055            StallResourceGetResponse,
9056            StallResourceMarker,
9057        >(
9058            (),
9059            0x5edf4c8629a9781a,
9060            fidl::encoding::DynamicFlags::empty(),
9061            ___deadline,
9062        )?;
9063        Ok(_response.resource)
9064    }
9065}
9066
9067#[cfg(target_os = "fuchsia")]
9068impl From<StallResourceSynchronousProxy> for zx::NullableHandle {
9069    fn from(value: StallResourceSynchronousProxy) -> Self {
9070        value.into_channel().into()
9071    }
9072}
9073
9074#[cfg(target_os = "fuchsia")]
9075impl From<fidl::Channel> for StallResourceSynchronousProxy {
9076    fn from(value: fidl::Channel) -> Self {
9077        Self::new(value)
9078    }
9079}
9080
9081#[cfg(target_os = "fuchsia")]
9082impl fidl::endpoints::FromClient for StallResourceSynchronousProxy {
9083    type Protocol = StallResourceMarker;
9084
9085    fn from_client(value: fidl::endpoints::ClientEnd<StallResourceMarker>) -> Self {
9086        Self::new(value.into_channel())
9087    }
9088}
9089
9090#[derive(Debug, Clone)]
9091pub struct StallResourceProxy {
9092    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9093}
9094
9095impl fidl::endpoints::Proxy for StallResourceProxy {
9096    type Protocol = StallResourceMarker;
9097
9098    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9099        Self::new(inner)
9100    }
9101
9102    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9103        self.client.into_channel().map_err(|client| Self { client })
9104    }
9105
9106    fn as_channel(&self) -> &::fidl::AsyncChannel {
9107        self.client.as_channel()
9108    }
9109}
9110
9111impl StallResourceProxy {
9112    /// Create a new Proxy for fuchsia.kernel/StallResource.
9113    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9114        let protocol_name = <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9115        Self { client: fidl::client::Client::new(channel, protocol_name) }
9116    }
9117
9118    /// Get a Stream of events from the remote end of the protocol.
9119    ///
9120    /// # Panics
9121    ///
9122    /// Panics if the event stream was already taken.
9123    pub fn take_event_stream(&self) -> StallResourceEventStream {
9124        StallResourceEventStream { event_receiver: self.client.take_event_receiver() }
9125    }
9126
9127    /// Get a stall resource handle.
9128    pub fn r#get(
9129        &self,
9130    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
9131    {
9132        StallResourceProxyInterface::r#get(self)
9133    }
9134}
9135
9136impl StallResourceProxyInterface for StallResourceProxy {
9137    type GetResponseFut = fidl::client::QueryResponseFut<
9138        fidl::Resource,
9139        fidl::encoding::DefaultFuchsiaResourceDialect,
9140    >;
9141    fn r#get(&self) -> Self::GetResponseFut {
9142        fn _decode(
9143            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9144        ) -> Result<fidl::Resource, fidl::Error> {
9145            let _response = fidl::client::decode_transaction_body::<
9146                StallResourceGetResponse,
9147                fidl::encoding::DefaultFuchsiaResourceDialect,
9148                0x5edf4c8629a9781a,
9149            >(_buf?)?;
9150            Ok(_response.resource)
9151        }
9152        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
9153            (),
9154            0x5edf4c8629a9781a,
9155            fidl::encoding::DynamicFlags::empty(),
9156            _decode,
9157        )
9158    }
9159}
9160
9161pub struct StallResourceEventStream {
9162    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9163}
9164
9165impl std::marker::Unpin for StallResourceEventStream {}
9166
9167impl futures::stream::FusedStream for StallResourceEventStream {
9168    fn is_terminated(&self) -> bool {
9169        self.event_receiver.is_terminated()
9170    }
9171}
9172
9173impl futures::Stream for StallResourceEventStream {
9174    type Item = Result<StallResourceEvent, fidl::Error>;
9175
9176    fn poll_next(
9177        mut self: std::pin::Pin<&mut Self>,
9178        cx: &mut std::task::Context<'_>,
9179    ) -> std::task::Poll<Option<Self::Item>> {
9180        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9181            &mut self.event_receiver,
9182            cx
9183        )?) {
9184            Some(buf) => std::task::Poll::Ready(Some(StallResourceEvent::decode(buf))),
9185            None => std::task::Poll::Ready(None),
9186        }
9187    }
9188}
9189
9190#[derive(Debug)]
9191pub enum StallResourceEvent {}
9192
9193impl StallResourceEvent {
9194    /// Decodes a message buffer as a [`StallResourceEvent`].
9195    fn decode(
9196        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9197    ) -> Result<StallResourceEvent, fidl::Error> {
9198        let (bytes, _handles) = buf.split_mut();
9199        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9200        debug_assert_eq!(tx_header.tx_id, 0);
9201        match tx_header.ordinal {
9202            _ => Err(fidl::Error::UnknownOrdinal {
9203                ordinal: tx_header.ordinal,
9204                protocol_name: <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9205            }),
9206        }
9207    }
9208}
9209
9210/// A Stream of incoming requests for fuchsia.kernel/StallResource.
9211pub struct StallResourceRequestStream {
9212    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9213    is_terminated: bool,
9214}
9215
9216impl std::marker::Unpin for StallResourceRequestStream {}
9217
9218impl futures::stream::FusedStream for StallResourceRequestStream {
9219    fn is_terminated(&self) -> bool {
9220        self.is_terminated
9221    }
9222}
9223
9224impl fidl::endpoints::RequestStream for StallResourceRequestStream {
9225    type Protocol = StallResourceMarker;
9226    type ControlHandle = StallResourceControlHandle;
9227
9228    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9229        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9230    }
9231
9232    fn control_handle(&self) -> Self::ControlHandle {
9233        StallResourceControlHandle { inner: self.inner.clone() }
9234    }
9235
9236    fn into_inner(
9237        self,
9238    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9239    {
9240        (self.inner, self.is_terminated)
9241    }
9242
9243    fn from_inner(
9244        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9245        is_terminated: bool,
9246    ) -> Self {
9247        Self { inner, is_terminated }
9248    }
9249}
9250
9251impl futures::Stream for StallResourceRequestStream {
9252    type Item = Result<StallResourceRequest, fidl::Error>;
9253
9254    fn poll_next(
9255        mut self: std::pin::Pin<&mut Self>,
9256        cx: &mut std::task::Context<'_>,
9257    ) -> std::task::Poll<Option<Self::Item>> {
9258        let this = &mut *self;
9259        if this.inner.check_shutdown(cx) {
9260            this.is_terminated = true;
9261            return std::task::Poll::Ready(None);
9262        }
9263        if this.is_terminated {
9264            panic!("polled StallResourceRequestStream after completion");
9265        }
9266        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9267            |bytes, handles| {
9268                match this.inner.channel().read_etc(cx, bytes, handles) {
9269                    std::task::Poll::Ready(Ok(())) => {}
9270                    std::task::Poll::Pending => return std::task::Poll::Pending,
9271                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9272                        this.is_terminated = true;
9273                        return std::task::Poll::Ready(None);
9274                    }
9275                    std::task::Poll::Ready(Err(e)) => {
9276                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9277                            e.into(),
9278                        ))));
9279                    }
9280                }
9281
9282                // A message has been received from the channel
9283                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9284
9285                std::task::Poll::Ready(Some(match header.ordinal {
9286                    0x5edf4c8629a9781a => {
9287                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9288                        let mut req = fidl::new_empty!(
9289                            fidl::encoding::EmptyPayload,
9290                            fidl::encoding::DefaultFuchsiaResourceDialect
9291                        );
9292                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9293                        let control_handle =
9294                            StallResourceControlHandle { inner: this.inner.clone() };
9295                        Ok(StallResourceRequest::Get {
9296                            responder: StallResourceGetResponder {
9297                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9298                                tx_id: header.tx_id,
9299                            },
9300                        })
9301                    }
9302                    _ => Err(fidl::Error::UnknownOrdinal {
9303                        ordinal: header.ordinal,
9304                        protocol_name:
9305                            <StallResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9306                    }),
9307                }))
9308            },
9309        )
9310    }
9311}
9312
9313/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
9314/// `ZX_RSRC_SYSTEM_STALL_BASE` to programs that should be able to measure and
9315/// be notified of stalls.
9316#[derive(Debug)]
9317pub enum StallResourceRequest {
9318    /// Get a stall resource handle.
9319    Get { responder: StallResourceGetResponder },
9320}
9321
9322impl StallResourceRequest {
9323    #[allow(irrefutable_let_patterns)]
9324    pub fn into_get(self) -> Option<(StallResourceGetResponder)> {
9325        if let StallResourceRequest::Get { responder } = self { Some((responder)) } else { None }
9326    }
9327
9328    /// Name of the method defined in FIDL
9329    pub fn method_name(&self) -> &'static str {
9330        match *self {
9331            StallResourceRequest::Get { .. } => "get",
9332        }
9333    }
9334}
9335
9336#[derive(Debug, Clone)]
9337pub struct StallResourceControlHandle {
9338    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9339}
9340
9341impl StallResourceControlHandle {
9342    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
9343        self.inner.shutdown_with_epitaph(status.into())
9344    }
9345}
9346
9347impl fidl::endpoints::ControlHandle for StallResourceControlHandle {
9348    fn shutdown(&self) {
9349        self.inner.shutdown()
9350    }
9351
9352    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
9353        self.inner.shutdown_with_epitaph(status)
9354    }
9355
9356    fn is_closed(&self) -> bool {
9357        self.inner.channel().is_closed()
9358    }
9359    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9360        self.inner.channel().on_closed()
9361    }
9362
9363    #[cfg(target_os = "fuchsia")]
9364    fn signal_peer(
9365        &self,
9366        clear_mask: zx::Signals,
9367        set_mask: zx::Signals,
9368    ) -> Result<(), zx_status::Status> {
9369        use fidl::Peered;
9370        self.inner.channel().signal_peer(clear_mask, set_mask)
9371    }
9372}
9373
9374impl StallResourceControlHandle {}
9375
9376#[must_use = "FIDL methods require a response to be sent"]
9377#[derive(Debug)]
9378pub struct StallResourceGetResponder {
9379    control_handle: std::mem::ManuallyDrop<StallResourceControlHandle>,
9380    tx_id: u32,
9381}
9382
9383/// Set the the channel to be shutdown (see [`StallResourceControlHandle::shutdown`])
9384/// if the responder is dropped without sending a response, so that the client
9385/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9386impl std::ops::Drop for StallResourceGetResponder {
9387    fn drop(&mut self) {
9388        self.control_handle.shutdown();
9389        // Safety: drops once, never accessed again
9390        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9391    }
9392}
9393
9394impl fidl::endpoints::Responder for StallResourceGetResponder {
9395    type ControlHandle = StallResourceControlHandle;
9396
9397    fn control_handle(&self) -> &StallResourceControlHandle {
9398        &self.control_handle
9399    }
9400
9401    fn drop_without_shutdown(mut self) {
9402        // Safety: drops once, never accessed again due to mem::forget
9403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9404        // Prevent Drop from running (which would shut down the channel)
9405        std::mem::forget(self);
9406    }
9407}
9408
9409impl StallResourceGetResponder {
9410    /// Sends a response to the FIDL transaction.
9411    ///
9412    /// Sets the channel to shutdown if an error occurs.
9413    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9414        let _result = self.send_raw(resource);
9415        if _result.is_err() {
9416            self.control_handle.shutdown();
9417        }
9418        self.drop_without_shutdown();
9419        _result
9420    }
9421
9422    /// Similar to "send" but does not shutdown the channel if an error occurs.
9423    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9424        let _result = self.send_raw(resource);
9425        self.drop_without_shutdown();
9426        _result
9427    }
9428
9429    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
9430        self.control_handle.inner.send::<StallResourceGetResponse>(
9431            (resource,),
9432            self.tx_id,
9433            0x5edf4c8629a9781a,
9434            fidl::encoding::DynamicFlags::empty(),
9435        )
9436    }
9437}
9438
9439#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9440pub struct StatsMarker;
9441
9442impl fidl::endpoints::ProtocolMarker for StatsMarker {
9443    type Proxy = StatsProxy;
9444    type RequestStream = StatsRequestStream;
9445    #[cfg(target_os = "fuchsia")]
9446    type SynchronousProxy = StatsSynchronousProxy;
9447
9448    const DEBUG_NAME: &'static str = "fuchsia.kernel.Stats";
9449}
9450impl fidl::endpoints::DiscoverableProtocolMarker for StatsMarker {}
9451
9452pub trait StatsProxyInterface: Send + Sync {
9453    type GetMemoryStatsResponseFut: std::future::Future<Output = Result<MemoryStats, fidl::Error>>
9454        + Send;
9455    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut;
9456    type GetMemoryStatsExtendedResponseFut: std::future::Future<Output = Result<MemoryStatsExtended, fidl::Error>>
9457        + Send;
9458    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut;
9459    type GetMemoryStatsCompressionResponseFut: std::future::Future<Output = Result<MemoryStatsCompression, fidl::Error>>
9460        + Send;
9461    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut;
9462    type GetCpuStatsResponseFut: std::future::Future<Output = Result<CpuStats, fidl::Error>> + Send;
9463    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut;
9464    type GetCpuLoadResponseFut: std::future::Future<Output = Result<Vec<f32>, fidl::Error>> + Send;
9465    fn r#get_cpu_load(&self, duration: i64) -> Self::GetCpuLoadResponseFut;
9466}
9467#[derive(Debug)]
9468#[cfg(target_os = "fuchsia")]
9469pub struct StatsSynchronousProxy {
9470    client: fidl::client::sync::Client,
9471}
9472
9473#[cfg(target_os = "fuchsia")]
9474impl fidl::endpoints::SynchronousProxy for StatsSynchronousProxy {
9475    type Proxy = StatsProxy;
9476    type Protocol = StatsMarker;
9477
9478    fn from_channel(inner: fidl::Channel) -> Self {
9479        Self::new(inner)
9480    }
9481
9482    fn into_channel(self) -> fidl::Channel {
9483        self.client.into_channel()
9484    }
9485
9486    fn as_channel(&self) -> &fidl::Channel {
9487        self.client.as_channel()
9488    }
9489}
9490
9491#[cfg(target_os = "fuchsia")]
9492impl StatsSynchronousProxy {
9493    pub fn new(channel: fidl::Channel) -> Self {
9494        Self { client: fidl::client::sync::Client::new(channel) }
9495    }
9496
9497    pub fn into_channel(self) -> fidl::Channel {
9498        self.client.into_channel()
9499    }
9500
9501    /// Waits until an event arrives and returns it. It is safe for other
9502    /// threads to make concurrent requests while waiting for an event.
9503    pub fn wait_for_event(
9504        &self,
9505        deadline: zx::MonotonicInstant,
9506    ) -> Result<StatsEvent, fidl::Error> {
9507        StatsEvent::decode(self.client.wait_for_event::<StatsMarker>(deadline)?)
9508    }
9509
9510    pub fn r#get_memory_stats(
9511        &self,
9512        ___deadline: zx::MonotonicInstant,
9513    ) -> Result<MemoryStats, fidl::Error> {
9514        let _response = self
9515            .client
9516            .send_query::<fidl::encoding::EmptyPayload, StatsGetMemoryStatsResponse, StatsMarker>(
9517                (),
9518                0x686677932ae41074,
9519                fidl::encoding::DynamicFlags::empty(),
9520                ___deadline,
9521            )?;
9522        Ok(_response.stats)
9523    }
9524
9525    pub fn r#get_memory_stats_extended(
9526        &self,
9527        ___deadline: zx::MonotonicInstant,
9528    ) -> Result<MemoryStatsExtended, fidl::Error> {
9529        let _response = self.client.send_query::<
9530            fidl::encoding::EmptyPayload,
9531            StatsGetMemoryStatsExtendedResponse,
9532            StatsMarker,
9533        >(
9534            (),
9535            0x60faa0f8aa38c29f,
9536            fidl::encoding::DynamicFlags::empty(),
9537            ___deadline,
9538        )?;
9539        Ok(_response.stats)
9540    }
9541
9542    pub fn r#get_memory_stats_compression(
9543        &self,
9544        ___deadline: zx::MonotonicInstant,
9545    ) -> Result<MemoryStatsCompression, fidl::Error> {
9546        let _response = self
9547            .client
9548            .send_query::<fidl::encoding::EmptyPayload, MemoryStatsCompression, StatsMarker>(
9549                (),
9550                0x544a09995befb531,
9551                fidl::encoding::DynamicFlags::empty(),
9552                ___deadline,
9553            )?;
9554        Ok(_response)
9555    }
9556
9557    pub fn r#get_cpu_stats(
9558        &self,
9559        ___deadline: zx::MonotonicInstant,
9560    ) -> Result<CpuStats, fidl::Error> {
9561        let _response = self
9562            .client
9563            .send_query::<fidl::encoding::EmptyPayload, StatsGetCpuStatsResponse, StatsMarker>(
9564                (),
9565                0x470e2684ca1ca19e,
9566                fidl::encoding::DynamicFlags::empty(),
9567                ___deadline,
9568            )?;
9569        Ok(_response.stats)
9570    }
9571
9572    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9573    /// duration.
9574    ///
9575    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9576    /// PerCpuStats) over a time duration.
9577    pub fn r#get_cpu_load(
9578        &self,
9579        mut duration: i64,
9580        ___deadline: zx::MonotonicInstant,
9581    ) -> Result<Vec<f32>, fidl::Error> {
9582        let _response = self
9583            .client
9584            .send_query::<StatsGetCpuLoadRequest, StatsGetCpuLoadResponse, StatsMarker>(
9585                (duration,),
9586                0x4c8f0f05e7034666,
9587                fidl::encoding::DynamicFlags::empty(),
9588                ___deadline,
9589            )?;
9590        Ok(_response.per_cpu_load)
9591    }
9592}
9593
9594#[cfg(target_os = "fuchsia")]
9595impl From<StatsSynchronousProxy> for zx::NullableHandle {
9596    fn from(value: StatsSynchronousProxy) -> Self {
9597        value.into_channel().into()
9598    }
9599}
9600
9601#[cfg(target_os = "fuchsia")]
9602impl From<fidl::Channel> for StatsSynchronousProxy {
9603    fn from(value: fidl::Channel) -> Self {
9604        Self::new(value)
9605    }
9606}
9607
9608#[cfg(target_os = "fuchsia")]
9609impl fidl::endpoints::FromClient for StatsSynchronousProxy {
9610    type Protocol = StatsMarker;
9611
9612    fn from_client(value: fidl::endpoints::ClientEnd<StatsMarker>) -> Self {
9613        Self::new(value.into_channel())
9614    }
9615}
9616
9617#[derive(Debug, Clone)]
9618pub struct StatsProxy {
9619    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9620}
9621
9622impl fidl::endpoints::Proxy for StatsProxy {
9623    type Protocol = StatsMarker;
9624
9625    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9626        Self::new(inner)
9627    }
9628
9629    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9630        self.client.into_channel().map_err(|client| Self { client })
9631    }
9632
9633    fn as_channel(&self) -> &::fidl::AsyncChannel {
9634        self.client.as_channel()
9635    }
9636}
9637
9638impl StatsProxy {
9639    /// Create a new Proxy for fuchsia.kernel/Stats.
9640    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9641        let protocol_name = <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9642        Self { client: fidl::client::Client::new(channel, protocol_name) }
9643    }
9644
9645    /// Get a Stream of events from the remote end of the protocol.
9646    ///
9647    /// # Panics
9648    ///
9649    /// Panics if the event stream was already taken.
9650    pub fn take_event_stream(&self) -> StatsEventStream {
9651        StatsEventStream { event_receiver: self.client.take_event_receiver() }
9652    }
9653
9654    pub fn r#get_memory_stats(
9655        &self,
9656    ) -> fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9657    {
9658        StatsProxyInterface::r#get_memory_stats(self)
9659    }
9660
9661    pub fn r#get_memory_stats_extended(
9662        &self,
9663    ) -> fidl::client::QueryResponseFut<
9664        MemoryStatsExtended,
9665        fidl::encoding::DefaultFuchsiaResourceDialect,
9666    > {
9667        StatsProxyInterface::r#get_memory_stats_extended(self)
9668    }
9669
9670    pub fn r#get_memory_stats_compression(
9671        &self,
9672    ) -> fidl::client::QueryResponseFut<
9673        MemoryStatsCompression,
9674        fidl::encoding::DefaultFuchsiaResourceDialect,
9675    > {
9676        StatsProxyInterface::r#get_memory_stats_compression(self)
9677    }
9678
9679    pub fn r#get_cpu_stats(
9680        &self,
9681    ) -> fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>
9682    {
9683        StatsProxyInterface::r#get_cpu_stats(self)
9684    }
9685
9686    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
9687    /// duration.
9688    ///
9689    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
9690    /// PerCpuStats) over a time duration.
9691    pub fn r#get_cpu_load(
9692        &self,
9693        mut duration: i64,
9694    ) -> fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>
9695    {
9696        StatsProxyInterface::r#get_cpu_load(self, duration)
9697    }
9698}
9699
9700impl StatsProxyInterface for StatsProxy {
9701    type GetMemoryStatsResponseFut =
9702        fidl::client::QueryResponseFut<MemoryStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9703    fn r#get_memory_stats(&self) -> Self::GetMemoryStatsResponseFut {
9704        fn _decode(
9705            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9706        ) -> Result<MemoryStats, fidl::Error> {
9707            let _response = fidl::client::decode_transaction_body::<
9708                StatsGetMemoryStatsResponse,
9709                fidl::encoding::DefaultFuchsiaResourceDialect,
9710                0x686677932ae41074,
9711            >(_buf?)?;
9712            Ok(_response.stats)
9713        }
9714        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStats>(
9715            (),
9716            0x686677932ae41074,
9717            fidl::encoding::DynamicFlags::empty(),
9718            _decode,
9719        )
9720    }
9721
9722    type GetMemoryStatsExtendedResponseFut = fidl::client::QueryResponseFut<
9723        MemoryStatsExtended,
9724        fidl::encoding::DefaultFuchsiaResourceDialect,
9725    >;
9726    fn r#get_memory_stats_extended(&self) -> Self::GetMemoryStatsExtendedResponseFut {
9727        fn _decode(
9728            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9729        ) -> Result<MemoryStatsExtended, fidl::Error> {
9730            let _response = fidl::client::decode_transaction_body::<
9731                StatsGetMemoryStatsExtendedResponse,
9732                fidl::encoding::DefaultFuchsiaResourceDialect,
9733                0x60faa0f8aa38c29f,
9734            >(_buf?)?;
9735            Ok(_response.stats)
9736        }
9737        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsExtended>(
9738            (),
9739            0x60faa0f8aa38c29f,
9740            fidl::encoding::DynamicFlags::empty(),
9741            _decode,
9742        )
9743    }
9744
9745    type GetMemoryStatsCompressionResponseFut = fidl::client::QueryResponseFut<
9746        MemoryStatsCompression,
9747        fidl::encoding::DefaultFuchsiaResourceDialect,
9748    >;
9749    fn r#get_memory_stats_compression(&self) -> Self::GetMemoryStatsCompressionResponseFut {
9750        fn _decode(
9751            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9752        ) -> Result<MemoryStatsCompression, fidl::Error> {
9753            let _response = fidl::client::decode_transaction_body::<
9754                MemoryStatsCompression,
9755                fidl::encoding::DefaultFuchsiaResourceDialect,
9756                0x544a09995befb531,
9757            >(_buf?)?;
9758            Ok(_response)
9759        }
9760        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, MemoryStatsCompression>(
9761            (),
9762            0x544a09995befb531,
9763            fidl::encoding::DynamicFlags::empty(),
9764            _decode,
9765        )
9766    }
9767
9768    type GetCpuStatsResponseFut =
9769        fidl::client::QueryResponseFut<CpuStats, fidl::encoding::DefaultFuchsiaResourceDialect>;
9770    fn r#get_cpu_stats(&self) -> Self::GetCpuStatsResponseFut {
9771        fn _decode(
9772            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9773        ) -> Result<CpuStats, fidl::Error> {
9774            let _response = fidl::client::decode_transaction_body::<
9775                StatsGetCpuStatsResponse,
9776                fidl::encoding::DefaultFuchsiaResourceDialect,
9777                0x470e2684ca1ca19e,
9778            >(_buf?)?;
9779            Ok(_response.stats)
9780        }
9781        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, CpuStats>(
9782            (),
9783            0x470e2684ca1ca19e,
9784            fidl::encoding::DynamicFlags::empty(),
9785            _decode,
9786        )
9787    }
9788
9789    type GetCpuLoadResponseFut =
9790        fidl::client::QueryResponseFut<Vec<f32>, fidl::encoding::DefaultFuchsiaResourceDialect>;
9791    fn r#get_cpu_load(&self, mut duration: i64) -> Self::GetCpuLoadResponseFut {
9792        fn _decode(
9793            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9794        ) -> Result<Vec<f32>, fidl::Error> {
9795            let _response = fidl::client::decode_transaction_body::<
9796                StatsGetCpuLoadResponse,
9797                fidl::encoding::DefaultFuchsiaResourceDialect,
9798                0x4c8f0f05e7034666,
9799            >(_buf?)?;
9800            Ok(_response.per_cpu_load)
9801        }
9802        self.client.send_query_and_decode::<StatsGetCpuLoadRequest, Vec<f32>>(
9803            (duration,),
9804            0x4c8f0f05e7034666,
9805            fidl::encoding::DynamicFlags::empty(),
9806            _decode,
9807        )
9808    }
9809}
9810
9811pub struct StatsEventStream {
9812    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9813}
9814
9815impl std::marker::Unpin for StatsEventStream {}
9816
9817impl futures::stream::FusedStream for StatsEventStream {
9818    fn is_terminated(&self) -> bool {
9819        self.event_receiver.is_terminated()
9820    }
9821}
9822
9823impl futures::Stream for StatsEventStream {
9824    type Item = Result<StatsEvent, fidl::Error>;
9825
9826    fn poll_next(
9827        mut self: std::pin::Pin<&mut Self>,
9828        cx: &mut std::task::Context<'_>,
9829    ) -> std::task::Poll<Option<Self::Item>> {
9830        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9831            &mut self.event_receiver,
9832            cx
9833        )?) {
9834            Some(buf) => std::task::Poll::Ready(Some(StatsEvent::decode(buf))),
9835            None => std::task::Poll::Ready(None),
9836        }
9837    }
9838}
9839
9840#[derive(Debug)]
9841pub enum StatsEvent {}
9842
9843impl StatsEvent {
9844    /// Decodes a message buffer as a [`StatsEvent`].
9845    fn decode(
9846        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9847    ) -> Result<StatsEvent, fidl::Error> {
9848        let (bytes, _handles) = buf.split_mut();
9849        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9850        debug_assert_eq!(tx_header.tx_id, 0);
9851        match tx_header.ordinal {
9852            _ => Err(fidl::Error::UnknownOrdinal {
9853                ordinal: tx_header.ordinal,
9854                protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9855            }),
9856        }
9857    }
9858}
9859
9860/// A Stream of incoming requests for fuchsia.kernel/Stats.
9861pub struct StatsRequestStream {
9862    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9863    is_terminated: bool,
9864}
9865
9866impl std::marker::Unpin for StatsRequestStream {}
9867
9868impl futures::stream::FusedStream for StatsRequestStream {
9869    fn is_terminated(&self) -> bool {
9870        self.is_terminated
9871    }
9872}
9873
9874impl fidl::endpoints::RequestStream for StatsRequestStream {
9875    type Protocol = StatsMarker;
9876    type ControlHandle = StatsControlHandle;
9877
9878    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9879        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9880    }
9881
9882    fn control_handle(&self) -> Self::ControlHandle {
9883        StatsControlHandle { inner: self.inner.clone() }
9884    }
9885
9886    fn into_inner(
9887        self,
9888    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9889    {
9890        (self.inner, self.is_terminated)
9891    }
9892
9893    fn from_inner(
9894        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9895        is_terminated: bool,
9896    ) -> Self {
9897        Self { inner, is_terminated }
9898    }
9899}
9900
9901impl futures::Stream for StatsRequestStream {
9902    type Item = Result<StatsRequest, fidl::Error>;
9903
9904    fn poll_next(
9905        mut self: std::pin::Pin<&mut Self>,
9906        cx: &mut std::task::Context<'_>,
9907    ) -> std::task::Poll<Option<Self::Item>> {
9908        let this = &mut *self;
9909        if this.inner.check_shutdown(cx) {
9910            this.is_terminated = true;
9911            return std::task::Poll::Ready(None);
9912        }
9913        if this.is_terminated {
9914            panic!("polled StatsRequestStream after completion");
9915        }
9916        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9917            |bytes, handles| {
9918                match this.inner.channel().read_etc(cx, bytes, handles) {
9919                    std::task::Poll::Ready(Ok(())) => {}
9920                    std::task::Poll::Pending => return std::task::Poll::Pending,
9921                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9922                        this.is_terminated = true;
9923                        return std::task::Poll::Ready(None);
9924                    }
9925                    std::task::Poll::Ready(Err(e)) => {
9926                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9927                            e.into(),
9928                        ))));
9929                    }
9930                }
9931
9932                // A message has been received from the channel
9933                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9934
9935                std::task::Poll::Ready(Some(match header.ordinal {
9936                    0x686677932ae41074 => {
9937                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9938                        let mut req = fidl::new_empty!(
9939                            fidl::encoding::EmptyPayload,
9940                            fidl::encoding::DefaultFuchsiaResourceDialect
9941                        );
9942                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9943                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9944                        Ok(StatsRequest::GetMemoryStats {
9945                            responder: StatsGetMemoryStatsResponder {
9946                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9947                                tx_id: header.tx_id,
9948                            },
9949                        })
9950                    }
9951                    0x60faa0f8aa38c29f => {
9952                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9953                        let mut req = fidl::new_empty!(
9954                            fidl::encoding::EmptyPayload,
9955                            fidl::encoding::DefaultFuchsiaResourceDialect
9956                        );
9957                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9958                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9959                        Ok(StatsRequest::GetMemoryStatsExtended {
9960                            responder: StatsGetMemoryStatsExtendedResponder {
9961                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9962                                tx_id: header.tx_id,
9963                            },
9964                        })
9965                    }
9966                    0x544a09995befb531 => {
9967                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9968                        let mut req = fidl::new_empty!(
9969                            fidl::encoding::EmptyPayload,
9970                            fidl::encoding::DefaultFuchsiaResourceDialect
9971                        );
9972                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9973                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9974                        Ok(StatsRequest::GetMemoryStatsCompression {
9975                            responder: StatsGetMemoryStatsCompressionResponder {
9976                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9977                                tx_id: header.tx_id,
9978                            },
9979                        })
9980                    }
9981                    0x470e2684ca1ca19e => {
9982                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9983                        let mut req = fidl::new_empty!(
9984                            fidl::encoding::EmptyPayload,
9985                            fidl::encoding::DefaultFuchsiaResourceDialect
9986                        );
9987                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9988                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
9989                        Ok(StatsRequest::GetCpuStats {
9990                            responder: StatsGetCpuStatsResponder {
9991                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9992                                tx_id: header.tx_id,
9993                            },
9994                        })
9995                    }
9996                    0x4c8f0f05e7034666 => {
9997                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9998                        let mut req = fidl::new_empty!(
9999                            StatsGetCpuLoadRequest,
10000                            fidl::encoding::DefaultFuchsiaResourceDialect
10001                        );
10002                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StatsGetCpuLoadRequest>(&header, _body_bytes, handles, &mut req)?;
10003                        let control_handle = StatsControlHandle { inner: this.inner.clone() };
10004                        Ok(StatsRequest::GetCpuLoad {
10005                            duration: req.duration,
10006
10007                            responder: StatsGetCpuLoadResponder {
10008                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10009                                tx_id: header.tx_id,
10010                            },
10011                        })
10012                    }
10013                    _ => Err(fidl::Error::UnknownOrdinal {
10014                        ordinal: header.ordinal,
10015                        protocol_name: <StatsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10016                    }),
10017                }))
10018            },
10019        )
10020    }
10021}
10022
10023/// Protocol for providing kernel stats. This is roughly a wrapper around zx_object_get_info for
10024/// the ZX_INFO_KMEM_STATS and ZX_INFO_CPU_STATS topics, which today require the very powerful
10025/// 'Root Resource' capability to obtain. Instead of vending out that capability, programs that
10026/// just want stats should use this service instead. If for some reason the protocol fails to
10027/// retrieve stats, which will be an un-recoverable error, it will close the channel.
10028#[derive(Debug)]
10029pub enum StatsRequest {
10030    GetMemoryStats {
10031        responder: StatsGetMemoryStatsResponder,
10032    },
10033    GetMemoryStatsExtended {
10034        responder: StatsGetMemoryStatsExtendedResponder,
10035    },
10036    GetMemoryStatsCompression {
10037        responder: StatsGetMemoryStatsCompressionResponder,
10038    },
10039    GetCpuStats {
10040        responder: StatsGetCpuStatsResponder,
10041    },
10042    /// Gets the average load as a percentage (0.0 - 100.0) from each CPU over the specified
10043    /// duration.
10044    ///
10045    /// Load is calculated as (100 - %idle), where %idle is the percentage value of idle_time (from
10046    /// PerCpuStats) over a time duration.
10047    GetCpuLoad {
10048        duration: i64,
10049        responder: StatsGetCpuLoadResponder,
10050    },
10051}
10052
10053impl StatsRequest {
10054    #[allow(irrefutable_let_patterns)]
10055    pub fn into_get_memory_stats(self) -> Option<(StatsGetMemoryStatsResponder)> {
10056        if let StatsRequest::GetMemoryStats { responder } = self { Some((responder)) } else { None }
10057    }
10058
10059    #[allow(irrefutable_let_patterns)]
10060    pub fn into_get_memory_stats_extended(self) -> Option<(StatsGetMemoryStatsExtendedResponder)> {
10061        if let StatsRequest::GetMemoryStatsExtended { responder } = self {
10062            Some((responder))
10063        } else {
10064            None
10065        }
10066    }
10067
10068    #[allow(irrefutable_let_patterns)]
10069    pub fn into_get_memory_stats_compression(
10070        self,
10071    ) -> Option<(StatsGetMemoryStatsCompressionResponder)> {
10072        if let StatsRequest::GetMemoryStatsCompression { responder } = self {
10073            Some((responder))
10074        } else {
10075            None
10076        }
10077    }
10078
10079    #[allow(irrefutable_let_patterns)]
10080    pub fn into_get_cpu_stats(self) -> Option<(StatsGetCpuStatsResponder)> {
10081        if let StatsRequest::GetCpuStats { responder } = self { Some((responder)) } else { None }
10082    }
10083
10084    #[allow(irrefutable_let_patterns)]
10085    pub fn into_get_cpu_load(self) -> Option<(i64, StatsGetCpuLoadResponder)> {
10086        if let StatsRequest::GetCpuLoad { duration, responder } = self {
10087            Some((duration, responder))
10088        } else {
10089            None
10090        }
10091    }
10092
10093    /// Name of the method defined in FIDL
10094    pub fn method_name(&self) -> &'static str {
10095        match *self {
10096            StatsRequest::GetMemoryStats { .. } => "get_memory_stats",
10097            StatsRequest::GetMemoryStatsExtended { .. } => "get_memory_stats_extended",
10098            StatsRequest::GetMemoryStatsCompression { .. } => "get_memory_stats_compression",
10099            StatsRequest::GetCpuStats { .. } => "get_cpu_stats",
10100            StatsRequest::GetCpuLoad { .. } => "get_cpu_load",
10101        }
10102    }
10103}
10104
10105#[derive(Debug, Clone)]
10106pub struct StatsControlHandle {
10107    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10108}
10109
10110impl StatsControlHandle {
10111    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10112        self.inner.shutdown_with_epitaph(status.into())
10113    }
10114}
10115
10116impl fidl::endpoints::ControlHandle for StatsControlHandle {
10117    fn shutdown(&self) {
10118        self.inner.shutdown()
10119    }
10120
10121    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10122        self.inner.shutdown_with_epitaph(status)
10123    }
10124
10125    fn is_closed(&self) -> bool {
10126        self.inner.channel().is_closed()
10127    }
10128    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10129        self.inner.channel().on_closed()
10130    }
10131
10132    #[cfg(target_os = "fuchsia")]
10133    fn signal_peer(
10134        &self,
10135        clear_mask: zx::Signals,
10136        set_mask: zx::Signals,
10137    ) -> Result<(), zx_status::Status> {
10138        use fidl::Peered;
10139        self.inner.channel().signal_peer(clear_mask, set_mask)
10140    }
10141}
10142
10143impl StatsControlHandle {}
10144
10145#[must_use = "FIDL methods require a response to be sent"]
10146#[derive(Debug)]
10147pub struct StatsGetMemoryStatsResponder {
10148    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10149    tx_id: u32,
10150}
10151
10152/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10153/// if the responder is dropped without sending a response, so that the client
10154/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10155impl std::ops::Drop for StatsGetMemoryStatsResponder {
10156    fn drop(&mut self) {
10157        self.control_handle.shutdown();
10158        // Safety: drops once, never accessed again
10159        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10160    }
10161}
10162
10163impl fidl::endpoints::Responder for StatsGetMemoryStatsResponder {
10164    type ControlHandle = StatsControlHandle;
10165
10166    fn control_handle(&self) -> &StatsControlHandle {
10167        &self.control_handle
10168    }
10169
10170    fn drop_without_shutdown(mut self) {
10171        // Safety: drops once, never accessed again due to mem::forget
10172        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10173        // Prevent Drop from running (which would shut down the channel)
10174        std::mem::forget(self);
10175    }
10176}
10177
10178impl StatsGetMemoryStatsResponder {
10179    /// Sends a response to the FIDL transaction.
10180    ///
10181    /// Sets the channel to shutdown if an error occurs.
10182    pub fn send(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10183        let _result = self.send_raw(stats);
10184        if _result.is_err() {
10185            self.control_handle.shutdown();
10186        }
10187        self.drop_without_shutdown();
10188        _result
10189    }
10190
10191    /// Similar to "send" but does not shutdown the channel if an error occurs.
10192    pub fn send_no_shutdown_on_err(self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10193        let _result = self.send_raw(stats);
10194        self.drop_without_shutdown();
10195        _result
10196    }
10197
10198    fn send_raw(&self, mut stats: &MemoryStats) -> Result<(), fidl::Error> {
10199        self.control_handle.inner.send::<StatsGetMemoryStatsResponse>(
10200            (stats,),
10201            self.tx_id,
10202            0x686677932ae41074,
10203            fidl::encoding::DynamicFlags::empty(),
10204        )
10205    }
10206}
10207
10208#[must_use = "FIDL methods require a response to be sent"]
10209#[derive(Debug)]
10210pub struct StatsGetMemoryStatsExtendedResponder {
10211    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10212    tx_id: u32,
10213}
10214
10215/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10216/// if the responder is dropped without sending a response, so that the client
10217/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10218impl std::ops::Drop for StatsGetMemoryStatsExtendedResponder {
10219    fn drop(&mut self) {
10220        self.control_handle.shutdown();
10221        // Safety: drops once, never accessed again
10222        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10223    }
10224}
10225
10226impl fidl::endpoints::Responder for StatsGetMemoryStatsExtendedResponder {
10227    type ControlHandle = StatsControlHandle;
10228
10229    fn control_handle(&self) -> &StatsControlHandle {
10230        &self.control_handle
10231    }
10232
10233    fn drop_without_shutdown(mut self) {
10234        // Safety: drops once, never accessed again due to mem::forget
10235        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10236        // Prevent Drop from running (which would shut down the channel)
10237        std::mem::forget(self);
10238    }
10239}
10240
10241impl StatsGetMemoryStatsExtendedResponder {
10242    /// Sends a response to the FIDL transaction.
10243    ///
10244    /// Sets the channel to shutdown if an error occurs.
10245    pub fn send(self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10246        let _result = self.send_raw(stats);
10247        if _result.is_err() {
10248            self.control_handle.shutdown();
10249        }
10250        self.drop_without_shutdown();
10251        _result
10252    }
10253
10254    /// Similar to "send" but does not shutdown the channel if an error occurs.
10255    pub fn send_no_shutdown_on_err(
10256        self,
10257        mut stats: &MemoryStatsExtended,
10258    ) -> Result<(), fidl::Error> {
10259        let _result = self.send_raw(stats);
10260        self.drop_without_shutdown();
10261        _result
10262    }
10263
10264    fn send_raw(&self, mut stats: &MemoryStatsExtended) -> Result<(), fidl::Error> {
10265        self.control_handle.inner.send::<StatsGetMemoryStatsExtendedResponse>(
10266            (stats,),
10267            self.tx_id,
10268            0x60faa0f8aa38c29f,
10269            fidl::encoding::DynamicFlags::empty(),
10270        )
10271    }
10272}
10273
10274#[must_use = "FIDL methods require a response to be sent"]
10275#[derive(Debug)]
10276pub struct StatsGetMemoryStatsCompressionResponder {
10277    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10278    tx_id: u32,
10279}
10280
10281/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10282/// if the responder is dropped without sending a response, so that the client
10283/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10284impl std::ops::Drop for StatsGetMemoryStatsCompressionResponder {
10285    fn drop(&mut self) {
10286        self.control_handle.shutdown();
10287        // Safety: drops once, never accessed again
10288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10289    }
10290}
10291
10292impl fidl::endpoints::Responder for StatsGetMemoryStatsCompressionResponder {
10293    type ControlHandle = StatsControlHandle;
10294
10295    fn control_handle(&self) -> &StatsControlHandle {
10296        &self.control_handle
10297    }
10298
10299    fn drop_without_shutdown(mut self) {
10300        // Safety: drops once, never accessed again due to mem::forget
10301        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10302        // Prevent Drop from running (which would shut down the channel)
10303        std::mem::forget(self);
10304    }
10305}
10306
10307impl StatsGetMemoryStatsCompressionResponder {
10308    /// Sends a response to the FIDL transaction.
10309    ///
10310    /// Sets the channel to shutdown if an error occurs.
10311    pub fn send(self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10312        let _result = self.send_raw(payload);
10313        if _result.is_err() {
10314            self.control_handle.shutdown();
10315        }
10316        self.drop_without_shutdown();
10317        _result
10318    }
10319
10320    /// Similar to "send" but does not shutdown the channel if an error occurs.
10321    pub fn send_no_shutdown_on_err(
10322        self,
10323        mut payload: &MemoryStatsCompression,
10324    ) -> Result<(), fidl::Error> {
10325        let _result = self.send_raw(payload);
10326        self.drop_without_shutdown();
10327        _result
10328    }
10329
10330    fn send_raw(&self, mut payload: &MemoryStatsCompression) -> Result<(), fidl::Error> {
10331        self.control_handle.inner.send::<MemoryStatsCompression>(
10332            payload,
10333            self.tx_id,
10334            0x544a09995befb531,
10335            fidl::encoding::DynamicFlags::empty(),
10336        )
10337    }
10338}
10339
10340#[must_use = "FIDL methods require a response to be sent"]
10341#[derive(Debug)]
10342pub struct StatsGetCpuStatsResponder {
10343    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10344    tx_id: u32,
10345}
10346
10347/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10348/// if the responder is dropped without sending a response, so that the client
10349/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10350impl std::ops::Drop for StatsGetCpuStatsResponder {
10351    fn drop(&mut self) {
10352        self.control_handle.shutdown();
10353        // Safety: drops once, never accessed again
10354        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10355    }
10356}
10357
10358impl fidl::endpoints::Responder for StatsGetCpuStatsResponder {
10359    type ControlHandle = StatsControlHandle;
10360
10361    fn control_handle(&self) -> &StatsControlHandle {
10362        &self.control_handle
10363    }
10364
10365    fn drop_without_shutdown(mut self) {
10366        // Safety: drops once, never accessed again due to mem::forget
10367        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10368        // Prevent Drop from running (which would shut down the channel)
10369        std::mem::forget(self);
10370    }
10371}
10372
10373impl StatsGetCpuStatsResponder {
10374    /// Sends a response to the FIDL transaction.
10375    ///
10376    /// Sets the channel to shutdown if an error occurs.
10377    pub fn send(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10378        let _result = self.send_raw(stats);
10379        if _result.is_err() {
10380            self.control_handle.shutdown();
10381        }
10382        self.drop_without_shutdown();
10383        _result
10384    }
10385
10386    /// Similar to "send" but does not shutdown the channel if an error occurs.
10387    pub fn send_no_shutdown_on_err(self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10388        let _result = self.send_raw(stats);
10389        self.drop_without_shutdown();
10390        _result
10391    }
10392
10393    fn send_raw(&self, mut stats: &CpuStats) -> Result<(), fidl::Error> {
10394        self.control_handle.inner.send::<StatsGetCpuStatsResponse>(
10395            (stats,),
10396            self.tx_id,
10397            0x470e2684ca1ca19e,
10398            fidl::encoding::DynamicFlags::empty(),
10399        )
10400    }
10401}
10402
10403#[must_use = "FIDL methods require a response to be sent"]
10404#[derive(Debug)]
10405pub struct StatsGetCpuLoadResponder {
10406    control_handle: std::mem::ManuallyDrop<StatsControlHandle>,
10407    tx_id: u32,
10408}
10409
10410/// Set the the channel to be shutdown (see [`StatsControlHandle::shutdown`])
10411/// if the responder is dropped without sending a response, so that the client
10412/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10413impl std::ops::Drop for StatsGetCpuLoadResponder {
10414    fn drop(&mut self) {
10415        self.control_handle.shutdown();
10416        // Safety: drops once, never accessed again
10417        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10418    }
10419}
10420
10421impl fidl::endpoints::Responder for StatsGetCpuLoadResponder {
10422    type ControlHandle = StatsControlHandle;
10423
10424    fn control_handle(&self) -> &StatsControlHandle {
10425        &self.control_handle
10426    }
10427
10428    fn drop_without_shutdown(mut self) {
10429        // Safety: drops once, never accessed again due to mem::forget
10430        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10431        // Prevent Drop from running (which would shut down the channel)
10432        std::mem::forget(self);
10433    }
10434}
10435
10436impl StatsGetCpuLoadResponder {
10437    /// Sends a response to the FIDL transaction.
10438    ///
10439    /// Sets the channel to shutdown if an error occurs.
10440    pub fn send(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10441        let _result = self.send_raw(per_cpu_load);
10442        if _result.is_err() {
10443            self.control_handle.shutdown();
10444        }
10445        self.drop_without_shutdown();
10446        _result
10447    }
10448
10449    /// Similar to "send" but does not shutdown the channel if an error occurs.
10450    pub fn send_no_shutdown_on_err(self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10451        let _result = self.send_raw(per_cpu_load);
10452        self.drop_without_shutdown();
10453        _result
10454    }
10455
10456    fn send_raw(&self, mut per_cpu_load: &[f32]) -> Result<(), fidl::Error> {
10457        self.control_handle.inner.send::<StatsGetCpuLoadResponse>(
10458            (per_cpu_load,),
10459            self.tx_id,
10460            0x4c8f0f05e7034666,
10461            fidl::encoding::DynamicFlags::empty(),
10462        )
10463    }
10464}
10465
10466#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10467pub struct TracingResourceMarker;
10468
10469impl fidl::endpoints::ProtocolMarker for TracingResourceMarker {
10470    type Proxy = TracingResourceProxy;
10471    type RequestStream = TracingResourceRequestStream;
10472    #[cfg(target_os = "fuchsia")]
10473    type SynchronousProxy = TracingResourceSynchronousProxy;
10474
10475    const DEBUG_NAME: &'static str = "fuchsia.kernel.TracingResource";
10476}
10477impl fidl::endpoints::DiscoverableProtocolMarker for TracingResourceMarker {}
10478
10479pub trait TracingResourceProxyInterface: Send + Sync {
10480    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10481    fn r#get(&self) -> Self::GetResponseFut;
10482}
10483#[derive(Debug)]
10484#[cfg(target_os = "fuchsia")]
10485pub struct TracingResourceSynchronousProxy {
10486    client: fidl::client::sync::Client,
10487}
10488
10489#[cfg(target_os = "fuchsia")]
10490impl fidl::endpoints::SynchronousProxy for TracingResourceSynchronousProxy {
10491    type Proxy = TracingResourceProxy;
10492    type Protocol = TracingResourceMarker;
10493
10494    fn from_channel(inner: fidl::Channel) -> Self {
10495        Self::new(inner)
10496    }
10497
10498    fn into_channel(self) -> fidl::Channel {
10499        self.client.into_channel()
10500    }
10501
10502    fn as_channel(&self) -> &fidl::Channel {
10503        self.client.as_channel()
10504    }
10505}
10506
10507#[cfg(target_os = "fuchsia")]
10508impl TracingResourceSynchronousProxy {
10509    pub fn new(channel: fidl::Channel) -> Self {
10510        Self { client: fidl::client::sync::Client::new(channel) }
10511    }
10512
10513    pub fn into_channel(self) -> fidl::Channel {
10514        self.client.into_channel()
10515    }
10516
10517    /// Waits until an event arrives and returns it. It is safe for other
10518    /// threads to make concurrent requests while waiting for an event.
10519    pub fn wait_for_event(
10520        &self,
10521        deadline: zx::MonotonicInstant,
10522    ) -> Result<TracingResourceEvent, fidl::Error> {
10523        TracingResourceEvent::decode(self.client.wait_for_event::<TracingResourceMarker>(deadline)?)
10524    }
10525
10526    /// Get a tracing resource handle.
10527    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10528        let _response = self.client.send_query::<
10529            fidl::encoding::EmptyPayload,
10530            TracingResourceGetResponse,
10531            TracingResourceMarker,
10532        >(
10533            (),
10534            0x299bc179aa54c6aa,
10535            fidl::encoding::DynamicFlags::empty(),
10536            ___deadline,
10537        )?;
10538        Ok(_response.resource)
10539    }
10540}
10541
10542#[cfg(target_os = "fuchsia")]
10543impl From<TracingResourceSynchronousProxy> for zx::NullableHandle {
10544    fn from(value: TracingResourceSynchronousProxy) -> Self {
10545        value.into_channel().into()
10546    }
10547}
10548
10549#[cfg(target_os = "fuchsia")]
10550impl From<fidl::Channel> for TracingResourceSynchronousProxy {
10551    fn from(value: fidl::Channel) -> Self {
10552        Self::new(value)
10553    }
10554}
10555
10556#[cfg(target_os = "fuchsia")]
10557impl fidl::endpoints::FromClient for TracingResourceSynchronousProxy {
10558    type Protocol = TracingResourceMarker;
10559
10560    fn from_client(value: fidl::endpoints::ClientEnd<TracingResourceMarker>) -> Self {
10561        Self::new(value.into_channel())
10562    }
10563}
10564
10565#[derive(Debug, Clone)]
10566pub struct TracingResourceProxy {
10567    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10568}
10569
10570impl fidl::endpoints::Proxy for TracingResourceProxy {
10571    type Protocol = TracingResourceMarker;
10572
10573    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10574        Self::new(inner)
10575    }
10576
10577    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10578        self.client.into_channel().map_err(|client| Self { client })
10579    }
10580
10581    fn as_channel(&self) -> &::fidl::AsyncChannel {
10582        self.client.as_channel()
10583    }
10584}
10585
10586impl TracingResourceProxy {
10587    /// Create a new Proxy for fuchsia.kernel/TracingResource.
10588    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10589        let protocol_name = <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10590        Self { client: fidl::client::Client::new(channel, protocol_name) }
10591    }
10592
10593    /// Get a Stream of events from the remote end of the protocol.
10594    ///
10595    /// # Panics
10596    ///
10597    /// Panics if the event stream was already taken.
10598    pub fn take_event_stream(&self) -> TracingResourceEventStream {
10599        TracingResourceEventStream { event_receiver: self.client.take_event_receiver() }
10600    }
10601
10602    /// Get a tracing resource handle.
10603    pub fn r#get(
10604        &self,
10605    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
10606    {
10607        TracingResourceProxyInterface::r#get(self)
10608    }
10609}
10610
10611impl TracingResourceProxyInterface for TracingResourceProxy {
10612    type GetResponseFut = fidl::client::QueryResponseFut<
10613        fidl::Resource,
10614        fidl::encoding::DefaultFuchsiaResourceDialect,
10615    >;
10616    fn r#get(&self) -> Self::GetResponseFut {
10617        fn _decode(
10618            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
10619        ) -> Result<fidl::Resource, fidl::Error> {
10620            let _response = fidl::client::decode_transaction_body::<
10621                TracingResourceGetResponse,
10622                fidl::encoding::DefaultFuchsiaResourceDialect,
10623                0x299bc179aa54c6aa,
10624            >(_buf?)?;
10625            Ok(_response.resource)
10626        }
10627        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
10628            (),
10629            0x299bc179aa54c6aa,
10630            fidl::encoding::DynamicFlags::empty(),
10631            _decode,
10632        )
10633    }
10634}
10635
10636pub struct TracingResourceEventStream {
10637    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10638}
10639
10640impl std::marker::Unpin for TracingResourceEventStream {}
10641
10642impl futures::stream::FusedStream for TracingResourceEventStream {
10643    fn is_terminated(&self) -> bool {
10644        self.event_receiver.is_terminated()
10645    }
10646}
10647
10648impl futures::Stream for TracingResourceEventStream {
10649    type Item = Result<TracingResourceEvent, fidl::Error>;
10650
10651    fn poll_next(
10652        mut self: std::pin::Pin<&mut Self>,
10653        cx: &mut std::task::Context<'_>,
10654    ) -> std::task::Poll<Option<Self::Item>> {
10655        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10656            &mut self.event_receiver,
10657            cx
10658        )?) {
10659            Some(buf) => std::task::Poll::Ready(Some(TracingResourceEvent::decode(buf))),
10660            None => std::task::Poll::Ready(None),
10661        }
10662    }
10663}
10664
10665#[derive(Debug)]
10666pub enum TracingResourceEvent {}
10667
10668impl TracingResourceEvent {
10669    /// Decodes a message buffer as a [`TracingResourceEvent`].
10670    fn decode(
10671        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10672    ) -> Result<TracingResourceEvent, fidl::Error> {
10673        let (bytes, _handles) = buf.split_mut();
10674        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10675        debug_assert_eq!(tx_header.tx_id, 0);
10676        match tx_header.ordinal {
10677            _ => Err(fidl::Error::UnknownOrdinal {
10678                ordinal: tx_header.ordinal,
10679                protocol_name:
10680                    <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10681            }),
10682        }
10683    }
10684}
10685
10686/// A Stream of incoming requests for fuchsia.kernel/TracingResource.
10687pub struct TracingResourceRequestStream {
10688    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10689    is_terminated: bool,
10690}
10691
10692impl std::marker::Unpin for TracingResourceRequestStream {}
10693
10694impl futures::stream::FusedStream for TracingResourceRequestStream {
10695    fn is_terminated(&self) -> bool {
10696        self.is_terminated
10697    }
10698}
10699
10700impl fidl::endpoints::RequestStream for TracingResourceRequestStream {
10701    type Protocol = TracingResourceMarker;
10702    type ControlHandle = TracingResourceControlHandle;
10703
10704    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10705        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10706    }
10707
10708    fn control_handle(&self) -> Self::ControlHandle {
10709        TracingResourceControlHandle { inner: self.inner.clone() }
10710    }
10711
10712    fn into_inner(
10713        self,
10714    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10715    {
10716        (self.inner, self.is_terminated)
10717    }
10718
10719    fn from_inner(
10720        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10721        is_terminated: bool,
10722    ) -> Self {
10723        Self { inner, is_terminated }
10724    }
10725}
10726
10727impl futures::Stream for TracingResourceRequestStream {
10728    type Item = Result<TracingResourceRequest, fidl::Error>;
10729
10730    fn poll_next(
10731        mut self: std::pin::Pin<&mut Self>,
10732        cx: &mut std::task::Context<'_>,
10733    ) -> std::task::Poll<Option<Self::Item>> {
10734        let this = &mut *self;
10735        if this.inner.check_shutdown(cx) {
10736            this.is_terminated = true;
10737            return std::task::Poll::Ready(None);
10738        }
10739        if this.is_terminated {
10740            panic!("polled TracingResourceRequestStream after completion");
10741        }
10742        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10743            |bytes, handles| {
10744                match this.inner.channel().read_etc(cx, bytes, handles) {
10745                    std::task::Poll::Ready(Ok(())) => {}
10746                    std::task::Poll::Pending => return std::task::Poll::Pending,
10747                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10748                        this.is_terminated = true;
10749                        return std::task::Poll::Ready(None);
10750                    }
10751                    std::task::Poll::Ready(Err(e)) => {
10752                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10753                            e.into(),
10754                        ))));
10755                    }
10756                }
10757
10758                // A message has been received from the channel
10759                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10760
10761                std::task::Poll::Ready(Some(match header.ordinal {
10762                    0x299bc179aa54c6aa => {
10763                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
10764                        let mut req = fidl::new_empty!(
10765                            fidl::encoding::EmptyPayload,
10766                            fidl::encoding::DefaultFuchsiaResourceDialect
10767                        );
10768                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
10769                        let control_handle =
10770                            TracingResourceControlHandle { inner: this.inner.clone() };
10771                        Ok(TracingResourceRequest::Get {
10772                            responder: TracingResourceGetResponder {
10773                                control_handle: std::mem::ManuallyDrop::new(control_handle),
10774                                tx_id: header.tx_id,
10775                            },
10776                        })
10777                    }
10778                    _ => Err(fidl::Error::UnknownOrdinal {
10779                        ordinal: header.ordinal,
10780                        protocol_name:
10781                            <TracingResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10782                    }),
10783                }))
10784            },
10785        )
10786    }
10787}
10788
10789/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
10790/// `ZX_RSRC_SYSTEM_TRACING_BASE`.
10791#[derive(Debug)]
10792pub enum TracingResourceRequest {
10793    /// Get a tracing resource handle.
10794    Get { responder: TracingResourceGetResponder },
10795}
10796
10797impl TracingResourceRequest {
10798    #[allow(irrefutable_let_patterns)]
10799    pub fn into_get(self) -> Option<(TracingResourceGetResponder)> {
10800        if let TracingResourceRequest::Get { responder } = self { Some((responder)) } else { None }
10801    }
10802
10803    /// Name of the method defined in FIDL
10804    pub fn method_name(&self) -> &'static str {
10805        match *self {
10806            TracingResourceRequest::Get { .. } => "get",
10807        }
10808    }
10809}
10810
10811#[derive(Debug, Clone)]
10812pub struct TracingResourceControlHandle {
10813    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10814}
10815
10816impl TracingResourceControlHandle {
10817    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
10818        self.inner.shutdown_with_epitaph(status.into())
10819    }
10820}
10821
10822impl fidl::endpoints::ControlHandle for TracingResourceControlHandle {
10823    fn shutdown(&self) {
10824        self.inner.shutdown()
10825    }
10826
10827    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
10828        self.inner.shutdown_with_epitaph(status)
10829    }
10830
10831    fn is_closed(&self) -> bool {
10832        self.inner.channel().is_closed()
10833    }
10834    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10835        self.inner.channel().on_closed()
10836    }
10837
10838    #[cfg(target_os = "fuchsia")]
10839    fn signal_peer(
10840        &self,
10841        clear_mask: zx::Signals,
10842        set_mask: zx::Signals,
10843    ) -> Result<(), zx_status::Status> {
10844        use fidl::Peered;
10845        self.inner.channel().signal_peer(clear_mask, set_mask)
10846    }
10847}
10848
10849impl TracingResourceControlHandle {}
10850
10851#[must_use = "FIDL methods require a response to be sent"]
10852#[derive(Debug)]
10853pub struct TracingResourceGetResponder {
10854    control_handle: std::mem::ManuallyDrop<TracingResourceControlHandle>,
10855    tx_id: u32,
10856}
10857
10858/// Set the the channel to be shutdown (see [`TracingResourceControlHandle::shutdown`])
10859/// if the responder is dropped without sending a response, so that the client
10860/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
10861impl std::ops::Drop for TracingResourceGetResponder {
10862    fn drop(&mut self) {
10863        self.control_handle.shutdown();
10864        // Safety: drops once, never accessed again
10865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10866    }
10867}
10868
10869impl fidl::endpoints::Responder for TracingResourceGetResponder {
10870    type ControlHandle = TracingResourceControlHandle;
10871
10872    fn control_handle(&self) -> &TracingResourceControlHandle {
10873        &self.control_handle
10874    }
10875
10876    fn drop_without_shutdown(mut self) {
10877        // Safety: drops once, never accessed again due to mem::forget
10878        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
10879        // Prevent Drop from running (which would shut down the channel)
10880        std::mem::forget(self);
10881    }
10882}
10883
10884impl TracingResourceGetResponder {
10885    /// Sends a response to the FIDL transaction.
10886    ///
10887    /// Sets the channel to shutdown if an error occurs.
10888    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10889        let _result = self.send_raw(resource);
10890        if _result.is_err() {
10891            self.control_handle.shutdown();
10892        }
10893        self.drop_without_shutdown();
10894        _result
10895    }
10896
10897    /// Similar to "send" but does not shutdown the channel if an error occurs.
10898    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10899        let _result = self.send_raw(resource);
10900        self.drop_without_shutdown();
10901        _result
10902    }
10903
10904    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
10905        self.control_handle.inner.send::<TracingResourceGetResponse>(
10906            (resource,),
10907            self.tx_id,
10908            0x299bc179aa54c6aa,
10909            fidl::encoding::DynamicFlags::empty(),
10910        )
10911    }
10912}
10913
10914#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
10915pub struct VmexResourceMarker;
10916
10917impl fidl::endpoints::ProtocolMarker for VmexResourceMarker {
10918    type Proxy = VmexResourceProxy;
10919    type RequestStream = VmexResourceRequestStream;
10920    #[cfg(target_os = "fuchsia")]
10921    type SynchronousProxy = VmexResourceSynchronousProxy;
10922
10923    const DEBUG_NAME: &'static str = "fuchsia.kernel.VmexResource";
10924}
10925impl fidl::endpoints::DiscoverableProtocolMarker for VmexResourceMarker {}
10926
10927pub trait VmexResourceProxyInterface: Send + Sync {
10928    type GetResponseFut: std::future::Future<Output = Result<fidl::Resource, fidl::Error>> + Send;
10929    fn r#get(&self) -> Self::GetResponseFut;
10930}
10931#[derive(Debug)]
10932#[cfg(target_os = "fuchsia")]
10933pub struct VmexResourceSynchronousProxy {
10934    client: fidl::client::sync::Client,
10935}
10936
10937#[cfg(target_os = "fuchsia")]
10938impl fidl::endpoints::SynchronousProxy for VmexResourceSynchronousProxy {
10939    type Proxy = VmexResourceProxy;
10940    type Protocol = VmexResourceMarker;
10941
10942    fn from_channel(inner: fidl::Channel) -> Self {
10943        Self::new(inner)
10944    }
10945
10946    fn into_channel(self) -> fidl::Channel {
10947        self.client.into_channel()
10948    }
10949
10950    fn as_channel(&self) -> &fidl::Channel {
10951        self.client.as_channel()
10952    }
10953}
10954
10955#[cfg(target_os = "fuchsia")]
10956impl VmexResourceSynchronousProxy {
10957    pub fn new(channel: fidl::Channel) -> Self {
10958        Self { client: fidl::client::sync::Client::new(channel) }
10959    }
10960
10961    pub fn into_channel(self) -> fidl::Channel {
10962        self.client.into_channel()
10963    }
10964
10965    /// Waits until an event arrives and returns it. It is safe for other
10966    /// threads to make concurrent requests while waiting for an event.
10967    pub fn wait_for_event(
10968        &self,
10969        deadline: zx::MonotonicInstant,
10970    ) -> Result<VmexResourceEvent, fidl::Error> {
10971        VmexResourceEvent::decode(self.client.wait_for_event::<VmexResourceMarker>(deadline)?)
10972    }
10973
10974    /// Get a VMEX resource handle.
10975    pub fn r#get(&self, ___deadline: zx::MonotonicInstant) -> Result<fidl::Resource, fidl::Error> {
10976        let _response = self.client.send_query::<
10977            fidl::encoding::EmptyPayload,
10978            VmexResourceGetResponse,
10979            VmexResourceMarker,
10980        >(
10981            (),
10982            0x33db32deed650699,
10983            fidl::encoding::DynamicFlags::empty(),
10984            ___deadline,
10985        )?;
10986        Ok(_response.resource)
10987    }
10988}
10989
10990#[cfg(target_os = "fuchsia")]
10991impl From<VmexResourceSynchronousProxy> for zx::NullableHandle {
10992    fn from(value: VmexResourceSynchronousProxy) -> Self {
10993        value.into_channel().into()
10994    }
10995}
10996
10997#[cfg(target_os = "fuchsia")]
10998impl From<fidl::Channel> for VmexResourceSynchronousProxy {
10999    fn from(value: fidl::Channel) -> Self {
11000        Self::new(value)
11001    }
11002}
11003
11004#[cfg(target_os = "fuchsia")]
11005impl fidl::endpoints::FromClient for VmexResourceSynchronousProxy {
11006    type Protocol = VmexResourceMarker;
11007
11008    fn from_client(value: fidl::endpoints::ClientEnd<VmexResourceMarker>) -> Self {
11009        Self::new(value.into_channel())
11010    }
11011}
11012
11013#[derive(Debug, Clone)]
11014pub struct VmexResourceProxy {
11015    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
11016}
11017
11018impl fidl::endpoints::Proxy for VmexResourceProxy {
11019    type Protocol = VmexResourceMarker;
11020
11021    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
11022        Self::new(inner)
11023    }
11024
11025    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
11026        self.client.into_channel().map_err(|client| Self { client })
11027    }
11028
11029    fn as_channel(&self) -> &::fidl::AsyncChannel {
11030        self.client.as_channel()
11031    }
11032}
11033
11034impl VmexResourceProxy {
11035    /// Create a new Proxy for fuchsia.kernel/VmexResource.
11036    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
11037        let protocol_name = <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
11038        Self { client: fidl::client::Client::new(channel, protocol_name) }
11039    }
11040
11041    /// Get a Stream of events from the remote end of the protocol.
11042    ///
11043    /// # Panics
11044    ///
11045    /// Panics if the event stream was already taken.
11046    pub fn take_event_stream(&self) -> VmexResourceEventStream {
11047        VmexResourceEventStream { event_receiver: self.client.take_event_receiver() }
11048    }
11049
11050    /// Get a VMEX resource handle.
11051    pub fn r#get(
11052        &self,
11053    ) -> fidl::client::QueryResponseFut<fidl::Resource, fidl::encoding::DefaultFuchsiaResourceDialect>
11054    {
11055        VmexResourceProxyInterface::r#get(self)
11056    }
11057}
11058
11059impl VmexResourceProxyInterface for VmexResourceProxy {
11060    type GetResponseFut = fidl::client::QueryResponseFut<
11061        fidl::Resource,
11062        fidl::encoding::DefaultFuchsiaResourceDialect,
11063    >;
11064    fn r#get(&self) -> Self::GetResponseFut {
11065        fn _decode(
11066            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
11067        ) -> Result<fidl::Resource, fidl::Error> {
11068            let _response = fidl::client::decode_transaction_body::<
11069                VmexResourceGetResponse,
11070                fidl::encoding::DefaultFuchsiaResourceDialect,
11071                0x33db32deed650699,
11072            >(_buf?)?;
11073            Ok(_response.resource)
11074        }
11075        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Resource>(
11076            (),
11077            0x33db32deed650699,
11078            fidl::encoding::DynamicFlags::empty(),
11079            _decode,
11080        )
11081    }
11082}
11083
11084pub struct VmexResourceEventStream {
11085    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
11086}
11087
11088impl std::marker::Unpin for VmexResourceEventStream {}
11089
11090impl futures::stream::FusedStream for VmexResourceEventStream {
11091    fn is_terminated(&self) -> bool {
11092        self.event_receiver.is_terminated()
11093    }
11094}
11095
11096impl futures::Stream for VmexResourceEventStream {
11097    type Item = Result<VmexResourceEvent, fidl::Error>;
11098
11099    fn poll_next(
11100        mut self: std::pin::Pin<&mut Self>,
11101        cx: &mut std::task::Context<'_>,
11102    ) -> std::task::Poll<Option<Self::Item>> {
11103        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
11104            &mut self.event_receiver,
11105            cx
11106        )?) {
11107            Some(buf) => std::task::Poll::Ready(Some(VmexResourceEvent::decode(buf))),
11108            None => std::task::Poll::Ready(None),
11109        }
11110    }
11111}
11112
11113#[derive(Debug)]
11114pub enum VmexResourceEvent {}
11115
11116impl VmexResourceEvent {
11117    /// Decodes a message buffer as a [`VmexResourceEvent`].
11118    fn decode(
11119        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
11120    ) -> Result<VmexResourceEvent, fidl::Error> {
11121        let (bytes, _handles) = buf.split_mut();
11122        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11123        debug_assert_eq!(tx_header.tx_id, 0);
11124        match tx_header.ordinal {
11125            _ => Err(fidl::Error::UnknownOrdinal {
11126                ordinal: tx_header.ordinal,
11127                protocol_name: <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11128            }),
11129        }
11130    }
11131}
11132
11133/// A Stream of incoming requests for fuchsia.kernel/VmexResource.
11134pub struct VmexResourceRequestStream {
11135    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11136    is_terminated: bool,
11137}
11138
11139impl std::marker::Unpin for VmexResourceRequestStream {}
11140
11141impl futures::stream::FusedStream for VmexResourceRequestStream {
11142    fn is_terminated(&self) -> bool {
11143        self.is_terminated
11144    }
11145}
11146
11147impl fidl::endpoints::RequestStream for VmexResourceRequestStream {
11148    type Protocol = VmexResourceMarker;
11149    type ControlHandle = VmexResourceControlHandle;
11150
11151    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
11152        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
11153    }
11154
11155    fn control_handle(&self) -> Self::ControlHandle {
11156        VmexResourceControlHandle { inner: self.inner.clone() }
11157    }
11158
11159    fn into_inner(
11160        self,
11161    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
11162    {
11163        (self.inner, self.is_terminated)
11164    }
11165
11166    fn from_inner(
11167        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11168        is_terminated: bool,
11169    ) -> Self {
11170        Self { inner, is_terminated }
11171    }
11172}
11173
11174impl futures::Stream for VmexResourceRequestStream {
11175    type Item = Result<VmexResourceRequest, fidl::Error>;
11176
11177    fn poll_next(
11178        mut self: std::pin::Pin<&mut Self>,
11179        cx: &mut std::task::Context<'_>,
11180    ) -> std::task::Poll<Option<Self::Item>> {
11181        let this = &mut *self;
11182        if this.inner.check_shutdown(cx) {
11183            this.is_terminated = true;
11184            return std::task::Poll::Ready(None);
11185        }
11186        if this.is_terminated {
11187            panic!("polled VmexResourceRequestStream after completion");
11188        }
11189        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
11190            |bytes, handles| {
11191                match this.inner.channel().read_etc(cx, bytes, handles) {
11192                    std::task::Poll::Ready(Ok(())) => {}
11193                    std::task::Poll::Pending => return std::task::Poll::Pending,
11194                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
11195                        this.is_terminated = true;
11196                        return std::task::Poll::Ready(None);
11197                    }
11198                    std::task::Poll::Ready(Err(e)) => {
11199                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
11200                            e.into(),
11201                        ))));
11202                    }
11203                }
11204
11205                // A message has been received from the channel
11206                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
11207
11208                std::task::Poll::Ready(Some(match header.ordinal {
11209                    0x33db32deed650699 => {
11210                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
11211                        let mut req = fidl::new_empty!(
11212                            fidl::encoding::EmptyPayload,
11213                            fidl::encoding::DefaultFuchsiaResourceDialect
11214                        );
11215                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
11216                        let control_handle =
11217                            VmexResourceControlHandle { inner: this.inner.clone() };
11218                        Ok(VmexResourceRequest::Get {
11219                            responder: VmexResourceGetResponder {
11220                                control_handle: std::mem::ManuallyDrop::new(control_handle),
11221                                tx_id: header.tx_id,
11222                            },
11223                        })
11224                    }
11225                    _ => Err(fidl::Error::UnknownOrdinal {
11226                        ordinal: header.ordinal,
11227                        protocol_name:
11228                            <VmexResourceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
11229                    }),
11230                }))
11231            },
11232        )
11233    }
11234}
11235
11236/// Protocol for providing a `ZX_RSRC_KIND_SYSTEM` with base
11237/// `ZX_RSRC_SYSTEM_VMEX_BASE` to programs that should be able to mark VMOs as
11238/// executable.
11239#[derive(Debug)]
11240pub enum VmexResourceRequest {
11241    /// Get a VMEX resource handle.
11242    Get { responder: VmexResourceGetResponder },
11243}
11244
11245impl VmexResourceRequest {
11246    #[allow(irrefutable_let_patterns)]
11247    pub fn into_get(self) -> Option<(VmexResourceGetResponder)> {
11248        if let VmexResourceRequest::Get { responder } = self { Some((responder)) } else { None }
11249    }
11250
11251    /// Name of the method defined in FIDL
11252    pub fn method_name(&self) -> &'static str {
11253        match *self {
11254            VmexResourceRequest::Get { .. } => "get",
11255        }
11256    }
11257}
11258
11259#[derive(Debug, Clone)]
11260pub struct VmexResourceControlHandle {
11261    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
11262}
11263
11264impl VmexResourceControlHandle {
11265    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
11266        self.inner.shutdown_with_epitaph(status.into())
11267    }
11268}
11269
11270impl fidl::endpoints::ControlHandle for VmexResourceControlHandle {
11271    fn shutdown(&self) {
11272        self.inner.shutdown()
11273    }
11274
11275    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
11276        self.inner.shutdown_with_epitaph(status)
11277    }
11278
11279    fn is_closed(&self) -> bool {
11280        self.inner.channel().is_closed()
11281    }
11282    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
11283        self.inner.channel().on_closed()
11284    }
11285
11286    #[cfg(target_os = "fuchsia")]
11287    fn signal_peer(
11288        &self,
11289        clear_mask: zx::Signals,
11290        set_mask: zx::Signals,
11291    ) -> Result<(), zx_status::Status> {
11292        use fidl::Peered;
11293        self.inner.channel().signal_peer(clear_mask, set_mask)
11294    }
11295}
11296
11297impl VmexResourceControlHandle {}
11298
11299#[must_use = "FIDL methods require a response to be sent"]
11300#[derive(Debug)]
11301pub struct VmexResourceGetResponder {
11302    control_handle: std::mem::ManuallyDrop<VmexResourceControlHandle>,
11303    tx_id: u32,
11304}
11305
11306/// Set the the channel to be shutdown (see [`VmexResourceControlHandle::shutdown`])
11307/// if the responder is dropped without sending a response, so that the client
11308/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
11309impl std::ops::Drop for VmexResourceGetResponder {
11310    fn drop(&mut self) {
11311        self.control_handle.shutdown();
11312        // Safety: drops once, never accessed again
11313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11314    }
11315}
11316
11317impl fidl::endpoints::Responder for VmexResourceGetResponder {
11318    type ControlHandle = VmexResourceControlHandle;
11319
11320    fn control_handle(&self) -> &VmexResourceControlHandle {
11321        &self.control_handle
11322    }
11323
11324    fn drop_without_shutdown(mut self) {
11325        // Safety: drops once, never accessed again due to mem::forget
11326        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
11327        // Prevent Drop from running (which would shut down the channel)
11328        std::mem::forget(self);
11329    }
11330}
11331
11332impl VmexResourceGetResponder {
11333    /// Sends a response to the FIDL transaction.
11334    ///
11335    /// Sets the channel to shutdown if an error occurs.
11336    pub fn send(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11337        let _result = self.send_raw(resource);
11338        if _result.is_err() {
11339            self.control_handle.shutdown();
11340        }
11341        self.drop_without_shutdown();
11342        _result
11343    }
11344
11345    /// Similar to "send" but does not shutdown the channel if an error occurs.
11346    pub fn send_no_shutdown_on_err(self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11347        let _result = self.send_raw(resource);
11348        self.drop_without_shutdown();
11349        _result
11350    }
11351
11352    fn send_raw(&self, mut resource: fidl::Resource) -> Result<(), fidl::Error> {
11353        self.control_handle.inner.send::<VmexResourceGetResponse>(
11354            (resource,),
11355            self.tx_id,
11356            0x33db32deed650699,
11357            fidl::encoding::DynamicFlags::empty(),
11358        )
11359    }
11360}
11361
11362mod internal {
11363    use super::*;
11364
11365    impl fidl::encoding::ResourceTypeMarker for CounterGetInspectVmoResponse {
11366        type Borrowed<'a> = &'a mut Self;
11367        fn take_or_borrow<'a>(
11368            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11369        ) -> Self::Borrowed<'a> {
11370            value
11371        }
11372    }
11373
11374    unsafe impl fidl::encoding::TypeMarker for CounterGetInspectVmoResponse {
11375        type Owned = Self;
11376
11377        #[inline(always)]
11378        fn inline_align(_context: fidl::encoding::Context) -> usize {
11379            8
11380        }
11381
11382        #[inline(always)]
11383        fn inline_size(_context: fidl::encoding::Context) -> usize {
11384            24
11385        }
11386    }
11387
11388    unsafe impl
11389        fidl::encoding::Encode<
11390            CounterGetInspectVmoResponse,
11391            fidl::encoding::DefaultFuchsiaResourceDialect,
11392        > for &mut CounterGetInspectVmoResponse
11393    {
11394        #[inline]
11395        unsafe fn encode(
11396            self,
11397            encoder: &mut fidl::encoding::Encoder<
11398                '_,
11399                fidl::encoding::DefaultFuchsiaResourceDialect,
11400            >,
11401            offset: usize,
11402            _depth: fidl::encoding::Depth,
11403        ) -> fidl::Result<()> {
11404            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11405            // Delegate to tuple encoding.
11406            fidl::encoding::Encode::<CounterGetInspectVmoResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11407                (
11408                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
11409                    <fidl_fuchsia_mem::Buffer as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.buffer),
11410                ),
11411                encoder, offset, _depth
11412            )
11413        }
11414    }
11415    unsafe impl<
11416        T0: fidl::encoding::Encode<i32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11417        T1: fidl::encoding::Encode<
11418                fidl_fuchsia_mem::Buffer,
11419                fidl::encoding::DefaultFuchsiaResourceDialect,
11420            >,
11421    >
11422        fidl::encoding::Encode<
11423            CounterGetInspectVmoResponse,
11424            fidl::encoding::DefaultFuchsiaResourceDialect,
11425        > for (T0, T1)
11426    {
11427        #[inline]
11428        unsafe fn encode(
11429            self,
11430            encoder: &mut fidl::encoding::Encoder<
11431                '_,
11432                fidl::encoding::DefaultFuchsiaResourceDialect,
11433            >,
11434            offset: usize,
11435            depth: fidl::encoding::Depth,
11436        ) -> fidl::Result<()> {
11437            encoder.debug_check_bounds::<CounterGetInspectVmoResponse>(offset);
11438            // Zero out padding regions. There's no need to apply masks
11439            // because the unmasked parts will be overwritten by fields.
11440            unsafe {
11441                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11442                (ptr as *mut u64).write_unaligned(0);
11443            }
11444            // Write the fields.
11445            self.0.encode(encoder, offset + 0, depth)?;
11446            self.1.encode(encoder, offset + 8, depth)?;
11447            Ok(())
11448        }
11449    }
11450
11451    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11452        for CounterGetInspectVmoResponse
11453    {
11454        #[inline(always)]
11455        fn new_empty() -> Self {
11456            Self {
11457                status: fidl::new_empty!(i32, fidl::encoding::DefaultFuchsiaResourceDialect),
11458                buffer: fidl::new_empty!(
11459                    fidl_fuchsia_mem::Buffer,
11460                    fidl::encoding::DefaultFuchsiaResourceDialect
11461                ),
11462            }
11463        }
11464
11465        #[inline]
11466        unsafe fn decode(
11467            &mut self,
11468            decoder: &mut fidl::encoding::Decoder<
11469                '_,
11470                fidl::encoding::DefaultFuchsiaResourceDialect,
11471            >,
11472            offset: usize,
11473            _depth: fidl::encoding::Depth,
11474        ) -> fidl::Result<()> {
11475            decoder.debug_check_bounds::<Self>(offset);
11476            // Verify that padding bytes are zero.
11477            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11478            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11479            let mask = 0xffffffff00000000u64;
11480            let maskedval = padval & mask;
11481            if maskedval != 0 {
11482                return Err(fidl::Error::NonZeroPadding {
11483                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11484                });
11485            }
11486            fidl::decode!(
11487                i32,
11488                fidl::encoding::DefaultFuchsiaResourceDialect,
11489                &mut self.status,
11490                decoder,
11491                offset + 0,
11492                _depth
11493            )?;
11494            fidl::decode!(
11495                fidl_fuchsia_mem::Buffer,
11496                fidl::encoding::DefaultFuchsiaResourceDialect,
11497                &mut self.buffer,
11498                decoder,
11499                offset + 8,
11500                _depth
11501            )?;
11502            Ok(())
11503        }
11504    }
11505
11506    impl fidl::encoding::ResourceTypeMarker for CpuResourceGetResponse {
11507        type Borrowed<'a> = &'a mut Self;
11508        fn take_or_borrow<'a>(
11509            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11510        ) -> Self::Borrowed<'a> {
11511            value
11512        }
11513    }
11514
11515    unsafe impl fidl::encoding::TypeMarker for CpuResourceGetResponse {
11516        type Owned = Self;
11517
11518        #[inline(always)]
11519        fn inline_align(_context: fidl::encoding::Context) -> usize {
11520            4
11521        }
11522
11523        #[inline(always)]
11524        fn inline_size(_context: fidl::encoding::Context) -> usize {
11525            4
11526        }
11527    }
11528
11529    unsafe impl
11530        fidl::encoding::Encode<
11531            CpuResourceGetResponse,
11532            fidl::encoding::DefaultFuchsiaResourceDialect,
11533        > for &mut CpuResourceGetResponse
11534    {
11535        #[inline]
11536        unsafe fn encode(
11537            self,
11538            encoder: &mut fidl::encoding::Encoder<
11539                '_,
11540                fidl::encoding::DefaultFuchsiaResourceDialect,
11541            >,
11542            offset: usize,
11543            _depth: fidl::encoding::Depth,
11544        ) -> fidl::Result<()> {
11545            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11546            // Delegate to tuple encoding.
11547            fidl::encoding::Encode::<
11548                CpuResourceGetResponse,
11549                fidl::encoding::DefaultFuchsiaResourceDialect,
11550            >::encode(
11551                (<fidl::encoding::HandleType<
11552                    fidl::Resource,
11553                    { fidl::ObjectType::RESOURCE.into_raw() },
11554                    2147483648,
11555                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11556                    &mut self.resource
11557                ),),
11558                encoder,
11559                offset,
11560                _depth,
11561            )
11562        }
11563    }
11564    unsafe impl<
11565        T0: fidl::encoding::Encode<
11566                fidl::encoding::HandleType<
11567                    fidl::Resource,
11568                    { fidl::ObjectType::RESOURCE.into_raw() },
11569                    2147483648,
11570                >,
11571                fidl::encoding::DefaultFuchsiaResourceDialect,
11572            >,
11573    >
11574        fidl::encoding::Encode<
11575            CpuResourceGetResponse,
11576            fidl::encoding::DefaultFuchsiaResourceDialect,
11577        > for (T0,)
11578    {
11579        #[inline]
11580        unsafe fn encode(
11581            self,
11582            encoder: &mut fidl::encoding::Encoder<
11583                '_,
11584                fidl::encoding::DefaultFuchsiaResourceDialect,
11585            >,
11586            offset: usize,
11587            depth: fidl::encoding::Depth,
11588        ) -> fidl::Result<()> {
11589            encoder.debug_check_bounds::<CpuResourceGetResponse>(offset);
11590            // Zero out padding regions. There's no need to apply masks
11591            // because the unmasked parts will be overwritten by fields.
11592            // Write the fields.
11593            self.0.encode(encoder, offset + 0, depth)?;
11594            Ok(())
11595        }
11596    }
11597
11598    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11599        for CpuResourceGetResponse
11600    {
11601        #[inline(always)]
11602        fn new_empty() -> Self {
11603            Self {
11604                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11605            }
11606        }
11607
11608        #[inline]
11609        unsafe fn decode(
11610            &mut self,
11611            decoder: &mut fidl::encoding::Decoder<
11612                '_,
11613                fidl::encoding::DefaultFuchsiaResourceDialect,
11614            >,
11615            offset: usize,
11616            _depth: fidl::encoding::Depth,
11617        ) -> fidl::Result<()> {
11618            decoder.debug_check_bounds::<Self>(offset);
11619            // Verify that padding bytes are zero.
11620            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11621            Ok(())
11622        }
11623    }
11624
11625    impl fidl::encoding::ResourceTypeMarker for DebugResourceGetResponse {
11626        type Borrowed<'a> = &'a mut Self;
11627        fn take_or_borrow<'a>(
11628            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11629        ) -> Self::Borrowed<'a> {
11630            value
11631        }
11632    }
11633
11634    unsafe impl fidl::encoding::TypeMarker for DebugResourceGetResponse {
11635        type Owned = Self;
11636
11637        #[inline(always)]
11638        fn inline_align(_context: fidl::encoding::Context) -> usize {
11639            4
11640        }
11641
11642        #[inline(always)]
11643        fn inline_size(_context: fidl::encoding::Context) -> usize {
11644            4
11645        }
11646    }
11647
11648    unsafe impl
11649        fidl::encoding::Encode<
11650            DebugResourceGetResponse,
11651            fidl::encoding::DefaultFuchsiaResourceDialect,
11652        > for &mut DebugResourceGetResponse
11653    {
11654        #[inline]
11655        unsafe fn encode(
11656            self,
11657            encoder: &mut fidl::encoding::Encoder<
11658                '_,
11659                fidl::encoding::DefaultFuchsiaResourceDialect,
11660            >,
11661            offset: usize,
11662            _depth: fidl::encoding::Depth,
11663        ) -> fidl::Result<()> {
11664            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11665            // Delegate to tuple encoding.
11666            fidl::encoding::Encode::<
11667                DebugResourceGetResponse,
11668                fidl::encoding::DefaultFuchsiaResourceDialect,
11669            >::encode(
11670                (<fidl::encoding::HandleType<
11671                    fidl::Resource,
11672                    { fidl::ObjectType::RESOURCE.into_raw() },
11673                    2147483648,
11674                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11675                    &mut self.resource
11676                ),),
11677                encoder,
11678                offset,
11679                _depth,
11680            )
11681        }
11682    }
11683    unsafe impl<
11684        T0: fidl::encoding::Encode<
11685                fidl::encoding::HandleType<
11686                    fidl::Resource,
11687                    { fidl::ObjectType::RESOURCE.into_raw() },
11688                    2147483648,
11689                >,
11690                fidl::encoding::DefaultFuchsiaResourceDialect,
11691            >,
11692    >
11693        fidl::encoding::Encode<
11694            DebugResourceGetResponse,
11695            fidl::encoding::DefaultFuchsiaResourceDialect,
11696        > for (T0,)
11697    {
11698        #[inline]
11699        unsafe fn encode(
11700            self,
11701            encoder: &mut fidl::encoding::Encoder<
11702                '_,
11703                fidl::encoding::DefaultFuchsiaResourceDialect,
11704            >,
11705            offset: usize,
11706            depth: fidl::encoding::Depth,
11707        ) -> fidl::Result<()> {
11708            encoder.debug_check_bounds::<DebugResourceGetResponse>(offset);
11709            // Zero out padding regions. There's no need to apply masks
11710            // because the unmasked parts will be overwritten by fields.
11711            // Write the fields.
11712            self.0.encode(encoder, offset + 0, depth)?;
11713            Ok(())
11714        }
11715    }
11716
11717    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11718        for DebugResourceGetResponse
11719    {
11720        #[inline(always)]
11721        fn new_empty() -> Self {
11722            Self {
11723                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11724            }
11725        }
11726
11727        #[inline]
11728        unsafe fn decode(
11729            &mut self,
11730            decoder: &mut fidl::encoding::Decoder<
11731                '_,
11732                fidl::encoding::DefaultFuchsiaResourceDialect,
11733            >,
11734            offset: usize,
11735            _depth: fidl::encoding::Depth,
11736        ) -> fidl::Result<()> {
11737            decoder.debug_check_bounds::<Self>(offset);
11738            // Verify that padding bytes are zero.
11739            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11740            Ok(())
11741        }
11742    }
11743
11744    impl fidl::encoding::ResourceTypeMarker for DebuglogResourceGetResponse {
11745        type Borrowed<'a> = &'a mut Self;
11746        fn take_or_borrow<'a>(
11747            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11748        ) -> Self::Borrowed<'a> {
11749            value
11750        }
11751    }
11752
11753    unsafe impl fidl::encoding::TypeMarker for DebuglogResourceGetResponse {
11754        type Owned = Self;
11755
11756        #[inline(always)]
11757        fn inline_align(_context: fidl::encoding::Context) -> usize {
11758            4
11759        }
11760
11761        #[inline(always)]
11762        fn inline_size(_context: fidl::encoding::Context) -> usize {
11763            4
11764        }
11765    }
11766
11767    unsafe impl
11768        fidl::encoding::Encode<
11769            DebuglogResourceGetResponse,
11770            fidl::encoding::DefaultFuchsiaResourceDialect,
11771        > for &mut DebuglogResourceGetResponse
11772    {
11773        #[inline]
11774        unsafe fn encode(
11775            self,
11776            encoder: &mut fidl::encoding::Encoder<
11777                '_,
11778                fidl::encoding::DefaultFuchsiaResourceDialect,
11779            >,
11780            offset: usize,
11781            _depth: fidl::encoding::Depth,
11782        ) -> fidl::Result<()> {
11783            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11784            // Delegate to tuple encoding.
11785            fidl::encoding::Encode::<
11786                DebuglogResourceGetResponse,
11787                fidl::encoding::DefaultFuchsiaResourceDialect,
11788            >::encode(
11789                (<fidl::encoding::HandleType<
11790                    fidl::Resource,
11791                    { fidl::ObjectType::RESOURCE.into_raw() },
11792                    2147483648,
11793                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11794                    &mut self.resource
11795                ),),
11796                encoder,
11797                offset,
11798                _depth,
11799            )
11800        }
11801    }
11802    unsafe impl<
11803        T0: fidl::encoding::Encode<
11804                fidl::encoding::HandleType<
11805                    fidl::Resource,
11806                    { fidl::ObjectType::RESOURCE.into_raw() },
11807                    2147483648,
11808                >,
11809                fidl::encoding::DefaultFuchsiaResourceDialect,
11810            >,
11811    >
11812        fidl::encoding::Encode<
11813            DebuglogResourceGetResponse,
11814            fidl::encoding::DefaultFuchsiaResourceDialect,
11815        > for (T0,)
11816    {
11817        #[inline]
11818        unsafe fn encode(
11819            self,
11820            encoder: &mut fidl::encoding::Encoder<
11821                '_,
11822                fidl::encoding::DefaultFuchsiaResourceDialect,
11823            >,
11824            offset: usize,
11825            depth: fidl::encoding::Depth,
11826        ) -> fidl::Result<()> {
11827            encoder.debug_check_bounds::<DebuglogResourceGetResponse>(offset);
11828            // Zero out padding regions. There's no need to apply masks
11829            // because the unmasked parts will be overwritten by fields.
11830            // Write the fields.
11831            self.0.encode(encoder, offset + 0, depth)?;
11832            Ok(())
11833        }
11834    }
11835
11836    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11837        for DebuglogResourceGetResponse
11838    {
11839        #[inline(always)]
11840        fn new_empty() -> Self {
11841            Self {
11842                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11843            }
11844        }
11845
11846        #[inline]
11847        unsafe fn decode(
11848            &mut self,
11849            decoder: &mut fidl::encoding::Decoder<
11850                '_,
11851                fidl::encoding::DefaultFuchsiaResourceDialect,
11852            >,
11853            offset: usize,
11854            _depth: fidl::encoding::Depth,
11855        ) -> fidl::Result<()> {
11856            decoder.debug_check_bounds::<Self>(offset);
11857            // Verify that padding bytes are zero.
11858            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11859            Ok(())
11860        }
11861    }
11862
11863    impl fidl::encoding::ResourceTypeMarker for EnergyInfoResourceGetResponse {
11864        type Borrowed<'a> = &'a mut Self;
11865        fn take_or_borrow<'a>(
11866            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11867        ) -> Self::Borrowed<'a> {
11868            value
11869        }
11870    }
11871
11872    unsafe impl fidl::encoding::TypeMarker for EnergyInfoResourceGetResponse {
11873        type Owned = Self;
11874
11875        #[inline(always)]
11876        fn inline_align(_context: fidl::encoding::Context) -> usize {
11877            4
11878        }
11879
11880        #[inline(always)]
11881        fn inline_size(_context: fidl::encoding::Context) -> usize {
11882            4
11883        }
11884    }
11885
11886    unsafe impl
11887        fidl::encoding::Encode<
11888            EnergyInfoResourceGetResponse,
11889            fidl::encoding::DefaultFuchsiaResourceDialect,
11890        > for &mut EnergyInfoResourceGetResponse
11891    {
11892        #[inline]
11893        unsafe fn encode(
11894            self,
11895            encoder: &mut fidl::encoding::Encoder<
11896                '_,
11897                fidl::encoding::DefaultFuchsiaResourceDialect,
11898            >,
11899            offset: usize,
11900            _depth: fidl::encoding::Depth,
11901        ) -> fidl::Result<()> {
11902            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11903            // Delegate to tuple encoding.
11904            fidl::encoding::Encode::<
11905                EnergyInfoResourceGetResponse,
11906                fidl::encoding::DefaultFuchsiaResourceDialect,
11907            >::encode(
11908                (<fidl::encoding::HandleType<
11909                    fidl::Resource,
11910                    { fidl::ObjectType::RESOURCE.into_raw() },
11911                    2147483648,
11912                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11913                    &mut self.resource
11914                ),),
11915                encoder,
11916                offset,
11917                _depth,
11918            )
11919        }
11920    }
11921    unsafe impl<
11922        T0: fidl::encoding::Encode<
11923                fidl::encoding::HandleType<
11924                    fidl::Resource,
11925                    { fidl::ObjectType::RESOURCE.into_raw() },
11926                    2147483648,
11927                >,
11928                fidl::encoding::DefaultFuchsiaResourceDialect,
11929            >,
11930    >
11931        fidl::encoding::Encode<
11932            EnergyInfoResourceGetResponse,
11933            fidl::encoding::DefaultFuchsiaResourceDialect,
11934        > for (T0,)
11935    {
11936        #[inline]
11937        unsafe fn encode(
11938            self,
11939            encoder: &mut fidl::encoding::Encoder<
11940                '_,
11941                fidl::encoding::DefaultFuchsiaResourceDialect,
11942            >,
11943            offset: usize,
11944            depth: fidl::encoding::Depth,
11945        ) -> fidl::Result<()> {
11946            encoder.debug_check_bounds::<EnergyInfoResourceGetResponse>(offset);
11947            // Zero out padding regions. There's no need to apply masks
11948            // because the unmasked parts will be overwritten by fields.
11949            // Write the fields.
11950            self.0.encode(encoder, offset + 0, depth)?;
11951            Ok(())
11952        }
11953    }
11954
11955    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11956        for EnergyInfoResourceGetResponse
11957    {
11958        #[inline(always)]
11959        fn new_empty() -> Self {
11960            Self {
11961                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11962            }
11963        }
11964
11965        #[inline]
11966        unsafe fn decode(
11967            &mut self,
11968            decoder: &mut fidl::encoding::Decoder<
11969                '_,
11970                fidl::encoding::DefaultFuchsiaResourceDialect,
11971            >,
11972            offset: usize,
11973            _depth: fidl::encoding::Depth,
11974        ) -> fidl::Result<()> {
11975            decoder.debug_check_bounds::<Self>(offset);
11976            // Verify that padding bytes are zero.
11977            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
11978            Ok(())
11979        }
11980    }
11981
11982    impl fidl::encoding::ResourceTypeMarker for HypervisorResourceGetResponse {
11983        type Borrowed<'a> = &'a mut Self;
11984        fn take_or_borrow<'a>(
11985            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11986        ) -> Self::Borrowed<'a> {
11987            value
11988        }
11989    }
11990
11991    unsafe impl fidl::encoding::TypeMarker for HypervisorResourceGetResponse {
11992        type Owned = Self;
11993
11994        #[inline(always)]
11995        fn inline_align(_context: fidl::encoding::Context) -> usize {
11996            4
11997        }
11998
11999        #[inline(always)]
12000        fn inline_size(_context: fidl::encoding::Context) -> usize {
12001            4
12002        }
12003    }
12004
12005    unsafe impl
12006        fidl::encoding::Encode<
12007            HypervisorResourceGetResponse,
12008            fidl::encoding::DefaultFuchsiaResourceDialect,
12009        > for &mut HypervisorResourceGetResponse
12010    {
12011        #[inline]
12012        unsafe fn encode(
12013            self,
12014            encoder: &mut fidl::encoding::Encoder<
12015                '_,
12016                fidl::encoding::DefaultFuchsiaResourceDialect,
12017            >,
12018            offset: usize,
12019            _depth: fidl::encoding::Depth,
12020        ) -> fidl::Result<()> {
12021            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12022            // Delegate to tuple encoding.
12023            fidl::encoding::Encode::<
12024                HypervisorResourceGetResponse,
12025                fidl::encoding::DefaultFuchsiaResourceDialect,
12026            >::encode(
12027                (<fidl::encoding::HandleType<
12028                    fidl::Resource,
12029                    { fidl::ObjectType::RESOURCE.into_raw() },
12030                    2147483648,
12031                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12032                    &mut self.resource
12033                ),),
12034                encoder,
12035                offset,
12036                _depth,
12037            )
12038        }
12039    }
12040    unsafe impl<
12041        T0: fidl::encoding::Encode<
12042                fidl::encoding::HandleType<
12043                    fidl::Resource,
12044                    { fidl::ObjectType::RESOURCE.into_raw() },
12045                    2147483648,
12046                >,
12047                fidl::encoding::DefaultFuchsiaResourceDialect,
12048            >,
12049    >
12050        fidl::encoding::Encode<
12051            HypervisorResourceGetResponse,
12052            fidl::encoding::DefaultFuchsiaResourceDialect,
12053        > for (T0,)
12054    {
12055        #[inline]
12056        unsafe fn encode(
12057            self,
12058            encoder: &mut fidl::encoding::Encoder<
12059                '_,
12060                fidl::encoding::DefaultFuchsiaResourceDialect,
12061            >,
12062            offset: usize,
12063            depth: fidl::encoding::Depth,
12064        ) -> fidl::Result<()> {
12065            encoder.debug_check_bounds::<HypervisorResourceGetResponse>(offset);
12066            // Zero out padding regions. There's no need to apply masks
12067            // because the unmasked parts will be overwritten by fields.
12068            // Write the fields.
12069            self.0.encode(encoder, offset + 0, depth)?;
12070            Ok(())
12071        }
12072    }
12073
12074    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12075        for HypervisorResourceGetResponse
12076    {
12077        #[inline(always)]
12078        fn new_empty() -> Self {
12079            Self {
12080                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12081            }
12082        }
12083
12084        #[inline]
12085        unsafe fn decode(
12086            &mut self,
12087            decoder: &mut fidl::encoding::Decoder<
12088                '_,
12089                fidl::encoding::DefaultFuchsiaResourceDialect,
12090            >,
12091            offset: usize,
12092            _depth: fidl::encoding::Depth,
12093        ) -> fidl::Result<()> {
12094            decoder.debug_check_bounds::<Self>(offset);
12095            // Verify that padding bytes are zero.
12096            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12097            Ok(())
12098        }
12099    }
12100
12101    impl fidl::encoding::ResourceTypeMarker for InfoResourceGetResponse {
12102        type Borrowed<'a> = &'a mut Self;
12103        fn take_or_borrow<'a>(
12104            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12105        ) -> Self::Borrowed<'a> {
12106            value
12107        }
12108    }
12109
12110    unsafe impl fidl::encoding::TypeMarker for InfoResourceGetResponse {
12111        type Owned = Self;
12112
12113        #[inline(always)]
12114        fn inline_align(_context: fidl::encoding::Context) -> usize {
12115            4
12116        }
12117
12118        #[inline(always)]
12119        fn inline_size(_context: fidl::encoding::Context) -> usize {
12120            4
12121        }
12122    }
12123
12124    unsafe impl
12125        fidl::encoding::Encode<
12126            InfoResourceGetResponse,
12127            fidl::encoding::DefaultFuchsiaResourceDialect,
12128        > for &mut InfoResourceGetResponse
12129    {
12130        #[inline]
12131        unsafe fn encode(
12132            self,
12133            encoder: &mut fidl::encoding::Encoder<
12134                '_,
12135                fidl::encoding::DefaultFuchsiaResourceDialect,
12136            >,
12137            offset: usize,
12138            _depth: fidl::encoding::Depth,
12139        ) -> fidl::Result<()> {
12140            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12141            // Delegate to tuple encoding.
12142            fidl::encoding::Encode::<
12143                InfoResourceGetResponse,
12144                fidl::encoding::DefaultFuchsiaResourceDialect,
12145            >::encode(
12146                (<fidl::encoding::HandleType<
12147                    fidl::Resource,
12148                    { fidl::ObjectType::RESOURCE.into_raw() },
12149                    2147483648,
12150                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12151                    &mut self.resource
12152                ),),
12153                encoder,
12154                offset,
12155                _depth,
12156            )
12157        }
12158    }
12159    unsafe impl<
12160        T0: fidl::encoding::Encode<
12161                fidl::encoding::HandleType<
12162                    fidl::Resource,
12163                    { fidl::ObjectType::RESOURCE.into_raw() },
12164                    2147483648,
12165                >,
12166                fidl::encoding::DefaultFuchsiaResourceDialect,
12167            >,
12168    >
12169        fidl::encoding::Encode<
12170            InfoResourceGetResponse,
12171            fidl::encoding::DefaultFuchsiaResourceDialect,
12172        > for (T0,)
12173    {
12174        #[inline]
12175        unsafe fn encode(
12176            self,
12177            encoder: &mut fidl::encoding::Encoder<
12178                '_,
12179                fidl::encoding::DefaultFuchsiaResourceDialect,
12180            >,
12181            offset: usize,
12182            depth: fidl::encoding::Depth,
12183        ) -> fidl::Result<()> {
12184            encoder.debug_check_bounds::<InfoResourceGetResponse>(offset);
12185            // Zero out padding regions. There's no need to apply masks
12186            // because the unmasked parts will be overwritten by fields.
12187            // Write the fields.
12188            self.0.encode(encoder, offset + 0, depth)?;
12189            Ok(())
12190        }
12191    }
12192
12193    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12194        for InfoResourceGetResponse
12195    {
12196        #[inline(always)]
12197        fn new_empty() -> Self {
12198            Self {
12199                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12200            }
12201        }
12202
12203        #[inline]
12204        unsafe fn decode(
12205            &mut self,
12206            decoder: &mut fidl::encoding::Decoder<
12207                '_,
12208                fidl::encoding::DefaultFuchsiaResourceDialect,
12209            >,
12210            offset: usize,
12211            _depth: fidl::encoding::Depth,
12212        ) -> fidl::Result<()> {
12213            decoder.debug_check_bounds::<Self>(offset);
12214            // Verify that padding bytes are zero.
12215            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12216            Ok(())
12217        }
12218    }
12219
12220    impl fidl::encoding::ResourceTypeMarker for IommuResourceGetResponse {
12221        type Borrowed<'a> = &'a mut Self;
12222        fn take_or_borrow<'a>(
12223            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12224        ) -> Self::Borrowed<'a> {
12225            value
12226        }
12227    }
12228
12229    unsafe impl fidl::encoding::TypeMarker for IommuResourceGetResponse {
12230        type Owned = Self;
12231
12232        #[inline(always)]
12233        fn inline_align(_context: fidl::encoding::Context) -> usize {
12234            4
12235        }
12236
12237        #[inline(always)]
12238        fn inline_size(_context: fidl::encoding::Context) -> usize {
12239            4
12240        }
12241    }
12242
12243    unsafe impl
12244        fidl::encoding::Encode<
12245            IommuResourceGetResponse,
12246            fidl::encoding::DefaultFuchsiaResourceDialect,
12247        > for &mut IommuResourceGetResponse
12248    {
12249        #[inline]
12250        unsafe fn encode(
12251            self,
12252            encoder: &mut fidl::encoding::Encoder<
12253                '_,
12254                fidl::encoding::DefaultFuchsiaResourceDialect,
12255            >,
12256            offset: usize,
12257            _depth: fidl::encoding::Depth,
12258        ) -> fidl::Result<()> {
12259            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12260            // Delegate to tuple encoding.
12261            fidl::encoding::Encode::<
12262                IommuResourceGetResponse,
12263                fidl::encoding::DefaultFuchsiaResourceDialect,
12264            >::encode(
12265                (<fidl::encoding::HandleType<
12266                    fidl::Resource,
12267                    { fidl::ObjectType::RESOURCE.into_raw() },
12268                    2147483648,
12269                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12270                    &mut self.resource
12271                ),),
12272                encoder,
12273                offset,
12274                _depth,
12275            )
12276        }
12277    }
12278    unsafe impl<
12279        T0: fidl::encoding::Encode<
12280                fidl::encoding::HandleType<
12281                    fidl::Resource,
12282                    { fidl::ObjectType::RESOURCE.into_raw() },
12283                    2147483648,
12284                >,
12285                fidl::encoding::DefaultFuchsiaResourceDialect,
12286            >,
12287    >
12288        fidl::encoding::Encode<
12289            IommuResourceGetResponse,
12290            fidl::encoding::DefaultFuchsiaResourceDialect,
12291        > for (T0,)
12292    {
12293        #[inline]
12294        unsafe fn encode(
12295            self,
12296            encoder: &mut fidl::encoding::Encoder<
12297                '_,
12298                fidl::encoding::DefaultFuchsiaResourceDialect,
12299            >,
12300            offset: usize,
12301            depth: fidl::encoding::Depth,
12302        ) -> fidl::Result<()> {
12303            encoder.debug_check_bounds::<IommuResourceGetResponse>(offset);
12304            // Zero out padding regions. There's no need to apply masks
12305            // because the unmasked parts will be overwritten by fields.
12306            // Write the fields.
12307            self.0.encode(encoder, offset + 0, depth)?;
12308            Ok(())
12309        }
12310    }
12311
12312    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12313        for IommuResourceGetResponse
12314    {
12315        #[inline(always)]
12316        fn new_empty() -> Self {
12317            Self {
12318                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12319            }
12320        }
12321
12322        #[inline]
12323        unsafe fn decode(
12324            &mut self,
12325            decoder: &mut fidl::encoding::Decoder<
12326                '_,
12327                fidl::encoding::DefaultFuchsiaResourceDialect,
12328            >,
12329            offset: usize,
12330            _depth: fidl::encoding::Depth,
12331        ) -> fidl::Result<()> {
12332            decoder.debug_check_bounds::<Self>(offset);
12333            // Verify that padding bytes are zero.
12334            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12335            Ok(())
12336        }
12337    }
12338
12339    impl fidl::encoding::ResourceTypeMarker for IoportResourceGetResponse {
12340        type Borrowed<'a> = &'a mut Self;
12341        fn take_or_borrow<'a>(
12342            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12343        ) -> Self::Borrowed<'a> {
12344            value
12345        }
12346    }
12347
12348    unsafe impl fidl::encoding::TypeMarker for IoportResourceGetResponse {
12349        type Owned = Self;
12350
12351        #[inline(always)]
12352        fn inline_align(_context: fidl::encoding::Context) -> usize {
12353            4
12354        }
12355
12356        #[inline(always)]
12357        fn inline_size(_context: fidl::encoding::Context) -> usize {
12358            4
12359        }
12360    }
12361
12362    unsafe impl
12363        fidl::encoding::Encode<
12364            IoportResourceGetResponse,
12365            fidl::encoding::DefaultFuchsiaResourceDialect,
12366        > for &mut IoportResourceGetResponse
12367    {
12368        #[inline]
12369        unsafe fn encode(
12370            self,
12371            encoder: &mut fidl::encoding::Encoder<
12372                '_,
12373                fidl::encoding::DefaultFuchsiaResourceDialect,
12374            >,
12375            offset: usize,
12376            _depth: fidl::encoding::Depth,
12377        ) -> fidl::Result<()> {
12378            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12379            // Delegate to tuple encoding.
12380            fidl::encoding::Encode::<
12381                IoportResourceGetResponse,
12382                fidl::encoding::DefaultFuchsiaResourceDialect,
12383            >::encode(
12384                (<fidl::encoding::HandleType<
12385                    fidl::Resource,
12386                    { fidl::ObjectType::RESOURCE.into_raw() },
12387                    2147483648,
12388                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12389                    &mut self.resource
12390                ),),
12391                encoder,
12392                offset,
12393                _depth,
12394            )
12395        }
12396    }
12397    unsafe impl<
12398        T0: fidl::encoding::Encode<
12399                fidl::encoding::HandleType<
12400                    fidl::Resource,
12401                    { fidl::ObjectType::RESOURCE.into_raw() },
12402                    2147483648,
12403                >,
12404                fidl::encoding::DefaultFuchsiaResourceDialect,
12405            >,
12406    >
12407        fidl::encoding::Encode<
12408            IoportResourceGetResponse,
12409            fidl::encoding::DefaultFuchsiaResourceDialect,
12410        > for (T0,)
12411    {
12412        #[inline]
12413        unsafe fn encode(
12414            self,
12415            encoder: &mut fidl::encoding::Encoder<
12416                '_,
12417                fidl::encoding::DefaultFuchsiaResourceDialect,
12418            >,
12419            offset: usize,
12420            depth: fidl::encoding::Depth,
12421        ) -> fidl::Result<()> {
12422            encoder.debug_check_bounds::<IoportResourceGetResponse>(offset);
12423            // Zero out padding regions. There's no need to apply masks
12424            // because the unmasked parts will be overwritten by fields.
12425            // Write the fields.
12426            self.0.encode(encoder, offset + 0, depth)?;
12427            Ok(())
12428        }
12429    }
12430
12431    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12432        for IoportResourceGetResponse
12433    {
12434        #[inline(always)]
12435        fn new_empty() -> Self {
12436            Self {
12437                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12438            }
12439        }
12440
12441        #[inline]
12442        unsafe fn decode(
12443            &mut self,
12444            decoder: &mut fidl::encoding::Decoder<
12445                '_,
12446                fidl::encoding::DefaultFuchsiaResourceDialect,
12447            >,
12448            offset: usize,
12449            _depth: fidl::encoding::Depth,
12450        ) -> fidl::Result<()> {
12451            decoder.debug_check_bounds::<Self>(offset);
12452            // Verify that padding bytes are zero.
12453            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12454            Ok(())
12455        }
12456    }
12457
12458    impl fidl::encoding::ResourceTypeMarker for IrqResourceGetResponse {
12459        type Borrowed<'a> = &'a mut Self;
12460        fn take_or_borrow<'a>(
12461            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12462        ) -> Self::Borrowed<'a> {
12463            value
12464        }
12465    }
12466
12467    unsafe impl fidl::encoding::TypeMarker for IrqResourceGetResponse {
12468        type Owned = Self;
12469
12470        #[inline(always)]
12471        fn inline_align(_context: fidl::encoding::Context) -> usize {
12472            4
12473        }
12474
12475        #[inline(always)]
12476        fn inline_size(_context: fidl::encoding::Context) -> usize {
12477            4
12478        }
12479    }
12480
12481    unsafe impl
12482        fidl::encoding::Encode<
12483            IrqResourceGetResponse,
12484            fidl::encoding::DefaultFuchsiaResourceDialect,
12485        > for &mut IrqResourceGetResponse
12486    {
12487        #[inline]
12488        unsafe fn encode(
12489            self,
12490            encoder: &mut fidl::encoding::Encoder<
12491                '_,
12492                fidl::encoding::DefaultFuchsiaResourceDialect,
12493            >,
12494            offset: usize,
12495            _depth: fidl::encoding::Depth,
12496        ) -> fidl::Result<()> {
12497            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12498            // Delegate to tuple encoding.
12499            fidl::encoding::Encode::<
12500                IrqResourceGetResponse,
12501                fidl::encoding::DefaultFuchsiaResourceDialect,
12502            >::encode(
12503                (<fidl::encoding::HandleType<
12504                    fidl::Resource,
12505                    { fidl::ObjectType::RESOURCE.into_raw() },
12506                    2147483648,
12507                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12508                    &mut self.resource
12509                ),),
12510                encoder,
12511                offset,
12512                _depth,
12513            )
12514        }
12515    }
12516    unsafe impl<
12517        T0: fidl::encoding::Encode<
12518                fidl::encoding::HandleType<
12519                    fidl::Resource,
12520                    { fidl::ObjectType::RESOURCE.into_raw() },
12521                    2147483648,
12522                >,
12523                fidl::encoding::DefaultFuchsiaResourceDialect,
12524            >,
12525    >
12526        fidl::encoding::Encode<
12527            IrqResourceGetResponse,
12528            fidl::encoding::DefaultFuchsiaResourceDialect,
12529        > for (T0,)
12530    {
12531        #[inline]
12532        unsafe fn encode(
12533            self,
12534            encoder: &mut fidl::encoding::Encoder<
12535                '_,
12536                fidl::encoding::DefaultFuchsiaResourceDialect,
12537            >,
12538            offset: usize,
12539            depth: fidl::encoding::Depth,
12540        ) -> fidl::Result<()> {
12541            encoder.debug_check_bounds::<IrqResourceGetResponse>(offset);
12542            // Zero out padding regions. There's no need to apply masks
12543            // because the unmasked parts will be overwritten by fields.
12544            // Write the fields.
12545            self.0.encode(encoder, offset + 0, depth)?;
12546            Ok(())
12547        }
12548    }
12549
12550    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12551        for IrqResourceGetResponse
12552    {
12553        #[inline(always)]
12554        fn new_empty() -> Self {
12555            Self {
12556                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12557            }
12558        }
12559
12560        #[inline]
12561        unsafe fn decode(
12562            &mut self,
12563            decoder: &mut fidl::encoding::Decoder<
12564                '_,
12565                fidl::encoding::DefaultFuchsiaResourceDialect,
12566            >,
12567            offset: usize,
12568            _depth: fidl::encoding::Depth,
12569        ) -> fidl::Result<()> {
12570            decoder.debug_check_bounds::<Self>(offset);
12571            // Verify that padding bytes are zero.
12572            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12573            Ok(())
12574        }
12575    }
12576
12577    impl fidl::encoding::ResourceTypeMarker for MmioResourceGetResponse {
12578        type Borrowed<'a> = &'a mut Self;
12579        fn take_or_borrow<'a>(
12580            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12581        ) -> Self::Borrowed<'a> {
12582            value
12583        }
12584    }
12585
12586    unsafe impl fidl::encoding::TypeMarker for MmioResourceGetResponse {
12587        type Owned = Self;
12588
12589        #[inline(always)]
12590        fn inline_align(_context: fidl::encoding::Context) -> usize {
12591            4
12592        }
12593
12594        #[inline(always)]
12595        fn inline_size(_context: fidl::encoding::Context) -> usize {
12596            4
12597        }
12598    }
12599
12600    unsafe impl
12601        fidl::encoding::Encode<
12602            MmioResourceGetResponse,
12603            fidl::encoding::DefaultFuchsiaResourceDialect,
12604        > for &mut MmioResourceGetResponse
12605    {
12606        #[inline]
12607        unsafe fn encode(
12608            self,
12609            encoder: &mut fidl::encoding::Encoder<
12610                '_,
12611                fidl::encoding::DefaultFuchsiaResourceDialect,
12612            >,
12613            offset: usize,
12614            _depth: fidl::encoding::Depth,
12615        ) -> fidl::Result<()> {
12616            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12617            // Delegate to tuple encoding.
12618            fidl::encoding::Encode::<
12619                MmioResourceGetResponse,
12620                fidl::encoding::DefaultFuchsiaResourceDialect,
12621            >::encode(
12622                (<fidl::encoding::HandleType<
12623                    fidl::Resource,
12624                    { fidl::ObjectType::RESOURCE.into_raw() },
12625                    2147483648,
12626                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12627                    &mut self.resource
12628                ),),
12629                encoder,
12630                offset,
12631                _depth,
12632            )
12633        }
12634    }
12635    unsafe impl<
12636        T0: fidl::encoding::Encode<
12637                fidl::encoding::HandleType<
12638                    fidl::Resource,
12639                    { fidl::ObjectType::RESOURCE.into_raw() },
12640                    2147483648,
12641                >,
12642                fidl::encoding::DefaultFuchsiaResourceDialect,
12643            >,
12644    >
12645        fidl::encoding::Encode<
12646            MmioResourceGetResponse,
12647            fidl::encoding::DefaultFuchsiaResourceDialect,
12648        > for (T0,)
12649    {
12650        #[inline]
12651        unsafe fn encode(
12652            self,
12653            encoder: &mut fidl::encoding::Encoder<
12654                '_,
12655                fidl::encoding::DefaultFuchsiaResourceDialect,
12656            >,
12657            offset: usize,
12658            depth: fidl::encoding::Depth,
12659        ) -> fidl::Result<()> {
12660            encoder.debug_check_bounds::<MmioResourceGetResponse>(offset);
12661            // Zero out padding regions. There's no need to apply masks
12662            // because the unmasked parts will be overwritten by fields.
12663            // Write the fields.
12664            self.0.encode(encoder, offset + 0, depth)?;
12665            Ok(())
12666        }
12667    }
12668
12669    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12670        for MmioResourceGetResponse
12671    {
12672        #[inline(always)]
12673        fn new_empty() -> Self {
12674            Self {
12675                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12676            }
12677        }
12678
12679        #[inline]
12680        unsafe fn decode(
12681            &mut self,
12682            decoder: &mut fidl::encoding::Decoder<
12683                '_,
12684                fidl::encoding::DefaultFuchsiaResourceDialect,
12685            >,
12686            offset: usize,
12687            _depth: fidl::encoding::Depth,
12688        ) -> fidl::Result<()> {
12689            decoder.debug_check_bounds::<Self>(offset);
12690            // Verify that padding bytes are zero.
12691            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12692            Ok(())
12693        }
12694    }
12695
12696    impl fidl::encoding::ResourceTypeMarker for MsiResourceGetResponse {
12697        type Borrowed<'a> = &'a mut Self;
12698        fn take_or_borrow<'a>(
12699            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12700        ) -> Self::Borrowed<'a> {
12701            value
12702        }
12703    }
12704
12705    unsafe impl fidl::encoding::TypeMarker for MsiResourceGetResponse {
12706        type Owned = Self;
12707
12708        #[inline(always)]
12709        fn inline_align(_context: fidl::encoding::Context) -> usize {
12710            4
12711        }
12712
12713        #[inline(always)]
12714        fn inline_size(_context: fidl::encoding::Context) -> usize {
12715            4
12716        }
12717    }
12718
12719    unsafe impl
12720        fidl::encoding::Encode<
12721            MsiResourceGetResponse,
12722            fidl::encoding::DefaultFuchsiaResourceDialect,
12723        > for &mut MsiResourceGetResponse
12724    {
12725        #[inline]
12726        unsafe fn encode(
12727            self,
12728            encoder: &mut fidl::encoding::Encoder<
12729                '_,
12730                fidl::encoding::DefaultFuchsiaResourceDialect,
12731            >,
12732            offset: usize,
12733            _depth: fidl::encoding::Depth,
12734        ) -> fidl::Result<()> {
12735            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12736            // Delegate to tuple encoding.
12737            fidl::encoding::Encode::<
12738                MsiResourceGetResponse,
12739                fidl::encoding::DefaultFuchsiaResourceDialect,
12740            >::encode(
12741                (<fidl::encoding::HandleType<
12742                    fidl::Resource,
12743                    { fidl::ObjectType::RESOURCE.into_raw() },
12744                    2147483648,
12745                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12746                    &mut self.resource
12747                ),),
12748                encoder,
12749                offset,
12750                _depth,
12751            )
12752        }
12753    }
12754    unsafe impl<
12755        T0: fidl::encoding::Encode<
12756                fidl::encoding::HandleType<
12757                    fidl::Resource,
12758                    { fidl::ObjectType::RESOURCE.into_raw() },
12759                    2147483648,
12760                >,
12761                fidl::encoding::DefaultFuchsiaResourceDialect,
12762            >,
12763    >
12764        fidl::encoding::Encode<
12765            MsiResourceGetResponse,
12766            fidl::encoding::DefaultFuchsiaResourceDialect,
12767        > for (T0,)
12768    {
12769        #[inline]
12770        unsafe fn encode(
12771            self,
12772            encoder: &mut fidl::encoding::Encoder<
12773                '_,
12774                fidl::encoding::DefaultFuchsiaResourceDialect,
12775            >,
12776            offset: usize,
12777            depth: fidl::encoding::Depth,
12778        ) -> fidl::Result<()> {
12779            encoder.debug_check_bounds::<MsiResourceGetResponse>(offset);
12780            // Zero out padding regions. There's no need to apply masks
12781            // because the unmasked parts will be overwritten by fields.
12782            // Write the fields.
12783            self.0.encode(encoder, offset + 0, depth)?;
12784            Ok(())
12785        }
12786    }
12787
12788    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12789        for MsiResourceGetResponse
12790    {
12791        #[inline(always)]
12792        fn new_empty() -> Self {
12793            Self {
12794                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12795            }
12796        }
12797
12798        #[inline]
12799        unsafe fn decode(
12800            &mut self,
12801            decoder: &mut fidl::encoding::Decoder<
12802                '_,
12803                fidl::encoding::DefaultFuchsiaResourceDialect,
12804            >,
12805            offset: usize,
12806            _depth: fidl::encoding::Depth,
12807        ) -> fidl::Result<()> {
12808            decoder.debug_check_bounds::<Self>(offset);
12809            // Verify that padding bytes are zero.
12810            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12811            Ok(())
12812        }
12813    }
12814
12815    impl fidl::encoding::ResourceTypeMarker for PowerResourceGetResponse {
12816        type Borrowed<'a> = &'a mut Self;
12817        fn take_or_borrow<'a>(
12818            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12819        ) -> Self::Borrowed<'a> {
12820            value
12821        }
12822    }
12823
12824    unsafe impl fidl::encoding::TypeMarker for PowerResourceGetResponse {
12825        type Owned = Self;
12826
12827        #[inline(always)]
12828        fn inline_align(_context: fidl::encoding::Context) -> usize {
12829            4
12830        }
12831
12832        #[inline(always)]
12833        fn inline_size(_context: fidl::encoding::Context) -> usize {
12834            4
12835        }
12836    }
12837
12838    unsafe impl
12839        fidl::encoding::Encode<
12840            PowerResourceGetResponse,
12841            fidl::encoding::DefaultFuchsiaResourceDialect,
12842        > for &mut PowerResourceGetResponse
12843    {
12844        #[inline]
12845        unsafe fn encode(
12846            self,
12847            encoder: &mut fidl::encoding::Encoder<
12848                '_,
12849                fidl::encoding::DefaultFuchsiaResourceDialect,
12850            >,
12851            offset: usize,
12852            _depth: fidl::encoding::Depth,
12853        ) -> fidl::Result<()> {
12854            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12855            // Delegate to tuple encoding.
12856            fidl::encoding::Encode::<
12857                PowerResourceGetResponse,
12858                fidl::encoding::DefaultFuchsiaResourceDialect,
12859            >::encode(
12860                (<fidl::encoding::HandleType<
12861                    fidl::Resource,
12862                    { fidl::ObjectType::RESOURCE.into_raw() },
12863                    2147483648,
12864                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12865                    &mut self.resource
12866                ),),
12867                encoder,
12868                offset,
12869                _depth,
12870            )
12871        }
12872    }
12873    unsafe impl<
12874        T0: fidl::encoding::Encode<
12875                fidl::encoding::HandleType<
12876                    fidl::Resource,
12877                    { fidl::ObjectType::RESOURCE.into_raw() },
12878                    2147483648,
12879                >,
12880                fidl::encoding::DefaultFuchsiaResourceDialect,
12881            >,
12882    >
12883        fidl::encoding::Encode<
12884            PowerResourceGetResponse,
12885            fidl::encoding::DefaultFuchsiaResourceDialect,
12886        > for (T0,)
12887    {
12888        #[inline]
12889        unsafe fn encode(
12890            self,
12891            encoder: &mut fidl::encoding::Encoder<
12892                '_,
12893                fidl::encoding::DefaultFuchsiaResourceDialect,
12894            >,
12895            offset: usize,
12896            depth: fidl::encoding::Depth,
12897        ) -> fidl::Result<()> {
12898            encoder.debug_check_bounds::<PowerResourceGetResponse>(offset);
12899            // Zero out padding regions. There's no need to apply masks
12900            // because the unmasked parts will be overwritten by fields.
12901            // Write the fields.
12902            self.0.encode(encoder, offset + 0, depth)?;
12903            Ok(())
12904        }
12905    }
12906
12907    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12908        for PowerResourceGetResponse
12909    {
12910        #[inline(always)]
12911        fn new_empty() -> Self {
12912            Self {
12913                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
12914            }
12915        }
12916
12917        #[inline]
12918        unsafe fn decode(
12919            &mut self,
12920            decoder: &mut fidl::encoding::Decoder<
12921                '_,
12922                fidl::encoding::DefaultFuchsiaResourceDialect,
12923            >,
12924            offset: usize,
12925            _depth: fidl::encoding::Depth,
12926        ) -> fidl::Result<()> {
12927            decoder.debug_check_bounds::<Self>(offset);
12928            // Verify that padding bytes are zero.
12929            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
12930            Ok(())
12931        }
12932    }
12933
12934    impl fidl::encoding::ResourceTypeMarker for ProfileResourceGetResponse {
12935        type Borrowed<'a> = &'a mut Self;
12936        fn take_or_borrow<'a>(
12937            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12938        ) -> Self::Borrowed<'a> {
12939            value
12940        }
12941    }
12942
12943    unsafe impl fidl::encoding::TypeMarker for ProfileResourceGetResponse {
12944        type Owned = Self;
12945
12946        #[inline(always)]
12947        fn inline_align(_context: fidl::encoding::Context) -> usize {
12948            4
12949        }
12950
12951        #[inline(always)]
12952        fn inline_size(_context: fidl::encoding::Context) -> usize {
12953            4
12954        }
12955    }
12956
12957    unsafe impl
12958        fidl::encoding::Encode<
12959            ProfileResourceGetResponse,
12960            fidl::encoding::DefaultFuchsiaResourceDialect,
12961        > for &mut ProfileResourceGetResponse
12962    {
12963        #[inline]
12964        unsafe fn encode(
12965            self,
12966            encoder: &mut fidl::encoding::Encoder<
12967                '_,
12968                fidl::encoding::DefaultFuchsiaResourceDialect,
12969            >,
12970            offset: usize,
12971            _depth: fidl::encoding::Depth,
12972        ) -> fidl::Result<()> {
12973            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
12974            // Delegate to tuple encoding.
12975            fidl::encoding::Encode::<
12976                ProfileResourceGetResponse,
12977                fidl::encoding::DefaultFuchsiaResourceDialect,
12978            >::encode(
12979                (<fidl::encoding::HandleType<
12980                    fidl::Resource,
12981                    { fidl::ObjectType::RESOURCE.into_raw() },
12982                    2147483648,
12983                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
12984                    &mut self.resource
12985                ),),
12986                encoder,
12987                offset,
12988                _depth,
12989            )
12990        }
12991    }
12992    unsafe impl<
12993        T0: fidl::encoding::Encode<
12994                fidl::encoding::HandleType<
12995                    fidl::Resource,
12996                    { fidl::ObjectType::RESOURCE.into_raw() },
12997                    2147483648,
12998                >,
12999                fidl::encoding::DefaultFuchsiaResourceDialect,
13000            >,
13001    >
13002        fidl::encoding::Encode<
13003            ProfileResourceGetResponse,
13004            fidl::encoding::DefaultFuchsiaResourceDialect,
13005        > for (T0,)
13006    {
13007        #[inline]
13008        unsafe fn encode(
13009            self,
13010            encoder: &mut fidl::encoding::Encoder<
13011                '_,
13012                fidl::encoding::DefaultFuchsiaResourceDialect,
13013            >,
13014            offset: usize,
13015            depth: fidl::encoding::Depth,
13016        ) -> fidl::Result<()> {
13017            encoder.debug_check_bounds::<ProfileResourceGetResponse>(offset);
13018            // Zero out padding regions. There's no need to apply masks
13019            // because the unmasked parts will be overwritten by fields.
13020            // Write the fields.
13021            self.0.encode(encoder, offset + 0, depth)?;
13022            Ok(())
13023        }
13024    }
13025
13026    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13027        for ProfileResourceGetResponse
13028    {
13029        #[inline(always)]
13030        fn new_empty() -> Self {
13031            Self {
13032                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13033            }
13034        }
13035
13036        #[inline]
13037        unsafe fn decode(
13038            &mut self,
13039            decoder: &mut fidl::encoding::Decoder<
13040                '_,
13041                fidl::encoding::DefaultFuchsiaResourceDialect,
13042            >,
13043            offset: usize,
13044            _depth: fidl::encoding::Depth,
13045        ) -> fidl::Result<()> {
13046            decoder.debug_check_bounds::<Self>(offset);
13047            // Verify that padding bytes are zero.
13048            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13049            Ok(())
13050        }
13051    }
13052
13053    impl fidl::encoding::ResourceTypeMarker for RootJobGetResponse {
13054        type Borrowed<'a> = &'a mut Self;
13055        fn take_or_borrow<'a>(
13056            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13057        ) -> Self::Borrowed<'a> {
13058            value
13059        }
13060    }
13061
13062    unsafe impl fidl::encoding::TypeMarker for RootJobGetResponse {
13063        type Owned = Self;
13064
13065        #[inline(always)]
13066        fn inline_align(_context: fidl::encoding::Context) -> usize {
13067            4
13068        }
13069
13070        #[inline(always)]
13071        fn inline_size(_context: fidl::encoding::Context) -> usize {
13072            4
13073        }
13074    }
13075
13076    unsafe impl
13077        fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13078        for &mut RootJobGetResponse
13079    {
13080        #[inline]
13081        unsafe fn encode(
13082            self,
13083            encoder: &mut fidl::encoding::Encoder<
13084                '_,
13085                fidl::encoding::DefaultFuchsiaResourceDialect,
13086            >,
13087            offset: usize,
13088            _depth: fidl::encoding::Depth,
13089        ) -> fidl::Result<()> {
13090            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13091            // Delegate to tuple encoding.
13092            fidl::encoding::Encode::<
13093                RootJobGetResponse,
13094                fidl::encoding::DefaultFuchsiaResourceDialect,
13095            >::encode(
13096                (<fidl::encoding::HandleType<
13097                    fidl::Job,
13098                    { fidl::ObjectType::JOB.into_raw() },
13099                    2147483648,
13100                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13101                    &mut self.job
13102                ),),
13103                encoder,
13104                offset,
13105                _depth,
13106            )
13107        }
13108    }
13109    unsafe impl<
13110        T0: fidl::encoding::Encode<
13111                fidl::encoding::HandleType<
13112                    fidl::Job,
13113                    { fidl::ObjectType::JOB.into_raw() },
13114                    2147483648,
13115                >,
13116                fidl::encoding::DefaultFuchsiaResourceDialect,
13117            >,
13118    > fidl::encoding::Encode<RootJobGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
13119        for (T0,)
13120    {
13121        #[inline]
13122        unsafe fn encode(
13123            self,
13124            encoder: &mut fidl::encoding::Encoder<
13125                '_,
13126                fidl::encoding::DefaultFuchsiaResourceDialect,
13127            >,
13128            offset: usize,
13129            depth: fidl::encoding::Depth,
13130        ) -> fidl::Result<()> {
13131            encoder.debug_check_bounds::<RootJobGetResponse>(offset);
13132            // Zero out padding regions. There's no need to apply masks
13133            // because the unmasked parts will be overwritten by fields.
13134            // Write the fields.
13135            self.0.encode(encoder, offset + 0, depth)?;
13136            Ok(())
13137        }
13138    }
13139
13140    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13141        for RootJobGetResponse
13142    {
13143        #[inline(always)]
13144        fn new_empty() -> Self {
13145            Self {
13146                job: fidl::new_empty!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13147            }
13148        }
13149
13150        #[inline]
13151        unsafe fn decode(
13152            &mut self,
13153            decoder: &mut fidl::encoding::Decoder<
13154                '_,
13155                fidl::encoding::DefaultFuchsiaResourceDialect,
13156            >,
13157            offset: usize,
13158            _depth: fidl::encoding::Depth,
13159        ) -> fidl::Result<()> {
13160            decoder.debug_check_bounds::<Self>(offset);
13161            // Verify that padding bytes are zero.
13162            fidl::decode!(fidl::encoding::HandleType<fidl::Job, { fidl::ObjectType::JOB.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.job, decoder, offset + 0, _depth)?;
13163            Ok(())
13164        }
13165    }
13166
13167    impl fidl::encoding::ResourceTypeMarker for SamplingResourceGetResponse {
13168        type Borrowed<'a> = &'a mut Self;
13169        fn take_or_borrow<'a>(
13170            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13171        ) -> Self::Borrowed<'a> {
13172            value
13173        }
13174    }
13175
13176    unsafe impl fidl::encoding::TypeMarker for SamplingResourceGetResponse {
13177        type Owned = Self;
13178
13179        #[inline(always)]
13180        fn inline_align(_context: fidl::encoding::Context) -> usize {
13181            4
13182        }
13183
13184        #[inline(always)]
13185        fn inline_size(_context: fidl::encoding::Context) -> usize {
13186            4
13187        }
13188    }
13189
13190    unsafe impl
13191        fidl::encoding::Encode<
13192            SamplingResourceGetResponse,
13193            fidl::encoding::DefaultFuchsiaResourceDialect,
13194        > for &mut SamplingResourceGetResponse
13195    {
13196        #[inline]
13197        unsafe fn encode(
13198            self,
13199            encoder: &mut fidl::encoding::Encoder<
13200                '_,
13201                fidl::encoding::DefaultFuchsiaResourceDialect,
13202            >,
13203            offset: usize,
13204            _depth: fidl::encoding::Depth,
13205        ) -> fidl::Result<()> {
13206            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13207            // Delegate to tuple encoding.
13208            fidl::encoding::Encode::<
13209                SamplingResourceGetResponse,
13210                fidl::encoding::DefaultFuchsiaResourceDialect,
13211            >::encode(
13212                (<fidl::encoding::HandleType<
13213                    fidl::Resource,
13214                    { fidl::ObjectType::RESOURCE.into_raw() },
13215                    2147483648,
13216                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13217                    &mut self.resource
13218                ),),
13219                encoder,
13220                offset,
13221                _depth,
13222            )
13223        }
13224    }
13225    unsafe impl<
13226        T0: fidl::encoding::Encode<
13227                fidl::encoding::HandleType<
13228                    fidl::Resource,
13229                    { fidl::ObjectType::RESOURCE.into_raw() },
13230                    2147483648,
13231                >,
13232                fidl::encoding::DefaultFuchsiaResourceDialect,
13233            >,
13234    >
13235        fidl::encoding::Encode<
13236            SamplingResourceGetResponse,
13237            fidl::encoding::DefaultFuchsiaResourceDialect,
13238        > for (T0,)
13239    {
13240        #[inline]
13241        unsafe fn encode(
13242            self,
13243            encoder: &mut fidl::encoding::Encoder<
13244                '_,
13245                fidl::encoding::DefaultFuchsiaResourceDialect,
13246            >,
13247            offset: usize,
13248            depth: fidl::encoding::Depth,
13249        ) -> fidl::Result<()> {
13250            encoder.debug_check_bounds::<SamplingResourceGetResponse>(offset);
13251            // Zero out padding regions. There's no need to apply masks
13252            // because the unmasked parts will be overwritten by fields.
13253            // Write the fields.
13254            self.0.encode(encoder, offset + 0, depth)?;
13255            Ok(())
13256        }
13257    }
13258
13259    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13260        for SamplingResourceGetResponse
13261    {
13262        #[inline(always)]
13263        fn new_empty() -> Self {
13264            Self {
13265                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13266            }
13267        }
13268
13269        #[inline]
13270        unsafe fn decode(
13271            &mut self,
13272            decoder: &mut fidl::encoding::Decoder<
13273                '_,
13274                fidl::encoding::DefaultFuchsiaResourceDialect,
13275            >,
13276            offset: usize,
13277            _depth: fidl::encoding::Depth,
13278        ) -> fidl::Result<()> {
13279            decoder.debug_check_bounds::<Self>(offset);
13280            // Verify that padding bytes are zero.
13281            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13282            Ok(())
13283        }
13284    }
13285
13286    impl fidl::encoding::ResourceTypeMarker for SmcResourceGetResponse {
13287        type Borrowed<'a> = &'a mut Self;
13288        fn take_or_borrow<'a>(
13289            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13290        ) -> Self::Borrowed<'a> {
13291            value
13292        }
13293    }
13294
13295    unsafe impl fidl::encoding::TypeMarker for SmcResourceGetResponse {
13296        type Owned = Self;
13297
13298        #[inline(always)]
13299        fn inline_align(_context: fidl::encoding::Context) -> usize {
13300            4
13301        }
13302
13303        #[inline(always)]
13304        fn inline_size(_context: fidl::encoding::Context) -> usize {
13305            4
13306        }
13307    }
13308
13309    unsafe impl
13310        fidl::encoding::Encode<
13311            SmcResourceGetResponse,
13312            fidl::encoding::DefaultFuchsiaResourceDialect,
13313        > for &mut SmcResourceGetResponse
13314    {
13315        #[inline]
13316        unsafe fn encode(
13317            self,
13318            encoder: &mut fidl::encoding::Encoder<
13319                '_,
13320                fidl::encoding::DefaultFuchsiaResourceDialect,
13321            >,
13322            offset: usize,
13323            _depth: fidl::encoding::Depth,
13324        ) -> fidl::Result<()> {
13325            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13326            // Delegate to tuple encoding.
13327            fidl::encoding::Encode::<
13328                SmcResourceGetResponse,
13329                fidl::encoding::DefaultFuchsiaResourceDialect,
13330            >::encode(
13331                (<fidl::encoding::HandleType<
13332                    fidl::Resource,
13333                    { fidl::ObjectType::RESOURCE.into_raw() },
13334                    2147483648,
13335                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13336                    &mut self.resource
13337                ),),
13338                encoder,
13339                offset,
13340                _depth,
13341            )
13342        }
13343    }
13344    unsafe impl<
13345        T0: fidl::encoding::Encode<
13346                fidl::encoding::HandleType<
13347                    fidl::Resource,
13348                    { fidl::ObjectType::RESOURCE.into_raw() },
13349                    2147483648,
13350                >,
13351                fidl::encoding::DefaultFuchsiaResourceDialect,
13352            >,
13353    >
13354        fidl::encoding::Encode<
13355            SmcResourceGetResponse,
13356            fidl::encoding::DefaultFuchsiaResourceDialect,
13357        > for (T0,)
13358    {
13359        #[inline]
13360        unsafe fn encode(
13361            self,
13362            encoder: &mut fidl::encoding::Encoder<
13363                '_,
13364                fidl::encoding::DefaultFuchsiaResourceDialect,
13365            >,
13366            offset: usize,
13367            depth: fidl::encoding::Depth,
13368        ) -> fidl::Result<()> {
13369            encoder.debug_check_bounds::<SmcResourceGetResponse>(offset);
13370            // Zero out padding regions. There's no need to apply masks
13371            // because the unmasked parts will be overwritten by fields.
13372            // Write the fields.
13373            self.0.encode(encoder, offset + 0, depth)?;
13374            Ok(())
13375        }
13376    }
13377
13378    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13379        for SmcResourceGetResponse
13380    {
13381        #[inline(always)]
13382        fn new_empty() -> Self {
13383            Self {
13384                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13385            }
13386        }
13387
13388        #[inline]
13389        unsafe fn decode(
13390            &mut self,
13391            decoder: &mut fidl::encoding::Decoder<
13392                '_,
13393                fidl::encoding::DefaultFuchsiaResourceDialect,
13394            >,
13395            offset: usize,
13396            _depth: fidl::encoding::Depth,
13397        ) -> fidl::Result<()> {
13398            decoder.debug_check_bounds::<Self>(offset);
13399            // Verify that padding bytes are zero.
13400            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13401            Ok(())
13402        }
13403    }
13404
13405    impl fidl::encoding::ResourceTypeMarker for StallResourceGetResponse {
13406        type Borrowed<'a> = &'a mut Self;
13407        fn take_or_borrow<'a>(
13408            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13409        ) -> Self::Borrowed<'a> {
13410            value
13411        }
13412    }
13413
13414    unsafe impl fidl::encoding::TypeMarker for StallResourceGetResponse {
13415        type Owned = Self;
13416
13417        #[inline(always)]
13418        fn inline_align(_context: fidl::encoding::Context) -> usize {
13419            4
13420        }
13421
13422        #[inline(always)]
13423        fn inline_size(_context: fidl::encoding::Context) -> usize {
13424            4
13425        }
13426    }
13427
13428    unsafe impl
13429        fidl::encoding::Encode<
13430            StallResourceGetResponse,
13431            fidl::encoding::DefaultFuchsiaResourceDialect,
13432        > for &mut StallResourceGetResponse
13433    {
13434        #[inline]
13435        unsafe fn encode(
13436            self,
13437            encoder: &mut fidl::encoding::Encoder<
13438                '_,
13439                fidl::encoding::DefaultFuchsiaResourceDialect,
13440            >,
13441            offset: usize,
13442            _depth: fidl::encoding::Depth,
13443        ) -> fidl::Result<()> {
13444            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13445            // Delegate to tuple encoding.
13446            fidl::encoding::Encode::<
13447                StallResourceGetResponse,
13448                fidl::encoding::DefaultFuchsiaResourceDialect,
13449            >::encode(
13450                (<fidl::encoding::HandleType<
13451                    fidl::Resource,
13452                    { fidl::ObjectType::RESOURCE.into_raw() },
13453                    2147483648,
13454                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13455                    &mut self.resource
13456                ),),
13457                encoder,
13458                offset,
13459                _depth,
13460            )
13461        }
13462    }
13463    unsafe impl<
13464        T0: fidl::encoding::Encode<
13465                fidl::encoding::HandleType<
13466                    fidl::Resource,
13467                    { fidl::ObjectType::RESOURCE.into_raw() },
13468                    2147483648,
13469                >,
13470                fidl::encoding::DefaultFuchsiaResourceDialect,
13471            >,
13472    >
13473        fidl::encoding::Encode<
13474            StallResourceGetResponse,
13475            fidl::encoding::DefaultFuchsiaResourceDialect,
13476        > for (T0,)
13477    {
13478        #[inline]
13479        unsafe fn encode(
13480            self,
13481            encoder: &mut fidl::encoding::Encoder<
13482                '_,
13483                fidl::encoding::DefaultFuchsiaResourceDialect,
13484            >,
13485            offset: usize,
13486            depth: fidl::encoding::Depth,
13487        ) -> fidl::Result<()> {
13488            encoder.debug_check_bounds::<StallResourceGetResponse>(offset);
13489            // Zero out padding regions. There's no need to apply masks
13490            // because the unmasked parts will be overwritten by fields.
13491            // Write the fields.
13492            self.0.encode(encoder, offset + 0, depth)?;
13493            Ok(())
13494        }
13495    }
13496
13497    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13498        for StallResourceGetResponse
13499    {
13500        #[inline(always)]
13501        fn new_empty() -> Self {
13502            Self {
13503                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13504            }
13505        }
13506
13507        #[inline]
13508        unsafe fn decode(
13509            &mut self,
13510            decoder: &mut fidl::encoding::Decoder<
13511                '_,
13512                fidl::encoding::DefaultFuchsiaResourceDialect,
13513            >,
13514            offset: usize,
13515            _depth: fidl::encoding::Depth,
13516        ) -> fidl::Result<()> {
13517            decoder.debug_check_bounds::<Self>(offset);
13518            // Verify that padding bytes are zero.
13519            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13520            Ok(())
13521        }
13522    }
13523
13524    impl fidl::encoding::ResourceTypeMarker for TracingResourceGetResponse {
13525        type Borrowed<'a> = &'a mut Self;
13526        fn take_or_borrow<'a>(
13527            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13528        ) -> Self::Borrowed<'a> {
13529            value
13530        }
13531    }
13532
13533    unsafe impl fidl::encoding::TypeMarker for TracingResourceGetResponse {
13534        type Owned = Self;
13535
13536        #[inline(always)]
13537        fn inline_align(_context: fidl::encoding::Context) -> usize {
13538            4
13539        }
13540
13541        #[inline(always)]
13542        fn inline_size(_context: fidl::encoding::Context) -> usize {
13543            4
13544        }
13545    }
13546
13547    unsafe impl
13548        fidl::encoding::Encode<
13549            TracingResourceGetResponse,
13550            fidl::encoding::DefaultFuchsiaResourceDialect,
13551        > for &mut TracingResourceGetResponse
13552    {
13553        #[inline]
13554        unsafe fn encode(
13555            self,
13556            encoder: &mut fidl::encoding::Encoder<
13557                '_,
13558                fidl::encoding::DefaultFuchsiaResourceDialect,
13559            >,
13560            offset: usize,
13561            _depth: fidl::encoding::Depth,
13562        ) -> fidl::Result<()> {
13563            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13564            // Delegate to tuple encoding.
13565            fidl::encoding::Encode::<
13566                TracingResourceGetResponse,
13567                fidl::encoding::DefaultFuchsiaResourceDialect,
13568            >::encode(
13569                (<fidl::encoding::HandleType<
13570                    fidl::Resource,
13571                    { fidl::ObjectType::RESOURCE.into_raw() },
13572                    2147483648,
13573                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13574                    &mut self.resource
13575                ),),
13576                encoder,
13577                offset,
13578                _depth,
13579            )
13580        }
13581    }
13582    unsafe impl<
13583        T0: fidl::encoding::Encode<
13584                fidl::encoding::HandleType<
13585                    fidl::Resource,
13586                    { fidl::ObjectType::RESOURCE.into_raw() },
13587                    2147483648,
13588                >,
13589                fidl::encoding::DefaultFuchsiaResourceDialect,
13590            >,
13591    >
13592        fidl::encoding::Encode<
13593            TracingResourceGetResponse,
13594            fidl::encoding::DefaultFuchsiaResourceDialect,
13595        > for (T0,)
13596    {
13597        #[inline]
13598        unsafe fn encode(
13599            self,
13600            encoder: &mut fidl::encoding::Encoder<
13601                '_,
13602                fidl::encoding::DefaultFuchsiaResourceDialect,
13603            >,
13604            offset: usize,
13605            depth: fidl::encoding::Depth,
13606        ) -> fidl::Result<()> {
13607            encoder.debug_check_bounds::<TracingResourceGetResponse>(offset);
13608            // Zero out padding regions. There's no need to apply masks
13609            // because the unmasked parts will be overwritten by fields.
13610            // Write the fields.
13611            self.0.encode(encoder, offset + 0, depth)?;
13612            Ok(())
13613        }
13614    }
13615
13616    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13617        for TracingResourceGetResponse
13618    {
13619        #[inline(always)]
13620        fn new_empty() -> Self {
13621            Self {
13622                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13623            }
13624        }
13625
13626        #[inline]
13627        unsafe fn decode(
13628            &mut self,
13629            decoder: &mut fidl::encoding::Decoder<
13630                '_,
13631                fidl::encoding::DefaultFuchsiaResourceDialect,
13632            >,
13633            offset: usize,
13634            _depth: fidl::encoding::Depth,
13635        ) -> fidl::Result<()> {
13636            decoder.debug_check_bounds::<Self>(offset);
13637            // Verify that padding bytes are zero.
13638            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13639            Ok(())
13640        }
13641    }
13642
13643    impl fidl::encoding::ResourceTypeMarker for VmexResourceGetResponse {
13644        type Borrowed<'a> = &'a mut Self;
13645        fn take_or_borrow<'a>(
13646            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13647        ) -> Self::Borrowed<'a> {
13648            value
13649        }
13650    }
13651
13652    unsafe impl fidl::encoding::TypeMarker for VmexResourceGetResponse {
13653        type Owned = Self;
13654
13655        #[inline(always)]
13656        fn inline_align(_context: fidl::encoding::Context) -> usize {
13657            4
13658        }
13659
13660        #[inline(always)]
13661        fn inline_size(_context: fidl::encoding::Context) -> usize {
13662            4
13663        }
13664    }
13665
13666    unsafe impl
13667        fidl::encoding::Encode<
13668            VmexResourceGetResponse,
13669            fidl::encoding::DefaultFuchsiaResourceDialect,
13670        > for &mut VmexResourceGetResponse
13671    {
13672        #[inline]
13673        unsafe fn encode(
13674            self,
13675            encoder: &mut fidl::encoding::Encoder<
13676                '_,
13677                fidl::encoding::DefaultFuchsiaResourceDialect,
13678            >,
13679            offset: usize,
13680            _depth: fidl::encoding::Depth,
13681        ) -> fidl::Result<()> {
13682            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13683            // Delegate to tuple encoding.
13684            fidl::encoding::Encode::<
13685                VmexResourceGetResponse,
13686                fidl::encoding::DefaultFuchsiaResourceDialect,
13687            >::encode(
13688                (<fidl::encoding::HandleType<
13689                    fidl::Resource,
13690                    { fidl::ObjectType::RESOURCE.into_raw() },
13691                    2147483648,
13692                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
13693                    &mut self.resource
13694                ),),
13695                encoder,
13696                offset,
13697                _depth,
13698            )
13699        }
13700    }
13701    unsafe impl<
13702        T0: fidl::encoding::Encode<
13703                fidl::encoding::HandleType<
13704                    fidl::Resource,
13705                    { fidl::ObjectType::RESOURCE.into_raw() },
13706                    2147483648,
13707                >,
13708                fidl::encoding::DefaultFuchsiaResourceDialect,
13709            >,
13710    >
13711        fidl::encoding::Encode<
13712            VmexResourceGetResponse,
13713            fidl::encoding::DefaultFuchsiaResourceDialect,
13714        > for (T0,)
13715    {
13716        #[inline]
13717        unsafe fn encode(
13718            self,
13719            encoder: &mut fidl::encoding::Encoder<
13720                '_,
13721                fidl::encoding::DefaultFuchsiaResourceDialect,
13722            >,
13723            offset: usize,
13724            depth: fidl::encoding::Depth,
13725        ) -> fidl::Result<()> {
13726            encoder.debug_check_bounds::<VmexResourceGetResponse>(offset);
13727            // Zero out padding regions. There's no need to apply masks
13728            // because the unmasked parts will be overwritten by fields.
13729            // Write the fields.
13730            self.0.encode(encoder, offset + 0, depth)?;
13731            Ok(())
13732        }
13733    }
13734
13735    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13736        for VmexResourceGetResponse
13737    {
13738        #[inline(always)]
13739        fn new_empty() -> Self {
13740            Self {
13741                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
13742            }
13743        }
13744
13745        #[inline]
13746        unsafe fn decode(
13747            &mut self,
13748            decoder: &mut fidl::encoding::Decoder<
13749                '_,
13750                fidl::encoding::DefaultFuchsiaResourceDialect,
13751            >,
13752            offset: usize,
13753            _depth: fidl::encoding::Depth,
13754        ) -> fidl::Result<()> {
13755            decoder.debug_check_bounds::<Self>(offset);
13756            // Verify that padding bytes are zero.
13757            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 0, _depth)?;
13758            Ok(())
13759        }
13760    }
13761}