fidl_fuchsia_gpu_magma/
fidl_fuchsia_gpu_magma.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_gpu_magma__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DependencyInjectionSetMemoryPressureProviderRequest {
16    pub provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for DependencyInjectionSetMemoryPressureProviderRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct DeviceConnect2Request {
26    pub client_id: u64,
27    pub primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
28    pub notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceConnect2Request {}
32
33#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct PerformanceCounterAccessGetPerformanceCountTokenResponse {
35    pub access_token: fidl::Event,
36}
37
38impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
39    for PerformanceCounterAccessGetPerformanceCountTokenResponse
40{
41}
42
43#[derive(Debug, PartialEq)]
44pub struct PowerElementProviderGetPowerGoalsResponse {
45    pub goals: Vec<PowerGoal>,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
49    for PowerElementProviderGetPowerGoalsResponse
50{
51}
52
53#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54pub struct PrimaryCreatePerformanceCounterBufferPoolRequest {
55    pub pool_id: u64,
56    pub event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
57}
58
59impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
60    for PrimaryCreatePerformanceCounterBufferPoolRequest
61{
62}
63
64#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub struct PrimaryEnablePerformanceCounterAccessRequest {
66    pub access_token: fidl::Event,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
70    for PrimaryEnablePerformanceCounterAccessRequest
71{
72}
73
74#[derive(Debug, Default, PartialEq)]
75pub struct PowerElementProviderGetClockSpeedLevelResponse {
76    /// Required. The fuchsia.power.broker.DependencyToken that must be leased.
77    pub token: Option<fidl::Event>,
78    /// Required. The level to lease `token` at.
79    pub level: Option<u8>,
80    /// Required. The target frequency that the level represents. If `allow_max==false' (or
81    /// allow_max isn't set) then this must be >= `hz`; otherwise, it can be any value relative
82    /// to `hz`.
83    pub actual_hz: Option<u64>,
84    #[doc(hidden)]
85    pub __source_breaking: fidl::marker::SourceBreaking,
86}
87
88impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
89    for PowerElementProviderGetClockSpeedLevelResponse
90{
91}
92
93#[derive(Debug, Default, PartialEq)]
94pub struct PowerElementProviderSetClockLimitResponse {
95    /// Required. A handle representing this request; the clock limit will be honored as long as
96    /// the handle is open.
97    pub handle: Option<fidl::EventPair>,
98    /// Required. The actual frequency the clock is limited to. This may be more or less than
99    /// `hz`.
100    pub actual_hz: Option<u64>,
101    #[doc(hidden)]
102    pub __source_breaking: fidl::marker::SourceBreaking,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
106    for PowerElementProviderSetClockLimitResponse
107{
108}
109
110/// This table represents a specific power goal. The client must acquire a lease on the token to
111/// activate the state.
112#[derive(Debug, Default, PartialEq)]
113pub struct PowerGoal {
114    /// Required.
115    pub type_: Option<PowerGoalType>,
116    /// Required. The fuchsia.power.broker.DependencyToken that must be leased at level 1 to achieve
117    /// the goal.
118    pub token: Option<fidl::Event>,
119    #[doc(hidden)]
120    pub __source_breaking: fidl::marker::SourceBreaking,
121}
122
123impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PowerGoal {}
124
125#[derive(Debug, Default, PartialEq)]
126pub struct PrimaryImportObjectRequest {
127    /// Required.
128    pub object: Option<Object>,
129    /// Required.
130    pub object_type: Option<ObjectType>,
131    /// Required.
132    pub object_id: Option<u64>,
133    /// Optional
134    pub flags: Option<ImportFlags>,
135    #[doc(hidden)]
136    pub __source_breaking: fidl::marker::SourceBreaking,
137}
138
139impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
140    for PrimaryImportObjectRequest
141{
142}
143
144#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
145pub enum DeviceQueryResponse {
146    SimpleResult(u64),
147    BufferResult(fidl::Vmo),
148}
149
150impl DeviceQueryResponse {
151    #[inline]
152    pub fn ordinal(&self) -> u64 {
153        match *self {
154            Self::SimpleResult(_) => 1,
155            Self::BufferResult(_) => 2,
156        }
157    }
158}
159
160impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceQueryResponse {}
161
162#[derive(Debug)]
163pub enum Object {
164    Semaphore(fidl::Event),
165    Buffer(fidl::Vmo),
166    VmoSemaphore(fidl::Vmo),
167    CounterSemaphore(fidl::Counter),
168    #[doc(hidden)]
169    __SourceBreaking {
170        unknown_ordinal: u64,
171    },
172}
173
174/// Pattern that matches an unknown `Object` member.
175#[macro_export]
176macro_rules! ObjectUnknown {
177    () => {
178        _
179    };
180}
181
182// Custom PartialEq so that unknown variants are not equal to themselves.
183impl PartialEq for Object {
184    fn eq(&self, other: &Self) -> bool {
185        match (self, other) {
186            (Self::Semaphore(x), Self::Semaphore(y)) => *x == *y,
187            (Self::Buffer(x), Self::Buffer(y)) => *x == *y,
188            (Self::VmoSemaphore(x), Self::VmoSemaphore(y)) => *x == *y,
189            (Self::CounterSemaphore(x), Self::CounterSemaphore(y)) => *x == *y,
190            _ => false,
191        }
192    }
193}
194
195impl Object {
196    #[inline]
197    pub fn ordinal(&self) -> u64 {
198        match *self {
199            Self::Semaphore(_) => 1,
200            Self::Buffer(_) => 2,
201            Self::VmoSemaphore(_) => 3,
202            Self::CounterSemaphore(_) => 4,
203            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
204        }
205    }
206
207    #[inline]
208    pub fn unknown_variant_for_testing() -> Self {
209        Self::__SourceBreaking { unknown_ordinal: 0 }
210    }
211
212    #[inline]
213    pub fn is_unknown(&self) -> bool {
214        match self {
215            Self::__SourceBreaking { .. } => true,
216            _ => false,
217        }
218    }
219}
220
221impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Object {}
222
223#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
224pub struct CombinedDeviceMarker;
225
226impl fidl::endpoints::ProtocolMarker for CombinedDeviceMarker {
227    type Proxy = CombinedDeviceProxy;
228    type RequestStream = CombinedDeviceRequestStream;
229    #[cfg(target_os = "fuchsia")]
230    type SynchronousProxy = CombinedDeviceSynchronousProxy;
231
232    const DEBUG_NAME: &'static str = "(anonymous) CombinedDevice";
233}
234
235pub trait CombinedDeviceProxyInterface: Send + Sync {
236    type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
237        + Send;
238    fn r#query(&self, query_id: QueryId) -> Self::QueryResponseFut;
239    fn r#connect2(
240        &self,
241        client_id: u64,
242        primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
243        notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
244    ) -> Result<(), fidl::Error>;
245    fn r#dump_state(&self, dump_type: u32) -> Result<(), fidl::Error>;
246    type GetIcdListResponseFut: std::future::Future<Output = Result<Vec<IcdInfo>, fidl::Error>>
247        + Send;
248    fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut;
249}
250#[derive(Debug)]
251#[cfg(target_os = "fuchsia")]
252pub struct CombinedDeviceSynchronousProxy {
253    client: fidl::client::sync::Client,
254}
255
256#[cfg(target_os = "fuchsia")]
257impl fidl::endpoints::SynchronousProxy for CombinedDeviceSynchronousProxy {
258    type Proxy = CombinedDeviceProxy;
259    type Protocol = CombinedDeviceMarker;
260
261    fn from_channel(inner: fidl::Channel) -> Self {
262        Self::new(inner)
263    }
264
265    fn into_channel(self) -> fidl::Channel {
266        self.client.into_channel()
267    }
268
269    fn as_channel(&self) -> &fidl::Channel {
270        self.client.as_channel()
271    }
272}
273
274#[cfg(target_os = "fuchsia")]
275impl CombinedDeviceSynchronousProxy {
276    pub fn new(channel: fidl::Channel) -> Self {
277        let protocol_name = <CombinedDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
278        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
279    }
280
281    pub fn into_channel(self) -> fidl::Channel {
282        self.client.into_channel()
283    }
284
285    /// Waits until an event arrives and returns it. It is safe for other
286    /// threads to make concurrent requests while waiting for an event.
287    pub fn wait_for_event(
288        &self,
289        deadline: zx::MonotonicInstant,
290    ) -> Result<CombinedDeviceEvent, fidl::Error> {
291        CombinedDeviceEvent::decode(self.client.wait_for_event(deadline)?)
292    }
293
294    /// On success, returns a result either in a buffer or a simple value.
295    pub fn r#query(
296        &self,
297        mut query_id: QueryId,
298        ___deadline: zx::MonotonicInstant,
299    ) -> Result<DeviceQueryResult, fidl::Error> {
300        let _response = self
301            .client
302            .send_query::<DeviceQueryRequest, fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
303                (query_id,),
304                0x627d4c6093b078e7,
305                fidl::encoding::DynamicFlags::empty(),
306                ___deadline,
307            )?;
308        Ok(_response.map(|x| x))
309    }
310
311    /// Creates a connection to the device comprised of two IPC channels.
312    /// The primary channel is for the Primary protocol (see below).  The notification channel is
313    /// used for vendor-specific messages which are sent only in the reverse (server-client)
314    /// direction, typically in response to client command completion.
315    pub fn r#connect2(
316        &self,
317        mut client_id: u64,
318        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
319        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
320    ) -> Result<(), fidl::Error> {
321        self.client.send::<DeviceConnect2Request>(
322            (client_id, primary_channel, notification_channel),
323            0x3a5b134714c67914,
324            fidl::encoding::DynamicFlags::empty(),
325        )
326    }
327
328    /// Dumps driver and hardware state to the log.
329    pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
330        self.client.send::<DiagnosticDeviceDumpStateRequest>(
331            (dump_type,),
332            0x5420df493d4fa915,
333            fidl::encoding::DynamicFlags::empty(),
334        )
335    }
336
337    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
338    /// descending order of preference.
339    pub fn r#get_icd_list(
340        &self,
341        ___deadline: zx::MonotonicInstant,
342    ) -> Result<Vec<IcdInfo>, fidl::Error> {
343        let _response = self
344            .client
345            .send_query::<fidl::encoding::EmptyPayload, IcdLoaderDeviceGetIcdListResponse>(
346                (),
347                0x7673e76395008257,
348                fidl::encoding::DynamicFlags::empty(),
349                ___deadline,
350            )?;
351        Ok(_response.icd_list)
352    }
353}
354
355#[cfg(target_os = "fuchsia")]
356impl From<CombinedDeviceSynchronousProxy> for zx::Handle {
357    fn from(value: CombinedDeviceSynchronousProxy) -> Self {
358        value.into_channel().into()
359    }
360}
361
362#[cfg(target_os = "fuchsia")]
363impl From<fidl::Channel> for CombinedDeviceSynchronousProxy {
364    fn from(value: fidl::Channel) -> Self {
365        Self::new(value)
366    }
367}
368
369#[cfg(target_os = "fuchsia")]
370impl fidl::endpoints::FromClient for CombinedDeviceSynchronousProxy {
371    type Protocol = CombinedDeviceMarker;
372
373    fn from_client(value: fidl::endpoints::ClientEnd<CombinedDeviceMarker>) -> Self {
374        Self::new(value.into_channel())
375    }
376}
377
378#[derive(Debug, Clone)]
379pub struct CombinedDeviceProxy {
380    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
381}
382
383impl fidl::endpoints::Proxy for CombinedDeviceProxy {
384    type Protocol = CombinedDeviceMarker;
385
386    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
387        Self::new(inner)
388    }
389
390    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
391        self.client.into_channel().map_err(|client| Self { client })
392    }
393
394    fn as_channel(&self) -> &::fidl::AsyncChannel {
395        self.client.as_channel()
396    }
397}
398
399impl CombinedDeviceProxy {
400    /// Create a new Proxy for fuchsia.gpu.magma/CombinedDevice.
401    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
402        let protocol_name = <CombinedDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
403        Self { client: fidl::client::Client::new(channel, protocol_name) }
404    }
405
406    /// Get a Stream of events from the remote end of the protocol.
407    ///
408    /// # Panics
409    ///
410    /// Panics if the event stream was already taken.
411    pub fn take_event_stream(&self) -> CombinedDeviceEventStream {
412        CombinedDeviceEventStream { event_receiver: self.client.take_event_receiver() }
413    }
414
415    /// On success, returns a result either in a buffer or a simple value.
416    pub fn r#query(
417        &self,
418        mut query_id: QueryId,
419    ) -> fidl::client::QueryResponseFut<
420        DeviceQueryResult,
421        fidl::encoding::DefaultFuchsiaResourceDialect,
422    > {
423        CombinedDeviceProxyInterface::r#query(self, query_id)
424    }
425
426    /// Creates a connection to the device comprised of two IPC channels.
427    /// The primary channel is for the Primary protocol (see below).  The notification channel is
428    /// used for vendor-specific messages which are sent only in the reverse (server-client)
429    /// direction, typically in response to client command completion.
430    pub fn r#connect2(
431        &self,
432        mut client_id: u64,
433        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
434        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
435    ) -> Result<(), fidl::Error> {
436        CombinedDeviceProxyInterface::r#connect2(
437            self,
438            client_id,
439            primary_channel,
440            notification_channel,
441        )
442    }
443
444    /// Dumps driver and hardware state to the log.
445    pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
446        CombinedDeviceProxyInterface::r#dump_state(self, dump_type)
447    }
448
449    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
450    /// descending order of preference.
451    pub fn r#get_icd_list(
452        &self,
453    ) -> fidl::client::QueryResponseFut<Vec<IcdInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
454    {
455        CombinedDeviceProxyInterface::r#get_icd_list(self)
456    }
457}
458
459impl CombinedDeviceProxyInterface for CombinedDeviceProxy {
460    type QueryResponseFut = fidl::client::QueryResponseFut<
461        DeviceQueryResult,
462        fidl::encoding::DefaultFuchsiaResourceDialect,
463    >;
464    fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
465        fn _decode(
466            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
467        ) -> Result<DeviceQueryResult, fidl::Error> {
468            let _response = fidl::client::decode_transaction_body::<
469                fidl::encoding::ResultType<DeviceQueryResponse, i32>,
470                fidl::encoding::DefaultFuchsiaResourceDialect,
471                0x627d4c6093b078e7,
472            >(_buf?)?;
473            Ok(_response.map(|x| x))
474        }
475        self.client.send_query_and_decode::<DeviceQueryRequest, DeviceQueryResult>(
476            (query_id,),
477            0x627d4c6093b078e7,
478            fidl::encoding::DynamicFlags::empty(),
479            _decode,
480        )
481    }
482
483    fn r#connect2(
484        &self,
485        mut client_id: u64,
486        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
487        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
488    ) -> Result<(), fidl::Error> {
489        self.client.send::<DeviceConnect2Request>(
490            (client_id, primary_channel, notification_channel),
491            0x3a5b134714c67914,
492            fidl::encoding::DynamicFlags::empty(),
493        )
494    }
495
496    fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
497        self.client.send::<DiagnosticDeviceDumpStateRequest>(
498            (dump_type,),
499            0x5420df493d4fa915,
500            fidl::encoding::DynamicFlags::empty(),
501        )
502    }
503
504    type GetIcdListResponseFut =
505        fidl::client::QueryResponseFut<Vec<IcdInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>;
506    fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
507        fn _decode(
508            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
509        ) -> Result<Vec<IcdInfo>, fidl::Error> {
510            let _response = fidl::client::decode_transaction_body::<
511                IcdLoaderDeviceGetIcdListResponse,
512                fidl::encoding::DefaultFuchsiaResourceDialect,
513                0x7673e76395008257,
514            >(_buf?)?;
515            Ok(_response.icd_list)
516        }
517        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<IcdInfo>>(
518            (),
519            0x7673e76395008257,
520            fidl::encoding::DynamicFlags::empty(),
521            _decode,
522        )
523    }
524}
525
526pub struct CombinedDeviceEventStream {
527    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
528}
529
530impl std::marker::Unpin for CombinedDeviceEventStream {}
531
532impl futures::stream::FusedStream for CombinedDeviceEventStream {
533    fn is_terminated(&self) -> bool {
534        self.event_receiver.is_terminated()
535    }
536}
537
538impl futures::Stream for CombinedDeviceEventStream {
539    type Item = Result<CombinedDeviceEvent, fidl::Error>;
540
541    fn poll_next(
542        mut self: std::pin::Pin<&mut Self>,
543        cx: &mut std::task::Context<'_>,
544    ) -> std::task::Poll<Option<Self::Item>> {
545        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
546            &mut self.event_receiver,
547            cx
548        )?) {
549            Some(buf) => std::task::Poll::Ready(Some(CombinedDeviceEvent::decode(buf))),
550            None => std::task::Poll::Ready(None),
551        }
552    }
553}
554
555#[derive(Debug)]
556pub enum CombinedDeviceEvent {}
557
558impl CombinedDeviceEvent {
559    /// Decodes a message buffer as a [`CombinedDeviceEvent`].
560    fn decode(
561        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
562    ) -> Result<CombinedDeviceEvent, fidl::Error> {
563        let (bytes, _handles) = buf.split_mut();
564        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
565        debug_assert_eq!(tx_header.tx_id, 0);
566        match tx_header.ordinal {
567            _ => Err(fidl::Error::UnknownOrdinal {
568                ordinal: tx_header.ordinal,
569                protocol_name:
570                    <CombinedDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
571            }),
572        }
573    }
574}
575
576/// A Stream of incoming requests for fuchsia.gpu.magma/CombinedDevice.
577pub struct CombinedDeviceRequestStream {
578    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
579    is_terminated: bool,
580}
581
582impl std::marker::Unpin for CombinedDeviceRequestStream {}
583
584impl futures::stream::FusedStream for CombinedDeviceRequestStream {
585    fn is_terminated(&self) -> bool {
586        self.is_terminated
587    }
588}
589
590impl fidl::endpoints::RequestStream for CombinedDeviceRequestStream {
591    type Protocol = CombinedDeviceMarker;
592    type ControlHandle = CombinedDeviceControlHandle;
593
594    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
595        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
596    }
597
598    fn control_handle(&self) -> Self::ControlHandle {
599        CombinedDeviceControlHandle { inner: self.inner.clone() }
600    }
601
602    fn into_inner(
603        self,
604    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
605    {
606        (self.inner, self.is_terminated)
607    }
608
609    fn from_inner(
610        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
611        is_terminated: bool,
612    ) -> Self {
613        Self { inner, is_terminated }
614    }
615}
616
617impl futures::Stream for CombinedDeviceRequestStream {
618    type Item = Result<CombinedDeviceRequest, fidl::Error>;
619
620    fn poll_next(
621        mut self: std::pin::Pin<&mut Self>,
622        cx: &mut std::task::Context<'_>,
623    ) -> std::task::Poll<Option<Self::Item>> {
624        let this = &mut *self;
625        if this.inner.check_shutdown(cx) {
626            this.is_terminated = true;
627            return std::task::Poll::Ready(None);
628        }
629        if this.is_terminated {
630            panic!("polled CombinedDeviceRequestStream after completion");
631        }
632        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
633            |bytes, handles| {
634                match this.inner.channel().read_etc(cx, bytes, handles) {
635                    std::task::Poll::Ready(Ok(())) => {}
636                    std::task::Poll::Pending => return std::task::Poll::Pending,
637                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
638                        this.is_terminated = true;
639                        return std::task::Poll::Ready(None);
640                    }
641                    std::task::Poll::Ready(Err(e)) => {
642                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
643                            e.into(),
644                        ))));
645                    }
646                }
647
648                // A message has been received from the channel
649                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
650
651                std::task::Poll::Ready(Some(match header.ordinal {
652                    0x627d4c6093b078e7 => {
653                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
654                        let mut req = fidl::new_empty!(
655                            DeviceQueryRequest,
656                            fidl::encoding::DefaultFuchsiaResourceDialect
657                        );
658                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceQueryRequest>(&header, _body_bytes, handles, &mut req)?;
659                        let control_handle =
660                            CombinedDeviceControlHandle { inner: this.inner.clone() };
661                        Ok(CombinedDeviceRequest::Query {
662                            query_id: req.query_id,
663
664                            responder: CombinedDeviceQueryResponder {
665                                control_handle: std::mem::ManuallyDrop::new(control_handle),
666                                tx_id: header.tx_id,
667                            },
668                        })
669                    }
670                    0x3a5b134714c67914 => {
671                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
672                        let mut req = fidl::new_empty!(
673                            DeviceConnect2Request,
674                            fidl::encoding::DefaultFuchsiaResourceDialect
675                        );
676                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnect2Request>(&header, _body_bytes, handles, &mut req)?;
677                        let control_handle =
678                            CombinedDeviceControlHandle { inner: this.inner.clone() };
679                        Ok(CombinedDeviceRequest::Connect2 {
680                            client_id: req.client_id,
681                            primary_channel: req.primary_channel,
682                            notification_channel: req.notification_channel,
683
684                            control_handle,
685                        })
686                    }
687                    0x5420df493d4fa915 => {
688                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
689                        let mut req = fidl::new_empty!(
690                            DiagnosticDeviceDumpStateRequest,
691                            fidl::encoding::DefaultFuchsiaResourceDialect
692                        );
693                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticDeviceDumpStateRequest>(&header, _body_bytes, handles, &mut req)?;
694                        let control_handle =
695                            CombinedDeviceControlHandle { inner: this.inner.clone() };
696                        Ok(CombinedDeviceRequest::DumpState {
697                            dump_type: req.dump_type,
698
699                            control_handle,
700                        })
701                    }
702                    0x7673e76395008257 => {
703                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
704                        let mut req = fidl::new_empty!(
705                            fidl::encoding::EmptyPayload,
706                            fidl::encoding::DefaultFuchsiaResourceDialect
707                        );
708                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
709                        let control_handle =
710                            CombinedDeviceControlHandle { inner: this.inner.clone() };
711                        Ok(CombinedDeviceRequest::GetIcdList {
712                            responder: CombinedDeviceGetIcdListResponder {
713                                control_handle: std::mem::ManuallyDrop::new(control_handle),
714                                tx_id: header.tx_id,
715                            },
716                        })
717                    }
718                    _ => Err(fidl::Error::UnknownOrdinal {
719                        ordinal: header.ordinal,
720                        protocol_name:
721                            <CombinedDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
722                    }),
723                }))
724            },
725        )
726    }
727}
728
729/// A combination of all the production |Device| protocols. This protocol is implemented on the
730/// Magma service side and should not be used by clients.
731#[derive(Debug)]
732pub enum CombinedDeviceRequest {
733    /// On success, returns a result either in a buffer or a simple value.
734    Query { query_id: QueryId, responder: CombinedDeviceQueryResponder },
735    /// Creates a connection to the device comprised of two IPC channels.
736    /// The primary channel is for the Primary protocol (see below).  The notification channel is
737    /// used for vendor-specific messages which are sent only in the reverse (server-client)
738    /// direction, typically in response to client command completion.
739    Connect2 {
740        client_id: u64,
741        primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
742        notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
743        control_handle: CombinedDeviceControlHandle,
744    },
745    /// Dumps driver and hardware state to the log.
746    DumpState { dump_type: u32, control_handle: CombinedDeviceControlHandle },
747    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
748    /// descending order of preference.
749    GetIcdList { responder: CombinedDeviceGetIcdListResponder },
750}
751
752impl CombinedDeviceRequest {
753    #[allow(irrefutable_let_patterns)]
754    pub fn into_query(self) -> Option<(QueryId, CombinedDeviceQueryResponder)> {
755        if let CombinedDeviceRequest::Query { query_id, responder } = self {
756            Some((query_id, responder))
757        } else {
758            None
759        }
760    }
761
762    #[allow(irrefutable_let_patterns)]
763    pub fn into_connect2(
764        self,
765    ) -> Option<(
766        u64,
767        fidl::endpoints::ServerEnd<PrimaryMarker>,
768        fidl::endpoints::ServerEnd<NotificationMarker>,
769        CombinedDeviceControlHandle,
770    )> {
771        if let CombinedDeviceRequest::Connect2 {
772            client_id,
773            primary_channel,
774            notification_channel,
775            control_handle,
776        } = self
777        {
778            Some((client_id, primary_channel, notification_channel, control_handle))
779        } else {
780            None
781        }
782    }
783
784    #[allow(irrefutable_let_patterns)]
785    pub fn into_dump_state(self) -> Option<(u32, CombinedDeviceControlHandle)> {
786        if let CombinedDeviceRequest::DumpState { dump_type, control_handle } = self {
787            Some((dump_type, control_handle))
788        } else {
789            None
790        }
791    }
792
793    #[allow(irrefutable_let_patterns)]
794    pub fn into_get_icd_list(self) -> Option<(CombinedDeviceGetIcdListResponder)> {
795        if let CombinedDeviceRequest::GetIcdList { responder } = self {
796            Some((responder))
797        } else {
798            None
799        }
800    }
801
802    /// Name of the method defined in FIDL
803    pub fn method_name(&self) -> &'static str {
804        match *self {
805            CombinedDeviceRequest::Query { .. } => "query",
806            CombinedDeviceRequest::Connect2 { .. } => "connect2",
807            CombinedDeviceRequest::DumpState { .. } => "dump_state",
808            CombinedDeviceRequest::GetIcdList { .. } => "get_icd_list",
809        }
810    }
811}
812
813#[derive(Debug, Clone)]
814pub struct CombinedDeviceControlHandle {
815    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
816}
817
818impl fidl::endpoints::ControlHandle for CombinedDeviceControlHandle {
819    fn shutdown(&self) {
820        self.inner.shutdown()
821    }
822    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
823        self.inner.shutdown_with_epitaph(status)
824    }
825
826    fn is_closed(&self) -> bool {
827        self.inner.channel().is_closed()
828    }
829    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
830        self.inner.channel().on_closed()
831    }
832
833    #[cfg(target_os = "fuchsia")]
834    fn signal_peer(
835        &self,
836        clear_mask: zx::Signals,
837        set_mask: zx::Signals,
838    ) -> Result<(), zx_status::Status> {
839        use fidl::Peered;
840        self.inner.channel().signal_peer(clear_mask, set_mask)
841    }
842}
843
844impl CombinedDeviceControlHandle {}
845
846#[must_use = "FIDL methods require a response to be sent"]
847#[derive(Debug)]
848pub struct CombinedDeviceQueryResponder {
849    control_handle: std::mem::ManuallyDrop<CombinedDeviceControlHandle>,
850    tx_id: u32,
851}
852
853/// Set the the channel to be shutdown (see [`CombinedDeviceControlHandle::shutdown`])
854/// if the responder is dropped without sending a response, so that the client
855/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
856impl std::ops::Drop for CombinedDeviceQueryResponder {
857    fn drop(&mut self) {
858        self.control_handle.shutdown();
859        // Safety: drops once, never accessed again
860        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
861    }
862}
863
864impl fidl::endpoints::Responder for CombinedDeviceQueryResponder {
865    type ControlHandle = CombinedDeviceControlHandle;
866
867    fn control_handle(&self) -> &CombinedDeviceControlHandle {
868        &self.control_handle
869    }
870
871    fn drop_without_shutdown(mut self) {
872        // Safety: drops once, never accessed again due to mem::forget
873        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
874        // Prevent Drop from running (which would shut down the channel)
875        std::mem::forget(self);
876    }
877}
878
879impl CombinedDeviceQueryResponder {
880    /// Sends a response to the FIDL transaction.
881    ///
882    /// Sets the channel to shutdown if an error occurs.
883    pub fn send(self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
884        let _result = self.send_raw(result);
885        if _result.is_err() {
886            self.control_handle.shutdown();
887        }
888        self.drop_without_shutdown();
889        _result
890    }
891
892    /// Similar to "send" but does not shutdown the channel if an error occurs.
893    pub fn send_no_shutdown_on_err(
894        self,
895        mut result: Result<DeviceQueryResponse, i32>,
896    ) -> Result<(), fidl::Error> {
897        let _result = self.send_raw(result);
898        self.drop_without_shutdown();
899        _result
900    }
901
902    fn send_raw(&self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
903        self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
904            result.as_mut().map_err(|e| *e),
905            self.tx_id,
906            0x627d4c6093b078e7,
907            fidl::encoding::DynamicFlags::empty(),
908        )
909    }
910}
911
912#[must_use = "FIDL methods require a response to be sent"]
913#[derive(Debug)]
914pub struct CombinedDeviceGetIcdListResponder {
915    control_handle: std::mem::ManuallyDrop<CombinedDeviceControlHandle>,
916    tx_id: u32,
917}
918
919/// Set the the channel to be shutdown (see [`CombinedDeviceControlHandle::shutdown`])
920/// if the responder is dropped without sending a response, so that the client
921/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
922impl std::ops::Drop for CombinedDeviceGetIcdListResponder {
923    fn drop(&mut self) {
924        self.control_handle.shutdown();
925        // Safety: drops once, never accessed again
926        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
927    }
928}
929
930impl fidl::endpoints::Responder for CombinedDeviceGetIcdListResponder {
931    type ControlHandle = CombinedDeviceControlHandle;
932
933    fn control_handle(&self) -> &CombinedDeviceControlHandle {
934        &self.control_handle
935    }
936
937    fn drop_without_shutdown(mut self) {
938        // Safety: drops once, never accessed again due to mem::forget
939        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
940        // Prevent Drop from running (which would shut down the channel)
941        std::mem::forget(self);
942    }
943}
944
945impl CombinedDeviceGetIcdListResponder {
946    /// Sends a response to the FIDL transaction.
947    ///
948    /// Sets the channel to shutdown if an error occurs.
949    pub fn send(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
950        let _result = self.send_raw(icd_list);
951        if _result.is_err() {
952            self.control_handle.shutdown();
953        }
954        self.drop_without_shutdown();
955        _result
956    }
957
958    /// Similar to "send" but does not shutdown the channel if an error occurs.
959    pub fn send_no_shutdown_on_err(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
960        let _result = self.send_raw(icd_list);
961        self.drop_without_shutdown();
962        _result
963    }
964
965    fn send_raw(&self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
966        self.control_handle.inner.send::<IcdLoaderDeviceGetIcdListResponse>(
967            (icd_list,),
968            self.tx_id,
969            0x7673e76395008257,
970            fidl::encoding::DynamicFlags::empty(),
971        )
972    }
973}
974
975#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
976pub struct DebugUtilsMarker;
977
978impl fidl::endpoints::ProtocolMarker for DebugUtilsMarker {
979    type Proxy = DebugUtilsProxy;
980    type RequestStream = DebugUtilsRequestStream;
981    #[cfg(target_os = "fuchsia")]
982    type SynchronousProxy = DebugUtilsSynchronousProxy;
983
984    const DEBUG_NAME: &'static str = "(anonymous) DebugUtils";
985}
986pub type DebugUtilsSetPowerStateResult = Result<(), i32>;
987
988pub trait DebugUtilsProxyInterface: Send + Sync {
989    type SetPowerStateResponseFut: std::future::Future<Output = Result<DebugUtilsSetPowerStateResult, fidl::Error>>
990        + Send;
991    fn r#set_power_state(&self, power_state: i64) -> Self::SetPowerStateResponseFut;
992}
993#[derive(Debug)]
994#[cfg(target_os = "fuchsia")]
995pub struct DebugUtilsSynchronousProxy {
996    client: fidl::client::sync::Client,
997}
998
999#[cfg(target_os = "fuchsia")]
1000impl fidl::endpoints::SynchronousProxy for DebugUtilsSynchronousProxy {
1001    type Proxy = DebugUtilsProxy;
1002    type Protocol = DebugUtilsMarker;
1003
1004    fn from_channel(inner: fidl::Channel) -> Self {
1005        Self::new(inner)
1006    }
1007
1008    fn into_channel(self) -> fidl::Channel {
1009        self.client.into_channel()
1010    }
1011
1012    fn as_channel(&self) -> &fidl::Channel {
1013        self.client.as_channel()
1014    }
1015}
1016
1017#[cfg(target_os = "fuchsia")]
1018impl DebugUtilsSynchronousProxy {
1019    pub fn new(channel: fidl::Channel) -> Self {
1020        let protocol_name = <DebugUtilsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1021        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1022    }
1023
1024    pub fn into_channel(self) -> fidl::Channel {
1025        self.client.into_channel()
1026    }
1027
1028    /// Waits until an event arrives and returns it. It is safe for other
1029    /// threads to make concurrent requests while waiting for an event.
1030    pub fn wait_for_event(
1031        &self,
1032        deadline: zx::MonotonicInstant,
1033    ) -> Result<DebugUtilsEvent, fidl::Error> {
1034        DebugUtilsEvent::decode(self.client.wait_for_event(deadline)?)
1035    }
1036
1037    /// Set the GPU power state. Returns after the transition is complete.
1038    pub fn r#set_power_state(
1039        &self,
1040        mut power_state: i64,
1041        ___deadline: zx::MonotonicInstant,
1042    ) -> Result<DebugUtilsSetPowerStateResult, fidl::Error> {
1043        let _response = self.client.send_query::<
1044            DebugUtilsSetPowerStateRequest,
1045            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1046        >(
1047            (power_state,),
1048            0x1db4f4bbbf7fb866,
1049            fidl::encoding::DynamicFlags::empty(),
1050            ___deadline,
1051        )?;
1052        Ok(_response.map(|x| x))
1053    }
1054}
1055
1056#[cfg(target_os = "fuchsia")]
1057impl From<DebugUtilsSynchronousProxy> for zx::Handle {
1058    fn from(value: DebugUtilsSynchronousProxy) -> Self {
1059        value.into_channel().into()
1060    }
1061}
1062
1063#[cfg(target_os = "fuchsia")]
1064impl From<fidl::Channel> for DebugUtilsSynchronousProxy {
1065    fn from(value: fidl::Channel) -> Self {
1066        Self::new(value)
1067    }
1068}
1069
1070#[cfg(target_os = "fuchsia")]
1071impl fidl::endpoints::FromClient for DebugUtilsSynchronousProxy {
1072    type Protocol = DebugUtilsMarker;
1073
1074    fn from_client(value: fidl::endpoints::ClientEnd<DebugUtilsMarker>) -> Self {
1075        Self::new(value.into_channel())
1076    }
1077}
1078
1079#[derive(Debug, Clone)]
1080pub struct DebugUtilsProxy {
1081    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1082}
1083
1084impl fidl::endpoints::Proxy for DebugUtilsProxy {
1085    type Protocol = DebugUtilsMarker;
1086
1087    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1088        Self::new(inner)
1089    }
1090
1091    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1092        self.client.into_channel().map_err(|client| Self { client })
1093    }
1094
1095    fn as_channel(&self) -> &::fidl::AsyncChannel {
1096        self.client.as_channel()
1097    }
1098}
1099
1100impl DebugUtilsProxy {
1101    /// Create a new Proxy for fuchsia.gpu.magma/DebugUtils.
1102    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1103        let protocol_name = <DebugUtilsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1104        Self { client: fidl::client::Client::new(channel, protocol_name) }
1105    }
1106
1107    /// Get a Stream of events from the remote end of the protocol.
1108    ///
1109    /// # Panics
1110    ///
1111    /// Panics if the event stream was already taken.
1112    pub fn take_event_stream(&self) -> DebugUtilsEventStream {
1113        DebugUtilsEventStream { event_receiver: self.client.take_event_receiver() }
1114    }
1115
1116    /// Set the GPU power state. Returns after the transition is complete.
1117    pub fn r#set_power_state(
1118        &self,
1119        mut power_state: i64,
1120    ) -> fidl::client::QueryResponseFut<
1121        DebugUtilsSetPowerStateResult,
1122        fidl::encoding::DefaultFuchsiaResourceDialect,
1123    > {
1124        DebugUtilsProxyInterface::r#set_power_state(self, power_state)
1125    }
1126}
1127
1128impl DebugUtilsProxyInterface for DebugUtilsProxy {
1129    type SetPowerStateResponseFut = fidl::client::QueryResponseFut<
1130        DebugUtilsSetPowerStateResult,
1131        fidl::encoding::DefaultFuchsiaResourceDialect,
1132    >;
1133    fn r#set_power_state(&self, mut power_state: i64) -> Self::SetPowerStateResponseFut {
1134        fn _decode(
1135            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1136        ) -> Result<DebugUtilsSetPowerStateResult, fidl::Error> {
1137            let _response = fidl::client::decode_transaction_body::<
1138                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1139                fidl::encoding::DefaultFuchsiaResourceDialect,
1140                0x1db4f4bbbf7fb866,
1141            >(_buf?)?;
1142            Ok(_response.map(|x| x))
1143        }
1144        self.client
1145            .send_query_and_decode::<DebugUtilsSetPowerStateRequest, DebugUtilsSetPowerStateResult>(
1146                (power_state,),
1147                0x1db4f4bbbf7fb866,
1148                fidl::encoding::DynamicFlags::empty(),
1149                _decode,
1150            )
1151    }
1152}
1153
1154pub struct DebugUtilsEventStream {
1155    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1156}
1157
1158impl std::marker::Unpin for DebugUtilsEventStream {}
1159
1160impl futures::stream::FusedStream for DebugUtilsEventStream {
1161    fn is_terminated(&self) -> bool {
1162        self.event_receiver.is_terminated()
1163    }
1164}
1165
1166impl futures::Stream for DebugUtilsEventStream {
1167    type Item = Result<DebugUtilsEvent, fidl::Error>;
1168
1169    fn poll_next(
1170        mut self: std::pin::Pin<&mut Self>,
1171        cx: &mut std::task::Context<'_>,
1172    ) -> std::task::Poll<Option<Self::Item>> {
1173        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1174            &mut self.event_receiver,
1175            cx
1176        )?) {
1177            Some(buf) => std::task::Poll::Ready(Some(DebugUtilsEvent::decode(buf))),
1178            None => std::task::Poll::Ready(None),
1179        }
1180    }
1181}
1182
1183#[derive(Debug)]
1184pub enum DebugUtilsEvent {}
1185
1186impl DebugUtilsEvent {
1187    /// Decodes a message buffer as a [`DebugUtilsEvent`].
1188    fn decode(
1189        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1190    ) -> Result<DebugUtilsEvent, fidl::Error> {
1191        let (bytes, _handles) = buf.split_mut();
1192        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1193        debug_assert_eq!(tx_header.tx_id, 0);
1194        match tx_header.ordinal {
1195            _ => Err(fidl::Error::UnknownOrdinal {
1196                ordinal: tx_header.ordinal,
1197                protocol_name: <DebugUtilsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1198            }),
1199        }
1200    }
1201}
1202
1203/// A Stream of incoming requests for fuchsia.gpu.magma/DebugUtils.
1204pub struct DebugUtilsRequestStream {
1205    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1206    is_terminated: bool,
1207}
1208
1209impl std::marker::Unpin for DebugUtilsRequestStream {}
1210
1211impl futures::stream::FusedStream for DebugUtilsRequestStream {
1212    fn is_terminated(&self) -> bool {
1213        self.is_terminated
1214    }
1215}
1216
1217impl fidl::endpoints::RequestStream for DebugUtilsRequestStream {
1218    type Protocol = DebugUtilsMarker;
1219    type ControlHandle = DebugUtilsControlHandle;
1220
1221    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1222        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1223    }
1224
1225    fn control_handle(&self) -> Self::ControlHandle {
1226        DebugUtilsControlHandle { inner: self.inner.clone() }
1227    }
1228
1229    fn into_inner(
1230        self,
1231    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1232    {
1233        (self.inner, self.is_terminated)
1234    }
1235
1236    fn from_inner(
1237        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1238        is_terminated: bool,
1239    ) -> Self {
1240        Self { inner, is_terminated }
1241    }
1242}
1243
1244impl futures::Stream for DebugUtilsRequestStream {
1245    type Item = Result<DebugUtilsRequest, fidl::Error>;
1246
1247    fn poll_next(
1248        mut self: std::pin::Pin<&mut Self>,
1249        cx: &mut std::task::Context<'_>,
1250    ) -> std::task::Poll<Option<Self::Item>> {
1251        let this = &mut *self;
1252        if this.inner.check_shutdown(cx) {
1253            this.is_terminated = true;
1254            return std::task::Poll::Ready(None);
1255        }
1256        if this.is_terminated {
1257            panic!("polled DebugUtilsRequestStream after completion");
1258        }
1259        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1260            |bytes, handles| {
1261                match this.inner.channel().read_etc(cx, bytes, handles) {
1262                    std::task::Poll::Ready(Ok(())) => {}
1263                    std::task::Poll::Pending => return std::task::Poll::Pending,
1264                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1265                        this.is_terminated = true;
1266                        return std::task::Poll::Ready(None);
1267                    }
1268                    std::task::Poll::Ready(Err(e)) => {
1269                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1270                            e.into(),
1271                        ))));
1272                    }
1273                }
1274
1275                // A message has been received from the channel
1276                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1277
1278                std::task::Poll::Ready(Some(match header.ordinal {
1279                    0x1db4f4bbbf7fb866 => {
1280                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1281                        let mut req = fidl::new_empty!(
1282                            DebugUtilsSetPowerStateRequest,
1283                            fidl::encoding::DefaultFuchsiaResourceDialect
1284                        );
1285                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DebugUtilsSetPowerStateRequest>(&header, _body_bytes, handles, &mut req)?;
1286                        let control_handle = DebugUtilsControlHandle { inner: this.inner.clone() };
1287                        Ok(DebugUtilsRequest::SetPowerState {
1288                            power_state: req.power_state,
1289
1290                            responder: DebugUtilsSetPowerStateResponder {
1291                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1292                                tx_id: header.tx_id,
1293                            },
1294                        })
1295                    }
1296                    _ => Err(fidl::Error::UnknownOrdinal {
1297                        ordinal: header.ordinal,
1298                        protocol_name:
1299                            <DebugUtilsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1300                    }),
1301                }))
1302            },
1303        )
1304    }
1305}
1306
1307/// Low-level protocol exposed by the GPU driver used mainly for testing and debugging the driver.
1308#[derive(Debug)]
1309pub enum DebugUtilsRequest {
1310    /// Set the GPU power state. Returns after the transition is complete.
1311    SetPowerState { power_state: i64, responder: DebugUtilsSetPowerStateResponder },
1312}
1313
1314impl DebugUtilsRequest {
1315    #[allow(irrefutable_let_patterns)]
1316    pub fn into_set_power_state(self) -> Option<(i64, DebugUtilsSetPowerStateResponder)> {
1317        if let DebugUtilsRequest::SetPowerState { power_state, responder } = self {
1318            Some((power_state, responder))
1319        } else {
1320            None
1321        }
1322    }
1323
1324    /// Name of the method defined in FIDL
1325    pub fn method_name(&self) -> &'static str {
1326        match *self {
1327            DebugUtilsRequest::SetPowerState { .. } => "set_power_state",
1328        }
1329    }
1330}
1331
1332#[derive(Debug, Clone)]
1333pub struct DebugUtilsControlHandle {
1334    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1335}
1336
1337impl fidl::endpoints::ControlHandle for DebugUtilsControlHandle {
1338    fn shutdown(&self) {
1339        self.inner.shutdown()
1340    }
1341    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1342        self.inner.shutdown_with_epitaph(status)
1343    }
1344
1345    fn is_closed(&self) -> bool {
1346        self.inner.channel().is_closed()
1347    }
1348    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1349        self.inner.channel().on_closed()
1350    }
1351
1352    #[cfg(target_os = "fuchsia")]
1353    fn signal_peer(
1354        &self,
1355        clear_mask: zx::Signals,
1356        set_mask: zx::Signals,
1357    ) -> Result<(), zx_status::Status> {
1358        use fidl::Peered;
1359        self.inner.channel().signal_peer(clear_mask, set_mask)
1360    }
1361}
1362
1363impl DebugUtilsControlHandle {}
1364
1365#[must_use = "FIDL methods require a response to be sent"]
1366#[derive(Debug)]
1367pub struct DebugUtilsSetPowerStateResponder {
1368    control_handle: std::mem::ManuallyDrop<DebugUtilsControlHandle>,
1369    tx_id: u32,
1370}
1371
1372/// Set the the channel to be shutdown (see [`DebugUtilsControlHandle::shutdown`])
1373/// if the responder is dropped without sending a response, so that the client
1374/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1375impl std::ops::Drop for DebugUtilsSetPowerStateResponder {
1376    fn drop(&mut self) {
1377        self.control_handle.shutdown();
1378        // Safety: drops once, never accessed again
1379        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1380    }
1381}
1382
1383impl fidl::endpoints::Responder for DebugUtilsSetPowerStateResponder {
1384    type ControlHandle = DebugUtilsControlHandle;
1385
1386    fn control_handle(&self) -> &DebugUtilsControlHandle {
1387        &self.control_handle
1388    }
1389
1390    fn drop_without_shutdown(mut self) {
1391        // Safety: drops once, never accessed again due to mem::forget
1392        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1393        // Prevent Drop from running (which would shut down the channel)
1394        std::mem::forget(self);
1395    }
1396}
1397
1398impl DebugUtilsSetPowerStateResponder {
1399    /// Sends a response to the FIDL transaction.
1400    ///
1401    /// Sets the channel to shutdown if an error occurs.
1402    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1403        let _result = self.send_raw(result);
1404        if _result.is_err() {
1405            self.control_handle.shutdown();
1406        }
1407        self.drop_without_shutdown();
1408        _result
1409    }
1410
1411    /// Similar to "send" but does not shutdown the channel if an error occurs.
1412    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1413        let _result = self.send_raw(result);
1414        self.drop_without_shutdown();
1415        _result
1416    }
1417
1418    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1419        self.control_handle
1420            .inner
1421            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1422                result,
1423                self.tx_id,
1424                0x1db4f4bbbf7fb866,
1425                fidl::encoding::DynamicFlags::empty(),
1426            )
1427    }
1428}
1429
1430#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1431pub struct DependencyInjectionMarker;
1432
1433impl fidl::endpoints::ProtocolMarker for DependencyInjectionMarker {
1434    type Proxy = DependencyInjectionProxy;
1435    type RequestStream = DependencyInjectionRequestStream;
1436    #[cfg(target_os = "fuchsia")]
1437    type SynchronousProxy = DependencyInjectionSynchronousProxy;
1438
1439    const DEBUG_NAME: &'static str = "(anonymous) DependencyInjection";
1440}
1441
1442pub trait DependencyInjectionProxyInterface: Send + Sync {
1443    fn r#set_memory_pressure_provider(
1444        &self,
1445        provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
1446    ) -> Result<(), fidl::Error>;
1447}
1448#[derive(Debug)]
1449#[cfg(target_os = "fuchsia")]
1450pub struct DependencyInjectionSynchronousProxy {
1451    client: fidl::client::sync::Client,
1452}
1453
1454#[cfg(target_os = "fuchsia")]
1455impl fidl::endpoints::SynchronousProxy for DependencyInjectionSynchronousProxy {
1456    type Proxy = DependencyInjectionProxy;
1457    type Protocol = DependencyInjectionMarker;
1458
1459    fn from_channel(inner: fidl::Channel) -> Self {
1460        Self::new(inner)
1461    }
1462
1463    fn into_channel(self) -> fidl::Channel {
1464        self.client.into_channel()
1465    }
1466
1467    fn as_channel(&self) -> &fidl::Channel {
1468        self.client.as_channel()
1469    }
1470}
1471
1472#[cfg(target_os = "fuchsia")]
1473impl DependencyInjectionSynchronousProxy {
1474    pub fn new(channel: fidl::Channel) -> Self {
1475        let protocol_name =
1476            <DependencyInjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1477        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1478    }
1479
1480    pub fn into_channel(self) -> fidl::Channel {
1481        self.client.into_channel()
1482    }
1483
1484    /// Waits until an event arrives and returns it. It is safe for other
1485    /// threads to make concurrent requests while waiting for an event.
1486    pub fn wait_for_event(
1487        &self,
1488        deadline: zx::MonotonicInstant,
1489    ) -> Result<DependencyInjectionEvent, fidl::Error> {
1490        DependencyInjectionEvent::decode(self.client.wait_for_event(deadline)?)
1491    }
1492
1493    /// Provides a `fuchsia.memorypressure.Provider` implementation to the MSD.
1494    pub fn r#set_memory_pressure_provider(
1495        &self,
1496        mut provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
1497    ) -> Result<(), fidl::Error> {
1498        self.client.send::<DependencyInjectionSetMemoryPressureProviderRequest>(
1499            (provider,),
1500            0x5ef0be960d4b0f4c,
1501            fidl::encoding::DynamicFlags::empty(),
1502        )
1503    }
1504}
1505
1506#[cfg(target_os = "fuchsia")]
1507impl From<DependencyInjectionSynchronousProxy> for zx::Handle {
1508    fn from(value: DependencyInjectionSynchronousProxy) -> Self {
1509        value.into_channel().into()
1510    }
1511}
1512
1513#[cfg(target_os = "fuchsia")]
1514impl From<fidl::Channel> for DependencyInjectionSynchronousProxy {
1515    fn from(value: fidl::Channel) -> Self {
1516        Self::new(value)
1517    }
1518}
1519
1520#[cfg(target_os = "fuchsia")]
1521impl fidl::endpoints::FromClient for DependencyInjectionSynchronousProxy {
1522    type Protocol = DependencyInjectionMarker;
1523
1524    fn from_client(value: fidl::endpoints::ClientEnd<DependencyInjectionMarker>) -> Self {
1525        Self::new(value.into_channel())
1526    }
1527}
1528
1529#[derive(Debug, Clone)]
1530pub struct DependencyInjectionProxy {
1531    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1532}
1533
1534impl fidl::endpoints::Proxy for DependencyInjectionProxy {
1535    type Protocol = DependencyInjectionMarker;
1536
1537    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1538        Self::new(inner)
1539    }
1540
1541    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1542        self.client.into_channel().map_err(|client| Self { client })
1543    }
1544
1545    fn as_channel(&self) -> &::fidl::AsyncChannel {
1546        self.client.as_channel()
1547    }
1548}
1549
1550impl DependencyInjectionProxy {
1551    /// Create a new Proxy for fuchsia.gpu.magma/DependencyInjection.
1552    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1553        let protocol_name =
1554            <DependencyInjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1555        Self { client: fidl::client::Client::new(channel, protocol_name) }
1556    }
1557
1558    /// Get a Stream of events from the remote end of the protocol.
1559    ///
1560    /// # Panics
1561    ///
1562    /// Panics if the event stream was already taken.
1563    pub fn take_event_stream(&self) -> DependencyInjectionEventStream {
1564        DependencyInjectionEventStream { event_receiver: self.client.take_event_receiver() }
1565    }
1566
1567    /// Provides a `fuchsia.memorypressure.Provider` implementation to the MSD.
1568    pub fn r#set_memory_pressure_provider(
1569        &self,
1570        mut provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
1571    ) -> Result<(), fidl::Error> {
1572        DependencyInjectionProxyInterface::r#set_memory_pressure_provider(self, provider)
1573    }
1574}
1575
1576impl DependencyInjectionProxyInterface for DependencyInjectionProxy {
1577    fn r#set_memory_pressure_provider(
1578        &self,
1579        mut provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
1580    ) -> Result<(), fidl::Error> {
1581        self.client.send::<DependencyInjectionSetMemoryPressureProviderRequest>(
1582            (provider,),
1583            0x5ef0be960d4b0f4c,
1584            fidl::encoding::DynamicFlags::empty(),
1585        )
1586    }
1587}
1588
1589pub struct DependencyInjectionEventStream {
1590    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1591}
1592
1593impl std::marker::Unpin for DependencyInjectionEventStream {}
1594
1595impl futures::stream::FusedStream for DependencyInjectionEventStream {
1596    fn is_terminated(&self) -> bool {
1597        self.event_receiver.is_terminated()
1598    }
1599}
1600
1601impl futures::Stream for DependencyInjectionEventStream {
1602    type Item = Result<DependencyInjectionEvent, fidl::Error>;
1603
1604    fn poll_next(
1605        mut self: std::pin::Pin<&mut Self>,
1606        cx: &mut std::task::Context<'_>,
1607    ) -> std::task::Poll<Option<Self::Item>> {
1608        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1609            &mut self.event_receiver,
1610            cx
1611        )?) {
1612            Some(buf) => std::task::Poll::Ready(Some(DependencyInjectionEvent::decode(buf))),
1613            None => std::task::Poll::Ready(None),
1614        }
1615    }
1616}
1617
1618#[derive(Debug)]
1619pub enum DependencyInjectionEvent {}
1620
1621impl DependencyInjectionEvent {
1622    /// Decodes a message buffer as a [`DependencyInjectionEvent`].
1623    fn decode(
1624        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1625    ) -> Result<DependencyInjectionEvent, fidl::Error> {
1626        let (bytes, _handles) = buf.split_mut();
1627        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1628        debug_assert_eq!(tx_header.tx_id, 0);
1629        match tx_header.ordinal {
1630            _ => Err(fidl::Error::UnknownOrdinal {
1631                ordinal: tx_header.ordinal,
1632                protocol_name:
1633                    <DependencyInjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1634            }),
1635        }
1636    }
1637}
1638
1639/// A Stream of incoming requests for fuchsia.gpu.magma/DependencyInjection.
1640pub struct DependencyInjectionRequestStream {
1641    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1642    is_terminated: bool,
1643}
1644
1645impl std::marker::Unpin for DependencyInjectionRequestStream {}
1646
1647impl futures::stream::FusedStream for DependencyInjectionRequestStream {
1648    fn is_terminated(&self) -> bool {
1649        self.is_terminated
1650    }
1651}
1652
1653impl fidl::endpoints::RequestStream for DependencyInjectionRequestStream {
1654    type Protocol = DependencyInjectionMarker;
1655    type ControlHandle = DependencyInjectionControlHandle;
1656
1657    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1658        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1659    }
1660
1661    fn control_handle(&self) -> Self::ControlHandle {
1662        DependencyInjectionControlHandle { inner: self.inner.clone() }
1663    }
1664
1665    fn into_inner(
1666        self,
1667    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1668    {
1669        (self.inner, self.is_terminated)
1670    }
1671
1672    fn from_inner(
1673        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1674        is_terminated: bool,
1675    ) -> Self {
1676        Self { inner, is_terminated }
1677    }
1678}
1679
1680impl futures::Stream for DependencyInjectionRequestStream {
1681    type Item = Result<DependencyInjectionRequest, fidl::Error>;
1682
1683    fn poll_next(
1684        mut self: std::pin::Pin<&mut Self>,
1685        cx: &mut std::task::Context<'_>,
1686    ) -> std::task::Poll<Option<Self::Item>> {
1687        let this = &mut *self;
1688        if this.inner.check_shutdown(cx) {
1689            this.is_terminated = true;
1690            return std::task::Poll::Ready(None);
1691        }
1692        if this.is_terminated {
1693            panic!("polled DependencyInjectionRequestStream after completion");
1694        }
1695        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1696            |bytes, handles| {
1697                match this.inner.channel().read_etc(cx, bytes, handles) {
1698                    std::task::Poll::Ready(Ok(())) => {}
1699                    std::task::Poll::Pending => return std::task::Poll::Pending,
1700                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1701                        this.is_terminated = true;
1702                        return std::task::Poll::Ready(None);
1703                    }
1704                    std::task::Poll::Ready(Err(e)) => {
1705                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1706                            e.into(),
1707                        ))));
1708                    }
1709                }
1710
1711                // A message has been received from the channel
1712                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1713
1714                std::task::Poll::Ready(Some(match header.ordinal {
1715                0x5ef0be960d4b0f4c => {
1716                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1717                    let mut req = fidl::new_empty!(DependencyInjectionSetMemoryPressureProviderRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1718                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DependencyInjectionSetMemoryPressureProviderRequest>(&header, _body_bytes, handles, &mut req)?;
1719                    let control_handle = DependencyInjectionControlHandle {
1720                        inner: this.inner.clone(),
1721                    };
1722                    Ok(DependencyInjectionRequest::SetMemoryPressureProvider {provider: req.provider,
1723
1724                        control_handle,
1725                    })
1726                }
1727                _ => Err(fidl::Error::UnknownOrdinal {
1728                    ordinal: header.ordinal,
1729                    protocol_name: <DependencyInjectionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1730                }),
1731            }))
1732            },
1733        )
1734    }
1735}
1736
1737/// This protocol is implemented by ZX_PROTOCOL_GPU_DEPENDENCY_INJECTION devices. It's used
1738/// to inject dependencies on other services into the MSD. It can be used
1739/// only by a privileged process.
1740#[derive(Debug)]
1741pub enum DependencyInjectionRequest {
1742    /// Provides a `fuchsia.memorypressure.Provider` implementation to the MSD.
1743    SetMemoryPressureProvider {
1744        provider: fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
1745        control_handle: DependencyInjectionControlHandle,
1746    },
1747}
1748
1749impl DependencyInjectionRequest {
1750    #[allow(irrefutable_let_patterns)]
1751    pub fn into_set_memory_pressure_provider(
1752        self,
1753    ) -> Option<(
1754        fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
1755        DependencyInjectionControlHandle,
1756    )> {
1757        if let DependencyInjectionRequest::SetMemoryPressureProvider { provider, control_handle } =
1758            self
1759        {
1760            Some((provider, control_handle))
1761        } else {
1762            None
1763        }
1764    }
1765
1766    /// Name of the method defined in FIDL
1767    pub fn method_name(&self) -> &'static str {
1768        match *self {
1769            DependencyInjectionRequest::SetMemoryPressureProvider { .. } => {
1770                "set_memory_pressure_provider"
1771            }
1772        }
1773    }
1774}
1775
1776#[derive(Debug, Clone)]
1777pub struct DependencyInjectionControlHandle {
1778    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1779}
1780
1781impl fidl::endpoints::ControlHandle for DependencyInjectionControlHandle {
1782    fn shutdown(&self) {
1783        self.inner.shutdown()
1784    }
1785    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1786        self.inner.shutdown_with_epitaph(status)
1787    }
1788
1789    fn is_closed(&self) -> bool {
1790        self.inner.channel().is_closed()
1791    }
1792    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1793        self.inner.channel().on_closed()
1794    }
1795
1796    #[cfg(target_os = "fuchsia")]
1797    fn signal_peer(
1798        &self,
1799        clear_mask: zx::Signals,
1800        set_mask: zx::Signals,
1801    ) -> Result<(), zx_status::Status> {
1802        use fidl::Peered;
1803        self.inner.channel().signal_peer(clear_mask, set_mask)
1804    }
1805}
1806
1807impl DependencyInjectionControlHandle {}
1808
1809#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1810pub struct DeviceMarker;
1811
1812impl fidl::endpoints::ProtocolMarker for DeviceMarker {
1813    type Proxy = DeviceProxy;
1814    type RequestStream = DeviceRequestStream;
1815    #[cfg(target_os = "fuchsia")]
1816    type SynchronousProxy = DeviceSynchronousProxy;
1817
1818    const DEBUG_NAME: &'static str = "(anonymous) Device";
1819}
1820pub type DeviceQueryResult = Result<DeviceQueryResponse, i32>;
1821
1822pub trait DeviceProxyInterface: Send + Sync {
1823    type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
1824        + Send;
1825    fn r#query(&self, query_id: QueryId) -> Self::QueryResponseFut;
1826    fn r#connect2(
1827        &self,
1828        client_id: u64,
1829        primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
1830        notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
1831    ) -> Result<(), fidl::Error>;
1832}
1833#[derive(Debug)]
1834#[cfg(target_os = "fuchsia")]
1835pub struct DeviceSynchronousProxy {
1836    client: fidl::client::sync::Client,
1837}
1838
1839#[cfg(target_os = "fuchsia")]
1840impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
1841    type Proxy = DeviceProxy;
1842    type Protocol = DeviceMarker;
1843
1844    fn from_channel(inner: fidl::Channel) -> Self {
1845        Self::new(inner)
1846    }
1847
1848    fn into_channel(self) -> fidl::Channel {
1849        self.client.into_channel()
1850    }
1851
1852    fn as_channel(&self) -> &fidl::Channel {
1853        self.client.as_channel()
1854    }
1855}
1856
1857#[cfg(target_os = "fuchsia")]
1858impl DeviceSynchronousProxy {
1859    pub fn new(channel: fidl::Channel) -> Self {
1860        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1861        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1862    }
1863
1864    pub fn into_channel(self) -> fidl::Channel {
1865        self.client.into_channel()
1866    }
1867
1868    /// Waits until an event arrives and returns it. It is safe for other
1869    /// threads to make concurrent requests while waiting for an event.
1870    pub fn wait_for_event(
1871        &self,
1872        deadline: zx::MonotonicInstant,
1873    ) -> Result<DeviceEvent, fidl::Error> {
1874        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
1875    }
1876
1877    /// On success, returns a result either in a buffer or a simple value.
1878    pub fn r#query(
1879        &self,
1880        mut query_id: QueryId,
1881        ___deadline: zx::MonotonicInstant,
1882    ) -> Result<DeviceQueryResult, fidl::Error> {
1883        let _response = self
1884            .client
1885            .send_query::<DeviceQueryRequest, fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
1886                (query_id,),
1887                0x627d4c6093b078e7,
1888                fidl::encoding::DynamicFlags::empty(),
1889                ___deadline,
1890            )?;
1891        Ok(_response.map(|x| x))
1892    }
1893
1894    /// Creates a connection to the device comprised of two IPC channels.
1895    /// The primary channel is for the Primary protocol (see below).  The notification channel is
1896    /// used for vendor-specific messages which are sent only in the reverse (server-client)
1897    /// direction, typically in response to client command completion.
1898    pub fn r#connect2(
1899        &self,
1900        mut client_id: u64,
1901        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
1902        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
1903    ) -> Result<(), fidl::Error> {
1904        self.client.send::<DeviceConnect2Request>(
1905            (client_id, primary_channel, notification_channel),
1906            0x3a5b134714c67914,
1907            fidl::encoding::DynamicFlags::empty(),
1908        )
1909    }
1910}
1911
1912#[cfg(target_os = "fuchsia")]
1913impl From<DeviceSynchronousProxy> for zx::Handle {
1914    fn from(value: DeviceSynchronousProxy) -> Self {
1915        value.into_channel().into()
1916    }
1917}
1918
1919#[cfg(target_os = "fuchsia")]
1920impl From<fidl::Channel> for DeviceSynchronousProxy {
1921    fn from(value: fidl::Channel) -> Self {
1922        Self::new(value)
1923    }
1924}
1925
1926#[cfg(target_os = "fuchsia")]
1927impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
1928    type Protocol = DeviceMarker;
1929
1930    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
1931        Self::new(value.into_channel())
1932    }
1933}
1934
1935#[derive(Debug, Clone)]
1936pub struct DeviceProxy {
1937    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1938}
1939
1940impl fidl::endpoints::Proxy for DeviceProxy {
1941    type Protocol = DeviceMarker;
1942
1943    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1944        Self::new(inner)
1945    }
1946
1947    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1948        self.client.into_channel().map_err(|client| Self { client })
1949    }
1950
1951    fn as_channel(&self) -> &::fidl::AsyncChannel {
1952        self.client.as_channel()
1953    }
1954}
1955
1956impl DeviceProxy {
1957    /// Create a new Proxy for fuchsia.gpu.magma/Device.
1958    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1959        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1960        Self { client: fidl::client::Client::new(channel, protocol_name) }
1961    }
1962
1963    /// Get a Stream of events from the remote end of the protocol.
1964    ///
1965    /// # Panics
1966    ///
1967    /// Panics if the event stream was already taken.
1968    pub fn take_event_stream(&self) -> DeviceEventStream {
1969        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
1970    }
1971
1972    /// On success, returns a result either in a buffer or a simple value.
1973    pub fn r#query(
1974        &self,
1975        mut query_id: QueryId,
1976    ) -> fidl::client::QueryResponseFut<
1977        DeviceQueryResult,
1978        fidl::encoding::DefaultFuchsiaResourceDialect,
1979    > {
1980        DeviceProxyInterface::r#query(self, query_id)
1981    }
1982
1983    /// Creates a connection to the device comprised of two IPC channels.
1984    /// The primary channel is for the Primary protocol (see below).  The notification channel is
1985    /// used for vendor-specific messages which are sent only in the reverse (server-client)
1986    /// direction, typically in response to client command completion.
1987    pub fn r#connect2(
1988        &self,
1989        mut client_id: u64,
1990        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
1991        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
1992    ) -> Result<(), fidl::Error> {
1993        DeviceProxyInterface::r#connect2(self, client_id, primary_channel, notification_channel)
1994    }
1995}
1996
1997impl DeviceProxyInterface for DeviceProxy {
1998    type QueryResponseFut = fidl::client::QueryResponseFut<
1999        DeviceQueryResult,
2000        fidl::encoding::DefaultFuchsiaResourceDialect,
2001    >;
2002    fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
2003        fn _decode(
2004            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2005        ) -> Result<DeviceQueryResult, fidl::Error> {
2006            let _response = fidl::client::decode_transaction_body::<
2007                fidl::encoding::ResultType<DeviceQueryResponse, i32>,
2008                fidl::encoding::DefaultFuchsiaResourceDialect,
2009                0x627d4c6093b078e7,
2010            >(_buf?)?;
2011            Ok(_response.map(|x| x))
2012        }
2013        self.client.send_query_and_decode::<DeviceQueryRequest, DeviceQueryResult>(
2014            (query_id,),
2015            0x627d4c6093b078e7,
2016            fidl::encoding::DynamicFlags::empty(),
2017            _decode,
2018        )
2019    }
2020
2021    fn r#connect2(
2022        &self,
2023        mut client_id: u64,
2024        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
2025        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
2026    ) -> Result<(), fidl::Error> {
2027        self.client.send::<DeviceConnect2Request>(
2028            (client_id, primary_channel, notification_channel),
2029            0x3a5b134714c67914,
2030            fidl::encoding::DynamicFlags::empty(),
2031        )
2032    }
2033}
2034
2035pub struct DeviceEventStream {
2036    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2037}
2038
2039impl std::marker::Unpin for DeviceEventStream {}
2040
2041impl futures::stream::FusedStream for DeviceEventStream {
2042    fn is_terminated(&self) -> bool {
2043        self.event_receiver.is_terminated()
2044    }
2045}
2046
2047impl futures::Stream for DeviceEventStream {
2048    type Item = Result<DeviceEvent, fidl::Error>;
2049
2050    fn poll_next(
2051        mut self: std::pin::Pin<&mut Self>,
2052        cx: &mut std::task::Context<'_>,
2053    ) -> std::task::Poll<Option<Self::Item>> {
2054        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2055            &mut self.event_receiver,
2056            cx
2057        )?) {
2058            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
2059            None => std::task::Poll::Ready(None),
2060        }
2061    }
2062}
2063
2064#[derive(Debug)]
2065pub enum DeviceEvent {}
2066
2067impl DeviceEvent {
2068    /// Decodes a message buffer as a [`DeviceEvent`].
2069    fn decode(
2070        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2071    ) -> Result<DeviceEvent, fidl::Error> {
2072        let (bytes, _handles) = buf.split_mut();
2073        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2074        debug_assert_eq!(tx_header.tx_id, 0);
2075        match tx_header.ordinal {
2076            _ => Err(fidl::Error::UnknownOrdinal {
2077                ordinal: tx_header.ordinal,
2078                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2079            }),
2080        }
2081    }
2082}
2083
2084/// A Stream of incoming requests for fuchsia.gpu.magma/Device.
2085pub struct DeviceRequestStream {
2086    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2087    is_terminated: bool,
2088}
2089
2090impl std::marker::Unpin for DeviceRequestStream {}
2091
2092impl futures::stream::FusedStream for DeviceRequestStream {
2093    fn is_terminated(&self) -> bool {
2094        self.is_terminated
2095    }
2096}
2097
2098impl fidl::endpoints::RequestStream for DeviceRequestStream {
2099    type Protocol = DeviceMarker;
2100    type ControlHandle = DeviceControlHandle;
2101
2102    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2103        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2104    }
2105
2106    fn control_handle(&self) -> Self::ControlHandle {
2107        DeviceControlHandle { inner: self.inner.clone() }
2108    }
2109
2110    fn into_inner(
2111        self,
2112    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2113    {
2114        (self.inner, self.is_terminated)
2115    }
2116
2117    fn from_inner(
2118        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2119        is_terminated: bool,
2120    ) -> Self {
2121        Self { inner, is_terminated }
2122    }
2123}
2124
2125impl futures::Stream for DeviceRequestStream {
2126    type Item = Result<DeviceRequest, fidl::Error>;
2127
2128    fn poll_next(
2129        mut self: std::pin::Pin<&mut Self>,
2130        cx: &mut std::task::Context<'_>,
2131    ) -> std::task::Poll<Option<Self::Item>> {
2132        let this = &mut *self;
2133        if this.inner.check_shutdown(cx) {
2134            this.is_terminated = true;
2135            return std::task::Poll::Ready(None);
2136        }
2137        if this.is_terminated {
2138            panic!("polled DeviceRequestStream after completion");
2139        }
2140        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2141            |bytes, handles| {
2142                match this.inner.channel().read_etc(cx, bytes, handles) {
2143                    std::task::Poll::Ready(Ok(())) => {}
2144                    std::task::Poll::Pending => return std::task::Poll::Pending,
2145                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2146                        this.is_terminated = true;
2147                        return std::task::Poll::Ready(None);
2148                    }
2149                    std::task::Poll::Ready(Err(e)) => {
2150                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2151                            e.into(),
2152                        ))));
2153                    }
2154                }
2155
2156                // A message has been received from the channel
2157                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2158
2159                std::task::Poll::Ready(Some(match header.ordinal {
2160                    0x627d4c6093b078e7 => {
2161                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2162                        let mut req = fidl::new_empty!(
2163                            DeviceQueryRequest,
2164                            fidl::encoding::DefaultFuchsiaResourceDialect
2165                        );
2166                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceQueryRequest>(&header, _body_bytes, handles, &mut req)?;
2167                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2168                        Ok(DeviceRequest::Query {
2169                            query_id: req.query_id,
2170
2171                            responder: DeviceQueryResponder {
2172                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2173                                tx_id: header.tx_id,
2174                            },
2175                        })
2176                    }
2177                    0x3a5b134714c67914 => {
2178                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2179                        let mut req = fidl::new_empty!(
2180                            DeviceConnect2Request,
2181                            fidl::encoding::DefaultFuchsiaResourceDialect
2182                        );
2183                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnect2Request>(&header, _body_bytes, handles, &mut req)?;
2184                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
2185                        Ok(DeviceRequest::Connect2 {
2186                            client_id: req.client_id,
2187                            primary_channel: req.primary_channel,
2188                            notification_channel: req.notification_channel,
2189
2190                            control_handle,
2191                        })
2192                    }
2193                    _ => Err(fidl::Error::UnknownOrdinal {
2194                        ordinal: header.ordinal,
2195                        protocol_name:
2196                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2197                    }),
2198                }))
2199            },
2200        )
2201    }
2202}
2203
2204/// The Magma Device protocol allow clients to learn about the hardware by making queries, such as
2205/// device and vendor IDs, and which client drivers are supported by the device's system driver.  
2206/// To engage further with the device, clients may establish connections formed of channel pairs:
2207/// a primary channel for making requests (see Primary protocol below), and a secondary channel
2208/// for receiving notification messages (see Notification protocol below).
2209#[derive(Debug)]
2210pub enum DeviceRequest {
2211    /// On success, returns a result either in a buffer or a simple value.
2212    Query { query_id: QueryId, responder: DeviceQueryResponder },
2213    /// Creates a connection to the device comprised of two IPC channels.
2214    /// The primary channel is for the Primary protocol (see below).  The notification channel is
2215    /// used for vendor-specific messages which are sent only in the reverse (server-client)
2216    /// direction, typically in response to client command completion.
2217    Connect2 {
2218        client_id: u64,
2219        primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
2220        notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
2221        control_handle: DeviceControlHandle,
2222    },
2223}
2224
2225impl DeviceRequest {
2226    #[allow(irrefutable_let_patterns)]
2227    pub fn into_query(self) -> Option<(QueryId, DeviceQueryResponder)> {
2228        if let DeviceRequest::Query { query_id, responder } = self {
2229            Some((query_id, responder))
2230        } else {
2231            None
2232        }
2233    }
2234
2235    #[allow(irrefutable_let_patterns)]
2236    pub fn into_connect2(
2237        self,
2238    ) -> Option<(
2239        u64,
2240        fidl::endpoints::ServerEnd<PrimaryMarker>,
2241        fidl::endpoints::ServerEnd<NotificationMarker>,
2242        DeviceControlHandle,
2243    )> {
2244        if let DeviceRequest::Connect2 {
2245            client_id,
2246            primary_channel,
2247            notification_channel,
2248            control_handle,
2249        } = self
2250        {
2251            Some((client_id, primary_channel, notification_channel, control_handle))
2252        } else {
2253            None
2254        }
2255    }
2256
2257    /// Name of the method defined in FIDL
2258    pub fn method_name(&self) -> &'static str {
2259        match *self {
2260            DeviceRequest::Query { .. } => "query",
2261            DeviceRequest::Connect2 { .. } => "connect2",
2262        }
2263    }
2264}
2265
2266#[derive(Debug, Clone)]
2267pub struct DeviceControlHandle {
2268    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2269}
2270
2271impl fidl::endpoints::ControlHandle for DeviceControlHandle {
2272    fn shutdown(&self) {
2273        self.inner.shutdown()
2274    }
2275    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2276        self.inner.shutdown_with_epitaph(status)
2277    }
2278
2279    fn is_closed(&self) -> bool {
2280        self.inner.channel().is_closed()
2281    }
2282    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2283        self.inner.channel().on_closed()
2284    }
2285
2286    #[cfg(target_os = "fuchsia")]
2287    fn signal_peer(
2288        &self,
2289        clear_mask: zx::Signals,
2290        set_mask: zx::Signals,
2291    ) -> Result<(), zx_status::Status> {
2292        use fidl::Peered;
2293        self.inner.channel().signal_peer(clear_mask, set_mask)
2294    }
2295}
2296
2297impl DeviceControlHandle {}
2298
2299#[must_use = "FIDL methods require a response to be sent"]
2300#[derive(Debug)]
2301pub struct DeviceQueryResponder {
2302    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2303    tx_id: u32,
2304}
2305
2306/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
2307/// if the responder is dropped without sending a response, so that the client
2308/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2309impl std::ops::Drop for DeviceQueryResponder {
2310    fn drop(&mut self) {
2311        self.control_handle.shutdown();
2312        // Safety: drops once, never accessed again
2313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2314    }
2315}
2316
2317impl fidl::endpoints::Responder for DeviceQueryResponder {
2318    type ControlHandle = DeviceControlHandle;
2319
2320    fn control_handle(&self) -> &DeviceControlHandle {
2321        &self.control_handle
2322    }
2323
2324    fn drop_without_shutdown(mut self) {
2325        // Safety: drops once, never accessed again due to mem::forget
2326        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2327        // Prevent Drop from running (which would shut down the channel)
2328        std::mem::forget(self);
2329    }
2330}
2331
2332impl DeviceQueryResponder {
2333    /// Sends a response to the FIDL transaction.
2334    ///
2335    /// Sets the channel to shutdown if an error occurs.
2336    pub fn send(self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
2337        let _result = self.send_raw(result);
2338        if _result.is_err() {
2339            self.control_handle.shutdown();
2340        }
2341        self.drop_without_shutdown();
2342        _result
2343    }
2344
2345    /// Similar to "send" but does not shutdown the channel if an error occurs.
2346    pub fn send_no_shutdown_on_err(
2347        self,
2348        mut result: Result<DeviceQueryResponse, i32>,
2349    ) -> Result<(), fidl::Error> {
2350        let _result = self.send_raw(result);
2351        self.drop_without_shutdown();
2352        _result
2353    }
2354
2355    fn send_raw(&self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
2356        self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
2357            result.as_mut().map_err(|e| *e),
2358            self.tx_id,
2359            0x627d4c6093b078e7,
2360            fidl::encoding::DynamicFlags::empty(),
2361        )
2362    }
2363}
2364
2365#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2366pub struct DiagnosticDeviceMarker;
2367
2368impl fidl::endpoints::ProtocolMarker for DiagnosticDeviceMarker {
2369    type Proxy = DiagnosticDeviceProxy;
2370    type RequestStream = DiagnosticDeviceRequestStream;
2371    #[cfg(target_os = "fuchsia")]
2372    type SynchronousProxy = DiagnosticDeviceSynchronousProxy;
2373
2374    const DEBUG_NAME: &'static str = "(anonymous) DiagnosticDevice";
2375}
2376
2377pub trait DiagnosticDeviceProxyInterface: Send + Sync {
2378    fn r#dump_state(&self, dump_type: u32) -> Result<(), fidl::Error>;
2379}
2380#[derive(Debug)]
2381#[cfg(target_os = "fuchsia")]
2382pub struct DiagnosticDeviceSynchronousProxy {
2383    client: fidl::client::sync::Client,
2384}
2385
2386#[cfg(target_os = "fuchsia")]
2387impl fidl::endpoints::SynchronousProxy for DiagnosticDeviceSynchronousProxy {
2388    type Proxy = DiagnosticDeviceProxy;
2389    type Protocol = DiagnosticDeviceMarker;
2390
2391    fn from_channel(inner: fidl::Channel) -> Self {
2392        Self::new(inner)
2393    }
2394
2395    fn into_channel(self) -> fidl::Channel {
2396        self.client.into_channel()
2397    }
2398
2399    fn as_channel(&self) -> &fidl::Channel {
2400        self.client.as_channel()
2401    }
2402}
2403
2404#[cfg(target_os = "fuchsia")]
2405impl DiagnosticDeviceSynchronousProxy {
2406    pub fn new(channel: fidl::Channel) -> Self {
2407        let protocol_name = <DiagnosticDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2408        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2409    }
2410
2411    pub fn into_channel(self) -> fidl::Channel {
2412        self.client.into_channel()
2413    }
2414
2415    /// Waits until an event arrives and returns it. It is safe for other
2416    /// threads to make concurrent requests while waiting for an event.
2417    pub fn wait_for_event(
2418        &self,
2419        deadline: zx::MonotonicInstant,
2420    ) -> Result<DiagnosticDeviceEvent, fidl::Error> {
2421        DiagnosticDeviceEvent::decode(self.client.wait_for_event(deadline)?)
2422    }
2423
2424    /// Dumps driver and hardware state to the log.
2425    pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
2426        self.client.send::<DiagnosticDeviceDumpStateRequest>(
2427            (dump_type,),
2428            0x5420df493d4fa915,
2429            fidl::encoding::DynamicFlags::empty(),
2430        )
2431    }
2432}
2433
2434#[cfg(target_os = "fuchsia")]
2435impl From<DiagnosticDeviceSynchronousProxy> for zx::Handle {
2436    fn from(value: DiagnosticDeviceSynchronousProxy) -> Self {
2437        value.into_channel().into()
2438    }
2439}
2440
2441#[cfg(target_os = "fuchsia")]
2442impl From<fidl::Channel> for DiagnosticDeviceSynchronousProxy {
2443    fn from(value: fidl::Channel) -> Self {
2444        Self::new(value)
2445    }
2446}
2447
2448#[cfg(target_os = "fuchsia")]
2449impl fidl::endpoints::FromClient for DiagnosticDeviceSynchronousProxy {
2450    type Protocol = DiagnosticDeviceMarker;
2451
2452    fn from_client(value: fidl::endpoints::ClientEnd<DiagnosticDeviceMarker>) -> Self {
2453        Self::new(value.into_channel())
2454    }
2455}
2456
2457#[derive(Debug, Clone)]
2458pub struct DiagnosticDeviceProxy {
2459    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2460}
2461
2462impl fidl::endpoints::Proxy for DiagnosticDeviceProxy {
2463    type Protocol = DiagnosticDeviceMarker;
2464
2465    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2466        Self::new(inner)
2467    }
2468
2469    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2470        self.client.into_channel().map_err(|client| Self { client })
2471    }
2472
2473    fn as_channel(&self) -> &::fidl::AsyncChannel {
2474        self.client.as_channel()
2475    }
2476}
2477
2478impl DiagnosticDeviceProxy {
2479    /// Create a new Proxy for fuchsia.gpu.magma/DiagnosticDevice.
2480    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2481        let protocol_name = <DiagnosticDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2482        Self { client: fidl::client::Client::new(channel, protocol_name) }
2483    }
2484
2485    /// Get a Stream of events from the remote end of the protocol.
2486    ///
2487    /// # Panics
2488    ///
2489    /// Panics if the event stream was already taken.
2490    pub fn take_event_stream(&self) -> DiagnosticDeviceEventStream {
2491        DiagnosticDeviceEventStream { event_receiver: self.client.take_event_receiver() }
2492    }
2493
2494    /// Dumps driver and hardware state to the log.
2495    pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
2496        DiagnosticDeviceProxyInterface::r#dump_state(self, dump_type)
2497    }
2498}
2499
2500impl DiagnosticDeviceProxyInterface for DiagnosticDeviceProxy {
2501    fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
2502        self.client.send::<DiagnosticDeviceDumpStateRequest>(
2503            (dump_type,),
2504            0x5420df493d4fa915,
2505            fidl::encoding::DynamicFlags::empty(),
2506        )
2507    }
2508}
2509
2510pub struct DiagnosticDeviceEventStream {
2511    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2512}
2513
2514impl std::marker::Unpin for DiagnosticDeviceEventStream {}
2515
2516impl futures::stream::FusedStream for DiagnosticDeviceEventStream {
2517    fn is_terminated(&self) -> bool {
2518        self.event_receiver.is_terminated()
2519    }
2520}
2521
2522impl futures::Stream for DiagnosticDeviceEventStream {
2523    type Item = Result<DiagnosticDeviceEvent, fidl::Error>;
2524
2525    fn poll_next(
2526        mut self: std::pin::Pin<&mut Self>,
2527        cx: &mut std::task::Context<'_>,
2528    ) -> std::task::Poll<Option<Self::Item>> {
2529        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2530            &mut self.event_receiver,
2531            cx
2532        )?) {
2533            Some(buf) => std::task::Poll::Ready(Some(DiagnosticDeviceEvent::decode(buf))),
2534            None => std::task::Poll::Ready(None),
2535        }
2536    }
2537}
2538
2539#[derive(Debug)]
2540pub enum DiagnosticDeviceEvent {}
2541
2542impl DiagnosticDeviceEvent {
2543    /// Decodes a message buffer as a [`DiagnosticDeviceEvent`].
2544    fn decode(
2545        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2546    ) -> Result<DiagnosticDeviceEvent, fidl::Error> {
2547        let (bytes, _handles) = buf.split_mut();
2548        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2549        debug_assert_eq!(tx_header.tx_id, 0);
2550        match tx_header.ordinal {
2551            _ => Err(fidl::Error::UnknownOrdinal {
2552                ordinal: tx_header.ordinal,
2553                protocol_name:
2554                    <DiagnosticDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2555            }),
2556        }
2557    }
2558}
2559
2560/// A Stream of incoming requests for fuchsia.gpu.magma/DiagnosticDevice.
2561pub struct DiagnosticDeviceRequestStream {
2562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2563    is_terminated: bool,
2564}
2565
2566impl std::marker::Unpin for DiagnosticDeviceRequestStream {}
2567
2568impl futures::stream::FusedStream for DiagnosticDeviceRequestStream {
2569    fn is_terminated(&self) -> bool {
2570        self.is_terminated
2571    }
2572}
2573
2574impl fidl::endpoints::RequestStream for DiagnosticDeviceRequestStream {
2575    type Protocol = DiagnosticDeviceMarker;
2576    type ControlHandle = DiagnosticDeviceControlHandle;
2577
2578    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2579        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2580    }
2581
2582    fn control_handle(&self) -> Self::ControlHandle {
2583        DiagnosticDeviceControlHandle { inner: self.inner.clone() }
2584    }
2585
2586    fn into_inner(
2587        self,
2588    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2589    {
2590        (self.inner, self.is_terminated)
2591    }
2592
2593    fn from_inner(
2594        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2595        is_terminated: bool,
2596    ) -> Self {
2597        Self { inner, is_terminated }
2598    }
2599}
2600
2601impl futures::Stream for DiagnosticDeviceRequestStream {
2602    type Item = Result<DiagnosticDeviceRequest, fidl::Error>;
2603
2604    fn poll_next(
2605        mut self: std::pin::Pin<&mut Self>,
2606        cx: &mut std::task::Context<'_>,
2607    ) -> std::task::Poll<Option<Self::Item>> {
2608        let this = &mut *self;
2609        if this.inner.check_shutdown(cx) {
2610            this.is_terminated = true;
2611            return std::task::Poll::Ready(None);
2612        }
2613        if this.is_terminated {
2614            panic!("polled DiagnosticDeviceRequestStream after completion");
2615        }
2616        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2617            |bytes, handles| {
2618                match this.inner.channel().read_etc(cx, bytes, handles) {
2619                    std::task::Poll::Ready(Ok(())) => {}
2620                    std::task::Poll::Pending => return std::task::Poll::Pending,
2621                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2622                        this.is_terminated = true;
2623                        return std::task::Poll::Ready(None);
2624                    }
2625                    std::task::Poll::Ready(Err(e)) => {
2626                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2627                            e.into(),
2628                        ))));
2629                    }
2630                }
2631
2632                // A message has been received from the channel
2633                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2634
2635                std::task::Poll::Ready(Some(match header.ordinal {
2636                    0x5420df493d4fa915 => {
2637                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2638                        let mut req = fidl::new_empty!(
2639                            DiagnosticDeviceDumpStateRequest,
2640                            fidl::encoding::DefaultFuchsiaResourceDialect
2641                        );
2642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticDeviceDumpStateRequest>(&header, _body_bytes, handles, &mut req)?;
2643                        let control_handle =
2644                            DiagnosticDeviceControlHandle { inner: this.inner.clone() };
2645                        Ok(DiagnosticDeviceRequest::DumpState {
2646                            dump_type: req.dump_type,
2647
2648                            control_handle,
2649                        })
2650                    }
2651                    _ => Err(fidl::Error::UnknownOrdinal {
2652                        ordinal: header.ordinal,
2653                        protocol_name:
2654                            <DiagnosticDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2655                    }),
2656                }))
2657            },
2658        )
2659    }
2660}
2661
2662/// Methods used to expose diagnostics from the Magma device.
2663#[derive(Debug)]
2664pub enum DiagnosticDeviceRequest {
2665    /// Dumps driver and hardware state to the log.
2666    DumpState { dump_type: u32, control_handle: DiagnosticDeviceControlHandle },
2667}
2668
2669impl DiagnosticDeviceRequest {
2670    #[allow(irrefutable_let_patterns)]
2671    pub fn into_dump_state(self) -> Option<(u32, DiagnosticDeviceControlHandle)> {
2672        if let DiagnosticDeviceRequest::DumpState { dump_type, control_handle } = self {
2673            Some((dump_type, control_handle))
2674        } else {
2675            None
2676        }
2677    }
2678
2679    /// Name of the method defined in FIDL
2680    pub fn method_name(&self) -> &'static str {
2681        match *self {
2682            DiagnosticDeviceRequest::DumpState { .. } => "dump_state",
2683        }
2684    }
2685}
2686
2687#[derive(Debug, Clone)]
2688pub struct DiagnosticDeviceControlHandle {
2689    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2690}
2691
2692impl fidl::endpoints::ControlHandle for DiagnosticDeviceControlHandle {
2693    fn shutdown(&self) {
2694        self.inner.shutdown()
2695    }
2696    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2697        self.inner.shutdown_with_epitaph(status)
2698    }
2699
2700    fn is_closed(&self) -> bool {
2701        self.inner.channel().is_closed()
2702    }
2703    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2704        self.inner.channel().on_closed()
2705    }
2706
2707    #[cfg(target_os = "fuchsia")]
2708    fn signal_peer(
2709        &self,
2710        clear_mask: zx::Signals,
2711        set_mask: zx::Signals,
2712    ) -> Result<(), zx_status::Status> {
2713        use fidl::Peered;
2714        self.inner.channel().signal_peer(clear_mask, set_mask)
2715    }
2716}
2717
2718impl DiagnosticDeviceControlHandle {}
2719
2720#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2721pub struct IcdLoaderDeviceMarker;
2722
2723impl fidl::endpoints::ProtocolMarker for IcdLoaderDeviceMarker {
2724    type Proxy = IcdLoaderDeviceProxy;
2725    type RequestStream = IcdLoaderDeviceRequestStream;
2726    #[cfg(target_os = "fuchsia")]
2727    type SynchronousProxy = IcdLoaderDeviceSynchronousProxy;
2728
2729    const DEBUG_NAME: &'static str = "(anonymous) IcdLoaderDevice";
2730}
2731
2732pub trait IcdLoaderDeviceProxyInterface: Send + Sync {
2733    type GetIcdListResponseFut: std::future::Future<Output = Result<Vec<IcdInfo>, fidl::Error>>
2734        + Send;
2735    fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut;
2736}
2737#[derive(Debug)]
2738#[cfg(target_os = "fuchsia")]
2739pub struct IcdLoaderDeviceSynchronousProxy {
2740    client: fidl::client::sync::Client,
2741}
2742
2743#[cfg(target_os = "fuchsia")]
2744impl fidl::endpoints::SynchronousProxy for IcdLoaderDeviceSynchronousProxy {
2745    type Proxy = IcdLoaderDeviceProxy;
2746    type Protocol = IcdLoaderDeviceMarker;
2747
2748    fn from_channel(inner: fidl::Channel) -> Self {
2749        Self::new(inner)
2750    }
2751
2752    fn into_channel(self) -> fidl::Channel {
2753        self.client.into_channel()
2754    }
2755
2756    fn as_channel(&self) -> &fidl::Channel {
2757        self.client.as_channel()
2758    }
2759}
2760
2761#[cfg(target_os = "fuchsia")]
2762impl IcdLoaderDeviceSynchronousProxy {
2763    pub fn new(channel: fidl::Channel) -> Self {
2764        let protocol_name = <IcdLoaderDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2765        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2766    }
2767
2768    pub fn into_channel(self) -> fidl::Channel {
2769        self.client.into_channel()
2770    }
2771
2772    /// Waits until an event arrives and returns it. It is safe for other
2773    /// threads to make concurrent requests while waiting for an event.
2774    pub fn wait_for_event(
2775        &self,
2776        deadline: zx::MonotonicInstant,
2777    ) -> Result<IcdLoaderDeviceEvent, fidl::Error> {
2778        IcdLoaderDeviceEvent::decode(self.client.wait_for_event(deadline)?)
2779    }
2780
2781    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
2782    /// descending order of preference.
2783    pub fn r#get_icd_list(
2784        &self,
2785        ___deadline: zx::MonotonicInstant,
2786    ) -> Result<Vec<IcdInfo>, fidl::Error> {
2787        let _response = self
2788            .client
2789            .send_query::<fidl::encoding::EmptyPayload, IcdLoaderDeviceGetIcdListResponse>(
2790                (),
2791                0x7673e76395008257,
2792                fidl::encoding::DynamicFlags::empty(),
2793                ___deadline,
2794            )?;
2795        Ok(_response.icd_list)
2796    }
2797}
2798
2799#[cfg(target_os = "fuchsia")]
2800impl From<IcdLoaderDeviceSynchronousProxy> for zx::Handle {
2801    fn from(value: IcdLoaderDeviceSynchronousProxy) -> Self {
2802        value.into_channel().into()
2803    }
2804}
2805
2806#[cfg(target_os = "fuchsia")]
2807impl From<fidl::Channel> for IcdLoaderDeviceSynchronousProxy {
2808    fn from(value: fidl::Channel) -> Self {
2809        Self::new(value)
2810    }
2811}
2812
2813#[cfg(target_os = "fuchsia")]
2814impl fidl::endpoints::FromClient for IcdLoaderDeviceSynchronousProxy {
2815    type Protocol = IcdLoaderDeviceMarker;
2816
2817    fn from_client(value: fidl::endpoints::ClientEnd<IcdLoaderDeviceMarker>) -> Self {
2818        Self::new(value.into_channel())
2819    }
2820}
2821
2822#[derive(Debug, Clone)]
2823pub struct IcdLoaderDeviceProxy {
2824    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2825}
2826
2827impl fidl::endpoints::Proxy for IcdLoaderDeviceProxy {
2828    type Protocol = IcdLoaderDeviceMarker;
2829
2830    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2831        Self::new(inner)
2832    }
2833
2834    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2835        self.client.into_channel().map_err(|client| Self { client })
2836    }
2837
2838    fn as_channel(&self) -> &::fidl::AsyncChannel {
2839        self.client.as_channel()
2840    }
2841}
2842
2843impl IcdLoaderDeviceProxy {
2844    /// Create a new Proxy for fuchsia.gpu.magma/IcdLoaderDevice.
2845    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2846        let protocol_name = <IcdLoaderDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2847        Self { client: fidl::client::Client::new(channel, protocol_name) }
2848    }
2849
2850    /// Get a Stream of events from the remote end of the protocol.
2851    ///
2852    /// # Panics
2853    ///
2854    /// Panics if the event stream was already taken.
2855    pub fn take_event_stream(&self) -> IcdLoaderDeviceEventStream {
2856        IcdLoaderDeviceEventStream { event_receiver: self.client.take_event_receiver() }
2857    }
2858
2859    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
2860    /// descending order of preference.
2861    pub fn r#get_icd_list(
2862        &self,
2863    ) -> fidl::client::QueryResponseFut<Vec<IcdInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
2864    {
2865        IcdLoaderDeviceProxyInterface::r#get_icd_list(self)
2866    }
2867}
2868
2869impl IcdLoaderDeviceProxyInterface for IcdLoaderDeviceProxy {
2870    type GetIcdListResponseFut =
2871        fidl::client::QueryResponseFut<Vec<IcdInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>;
2872    fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
2873        fn _decode(
2874            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2875        ) -> Result<Vec<IcdInfo>, fidl::Error> {
2876            let _response = fidl::client::decode_transaction_body::<
2877                IcdLoaderDeviceGetIcdListResponse,
2878                fidl::encoding::DefaultFuchsiaResourceDialect,
2879                0x7673e76395008257,
2880            >(_buf?)?;
2881            Ok(_response.icd_list)
2882        }
2883        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<IcdInfo>>(
2884            (),
2885            0x7673e76395008257,
2886            fidl::encoding::DynamicFlags::empty(),
2887            _decode,
2888        )
2889    }
2890}
2891
2892pub struct IcdLoaderDeviceEventStream {
2893    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2894}
2895
2896impl std::marker::Unpin for IcdLoaderDeviceEventStream {}
2897
2898impl futures::stream::FusedStream for IcdLoaderDeviceEventStream {
2899    fn is_terminated(&self) -> bool {
2900        self.event_receiver.is_terminated()
2901    }
2902}
2903
2904impl futures::Stream for IcdLoaderDeviceEventStream {
2905    type Item = Result<IcdLoaderDeviceEvent, fidl::Error>;
2906
2907    fn poll_next(
2908        mut self: std::pin::Pin<&mut Self>,
2909        cx: &mut std::task::Context<'_>,
2910    ) -> std::task::Poll<Option<Self::Item>> {
2911        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2912            &mut self.event_receiver,
2913            cx
2914        )?) {
2915            Some(buf) => std::task::Poll::Ready(Some(IcdLoaderDeviceEvent::decode(buf))),
2916            None => std::task::Poll::Ready(None),
2917        }
2918    }
2919}
2920
2921#[derive(Debug)]
2922pub enum IcdLoaderDeviceEvent {}
2923
2924impl IcdLoaderDeviceEvent {
2925    /// Decodes a message buffer as a [`IcdLoaderDeviceEvent`].
2926    fn decode(
2927        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2928    ) -> Result<IcdLoaderDeviceEvent, fidl::Error> {
2929        let (bytes, _handles) = buf.split_mut();
2930        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2931        debug_assert_eq!(tx_header.tx_id, 0);
2932        match tx_header.ordinal {
2933            _ => Err(fidl::Error::UnknownOrdinal {
2934                ordinal: tx_header.ordinal,
2935                protocol_name:
2936                    <IcdLoaderDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2937            }),
2938        }
2939    }
2940}
2941
2942/// A Stream of incoming requests for fuchsia.gpu.magma/IcdLoaderDevice.
2943pub struct IcdLoaderDeviceRequestStream {
2944    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2945    is_terminated: bool,
2946}
2947
2948impl std::marker::Unpin for IcdLoaderDeviceRequestStream {}
2949
2950impl futures::stream::FusedStream for IcdLoaderDeviceRequestStream {
2951    fn is_terminated(&self) -> bool {
2952        self.is_terminated
2953    }
2954}
2955
2956impl fidl::endpoints::RequestStream for IcdLoaderDeviceRequestStream {
2957    type Protocol = IcdLoaderDeviceMarker;
2958    type ControlHandle = IcdLoaderDeviceControlHandle;
2959
2960    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2961        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2962    }
2963
2964    fn control_handle(&self) -> Self::ControlHandle {
2965        IcdLoaderDeviceControlHandle { inner: self.inner.clone() }
2966    }
2967
2968    fn into_inner(
2969        self,
2970    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2971    {
2972        (self.inner, self.is_terminated)
2973    }
2974
2975    fn from_inner(
2976        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2977        is_terminated: bool,
2978    ) -> Self {
2979        Self { inner, is_terminated }
2980    }
2981}
2982
2983impl futures::Stream for IcdLoaderDeviceRequestStream {
2984    type Item = Result<IcdLoaderDeviceRequest, fidl::Error>;
2985
2986    fn poll_next(
2987        mut self: std::pin::Pin<&mut Self>,
2988        cx: &mut std::task::Context<'_>,
2989    ) -> std::task::Poll<Option<Self::Item>> {
2990        let this = &mut *self;
2991        if this.inner.check_shutdown(cx) {
2992            this.is_terminated = true;
2993            return std::task::Poll::Ready(None);
2994        }
2995        if this.is_terminated {
2996            panic!("polled IcdLoaderDeviceRequestStream after completion");
2997        }
2998        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2999            |bytes, handles| {
3000                match this.inner.channel().read_etc(cx, bytes, handles) {
3001                    std::task::Poll::Ready(Ok(())) => {}
3002                    std::task::Poll::Pending => return std::task::Poll::Pending,
3003                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3004                        this.is_terminated = true;
3005                        return std::task::Poll::Ready(None);
3006                    }
3007                    std::task::Poll::Ready(Err(e)) => {
3008                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3009                            e.into(),
3010                        ))));
3011                    }
3012                }
3013
3014                // A message has been received from the channel
3015                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3016
3017                std::task::Poll::Ready(Some(match header.ordinal {
3018                    0x7673e76395008257 => {
3019                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3020                        let mut req = fidl::new_empty!(
3021                            fidl::encoding::EmptyPayload,
3022                            fidl::encoding::DefaultFuchsiaResourceDialect
3023                        );
3024                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3025                        let control_handle =
3026                            IcdLoaderDeviceControlHandle { inner: this.inner.clone() };
3027                        Ok(IcdLoaderDeviceRequest::GetIcdList {
3028                            responder: IcdLoaderDeviceGetIcdListResponder {
3029                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3030                                tx_id: header.tx_id,
3031                            },
3032                        })
3033                    }
3034                    _ => Err(fidl::Error::UnknownOrdinal {
3035                        ordinal: header.ordinal,
3036                        protocol_name:
3037                            <IcdLoaderDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3038                    }),
3039                }))
3040            },
3041        )
3042    }
3043}
3044
3045/// Methods implemented by an MSD and exposed for use of an ICD loader.
3046#[derive(Debug)]
3047pub enum IcdLoaderDeviceRequest {
3048    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
3049    /// descending order of preference.
3050    GetIcdList { responder: IcdLoaderDeviceGetIcdListResponder },
3051}
3052
3053impl IcdLoaderDeviceRequest {
3054    #[allow(irrefutable_let_patterns)]
3055    pub fn into_get_icd_list(self) -> Option<(IcdLoaderDeviceGetIcdListResponder)> {
3056        if let IcdLoaderDeviceRequest::GetIcdList { responder } = self {
3057            Some((responder))
3058        } else {
3059            None
3060        }
3061    }
3062
3063    /// Name of the method defined in FIDL
3064    pub fn method_name(&self) -> &'static str {
3065        match *self {
3066            IcdLoaderDeviceRequest::GetIcdList { .. } => "get_icd_list",
3067        }
3068    }
3069}
3070
3071#[derive(Debug, Clone)]
3072pub struct IcdLoaderDeviceControlHandle {
3073    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3074}
3075
3076impl fidl::endpoints::ControlHandle for IcdLoaderDeviceControlHandle {
3077    fn shutdown(&self) {
3078        self.inner.shutdown()
3079    }
3080    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3081        self.inner.shutdown_with_epitaph(status)
3082    }
3083
3084    fn is_closed(&self) -> bool {
3085        self.inner.channel().is_closed()
3086    }
3087    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3088        self.inner.channel().on_closed()
3089    }
3090
3091    #[cfg(target_os = "fuchsia")]
3092    fn signal_peer(
3093        &self,
3094        clear_mask: zx::Signals,
3095        set_mask: zx::Signals,
3096    ) -> Result<(), zx_status::Status> {
3097        use fidl::Peered;
3098        self.inner.channel().signal_peer(clear_mask, set_mask)
3099    }
3100}
3101
3102impl IcdLoaderDeviceControlHandle {}
3103
3104#[must_use = "FIDL methods require a response to be sent"]
3105#[derive(Debug)]
3106pub struct IcdLoaderDeviceGetIcdListResponder {
3107    control_handle: std::mem::ManuallyDrop<IcdLoaderDeviceControlHandle>,
3108    tx_id: u32,
3109}
3110
3111/// Set the the channel to be shutdown (see [`IcdLoaderDeviceControlHandle::shutdown`])
3112/// if the responder is dropped without sending a response, so that the client
3113/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3114impl std::ops::Drop for IcdLoaderDeviceGetIcdListResponder {
3115    fn drop(&mut self) {
3116        self.control_handle.shutdown();
3117        // Safety: drops once, never accessed again
3118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3119    }
3120}
3121
3122impl fidl::endpoints::Responder for IcdLoaderDeviceGetIcdListResponder {
3123    type ControlHandle = IcdLoaderDeviceControlHandle;
3124
3125    fn control_handle(&self) -> &IcdLoaderDeviceControlHandle {
3126        &self.control_handle
3127    }
3128
3129    fn drop_without_shutdown(mut self) {
3130        // Safety: drops once, never accessed again due to mem::forget
3131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3132        // Prevent Drop from running (which would shut down the channel)
3133        std::mem::forget(self);
3134    }
3135}
3136
3137impl IcdLoaderDeviceGetIcdListResponder {
3138    /// Sends a response to the FIDL transaction.
3139    ///
3140    /// Sets the channel to shutdown if an error occurs.
3141    pub fn send(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
3142        let _result = self.send_raw(icd_list);
3143        if _result.is_err() {
3144            self.control_handle.shutdown();
3145        }
3146        self.drop_without_shutdown();
3147        _result
3148    }
3149
3150    /// Similar to "send" but does not shutdown the channel if an error occurs.
3151    pub fn send_no_shutdown_on_err(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
3152        let _result = self.send_raw(icd_list);
3153        self.drop_without_shutdown();
3154        _result
3155    }
3156
3157    fn send_raw(&self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
3158        self.control_handle.inner.send::<IcdLoaderDeviceGetIcdListResponse>(
3159            (icd_list,),
3160            self.tx_id,
3161            0x7673e76395008257,
3162            fidl::encoding::DynamicFlags::empty(),
3163        )
3164    }
3165}
3166
3167#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3168pub struct NotificationMarker;
3169
3170impl fidl::endpoints::ProtocolMarker for NotificationMarker {
3171    type Proxy = NotificationProxy;
3172    type RequestStream = NotificationRequestStream;
3173    #[cfg(target_os = "fuchsia")]
3174    type SynchronousProxy = NotificationSynchronousProxy;
3175
3176    const DEBUG_NAME: &'static str = "(anonymous) Notification";
3177}
3178
3179pub trait NotificationProxyInterface: Send + Sync {}
3180#[derive(Debug)]
3181#[cfg(target_os = "fuchsia")]
3182pub struct NotificationSynchronousProxy {
3183    client: fidl::client::sync::Client,
3184}
3185
3186#[cfg(target_os = "fuchsia")]
3187impl fidl::endpoints::SynchronousProxy for NotificationSynchronousProxy {
3188    type Proxy = NotificationProxy;
3189    type Protocol = NotificationMarker;
3190
3191    fn from_channel(inner: fidl::Channel) -> Self {
3192        Self::new(inner)
3193    }
3194
3195    fn into_channel(self) -> fidl::Channel {
3196        self.client.into_channel()
3197    }
3198
3199    fn as_channel(&self) -> &fidl::Channel {
3200        self.client.as_channel()
3201    }
3202}
3203
3204#[cfg(target_os = "fuchsia")]
3205impl NotificationSynchronousProxy {
3206    pub fn new(channel: fidl::Channel) -> Self {
3207        let protocol_name = <NotificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3208        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3209    }
3210
3211    pub fn into_channel(self) -> fidl::Channel {
3212        self.client.into_channel()
3213    }
3214
3215    /// Waits until an event arrives and returns it. It is safe for other
3216    /// threads to make concurrent requests while waiting for an event.
3217    pub fn wait_for_event(
3218        &self,
3219        deadline: zx::MonotonicInstant,
3220    ) -> Result<NotificationEvent, fidl::Error> {
3221        NotificationEvent::decode(self.client.wait_for_event(deadline)?)
3222    }
3223}
3224
3225#[cfg(target_os = "fuchsia")]
3226impl From<NotificationSynchronousProxy> for zx::Handle {
3227    fn from(value: NotificationSynchronousProxy) -> Self {
3228        value.into_channel().into()
3229    }
3230}
3231
3232#[cfg(target_os = "fuchsia")]
3233impl From<fidl::Channel> for NotificationSynchronousProxy {
3234    fn from(value: fidl::Channel) -> Self {
3235        Self::new(value)
3236    }
3237}
3238
3239#[cfg(target_os = "fuchsia")]
3240impl fidl::endpoints::FromClient for NotificationSynchronousProxy {
3241    type Protocol = NotificationMarker;
3242
3243    fn from_client(value: fidl::endpoints::ClientEnd<NotificationMarker>) -> Self {
3244        Self::new(value.into_channel())
3245    }
3246}
3247
3248#[derive(Debug, Clone)]
3249pub struct NotificationProxy {
3250    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3251}
3252
3253impl fidl::endpoints::Proxy for NotificationProxy {
3254    type Protocol = NotificationMarker;
3255
3256    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3257        Self::new(inner)
3258    }
3259
3260    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3261        self.client.into_channel().map_err(|client| Self { client })
3262    }
3263
3264    fn as_channel(&self) -> &::fidl::AsyncChannel {
3265        self.client.as_channel()
3266    }
3267}
3268
3269impl NotificationProxy {
3270    /// Create a new Proxy for fuchsia.gpu.magma/Notification.
3271    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3272        let protocol_name = <NotificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3273        Self { client: fidl::client::Client::new(channel, protocol_name) }
3274    }
3275
3276    /// Get a Stream of events from the remote end of the protocol.
3277    ///
3278    /// # Panics
3279    ///
3280    /// Panics if the event stream was already taken.
3281    pub fn take_event_stream(&self) -> NotificationEventStream {
3282        NotificationEventStream { event_receiver: self.client.take_event_receiver() }
3283    }
3284}
3285
3286impl NotificationProxyInterface for NotificationProxy {}
3287
3288pub struct NotificationEventStream {
3289    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3290}
3291
3292impl std::marker::Unpin for NotificationEventStream {}
3293
3294impl futures::stream::FusedStream for NotificationEventStream {
3295    fn is_terminated(&self) -> bool {
3296        self.event_receiver.is_terminated()
3297    }
3298}
3299
3300impl futures::Stream for NotificationEventStream {
3301    type Item = Result<NotificationEvent, fidl::Error>;
3302
3303    fn poll_next(
3304        mut self: std::pin::Pin<&mut Self>,
3305        cx: &mut std::task::Context<'_>,
3306    ) -> std::task::Poll<Option<Self::Item>> {
3307        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3308            &mut self.event_receiver,
3309            cx
3310        )?) {
3311            Some(buf) => std::task::Poll::Ready(Some(NotificationEvent::decode(buf))),
3312            None => std::task::Poll::Ready(None),
3313        }
3314    }
3315}
3316
3317#[derive(Debug)]
3318pub enum NotificationEvent {}
3319
3320impl NotificationEvent {
3321    /// Decodes a message buffer as a [`NotificationEvent`].
3322    fn decode(
3323        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3324    ) -> Result<NotificationEvent, fidl::Error> {
3325        let (bytes, _handles) = buf.split_mut();
3326        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3327        debug_assert_eq!(tx_header.tx_id, 0);
3328        match tx_header.ordinal {
3329            _ => Err(fidl::Error::UnknownOrdinal {
3330                ordinal: tx_header.ordinal,
3331                protocol_name: <NotificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3332            }),
3333        }
3334    }
3335}
3336
3337/// A Stream of incoming requests for fuchsia.gpu.magma/Notification.
3338pub struct NotificationRequestStream {
3339    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3340    is_terminated: bool,
3341}
3342
3343impl std::marker::Unpin for NotificationRequestStream {}
3344
3345impl futures::stream::FusedStream for NotificationRequestStream {
3346    fn is_terminated(&self) -> bool {
3347        self.is_terminated
3348    }
3349}
3350
3351impl fidl::endpoints::RequestStream for NotificationRequestStream {
3352    type Protocol = NotificationMarker;
3353    type ControlHandle = NotificationControlHandle;
3354
3355    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3356        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3357    }
3358
3359    fn control_handle(&self) -> Self::ControlHandle {
3360        NotificationControlHandle { inner: self.inner.clone() }
3361    }
3362
3363    fn into_inner(
3364        self,
3365    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3366    {
3367        (self.inner, self.is_terminated)
3368    }
3369
3370    fn from_inner(
3371        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3372        is_terminated: bool,
3373    ) -> Self {
3374        Self { inner, is_terminated }
3375    }
3376}
3377
3378impl futures::Stream for NotificationRequestStream {
3379    type Item = Result<NotificationRequest, fidl::Error>;
3380
3381    fn poll_next(
3382        mut self: std::pin::Pin<&mut Self>,
3383        cx: &mut std::task::Context<'_>,
3384    ) -> std::task::Poll<Option<Self::Item>> {
3385        let this = &mut *self;
3386        if this.inner.check_shutdown(cx) {
3387            this.is_terminated = true;
3388            return std::task::Poll::Ready(None);
3389        }
3390        if this.is_terminated {
3391            panic!("polled NotificationRequestStream after completion");
3392        }
3393        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3394            |bytes, handles| {
3395                match this.inner.channel().read_etc(cx, bytes, handles) {
3396                    std::task::Poll::Ready(Ok(())) => {}
3397                    std::task::Poll::Pending => return std::task::Poll::Pending,
3398                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3399                        this.is_terminated = true;
3400                        return std::task::Poll::Ready(None);
3401                    }
3402                    std::task::Poll::Ready(Err(e)) => {
3403                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3404                            e.into(),
3405                        ))));
3406                    }
3407                }
3408
3409                // A message has been received from the channel
3410                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3411
3412                std::task::Poll::Ready(Some(match header.ordinal {
3413                    _ => Err(fidl::Error::UnknownOrdinal {
3414                        ordinal: header.ordinal,
3415                        protocol_name:
3416                            <NotificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3417                    }),
3418                }))
3419            },
3420        )
3421    }
3422}
3423
3424/// This protocol is empty as the message contents are vendor specific.
3425#[derive(Debug)]
3426pub enum NotificationRequest {}
3427
3428impl NotificationRequest {
3429    /// Name of the method defined in FIDL
3430    pub fn method_name(&self) -> &'static str {
3431        match *self {}
3432    }
3433}
3434
3435#[derive(Debug, Clone)]
3436pub struct NotificationControlHandle {
3437    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3438}
3439
3440impl fidl::endpoints::ControlHandle for NotificationControlHandle {
3441    fn shutdown(&self) {
3442        self.inner.shutdown()
3443    }
3444    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3445        self.inner.shutdown_with_epitaph(status)
3446    }
3447
3448    fn is_closed(&self) -> bool {
3449        self.inner.channel().is_closed()
3450    }
3451    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3452        self.inner.channel().on_closed()
3453    }
3454
3455    #[cfg(target_os = "fuchsia")]
3456    fn signal_peer(
3457        &self,
3458        clear_mask: zx::Signals,
3459        set_mask: zx::Signals,
3460    ) -> Result<(), zx_status::Status> {
3461        use fidl::Peered;
3462        self.inner.channel().signal_peer(clear_mask, set_mask)
3463    }
3464}
3465
3466impl NotificationControlHandle {}
3467
3468#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3469pub struct PerformanceCounterAccessMarker;
3470
3471impl fidl::endpoints::ProtocolMarker for PerformanceCounterAccessMarker {
3472    type Proxy = PerformanceCounterAccessProxy;
3473    type RequestStream = PerformanceCounterAccessRequestStream;
3474    #[cfg(target_os = "fuchsia")]
3475    type SynchronousProxy = PerformanceCounterAccessSynchronousProxy;
3476
3477    const DEBUG_NAME: &'static str = "(anonymous) PerformanceCounterAccess";
3478}
3479
3480pub trait PerformanceCounterAccessProxyInterface: Send + Sync {
3481    type GetPerformanceCountTokenResponseFut: std::future::Future<Output = Result<fidl::Event, fidl::Error>>
3482        + Send;
3483    fn r#get_performance_count_token(&self) -> Self::GetPerformanceCountTokenResponseFut;
3484}
3485#[derive(Debug)]
3486#[cfg(target_os = "fuchsia")]
3487pub struct PerformanceCounterAccessSynchronousProxy {
3488    client: fidl::client::sync::Client,
3489}
3490
3491#[cfg(target_os = "fuchsia")]
3492impl fidl::endpoints::SynchronousProxy for PerformanceCounterAccessSynchronousProxy {
3493    type Proxy = PerformanceCounterAccessProxy;
3494    type Protocol = PerformanceCounterAccessMarker;
3495
3496    fn from_channel(inner: fidl::Channel) -> Self {
3497        Self::new(inner)
3498    }
3499
3500    fn into_channel(self) -> fidl::Channel {
3501        self.client.into_channel()
3502    }
3503
3504    fn as_channel(&self) -> &fidl::Channel {
3505        self.client.as_channel()
3506    }
3507}
3508
3509#[cfg(target_os = "fuchsia")]
3510impl PerformanceCounterAccessSynchronousProxy {
3511    pub fn new(channel: fidl::Channel) -> Self {
3512        let protocol_name =
3513            <PerformanceCounterAccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3514        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3515    }
3516
3517    pub fn into_channel(self) -> fidl::Channel {
3518        self.client.into_channel()
3519    }
3520
3521    /// Waits until an event arrives and returns it. It is safe for other
3522    /// threads to make concurrent requests while waiting for an event.
3523    pub fn wait_for_event(
3524        &self,
3525        deadline: zx::MonotonicInstant,
3526    ) -> Result<PerformanceCounterAccessEvent, fidl::Error> {
3527        PerformanceCounterAccessEvent::decode(self.client.wait_for_event(deadline)?)
3528    }
3529
3530    /// This access token is not used as an event, but is instead passed to
3531    /// Primary.EnablePerformanceCounterAccess.
3532    pub fn r#get_performance_count_token(
3533        &self,
3534        ___deadline: zx::MonotonicInstant,
3535    ) -> Result<fidl::Event, fidl::Error> {
3536        let _response = self.client.send_query::<
3537            fidl::encoding::EmptyPayload,
3538            PerformanceCounterAccessGetPerformanceCountTokenResponse,
3539        >(
3540            (),
3541            0x48410470c5f00f92,
3542            fidl::encoding::DynamicFlags::empty(),
3543            ___deadline,
3544        )?;
3545        Ok(_response.access_token)
3546    }
3547}
3548
3549#[cfg(target_os = "fuchsia")]
3550impl From<PerformanceCounterAccessSynchronousProxy> for zx::Handle {
3551    fn from(value: PerformanceCounterAccessSynchronousProxy) -> Self {
3552        value.into_channel().into()
3553    }
3554}
3555
3556#[cfg(target_os = "fuchsia")]
3557impl From<fidl::Channel> for PerformanceCounterAccessSynchronousProxy {
3558    fn from(value: fidl::Channel) -> Self {
3559        Self::new(value)
3560    }
3561}
3562
3563#[cfg(target_os = "fuchsia")]
3564impl fidl::endpoints::FromClient for PerformanceCounterAccessSynchronousProxy {
3565    type Protocol = PerformanceCounterAccessMarker;
3566
3567    fn from_client(value: fidl::endpoints::ClientEnd<PerformanceCounterAccessMarker>) -> Self {
3568        Self::new(value.into_channel())
3569    }
3570}
3571
3572#[derive(Debug, Clone)]
3573pub struct PerformanceCounterAccessProxy {
3574    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3575}
3576
3577impl fidl::endpoints::Proxy for PerformanceCounterAccessProxy {
3578    type Protocol = PerformanceCounterAccessMarker;
3579
3580    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3581        Self::new(inner)
3582    }
3583
3584    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3585        self.client.into_channel().map_err(|client| Self { client })
3586    }
3587
3588    fn as_channel(&self) -> &::fidl::AsyncChannel {
3589        self.client.as_channel()
3590    }
3591}
3592
3593impl PerformanceCounterAccessProxy {
3594    /// Create a new Proxy for fuchsia.gpu.magma/PerformanceCounterAccess.
3595    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3596        let protocol_name =
3597            <PerformanceCounterAccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3598        Self { client: fidl::client::Client::new(channel, protocol_name) }
3599    }
3600
3601    /// Get a Stream of events from the remote end of the protocol.
3602    ///
3603    /// # Panics
3604    ///
3605    /// Panics if the event stream was already taken.
3606    pub fn take_event_stream(&self) -> PerformanceCounterAccessEventStream {
3607        PerformanceCounterAccessEventStream { event_receiver: self.client.take_event_receiver() }
3608    }
3609
3610    /// This access token is not used as an event, but is instead passed to
3611    /// Primary.EnablePerformanceCounterAccess.
3612    pub fn r#get_performance_count_token(
3613        &self,
3614    ) -> fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>
3615    {
3616        PerformanceCounterAccessProxyInterface::r#get_performance_count_token(self)
3617    }
3618}
3619
3620impl PerformanceCounterAccessProxyInterface for PerformanceCounterAccessProxy {
3621    type GetPerformanceCountTokenResponseFut =
3622        fidl::client::QueryResponseFut<fidl::Event, fidl::encoding::DefaultFuchsiaResourceDialect>;
3623    fn r#get_performance_count_token(&self) -> Self::GetPerformanceCountTokenResponseFut {
3624        fn _decode(
3625            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3626        ) -> Result<fidl::Event, fidl::Error> {
3627            let _response = fidl::client::decode_transaction_body::<
3628                PerformanceCounterAccessGetPerformanceCountTokenResponse,
3629                fidl::encoding::DefaultFuchsiaResourceDialect,
3630                0x48410470c5f00f92,
3631            >(_buf?)?;
3632            Ok(_response.access_token)
3633        }
3634        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::Event>(
3635            (),
3636            0x48410470c5f00f92,
3637            fidl::encoding::DynamicFlags::empty(),
3638            _decode,
3639        )
3640    }
3641}
3642
3643pub struct PerformanceCounterAccessEventStream {
3644    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3645}
3646
3647impl std::marker::Unpin for PerformanceCounterAccessEventStream {}
3648
3649impl futures::stream::FusedStream for PerformanceCounterAccessEventStream {
3650    fn is_terminated(&self) -> bool {
3651        self.event_receiver.is_terminated()
3652    }
3653}
3654
3655impl futures::Stream for PerformanceCounterAccessEventStream {
3656    type Item = Result<PerformanceCounterAccessEvent, fidl::Error>;
3657
3658    fn poll_next(
3659        mut self: std::pin::Pin<&mut Self>,
3660        cx: &mut std::task::Context<'_>,
3661    ) -> std::task::Poll<Option<Self::Item>> {
3662        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3663            &mut self.event_receiver,
3664            cx
3665        )?) {
3666            Some(buf) => std::task::Poll::Ready(Some(PerformanceCounterAccessEvent::decode(buf))),
3667            None => std::task::Poll::Ready(None),
3668        }
3669    }
3670}
3671
3672#[derive(Debug)]
3673pub enum PerformanceCounterAccessEvent {}
3674
3675impl PerformanceCounterAccessEvent {
3676    /// Decodes a message buffer as a [`PerformanceCounterAccessEvent`].
3677    fn decode(
3678        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3679    ) -> Result<PerformanceCounterAccessEvent, fidl::Error> {
3680        let (bytes, _handles) = buf.split_mut();
3681        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3682        debug_assert_eq!(tx_header.tx_id, 0);
3683        match tx_header.ordinal {
3684            _ => Err(fidl::Error::UnknownOrdinal {
3685                ordinal: tx_header.ordinal,
3686                protocol_name:
3687                    <PerformanceCounterAccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3688            }),
3689        }
3690    }
3691}
3692
3693/// A Stream of incoming requests for fuchsia.gpu.magma/PerformanceCounterAccess.
3694pub struct PerformanceCounterAccessRequestStream {
3695    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3696    is_terminated: bool,
3697}
3698
3699impl std::marker::Unpin for PerformanceCounterAccessRequestStream {}
3700
3701impl futures::stream::FusedStream for PerformanceCounterAccessRequestStream {
3702    fn is_terminated(&self) -> bool {
3703        self.is_terminated
3704    }
3705}
3706
3707impl fidl::endpoints::RequestStream for PerformanceCounterAccessRequestStream {
3708    type Protocol = PerformanceCounterAccessMarker;
3709    type ControlHandle = PerformanceCounterAccessControlHandle;
3710
3711    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3712        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3713    }
3714
3715    fn control_handle(&self) -> Self::ControlHandle {
3716        PerformanceCounterAccessControlHandle { inner: self.inner.clone() }
3717    }
3718
3719    fn into_inner(
3720        self,
3721    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3722    {
3723        (self.inner, self.is_terminated)
3724    }
3725
3726    fn from_inner(
3727        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3728        is_terminated: bool,
3729    ) -> Self {
3730        Self { inner, is_terminated }
3731    }
3732}
3733
3734impl futures::Stream for PerformanceCounterAccessRequestStream {
3735    type Item = Result<PerformanceCounterAccessRequest, fidl::Error>;
3736
3737    fn poll_next(
3738        mut self: std::pin::Pin<&mut Self>,
3739        cx: &mut std::task::Context<'_>,
3740    ) -> std::task::Poll<Option<Self::Item>> {
3741        let this = &mut *self;
3742        if this.inner.check_shutdown(cx) {
3743            this.is_terminated = true;
3744            return std::task::Poll::Ready(None);
3745        }
3746        if this.is_terminated {
3747            panic!("polled PerformanceCounterAccessRequestStream after completion");
3748        }
3749        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3750            |bytes, handles| {
3751                match this.inner.channel().read_etc(cx, bytes, handles) {
3752                    std::task::Poll::Ready(Ok(())) => {}
3753                    std::task::Poll::Pending => return std::task::Poll::Pending,
3754                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3755                        this.is_terminated = true;
3756                        return std::task::Poll::Ready(None);
3757                    }
3758                    std::task::Poll::Ready(Err(e)) => {
3759                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3760                            e.into(),
3761                        ))));
3762                    }
3763                }
3764
3765                // A message has been received from the channel
3766                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3767
3768                std::task::Poll::Ready(Some(match header.ordinal {
3769                0x48410470c5f00f92 => {
3770                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3771                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3772                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3773                    let control_handle = PerformanceCounterAccessControlHandle {
3774                        inner: this.inner.clone(),
3775                    };
3776                    Ok(PerformanceCounterAccessRequest::GetPerformanceCountToken {
3777                        responder: PerformanceCounterAccessGetPerformanceCountTokenResponder {
3778                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3779                            tx_id: header.tx_id,
3780                        },
3781                    })
3782                }
3783                _ => Err(fidl::Error::UnknownOrdinal {
3784                    ordinal: header.ordinal,
3785                    protocol_name: <PerformanceCounterAccessMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3786                }),
3787            }))
3788            },
3789        )
3790    }
3791}
3792
3793/// This protocol is implemented by ZX_PROTOCOL_GPU_PERFORMANCE_COUNTERS devices.
3794#[derive(Debug)]
3795pub enum PerformanceCounterAccessRequest {
3796    /// This access token is not used as an event, but is instead passed to
3797    /// Primary.EnablePerformanceCounterAccess.
3798    GetPerformanceCountToken {
3799        responder: PerformanceCounterAccessGetPerformanceCountTokenResponder,
3800    },
3801}
3802
3803impl PerformanceCounterAccessRequest {
3804    #[allow(irrefutable_let_patterns)]
3805    pub fn into_get_performance_count_token(
3806        self,
3807    ) -> Option<(PerformanceCounterAccessGetPerformanceCountTokenResponder)> {
3808        if let PerformanceCounterAccessRequest::GetPerformanceCountToken { responder } = self {
3809            Some((responder))
3810        } else {
3811            None
3812        }
3813    }
3814
3815    /// Name of the method defined in FIDL
3816    pub fn method_name(&self) -> &'static str {
3817        match *self {
3818            PerformanceCounterAccessRequest::GetPerformanceCountToken { .. } => {
3819                "get_performance_count_token"
3820            }
3821        }
3822    }
3823}
3824
3825#[derive(Debug, Clone)]
3826pub struct PerformanceCounterAccessControlHandle {
3827    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3828}
3829
3830impl fidl::endpoints::ControlHandle for PerformanceCounterAccessControlHandle {
3831    fn shutdown(&self) {
3832        self.inner.shutdown()
3833    }
3834    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3835        self.inner.shutdown_with_epitaph(status)
3836    }
3837
3838    fn is_closed(&self) -> bool {
3839        self.inner.channel().is_closed()
3840    }
3841    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3842        self.inner.channel().on_closed()
3843    }
3844
3845    #[cfg(target_os = "fuchsia")]
3846    fn signal_peer(
3847        &self,
3848        clear_mask: zx::Signals,
3849        set_mask: zx::Signals,
3850    ) -> Result<(), zx_status::Status> {
3851        use fidl::Peered;
3852        self.inner.channel().signal_peer(clear_mask, set_mask)
3853    }
3854}
3855
3856impl PerformanceCounterAccessControlHandle {}
3857
3858#[must_use = "FIDL methods require a response to be sent"]
3859#[derive(Debug)]
3860pub struct PerformanceCounterAccessGetPerformanceCountTokenResponder {
3861    control_handle: std::mem::ManuallyDrop<PerformanceCounterAccessControlHandle>,
3862    tx_id: u32,
3863}
3864
3865/// Set the the channel to be shutdown (see [`PerformanceCounterAccessControlHandle::shutdown`])
3866/// if the responder is dropped without sending a response, so that the client
3867/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3868impl std::ops::Drop for PerformanceCounterAccessGetPerformanceCountTokenResponder {
3869    fn drop(&mut self) {
3870        self.control_handle.shutdown();
3871        // Safety: drops once, never accessed again
3872        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3873    }
3874}
3875
3876impl fidl::endpoints::Responder for PerformanceCounterAccessGetPerformanceCountTokenResponder {
3877    type ControlHandle = PerformanceCounterAccessControlHandle;
3878
3879    fn control_handle(&self) -> &PerformanceCounterAccessControlHandle {
3880        &self.control_handle
3881    }
3882
3883    fn drop_without_shutdown(mut self) {
3884        // Safety: drops once, never accessed again due to mem::forget
3885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3886        // Prevent Drop from running (which would shut down the channel)
3887        std::mem::forget(self);
3888    }
3889}
3890
3891impl PerformanceCounterAccessGetPerformanceCountTokenResponder {
3892    /// Sends a response to the FIDL transaction.
3893    ///
3894    /// Sets the channel to shutdown if an error occurs.
3895    pub fn send(self, mut access_token: fidl::Event) -> Result<(), fidl::Error> {
3896        let _result = self.send_raw(access_token);
3897        if _result.is_err() {
3898            self.control_handle.shutdown();
3899        }
3900        self.drop_without_shutdown();
3901        _result
3902    }
3903
3904    /// Similar to "send" but does not shutdown the channel if an error occurs.
3905    pub fn send_no_shutdown_on_err(self, mut access_token: fidl::Event) -> Result<(), fidl::Error> {
3906        let _result = self.send_raw(access_token);
3907        self.drop_without_shutdown();
3908        _result
3909    }
3910
3911    fn send_raw(&self, mut access_token: fidl::Event) -> Result<(), fidl::Error> {
3912        self.control_handle.inner.send::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
3913            (access_token,),
3914            self.tx_id,
3915            0x48410470c5f00f92,
3916            fidl::encoding::DynamicFlags::empty(),
3917        )
3918    }
3919}
3920
3921#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3922pub struct PerformanceCounterEventsMarker;
3923
3924impl fidl::endpoints::ProtocolMarker for PerformanceCounterEventsMarker {
3925    type Proxy = PerformanceCounterEventsProxy;
3926    type RequestStream = PerformanceCounterEventsRequestStream;
3927    #[cfg(target_os = "fuchsia")]
3928    type SynchronousProxy = PerformanceCounterEventsSynchronousProxy;
3929
3930    const DEBUG_NAME: &'static str = "(anonymous) PerformanceCounterEvents";
3931}
3932
3933pub trait PerformanceCounterEventsProxyInterface: Send + Sync {}
3934#[derive(Debug)]
3935#[cfg(target_os = "fuchsia")]
3936pub struct PerformanceCounterEventsSynchronousProxy {
3937    client: fidl::client::sync::Client,
3938}
3939
3940#[cfg(target_os = "fuchsia")]
3941impl fidl::endpoints::SynchronousProxy for PerformanceCounterEventsSynchronousProxy {
3942    type Proxy = PerformanceCounterEventsProxy;
3943    type Protocol = PerformanceCounterEventsMarker;
3944
3945    fn from_channel(inner: fidl::Channel) -> Self {
3946        Self::new(inner)
3947    }
3948
3949    fn into_channel(self) -> fidl::Channel {
3950        self.client.into_channel()
3951    }
3952
3953    fn as_channel(&self) -> &fidl::Channel {
3954        self.client.as_channel()
3955    }
3956}
3957
3958#[cfg(target_os = "fuchsia")]
3959impl PerformanceCounterEventsSynchronousProxy {
3960    pub fn new(channel: fidl::Channel) -> Self {
3961        let protocol_name =
3962            <PerformanceCounterEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3963        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3964    }
3965
3966    pub fn into_channel(self) -> fidl::Channel {
3967        self.client.into_channel()
3968    }
3969
3970    /// Waits until an event arrives and returns it. It is safe for other
3971    /// threads to make concurrent requests while waiting for an event.
3972    pub fn wait_for_event(
3973        &self,
3974        deadline: zx::MonotonicInstant,
3975    ) -> Result<PerformanceCounterEventsEvent, fidl::Error> {
3976        PerformanceCounterEventsEvent::decode(self.client.wait_for_event(deadline)?)
3977    }
3978}
3979
3980#[cfg(target_os = "fuchsia")]
3981impl From<PerformanceCounterEventsSynchronousProxy> for zx::Handle {
3982    fn from(value: PerformanceCounterEventsSynchronousProxy) -> Self {
3983        value.into_channel().into()
3984    }
3985}
3986
3987#[cfg(target_os = "fuchsia")]
3988impl From<fidl::Channel> for PerformanceCounterEventsSynchronousProxy {
3989    fn from(value: fidl::Channel) -> Self {
3990        Self::new(value)
3991    }
3992}
3993
3994#[cfg(target_os = "fuchsia")]
3995impl fidl::endpoints::FromClient for PerformanceCounterEventsSynchronousProxy {
3996    type Protocol = PerformanceCounterEventsMarker;
3997
3998    fn from_client(value: fidl::endpoints::ClientEnd<PerformanceCounterEventsMarker>) -> Self {
3999        Self::new(value.into_channel())
4000    }
4001}
4002
4003#[derive(Debug, Clone)]
4004pub struct PerformanceCounterEventsProxy {
4005    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4006}
4007
4008impl fidl::endpoints::Proxy for PerformanceCounterEventsProxy {
4009    type Protocol = PerformanceCounterEventsMarker;
4010
4011    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4012        Self::new(inner)
4013    }
4014
4015    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4016        self.client.into_channel().map_err(|client| Self { client })
4017    }
4018
4019    fn as_channel(&self) -> &::fidl::AsyncChannel {
4020        self.client.as_channel()
4021    }
4022}
4023
4024impl PerformanceCounterEventsProxy {
4025    /// Create a new Proxy for fuchsia.gpu.magma/PerformanceCounterEvents.
4026    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4027        let protocol_name =
4028            <PerformanceCounterEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4029        Self { client: fidl::client::Client::new(channel, protocol_name) }
4030    }
4031
4032    /// Get a Stream of events from the remote end of the protocol.
4033    ///
4034    /// # Panics
4035    ///
4036    /// Panics if the event stream was already taken.
4037    pub fn take_event_stream(&self) -> PerformanceCounterEventsEventStream {
4038        PerformanceCounterEventsEventStream { event_receiver: self.client.take_event_receiver() }
4039    }
4040}
4041
4042impl PerformanceCounterEventsProxyInterface for PerformanceCounterEventsProxy {}
4043
4044pub struct PerformanceCounterEventsEventStream {
4045    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4046}
4047
4048impl std::marker::Unpin for PerformanceCounterEventsEventStream {}
4049
4050impl futures::stream::FusedStream for PerformanceCounterEventsEventStream {
4051    fn is_terminated(&self) -> bool {
4052        self.event_receiver.is_terminated()
4053    }
4054}
4055
4056impl futures::Stream for PerformanceCounterEventsEventStream {
4057    type Item = Result<PerformanceCounterEventsEvent, fidl::Error>;
4058
4059    fn poll_next(
4060        mut self: std::pin::Pin<&mut Self>,
4061        cx: &mut std::task::Context<'_>,
4062    ) -> std::task::Poll<Option<Self::Item>> {
4063        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4064            &mut self.event_receiver,
4065            cx
4066        )?) {
4067            Some(buf) => std::task::Poll::Ready(Some(PerformanceCounterEventsEvent::decode(buf))),
4068            None => std::task::Poll::Ready(None),
4069        }
4070    }
4071}
4072
4073#[derive(Debug)]
4074pub enum PerformanceCounterEventsEvent {
4075    OnPerformanceCounterReadCompleted {
4076        payload: PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest,
4077    },
4078}
4079
4080impl PerformanceCounterEventsEvent {
4081    #[allow(irrefutable_let_patterns)]
4082    pub fn into_on_performance_counter_read_completed(
4083        self,
4084    ) -> Option<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest> {
4085        if let PerformanceCounterEventsEvent::OnPerformanceCounterReadCompleted { payload } = self {
4086            Some((payload))
4087        } else {
4088            None
4089        }
4090    }
4091
4092    /// Decodes a message buffer as a [`PerformanceCounterEventsEvent`].
4093    fn decode(
4094        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4095    ) -> Result<PerformanceCounterEventsEvent, fidl::Error> {
4096        let (bytes, _handles) = buf.split_mut();
4097        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4098        debug_assert_eq!(tx_header.tx_id, 0);
4099        match tx_header.ordinal {
4100            0x3f134926720d44d7 => {
4101                let mut out = fidl::new_empty!(
4102                    PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest,
4103                    fidl::encoding::DefaultFuchsiaResourceDialect
4104                );
4105                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
4106                Ok((PerformanceCounterEventsEvent::OnPerformanceCounterReadCompleted {
4107                    payload: out,
4108                }))
4109            }
4110            _ => Err(fidl::Error::UnknownOrdinal {
4111                ordinal: tx_header.ordinal,
4112                protocol_name:
4113                    <PerformanceCounterEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4114            }),
4115        }
4116    }
4117}
4118
4119/// A Stream of incoming requests for fuchsia.gpu.magma/PerformanceCounterEvents.
4120pub struct PerformanceCounterEventsRequestStream {
4121    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4122    is_terminated: bool,
4123}
4124
4125impl std::marker::Unpin for PerformanceCounterEventsRequestStream {}
4126
4127impl futures::stream::FusedStream for PerformanceCounterEventsRequestStream {
4128    fn is_terminated(&self) -> bool {
4129        self.is_terminated
4130    }
4131}
4132
4133impl fidl::endpoints::RequestStream for PerformanceCounterEventsRequestStream {
4134    type Protocol = PerformanceCounterEventsMarker;
4135    type ControlHandle = PerformanceCounterEventsControlHandle;
4136
4137    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4138        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4139    }
4140
4141    fn control_handle(&self) -> Self::ControlHandle {
4142        PerformanceCounterEventsControlHandle { inner: self.inner.clone() }
4143    }
4144
4145    fn into_inner(
4146        self,
4147    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4148    {
4149        (self.inner, self.is_terminated)
4150    }
4151
4152    fn from_inner(
4153        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4154        is_terminated: bool,
4155    ) -> Self {
4156        Self { inner, is_terminated }
4157    }
4158}
4159
4160impl futures::Stream for PerformanceCounterEventsRequestStream {
4161    type Item = Result<PerformanceCounterEventsRequest, fidl::Error>;
4162
4163    fn poll_next(
4164        mut self: std::pin::Pin<&mut Self>,
4165        cx: &mut std::task::Context<'_>,
4166    ) -> std::task::Poll<Option<Self::Item>> {
4167        let this = &mut *self;
4168        if this.inner.check_shutdown(cx) {
4169            this.is_terminated = true;
4170            return std::task::Poll::Ready(None);
4171        }
4172        if this.is_terminated {
4173            panic!("polled PerformanceCounterEventsRequestStream after completion");
4174        }
4175        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4176            |bytes, handles| {
4177                match this.inner.channel().read_etc(cx, bytes, handles) {
4178                    std::task::Poll::Ready(Ok(())) => {}
4179                    std::task::Poll::Pending => return std::task::Poll::Pending,
4180                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4181                        this.is_terminated = true;
4182                        return std::task::Poll::Ready(None);
4183                    }
4184                    std::task::Poll::Ready(Err(e)) => {
4185                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4186                            e.into(),
4187                        ))));
4188                    }
4189                }
4190
4191                // A message has been received from the channel
4192                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4193
4194                std::task::Poll::Ready(Some(match header.ordinal {
4195                _ => Err(fidl::Error::UnknownOrdinal {
4196                    ordinal: header.ordinal,
4197                    protocol_name: <PerformanceCounterEventsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4198                }),
4199            }))
4200            },
4201        )
4202    }
4203}
4204
4205#[derive(Debug)]
4206pub enum PerformanceCounterEventsRequest {}
4207
4208impl PerformanceCounterEventsRequest {
4209    /// Name of the method defined in FIDL
4210    pub fn method_name(&self) -> &'static str {
4211        match *self {}
4212    }
4213}
4214
4215#[derive(Debug, Clone)]
4216pub struct PerformanceCounterEventsControlHandle {
4217    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4218}
4219
4220impl fidl::endpoints::ControlHandle for PerformanceCounterEventsControlHandle {
4221    fn shutdown(&self) {
4222        self.inner.shutdown()
4223    }
4224    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4225        self.inner.shutdown_with_epitaph(status)
4226    }
4227
4228    fn is_closed(&self) -> bool {
4229        self.inner.channel().is_closed()
4230    }
4231    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4232        self.inner.channel().on_closed()
4233    }
4234
4235    #[cfg(target_os = "fuchsia")]
4236    fn signal_peer(
4237        &self,
4238        clear_mask: zx::Signals,
4239        set_mask: zx::Signals,
4240    ) -> Result<(), zx_status::Status> {
4241        use fidl::Peered;
4242        self.inner.channel().signal_peer(clear_mask, set_mask)
4243    }
4244}
4245
4246impl PerformanceCounterEventsControlHandle {
4247    pub fn send_on_performance_counter_read_completed(
4248        &self,
4249        mut payload: &PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest,
4250    ) -> Result<(), fidl::Error> {
4251        self.inner.send::<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest>(
4252            payload,
4253            0,
4254            0x3f134926720d44d7,
4255            fidl::encoding::DynamicFlags::empty(),
4256        )
4257    }
4258}
4259
4260#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4261pub struct PowerElementProviderMarker;
4262
4263impl fidl::endpoints::ProtocolMarker for PowerElementProviderMarker {
4264    type Proxy = PowerElementProviderProxy;
4265    type RequestStream = PowerElementProviderRequestStream;
4266    #[cfg(target_os = "fuchsia")]
4267    type SynchronousProxy = PowerElementProviderSynchronousProxy;
4268
4269    const DEBUG_NAME: &'static str = "(anonymous) PowerElementProvider";
4270}
4271pub type PowerElementProviderGetClockSpeedLevelResult =
4272    Result<PowerElementProviderGetClockSpeedLevelResponse, i32>;
4273pub type PowerElementProviderSetClockLimitResult =
4274    Result<PowerElementProviderSetClockLimitResponse, i32>;
4275
4276pub trait PowerElementProviderProxyInterface: Send + Sync {
4277    type GetPowerGoalsResponseFut: std::future::Future<Output = Result<Vec<PowerGoal>, fidl::Error>>
4278        + Send;
4279    fn r#get_power_goals(&self) -> Self::GetPowerGoalsResponseFut;
4280    type GetClockSpeedLevelResponseFut: std::future::Future<
4281            Output = Result<PowerElementProviderGetClockSpeedLevelResult, fidl::Error>,
4282        > + Send;
4283    fn r#get_clock_speed_level(
4284        &self,
4285        payload: &PowerElementProviderGetClockSpeedLevelRequest,
4286    ) -> Self::GetClockSpeedLevelResponseFut;
4287    type SetClockLimitResponseFut: std::future::Future<Output = Result<PowerElementProviderSetClockLimitResult, fidl::Error>>
4288        + Send;
4289    fn r#set_clock_limit(
4290        &self,
4291        payload: &PowerElementProviderSetClockLimitRequest,
4292    ) -> Self::SetClockLimitResponseFut;
4293}
4294#[derive(Debug)]
4295#[cfg(target_os = "fuchsia")]
4296pub struct PowerElementProviderSynchronousProxy {
4297    client: fidl::client::sync::Client,
4298}
4299
4300#[cfg(target_os = "fuchsia")]
4301impl fidl::endpoints::SynchronousProxy for PowerElementProviderSynchronousProxy {
4302    type Proxy = PowerElementProviderProxy;
4303    type Protocol = PowerElementProviderMarker;
4304
4305    fn from_channel(inner: fidl::Channel) -> Self {
4306        Self::new(inner)
4307    }
4308
4309    fn into_channel(self) -> fidl::Channel {
4310        self.client.into_channel()
4311    }
4312
4313    fn as_channel(&self) -> &fidl::Channel {
4314        self.client.as_channel()
4315    }
4316}
4317
4318#[cfg(target_os = "fuchsia")]
4319impl PowerElementProviderSynchronousProxy {
4320    pub fn new(channel: fidl::Channel) -> Self {
4321        let protocol_name =
4322            <PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4323        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4324    }
4325
4326    pub fn into_channel(self) -> fidl::Channel {
4327        self.client.into_channel()
4328    }
4329
4330    /// Waits until an event arrives and returns it. It is safe for other
4331    /// threads to make concurrent requests while waiting for an event.
4332    pub fn wait_for_event(
4333        &self,
4334        deadline: zx::MonotonicInstant,
4335    ) -> Result<PowerElementProviderEvent, fidl::Error> {
4336        PowerElementProviderEvent::decode(self.client.wait_for_event(deadline)?)
4337    }
4338
4339    /// Retrieve a list of power goals that the hardware can attempt to achieve.
4340    pub fn r#get_power_goals(
4341        &self,
4342        ___deadline: zx::MonotonicInstant,
4343    ) -> Result<Vec<PowerGoal>, fidl::Error> {
4344        let _response = self.client.send_query::<
4345            fidl::encoding::EmptyPayload,
4346            fidl::encoding::FlexibleType<PowerElementProviderGetPowerGoalsResponse>,
4347        >(
4348            (),
4349            0x2ff49ddffb0e07c0,
4350            fidl::encoding::DynamicFlags::FLEXIBLE,
4351            ___deadline,
4352        )?
4353        .into_result::<PowerElementProviderMarker>("get_power_goals")?;
4354        Ok(_response.goals)
4355    }
4356
4357    /// Get a power level that represents the GPU clock being set to at least a target frequency.
4358    /// The power level may allow the GPU to idle or turn off, as long as the clock frequency
4359    /// remains the same.
4360    pub fn r#get_clock_speed_level(
4361        &self,
4362        mut payload: &PowerElementProviderGetClockSpeedLevelRequest,
4363        ___deadline: zx::MonotonicInstant,
4364    ) -> Result<PowerElementProviderGetClockSpeedLevelResult, fidl::Error> {
4365        let _response = self.client.send_query::<
4366            PowerElementProviderGetClockSpeedLevelRequest,
4367            fidl::encoding::FlexibleResultType<PowerElementProviderGetClockSpeedLevelResponse, i32>,
4368        >(
4369            payload,
4370            0x5315a9bc44a9c53c,
4371            fidl::encoding::DynamicFlags::FLEXIBLE,
4372            ___deadline,
4373        )?
4374        .into_result::<PowerElementProviderMarker>("get_clock_speed_level")?;
4375        Ok(_response.map(|x| x))
4376    }
4377
4378    /// Limit the clock to at most a specific frequency.
4379    pub fn r#set_clock_limit(
4380        &self,
4381        mut payload: &PowerElementProviderSetClockLimitRequest,
4382        ___deadline: zx::MonotonicInstant,
4383    ) -> Result<PowerElementProviderSetClockLimitResult, fidl::Error> {
4384        let _response = self.client.send_query::<
4385            PowerElementProviderSetClockLimitRequest,
4386            fidl::encoding::FlexibleResultType<PowerElementProviderSetClockLimitResponse, i32>,
4387        >(
4388            payload,
4389            0x614bf25c3a1571b4,
4390            fidl::encoding::DynamicFlags::FLEXIBLE,
4391            ___deadline,
4392        )?
4393        .into_result::<PowerElementProviderMarker>("set_clock_limit")?;
4394        Ok(_response.map(|x| x))
4395    }
4396}
4397
4398#[cfg(target_os = "fuchsia")]
4399impl From<PowerElementProviderSynchronousProxy> for zx::Handle {
4400    fn from(value: PowerElementProviderSynchronousProxy) -> Self {
4401        value.into_channel().into()
4402    }
4403}
4404
4405#[cfg(target_os = "fuchsia")]
4406impl From<fidl::Channel> for PowerElementProviderSynchronousProxy {
4407    fn from(value: fidl::Channel) -> Self {
4408        Self::new(value)
4409    }
4410}
4411
4412#[cfg(target_os = "fuchsia")]
4413impl fidl::endpoints::FromClient for PowerElementProviderSynchronousProxy {
4414    type Protocol = PowerElementProviderMarker;
4415
4416    fn from_client(value: fidl::endpoints::ClientEnd<PowerElementProviderMarker>) -> Self {
4417        Self::new(value.into_channel())
4418    }
4419}
4420
4421#[derive(Debug, Clone)]
4422pub struct PowerElementProviderProxy {
4423    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4424}
4425
4426impl fidl::endpoints::Proxy for PowerElementProviderProxy {
4427    type Protocol = PowerElementProviderMarker;
4428
4429    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4430        Self::new(inner)
4431    }
4432
4433    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4434        self.client.into_channel().map_err(|client| Self { client })
4435    }
4436
4437    fn as_channel(&self) -> &::fidl::AsyncChannel {
4438        self.client.as_channel()
4439    }
4440}
4441
4442impl PowerElementProviderProxy {
4443    /// Create a new Proxy for fuchsia.gpu.magma/PowerElementProvider.
4444    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4445        let protocol_name =
4446            <PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4447        Self { client: fidl::client::Client::new(channel, protocol_name) }
4448    }
4449
4450    /// Get a Stream of events from the remote end of the protocol.
4451    ///
4452    /// # Panics
4453    ///
4454    /// Panics if the event stream was already taken.
4455    pub fn take_event_stream(&self) -> PowerElementProviderEventStream {
4456        PowerElementProviderEventStream { event_receiver: self.client.take_event_receiver() }
4457    }
4458
4459    /// Retrieve a list of power goals that the hardware can attempt to achieve.
4460    pub fn r#get_power_goals(
4461        &self,
4462    ) -> fidl::client::QueryResponseFut<Vec<PowerGoal>, fidl::encoding::DefaultFuchsiaResourceDialect>
4463    {
4464        PowerElementProviderProxyInterface::r#get_power_goals(self)
4465    }
4466
4467    /// Get a power level that represents the GPU clock being set to at least a target frequency.
4468    /// The power level may allow the GPU to idle or turn off, as long as the clock frequency
4469    /// remains the same.
4470    pub fn r#get_clock_speed_level(
4471        &self,
4472        mut payload: &PowerElementProviderGetClockSpeedLevelRequest,
4473    ) -> fidl::client::QueryResponseFut<
4474        PowerElementProviderGetClockSpeedLevelResult,
4475        fidl::encoding::DefaultFuchsiaResourceDialect,
4476    > {
4477        PowerElementProviderProxyInterface::r#get_clock_speed_level(self, payload)
4478    }
4479
4480    /// Limit the clock to at most a specific frequency.
4481    pub fn r#set_clock_limit(
4482        &self,
4483        mut payload: &PowerElementProviderSetClockLimitRequest,
4484    ) -> fidl::client::QueryResponseFut<
4485        PowerElementProviderSetClockLimitResult,
4486        fidl::encoding::DefaultFuchsiaResourceDialect,
4487    > {
4488        PowerElementProviderProxyInterface::r#set_clock_limit(self, payload)
4489    }
4490}
4491
4492impl PowerElementProviderProxyInterface for PowerElementProviderProxy {
4493    type GetPowerGoalsResponseFut = fidl::client::QueryResponseFut<
4494        Vec<PowerGoal>,
4495        fidl::encoding::DefaultFuchsiaResourceDialect,
4496    >;
4497    fn r#get_power_goals(&self) -> Self::GetPowerGoalsResponseFut {
4498        fn _decode(
4499            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4500        ) -> Result<Vec<PowerGoal>, fidl::Error> {
4501            let _response = fidl::client::decode_transaction_body::<
4502                fidl::encoding::FlexibleType<PowerElementProviderGetPowerGoalsResponse>,
4503                fidl::encoding::DefaultFuchsiaResourceDialect,
4504                0x2ff49ddffb0e07c0,
4505            >(_buf?)?
4506            .into_result::<PowerElementProviderMarker>("get_power_goals")?;
4507            Ok(_response.goals)
4508        }
4509        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PowerGoal>>(
4510            (),
4511            0x2ff49ddffb0e07c0,
4512            fidl::encoding::DynamicFlags::FLEXIBLE,
4513            _decode,
4514        )
4515    }
4516
4517    type GetClockSpeedLevelResponseFut = fidl::client::QueryResponseFut<
4518        PowerElementProviderGetClockSpeedLevelResult,
4519        fidl::encoding::DefaultFuchsiaResourceDialect,
4520    >;
4521    fn r#get_clock_speed_level(
4522        &self,
4523        mut payload: &PowerElementProviderGetClockSpeedLevelRequest,
4524    ) -> Self::GetClockSpeedLevelResponseFut {
4525        fn _decode(
4526            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4527        ) -> Result<PowerElementProviderGetClockSpeedLevelResult, fidl::Error> {
4528            let _response = fidl::client::decode_transaction_body::<
4529                fidl::encoding::FlexibleResultType<
4530                    PowerElementProviderGetClockSpeedLevelResponse,
4531                    i32,
4532                >,
4533                fidl::encoding::DefaultFuchsiaResourceDialect,
4534                0x5315a9bc44a9c53c,
4535            >(_buf?)?
4536            .into_result::<PowerElementProviderMarker>("get_clock_speed_level")?;
4537            Ok(_response.map(|x| x))
4538        }
4539        self.client.send_query_and_decode::<
4540            PowerElementProviderGetClockSpeedLevelRequest,
4541            PowerElementProviderGetClockSpeedLevelResult,
4542        >(
4543            payload,
4544            0x5315a9bc44a9c53c,
4545            fidl::encoding::DynamicFlags::FLEXIBLE,
4546            _decode,
4547        )
4548    }
4549
4550    type SetClockLimitResponseFut = fidl::client::QueryResponseFut<
4551        PowerElementProviderSetClockLimitResult,
4552        fidl::encoding::DefaultFuchsiaResourceDialect,
4553    >;
4554    fn r#set_clock_limit(
4555        &self,
4556        mut payload: &PowerElementProviderSetClockLimitRequest,
4557    ) -> Self::SetClockLimitResponseFut {
4558        fn _decode(
4559            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4560        ) -> Result<PowerElementProviderSetClockLimitResult, fidl::Error> {
4561            let _response = fidl::client::decode_transaction_body::<
4562                fidl::encoding::FlexibleResultType<PowerElementProviderSetClockLimitResponse, i32>,
4563                fidl::encoding::DefaultFuchsiaResourceDialect,
4564                0x614bf25c3a1571b4,
4565            >(_buf?)?
4566            .into_result::<PowerElementProviderMarker>("set_clock_limit")?;
4567            Ok(_response.map(|x| x))
4568        }
4569        self.client.send_query_and_decode::<
4570            PowerElementProviderSetClockLimitRequest,
4571            PowerElementProviderSetClockLimitResult,
4572        >(
4573            payload,
4574            0x614bf25c3a1571b4,
4575            fidl::encoding::DynamicFlags::FLEXIBLE,
4576            _decode,
4577        )
4578    }
4579}
4580
4581pub struct PowerElementProviderEventStream {
4582    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4583}
4584
4585impl std::marker::Unpin for PowerElementProviderEventStream {}
4586
4587impl futures::stream::FusedStream for PowerElementProviderEventStream {
4588    fn is_terminated(&self) -> bool {
4589        self.event_receiver.is_terminated()
4590    }
4591}
4592
4593impl futures::Stream for PowerElementProviderEventStream {
4594    type Item = Result<PowerElementProviderEvent, fidl::Error>;
4595
4596    fn poll_next(
4597        mut self: std::pin::Pin<&mut Self>,
4598        cx: &mut std::task::Context<'_>,
4599    ) -> std::task::Poll<Option<Self::Item>> {
4600        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4601            &mut self.event_receiver,
4602            cx
4603        )?) {
4604            Some(buf) => std::task::Poll::Ready(Some(PowerElementProviderEvent::decode(buf))),
4605            None => std::task::Poll::Ready(None),
4606        }
4607    }
4608}
4609
4610#[derive(Debug)]
4611pub enum PowerElementProviderEvent {
4612    #[non_exhaustive]
4613    _UnknownEvent {
4614        /// Ordinal of the event that was sent.
4615        ordinal: u64,
4616    },
4617}
4618
4619impl PowerElementProviderEvent {
4620    /// Decodes a message buffer as a [`PowerElementProviderEvent`].
4621    fn decode(
4622        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4623    ) -> Result<PowerElementProviderEvent, fidl::Error> {
4624        let (bytes, _handles) = buf.split_mut();
4625        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4626        debug_assert_eq!(tx_header.tx_id, 0);
4627        match tx_header.ordinal {
4628            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4629                Ok(PowerElementProviderEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4630            }
4631            _ => Err(fidl::Error::UnknownOrdinal {
4632                ordinal: tx_header.ordinal,
4633                protocol_name:
4634                    <PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4635            }),
4636        }
4637    }
4638}
4639
4640/// A Stream of incoming requests for fuchsia.gpu.magma/PowerElementProvider.
4641pub struct PowerElementProviderRequestStream {
4642    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4643    is_terminated: bool,
4644}
4645
4646impl std::marker::Unpin for PowerElementProviderRequestStream {}
4647
4648impl futures::stream::FusedStream for PowerElementProviderRequestStream {
4649    fn is_terminated(&self) -> bool {
4650        self.is_terminated
4651    }
4652}
4653
4654impl fidl::endpoints::RequestStream for PowerElementProviderRequestStream {
4655    type Protocol = PowerElementProviderMarker;
4656    type ControlHandle = PowerElementProviderControlHandle;
4657
4658    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4659        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4660    }
4661
4662    fn control_handle(&self) -> Self::ControlHandle {
4663        PowerElementProviderControlHandle { inner: self.inner.clone() }
4664    }
4665
4666    fn into_inner(
4667        self,
4668    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4669    {
4670        (self.inner, self.is_terminated)
4671    }
4672
4673    fn from_inner(
4674        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4675        is_terminated: bool,
4676    ) -> Self {
4677        Self { inner, is_terminated }
4678    }
4679}
4680
4681impl futures::Stream for PowerElementProviderRequestStream {
4682    type Item = Result<PowerElementProviderRequest, fidl::Error>;
4683
4684    fn poll_next(
4685        mut self: std::pin::Pin<&mut Self>,
4686        cx: &mut std::task::Context<'_>,
4687    ) -> std::task::Poll<Option<Self::Item>> {
4688        let this = &mut *self;
4689        if this.inner.check_shutdown(cx) {
4690            this.is_terminated = true;
4691            return std::task::Poll::Ready(None);
4692        }
4693        if this.is_terminated {
4694            panic!("polled PowerElementProviderRequestStream after completion");
4695        }
4696        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4697            |bytes, handles| {
4698                match this.inner.channel().read_etc(cx, bytes, handles) {
4699                    std::task::Poll::Ready(Ok(())) => {}
4700                    std::task::Poll::Pending => return std::task::Poll::Pending,
4701                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4702                        this.is_terminated = true;
4703                        return std::task::Poll::Ready(None);
4704                    }
4705                    std::task::Poll::Ready(Err(e)) => {
4706                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4707                            e.into(),
4708                        ))));
4709                    }
4710                }
4711
4712                // A message has been received from the channel
4713                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4714
4715                std::task::Poll::Ready(Some(match header.ordinal {
4716                0x2ff49ddffb0e07c0 => {
4717                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4718                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4719                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4720                    let control_handle = PowerElementProviderControlHandle {
4721                        inner: this.inner.clone(),
4722                    };
4723                    Ok(PowerElementProviderRequest::GetPowerGoals {
4724                        responder: PowerElementProviderGetPowerGoalsResponder {
4725                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4726                            tx_id: header.tx_id,
4727                        },
4728                    })
4729                }
4730                0x5315a9bc44a9c53c => {
4731                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4732                    let mut req = fidl::new_empty!(PowerElementProviderGetClockSpeedLevelRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4733                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PowerElementProviderGetClockSpeedLevelRequest>(&header, _body_bytes, handles, &mut req)?;
4734                    let control_handle = PowerElementProviderControlHandle {
4735                        inner: this.inner.clone(),
4736                    };
4737                    Ok(PowerElementProviderRequest::GetClockSpeedLevel {payload: req,
4738                        responder: PowerElementProviderGetClockSpeedLevelResponder {
4739                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4740                            tx_id: header.tx_id,
4741                        },
4742                    })
4743                }
4744                0x614bf25c3a1571b4 => {
4745                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4746                    let mut req = fidl::new_empty!(PowerElementProviderSetClockLimitRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4747                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PowerElementProviderSetClockLimitRequest>(&header, _body_bytes, handles, &mut req)?;
4748                    let control_handle = PowerElementProviderControlHandle {
4749                        inner: this.inner.clone(),
4750                    };
4751                    Ok(PowerElementProviderRequest::SetClockLimit {payload: req,
4752                        responder: PowerElementProviderSetClockLimitResponder {
4753                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4754                            tx_id: header.tx_id,
4755                        },
4756                    })
4757                }
4758                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4759                    Ok(PowerElementProviderRequest::_UnknownMethod {
4760                        ordinal: header.ordinal,
4761                        control_handle: PowerElementProviderControlHandle { inner: this.inner.clone() },
4762                        method_type: fidl::MethodType::OneWay,
4763                    })
4764                }
4765                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4766                    this.inner.send_framework_err(
4767                        fidl::encoding::FrameworkErr::UnknownMethod,
4768                        header.tx_id,
4769                        header.ordinal,
4770                        header.dynamic_flags(),
4771                        (bytes, handles),
4772                    )?;
4773                    Ok(PowerElementProviderRequest::_UnknownMethod {
4774                        ordinal: header.ordinal,
4775                        control_handle: PowerElementProviderControlHandle { inner: this.inner.clone() },
4776                        method_type: fidl::MethodType::TwoWay,
4777                    })
4778                }
4779                _ => Err(fidl::Error::UnknownOrdinal {
4780                    ordinal: header.ordinal,
4781                    protocol_name: <PowerElementProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4782                }),
4783            }))
4784            },
4785        )
4786    }
4787}
4788
4789/// This protocol is used to retrieve information on the power levels that this driver provides.
4790#[derive(Debug)]
4791pub enum PowerElementProviderRequest {
4792    /// Retrieve a list of power goals that the hardware can attempt to achieve.
4793    GetPowerGoals { responder: PowerElementProviderGetPowerGoalsResponder },
4794    /// Get a power level that represents the GPU clock being set to at least a target frequency.
4795    /// The power level may allow the GPU to idle or turn off, as long as the clock frequency
4796    /// remains the same.
4797    GetClockSpeedLevel {
4798        payload: PowerElementProviderGetClockSpeedLevelRequest,
4799        responder: PowerElementProviderGetClockSpeedLevelResponder,
4800    },
4801    /// Limit the clock to at most a specific frequency.
4802    SetClockLimit {
4803        payload: PowerElementProviderSetClockLimitRequest,
4804        responder: PowerElementProviderSetClockLimitResponder,
4805    },
4806    /// An interaction was received which does not match any known method.
4807    #[non_exhaustive]
4808    _UnknownMethod {
4809        /// Ordinal of the method that was called.
4810        ordinal: u64,
4811        control_handle: PowerElementProviderControlHandle,
4812        method_type: fidl::MethodType,
4813    },
4814}
4815
4816impl PowerElementProviderRequest {
4817    #[allow(irrefutable_let_patterns)]
4818    pub fn into_get_power_goals(self) -> Option<(PowerElementProviderGetPowerGoalsResponder)> {
4819        if let PowerElementProviderRequest::GetPowerGoals { responder } = self {
4820            Some((responder))
4821        } else {
4822            None
4823        }
4824    }
4825
4826    #[allow(irrefutable_let_patterns)]
4827    pub fn into_get_clock_speed_level(
4828        self,
4829    ) -> Option<(
4830        PowerElementProviderGetClockSpeedLevelRequest,
4831        PowerElementProviderGetClockSpeedLevelResponder,
4832    )> {
4833        if let PowerElementProviderRequest::GetClockSpeedLevel { payload, responder } = self {
4834            Some((payload, responder))
4835        } else {
4836            None
4837        }
4838    }
4839
4840    #[allow(irrefutable_let_patterns)]
4841    pub fn into_set_clock_limit(
4842        self,
4843    ) -> Option<(
4844        PowerElementProviderSetClockLimitRequest,
4845        PowerElementProviderSetClockLimitResponder,
4846    )> {
4847        if let PowerElementProviderRequest::SetClockLimit { payload, responder } = self {
4848            Some((payload, responder))
4849        } else {
4850            None
4851        }
4852    }
4853
4854    /// Name of the method defined in FIDL
4855    pub fn method_name(&self) -> &'static str {
4856        match *self {
4857            PowerElementProviderRequest::GetPowerGoals { .. } => "get_power_goals",
4858            PowerElementProviderRequest::GetClockSpeedLevel { .. } => "get_clock_speed_level",
4859            PowerElementProviderRequest::SetClockLimit { .. } => "set_clock_limit",
4860            PowerElementProviderRequest::_UnknownMethod {
4861                method_type: fidl::MethodType::OneWay,
4862                ..
4863            } => "unknown one-way method",
4864            PowerElementProviderRequest::_UnknownMethod {
4865                method_type: fidl::MethodType::TwoWay,
4866                ..
4867            } => "unknown two-way method",
4868        }
4869    }
4870}
4871
4872#[derive(Debug, Clone)]
4873pub struct PowerElementProviderControlHandle {
4874    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4875}
4876
4877impl fidl::endpoints::ControlHandle for PowerElementProviderControlHandle {
4878    fn shutdown(&self) {
4879        self.inner.shutdown()
4880    }
4881    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4882        self.inner.shutdown_with_epitaph(status)
4883    }
4884
4885    fn is_closed(&self) -> bool {
4886        self.inner.channel().is_closed()
4887    }
4888    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4889        self.inner.channel().on_closed()
4890    }
4891
4892    #[cfg(target_os = "fuchsia")]
4893    fn signal_peer(
4894        &self,
4895        clear_mask: zx::Signals,
4896        set_mask: zx::Signals,
4897    ) -> Result<(), zx_status::Status> {
4898        use fidl::Peered;
4899        self.inner.channel().signal_peer(clear_mask, set_mask)
4900    }
4901}
4902
4903impl PowerElementProviderControlHandle {}
4904
4905#[must_use = "FIDL methods require a response to be sent"]
4906#[derive(Debug)]
4907pub struct PowerElementProviderGetPowerGoalsResponder {
4908    control_handle: std::mem::ManuallyDrop<PowerElementProviderControlHandle>,
4909    tx_id: u32,
4910}
4911
4912/// Set the the channel to be shutdown (see [`PowerElementProviderControlHandle::shutdown`])
4913/// if the responder is dropped without sending a response, so that the client
4914/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4915impl std::ops::Drop for PowerElementProviderGetPowerGoalsResponder {
4916    fn drop(&mut self) {
4917        self.control_handle.shutdown();
4918        // Safety: drops once, never accessed again
4919        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4920    }
4921}
4922
4923impl fidl::endpoints::Responder for PowerElementProviderGetPowerGoalsResponder {
4924    type ControlHandle = PowerElementProviderControlHandle;
4925
4926    fn control_handle(&self) -> &PowerElementProviderControlHandle {
4927        &self.control_handle
4928    }
4929
4930    fn drop_without_shutdown(mut self) {
4931        // Safety: drops once, never accessed again due to mem::forget
4932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4933        // Prevent Drop from running (which would shut down the channel)
4934        std::mem::forget(self);
4935    }
4936}
4937
4938impl PowerElementProviderGetPowerGoalsResponder {
4939    /// Sends a response to the FIDL transaction.
4940    ///
4941    /// Sets the channel to shutdown if an error occurs.
4942    pub fn send(self, mut goals: Vec<PowerGoal>) -> Result<(), fidl::Error> {
4943        let _result = self.send_raw(goals);
4944        if _result.is_err() {
4945            self.control_handle.shutdown();
4946        }
4947        self.drop_without_shutdown();
4948        _result
4949    }
4950
4951    /// Similar to "send" but does not shutdown the channel if an error occurs.
4952    pub fn send_no_shutdown_on_err(self, mut goals: Vec<PowerGoal>) -> Result<(), fidl::Error> {
4953        let _result = self.send_raw(goals);
4954        self.drop_without_shutdown();
4955        _result
4956    }
4957
4958    fn send_raw(&self, mut goals: Vec<PowerGoal>) -> Result<(), fidl::Error> {
4959        self.control_handle.inner.send::<fidl::encoding::FlexibleType<
4960            PowerElementProviderGetPowerGoalsResponse,
4961        >>(
4962            fidl::encoding::Flexible::new((goals.as_mut(),)),
4963            self.tx_id,
4964            0x2ff49ddffb0e07c0,
4965            fidl::encoding::DynamicFlags::FLEXIBLE,
4966        )
4967    }
4968}
4969
4970#[must_use = "FIDL methods require a response to be sent"]
4971#[derive(Debug)]
4972pub struct PowerElementProviderGetClockSpeedLevelResponder {
4973    control_handle: std::mem::ManuallyDrop<PowerElementProviderControlHandle>,
4974    tx_id: u32,
4975}
4976
4977/// Set the the channel to be shutdown (see [`PowerElementProviderControlHandle::shutdown`])
4978/// if the responder is dropped without sending a response, so that the client
4979/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4980impl std::ops::Drop for PowerElementProviderGetClockSpeedLevelResponder {
4981    fn drop(&mut self) {
4982        self.control_handle.shutdown();
4983        // Safety: drops once, never accessed again
4984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4985    }
4986}
4987
4988impl fidl::endpoints::Responder for PowerElementProviderGetClockSpeedLevelResponder {
4989    type ControlHandle = PowerElementProviderControlHandle;
4990
4991    fn control_handle(&self) -> &PowerElementProviderControlHandle {
4992        &self.control_handle
4993    }
4994
4995    fn drop_without_shutdown(mut self) {
4996        // Safety: drops once, never accessed again due to mem::forget
4997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4998        // Prevent Drop from running (which would shut down the channel)
4999        std::mem::forget(self);
5000    }
5001}
5002
5003impl PowerElementProviderGetClockSpeedLevelResponder {
5004    /// Sends a response to the FIDL transaction.
5005    ///
5006    /// Sets the channel to shutdown if an error occurs.
5007    pub fn send(
5008        self,
5009        mut result: Result<PowerElementProviderGetClockSpeedLevelResponse, i32>,
5010    ) -> Result<(), fidl::Error> {
5011        let _result = self.send_raw(result);
5012        if _result.is_err() {
5013            self.control_handle.shutdown();
5014        }
5015        self.drop_without_shutdown();
5016        _result
5017    }
5018
5019    /// Similar to "send" but does not shutdown the channel if an error occurs.
5020    pub fn send_no_shutdown_on_err(
5021        self,
5022        mut result: Result<PowerElementProviderGetClockSpeedLevelResponse, i32>,
5023    ) -> Result<(), fidl::Error> {
5024        let _result = self.send_raw(result);
5025        self.drop_without_shutdown();
5026        _result
5027    }
5028
5029    fn send_raw(
5030        &self,
5031        mut result: Result<PowerElementProviderGetClockSpeedLevelResponse, i32>,
5032    ) -> Result<(), fidl::Error> {
5033        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5034            PowerElementProviderGetClockSpeedLevelResponse,
5035            i32,
5036        >>(
5037            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
5038            self.tx_id,
5039            0x5315a9bc44a9c53c,
5040            fidl::encoding::DynamicFlags::FLEXIBLE,
5041        )
5042    }
5043}
5044
5045#[must_use = "FIDL methods require a response to be sent"]
5046#[derive(Debug)]
5047pub struct PowerElementProviderSetClockLimitResponder {
5048    control_handle: std::mem::ManuallyDrop<PowerElementProviderControlHandle>,
5049    tx_id: u32,
5050}
5051
5052/// Set the the channel to be shutdown (see [`PowerElementProviderControlHandle::shutdown`])
5053/// if the responder is dropped without sending a response, so that the client
5054/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5055impl std::ops::Drop for PowerElementProviderSetClockLimitResponder {
5056    fn drop(&mut self) {
5057        self.control_handle.shutdown();
5058        // Safety: drops once, never accessed again
5059        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5060    }
5061}
5062
5063impl fidl::endpoints::Responder for PowerElementProviderSetClockLimitResponder {
5064    type ControlHandle = PowerElementProviderControlHandle;
5065
5066    fn control_handle(&self) -> &PowerElementProviderControlHandle {
5067        &self.control_handle
5068    }
5069
5070    fn drop_without_shutdown(mut self) {
5071        // Safety: drops once, never accessed again due to mem::forget
5072        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5073        // Prevent Drop from running (which would shut down the channel)
5074        std::mem::forget(self);
5075    }
5076}
5077
5078impl PowerElementProviderSetClockLimitResponder {
5079    /// Sends a response to the FIDL transaction.
5080    ///
5081    /// Sets the channel to shutdown if an error occurs.
5082    pub fn send(
5083        self,
5084        mut result: Result<PowerElementProviderSetClockLimitResponse, i32>,
5085    ) -> Result<(), fidl::Error> {
5086        let _result = self.send_raw(result);
5087        if _result.is_err() {
5088            self.control_handle.shutdown();
5089        }
5090        self.drop_without_shutdown();
5091        _result
5092    }
5093
5094    /// Similar to "send" but does not shutdown the channel if an error occurs.
5095    pub fn send_no_shutdown_on_err(
5096        self,
5097        mut result: Result<PowerElementProviderSetClockLimitResponse, i32>,
5098    ) -> Result<(), fidl::Error> {
5099        let _result = self.send_raw(result);
5100        self.drop_without_shutdown();
5101        _result
5102    }
5103
5104    fn send_raw(
5105        &self,
5106        mut result: Result<PowerElementProviderSetClockLimitResponse, i32>,
5107    ) -> Result<(), fidl::Error> {
5108        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5109            PowerElementProviderSetClockLimitResponse,
5110            i32,
5111        >>(
5112            fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
5113            self.tx_id,
5114            0x614bf25c3a1571b4,
5115            fidl::encoding::DynamicFlags::FLEXIBLE,
5116        )
5117    }
5118}
5119
5120#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5121pub struct PrimaryMarker;
5122
5123impl fidl::endpoints::ProtocolMarker for PrimaryMarker {
5124    type Proxy = PrimaryProxy;
5125    type RequestStream = PrimaryRequestStream;
5126    #[cfg(target_os = "fuchsia")]
5127    type SynchronousProxy = PrimarySynchronousProxy;
5128
5129    const DEBUG_NAME: &'static str = "(anonymous) Primary";
5130}
5131
5132pub trait PrimaryProxyInterface: Send + Sync {
5133    fn r#import_object(&self, payload: PrimaryImportObjectRequest) -> Result<(), fidl::Error>;
5134    fn r#release_object(&self, object_id: u64, object_type: ObjectType) -> Result<(), fidl::Error>;
5135    fn r#create_context(&self, context_id: u32) -> Result<(), fidl::Error>;
5136    fn r#create_context2(&self, context_id: u32, priority: Priority) -> Result<(), fidl::Error>;
5137    fn r#destroy_context(&self, context_id: u32) -> Result<(), fidl::Error>;
5138    fn r#execute_command(
5139        &self,
5140        context_id: u32,
5141        resources: &[BufferRange],
5142        command_buffers: &[CommandBuffer],
5143        wait_semaphores: &[u64],
5144        signal_semaphores: &[u64],
5145        flags: CommandBufferFlags,
5146    ) -> Result<(), fidl::Error>;
5147    fn r#execute_immediate_commands(
5148        &self,
5149        context_id: u32,
5150        command_data: &[u8],
5151        semaphores: &[u64],
5152    ) -> Result<(), fidl::Error>;
5153    fn r#execute_inline_commands(
5154        &self,
5155        context_id: u32,
5156        commands: &[InlineCommand],
5157    ) -> Result<(), fidl::Error>;
5158    type FlushResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5159    fn r#flush(&self) -> Self::FlushResponseFut;
5160    fn r#map_buffer(&self, payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error>;
5161    fn r#unmap_buffer(&self, payload: &PrimaryUnmapBufferRequest) -> Result<(), fidl::Error>;
5162    fn r#buffer_range_op2(&self, op: BufferOp, range: &BufferRange) -> Result<(), fidl::Error>;
5163    fn r#enable_flow_control(&self) -> Result<(), fidl::Error>;
5164    fn r#enable_performance_counter_access(
5165        &self,
5166        access_token: fidl::Event,
5167    ) -> Result<(), fidl::Error>;
5168    type IsPerformanceCounterAccessAllowedResponseFut: std::future::Future<Output = Result<bool, fidl::Error>>
5169        + Send;
5170    fn r#is_performance_counter_access_allowed(
5171        &self,
5172    ) -> Self::IsPerformanceCounterAccessAllowedResponseFut;
5173    fn r#enable_performance_counters(&self, counters: &[u64]) -> Result<(), fidl::Error>;
5174    fn r#create_performance_counter_buffer_pool(
5175        &self,
5176        pool_id: u64,
5177        event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
5178    ) -> Result<(), fidl::Error>;
5179    fn r#release_performance_counter_buffer_pool(&self, pool_id: u64) -> Result<(), fidl::Error>;
5180    fn r#add_performance_counter_buffer_offsets_to_pool(
5181        &self,
5182        pool_id: u64,
5183        offsets: &[BufferRange],
5184    ) -> Result<(), fidl::Error>;
5185    fn r#remove_performance_counter_buffer_from_pool(
5186        &self,
5187        pool_id: u64,
5188        buffer_id: u64,
5189    ) -> Result<(), fidl::Error>;
5190    fn r#dump_performance_counters(&self, pool_id: u64, trigger_id: u32)
5191    -> Result<(), fidl::Error>;
5192    fn r#clear_performance_counters(&self, counters: &[u64]) -> Result<(), fidl::Error>;
5193}
5194#[derive(Debug)]
5195#[cfg(target_os = "fuchsia")]
5196pub struct PrimarySynchronousProxy {
5197    client: fidl::client::sync::Client,
5198}
5199
5200#[cfg(target_os = "fuchsia")]
5201impl fidl::endpoints::SynchronousProxy for PrimarySynchronousProxy {
5202    type Proxy = PrimaryProxy;
5203    type Protocol = PrimaryMarker;
5204
5205    fn from_channel(inner: fidl::Channel) -> Self {
5206        Self::new(inner)
5207    }
5208
5209    fn into_channel(self) -> fidl::Channel {
5210        self.client.into_channel()
5211    }
5212
5213    fn as_channel(&self) -> &fidl::Channel {
5214        self.client.as_channel()
5215    }
5216}
5217
5218#[cfg(target_os = "fuchsia")]
5219impl PrimarySynchronousProxy {
5220    pub fn new(channel: fidl::Channel) -> Self {
5221        let protocol_name = <PrimaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5222        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5223    }
5224
5225    pub fn into_channel(self) -> fidl::Channel {
5226        self.client.into_channel()
5227    }
5228
5229    /// Waits until an event arrives and returns it. It is safe for other
5230    /// threads to make concurrent requests while waiting for an event.
5231    pub fn wait_for_event(
5232        &self,
5233        deadline: zx::MonotonicInstant,
5234    ) -> Result<PrimaryEvent, fidl::Error> {
5235        PrimaryEvent::decode(self.client.wait_for_event(deadline)?)
5236    }
5237
5238    /// Imports an object for use in the system driver.
5239    pub fn r#import_object(
5240        &self,
5241        mut payload: PrimaryImportObjectRequest,
5242    ) -> Result<(), fidl::Error> {
5243        self.client.send::<PrimaryImportObjectRequest>(
5244            &mut payload,
5245            0x5f5a247abb1d9354,
5246            fidl::encoding::DynamicFlags::empty(),
5247        )
5248    }
5249
5250    /// Destroys the object with `object_id` within this connection.
5251    pub fn r#release_object(
5252        &self,
5253        mut object_id: u64,
5254        mut object_type: ObjectType,
5255    ) -> Result<(), fidl::Error> {
5256        self.client.send::<PrimaryReleaseObjectRequest>(
5257            (object_id, object_type),
5258            0x4a65d5885da5e88f,
5259            fidl::encoding::DynamicFlags::empty(),
5260        )
5261    }
5262
5263    /// Creates context `context_id` for use in command execution.  A context may be associated
5264    /// with hardware state.
5265    /// DEPRECATED: Please use CreateContext2.
5266    /// TODO(https://fxbug.dev/413030654): Fully deprecate this API.
5267    pub fn r#create_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
5268        self.client.send::<PrimaryCreateContextRequest>(
5269            (context_id,),
5270            0x5a9a91c8b88b5da4,
5271            fidl::encoding::DynamicFlags::empty(),
5272        )
5273    }
5274
5275    /// Creates context `context_id` for use in command execution.  A context may be associated
5276    /// with hardware state.
5277    pub fn r#create_context2(
5278        &self,
5279        mut context_id: u32,
5280        mut priority: Priority,
5281    ) -> Result<(), fidl::Error> {
5282        self.client.send::<PrimaryCreateContext2Request>(
5283            (context_id, priority),
5284            0x5f7e3a5137e758f6,
5285            fidl::encoding::DynamicFlags::empty(),
5286        )
5287    }
5288
5289    /// Destroys context `context_id`.
5290    pub fn r#destroy_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
5291        self.client.send::<PrimaryDestroyContextRequest>(
5292            (context_id,),
5293            0x26b626e6be162ef0,
5294            fidl::encoding::DynamicFlags::empty(),
5295        )
5296    }
5297
5298    /// Submits command buffers for execution on the hardware, with associated `resources`.
5299    /// `resources` must refer to buffers that have been imported.
5300    /// `wait_semaphores` and `signal_semaphores` must refer to events that have been imported.
5301    /// `wait_semaphores` must all be signaled before execution begins, then are reset.
5302    /// `signal_semaphores` will be signaled after the command buffer is completed.
5303    pub fn r#execute_command(
5304        &self,
5305        mut context_id: u32,
5306        mut resources: &[BufferRange],
5307        mut command_buffers: &[CommandBuffer],
5308        mut wait_semaphores: &[u64],
5309        mut signal_semaphores: &[u64],
5310        mut flags: CommandBufferFlags,
5311    ) -> Result<(), fidl::Error> {
5312        self.client.send::<PrimaryExecuteCommandRequest>(
5313            (context_id, resources, command_buffers, wait_semaphores, signal_semaphores, flags),
5314            0xf2799643aadb0db,
5315            fidl::encoding::DynamicFlags::empty(),
5316        )
5317    }
5318
5319    /// Submits a series of commands for execution on the hardware without using a command buffer.
5320    /// `semaphores` must refer to events that have been imported, and will be signaled after
5321    /// the commands are completed.
5322    pub fn r#execute_immediate_commands(
5323        &self,
5324        mut context_id: u32,
5325        mut command_data: &[u8],
5326        mut semaphores: &[u64],
5327    ) -> Result<(), fidl::Error> {
5328        self.client.send::<PrimaryExecuteImmediateCommandsRequest>(
5329            (context_id, command_data, semaphores),
5330            0x3d7e0dcdbfd4b61f,
5331            fidl::encoding::DynamicFlags::empty(),
5332        )
5333    }
5334
5335    /// Submits a series of commands for execution on the hardware without using a command buffer.
5336    /// The number of commands sent should be calculated so that the total message size is less than
5337    /// MAX_INLINE_COMMANDS_DATA_SIZE.
5338    pub fn r#execute_inline_commands(
5339        &self,
5340        mut context_id: u32,
5341        mut commands: &[InlineCommand],
5342    ) -> Result<(), fidl::Error> {
5343        self.client.send::<PrimaryExecuteInlineCommandsRequest>(
5344            (context_id, commands),
5345            0x766d5c86f35468a6,
5346            fidl::encoding::DynamicFlags::empty(),
5347        )
5348    }
5349
5350    /// Incurs a round-trip to the system driver, used to ensure all previous messages have been
5351    /// observed, but not necessarily completed.
5352    pub fn r#flush(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
5353        let _response =
5354            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
5355                (),
5356                0x54ccb5572d886039,
5357                fidl::encoding::DynamicFlags::empty(),
5358                ___deadline,
5359            )?;
5360        Ok(_response)
5361    }
5362
5363    /// Maps a page range onto the hardware in the connection's address space at address `hw_va`.
5364    /// `flags` is a set of flags from MapFlags that specify how the hardware can access the buffer.
5365    pub fn r#map_buffer(&self, mut payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error> {
5366        self.client.send::<PrimaryMapBufferRequest>(
5367            payload,
5368            0x56baa5d2092c8e33,
5369            fidl::encoding::DynamicFlags::empty(),
5370        )
5371    }
5372
5373    /// Releases the mapping at address `hw_va` from the hardware for the given `buffer_id`.
5374    /// Buffers will also be implicitly unmapped when released.
5375    pub fn r#unmap_buffer(
5376        &self,
5377        mut payload: &PrimaryUnmapBufferRequest,
5378    ) -> Result<(), fidl::Error> {
5379        self.client.send::<PrimaryUnmapBufferRequest>(
5380            payload,
5381            0x305188ebd8bcd95c,
5382            fidl::encoding::DynamicFlags::empty(),
5383        )
5384    }
5385
5386    /// Perform an operation on a range of the buffer.
5387    pub fn r#buffer_range_op2(
5388        &self,
5389        mut op: BufferOp,
5390        mut range: &BufferRange,
5391    ) -> Result<(), fidl::Error> {
5392        self.client.send::<PrimaryBufferRangeOp2Request>(
5393            (op, range),
5394            0x4175c8dfef355396,
5395            fidl::encoding::DynamicFlags::empty(),
5396        )
5397    }
5398
5399    /// Enables the events OnNotifyMessagesConsumed and OnNotifyMemoryImported.
5400    pub fn r#enable_flow_control(&self) -> Result<(), fidl::Error> {
5401        self.client.send::<fidl::encoding::EmptyPayload>(
5402            (),
5403            0x8b5e68f3ee0b22e,
5404            fidl::encoding::DynamicFlags::empty(),
5405        )
5406    }
5407
5408    /// Tries to enable performance counter FIDL messages. To be successful, |access_token| must
5409    /// have been returned by PerformanceCounterAccess.GetPerformanceCountToken() from the matching
5410    /// device.
5411    pub fn r#enable_performance_counter_access(
5412        &self,
5413        mut access_token: fidl::Event,
5414    ) -> Result<(), fidl::Error> {
5415        self.client.send::<PrimaryEnablePerformanceCounterAccessRequest>(
5416            (access_token,),
5417            0x51b369ac16588831,
5418            fidl::encoding::DynamicFlags::empty(),
5419        )
5420    }
5421
5422    /// Returns true if any EnablePerformanceCounterAccess message has succeeded.
5423    pub fn r#is_performance_counter_access_allowed(
5424        &self,
5425        ___deadline: zx::MonotonicInstant,
5426    ) -> Result<bool, fidl::Error> {
5427        let _response = self.client.send_query::<
5428            fidl::encoding::EmptyPayload,
5429            PrimaryIsPerformanceCounterAccessAllowedResponse,
5430        >(
5431            (),
5432            0x1933b70c06cc5702,
5433            fidl::encoding::DynamicFlags::empty(),
5434            ___deadline,
5435        )?;
5436        Ok(_response.enabled)
5437    }
5438
5439    /// Enables a set of performance counters.  Disables enabled performance counters that are not
5440    /// in the new set. Performance counters will also be automatically disabled on connection
5441    /// close. Performance counter access must have been enabled using
5442    /// EnablePerformanceCounterAccess before calling this method.
5443    pub fn r#enable_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
5444        self.client.send::<PrimaryEnablePerformanceCountersRequest>(
5445            (counters,),
5446            0x52c4db74b601aaa7,
5447            fidl::encoding::DynamicFlags::empty(),
5448        )
5449    }
5450
5451    /// Creates a pool of buffers that performance counters can be dumped into. Performance counter
5452    /// access must have been enabled using EnablePerformanceCounterAccess before calling this
5453    /// method.
5454    pub fn r#create_performance_counter_buffer_pool(
5455        &self,
5456        mut pool_id: u64,
5457        mut event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
5458    ) -> Result<(), fidl::Error> {
5459        self.client.send::<PrimaryCreatePerformanceCounterBufferPoolRequest>(
5460            (pool_id, event_channel),
5461            0x48ccf6519bbbc638,
5462            fidl::encoding::DynamicFlags::empty(),
5463        )
5464    }
5465
5466    /// Releases a pool of performance counter buffers. Performance counter access must have been
5467    /// enabled using EnablePerformanceCounterAccess before calling this method.
5468    pub fn r#release_performance_counter_buffer_pool(
5469        &self,
5470        mut pool_id: u64,
5471    ) -> Result<(), fidl::Error> {
5472        self.client.send::<PrimaryReleasePerformanceCounterBufferPoolRequest>(
5473            (pool_id,),
5474            0x18374c4b3ef0b4da,
5475            fidl::encoding::DynamicFlags::empty(),
5476        )
5477    }
5478
5479    /// Adds a set of offsets into buffers to the pool. |offsets[n].buffer_id| is the id of a
5480    /// buffer that was previously imported using ImportBuffer(). The same buffer may be added to
5481    /// multiple pools. The pool will hold on to a reference to the buffer even after ReleaseBuffer
5482    /// is called.  When dumped into this entry, counters will be written starting at
5483    /// |offsets[n].buffer_offset| bytes into the buffer, and up to |offsets[n].buffer_offset| +
5484    /// |offsets[n].buffer_size|. |offsets[n].buffer_size| must be large enough to fit all enabled
5485    /// counters. Performance counter access must have been enabled using
5486    /// EnablePerformanceCounterAccess before calling this method.
5487    pub fn r#add_performance_counter_buffer_offsets_to_pool(
5488        &self,
5489        mut pool_id: u64,
5490        mut offsets: &[BufferRange],
5491    ) -> Result<(), fidl::Error> {
5492        self.client.send::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
5493            (pool_id, offsets),
5494            0x1f7889571111386b,
5495            fidl::encoding::DynamicFlags::empty(),
5496        )
5497    }
5498
5499    /// Removes every offset of a buffer from the pool. Once this method is finished being handled
5500    /// on the server, no more dumps will be processed into this buffer. In-flight dumps into this
5501    /// buffer may be lost.  Performance counter access must have been enabled using
5502    /// EnablePerformanceCounterAccess before calling this method.
5503    pub fn r#remove_performance_counter_buffer_from_pool(
5504        &self,
5505        mut pool_id: u64,
5506        mut buffer_id: u64,
5507    ) -> Result<(), fidl::Error> {
5508        self.client.send::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(
5509            (pool_id, buffer_id),
5510            0xbf1275f5a36258e,
5511            fidl::encoding::DynamicFlags::empty(),
5512        )
5513    }
5514
5515    /// Triggers dumping of the performance counters into a buffer pool. May fail silently if there
5516    /// are no buffers in the pool. |trigger_id| is an arbitrary ID assigned by the client that can
5517    /// be returned in OnPerformanceCounterReadCompleted. Performance counter access must have been
5518    /// enabled using EnablePerformanceCounterAccess before calling this method.
5519    pub fn r#dump_performance_counters(
5520        &self,
5521        mut pool_id: u64,
5522        mut trigger_id: u32,
5523    ) -> Result<(), fidl::Error> {
5524        self.client.send::<PrimaryDumpPerformanceCountersRequest>(
5525            (pool_id, trigger_id),
5526            0x250b29340be28807,
5527            fidl::encoding::DynamicFlags::empty(),
5528        )
5529    }
5530
5531    /// Sets the values of all listed performance counters to 0. May not be supported by some
5532    /// hardware. Performance counter access must have been enabled using
5533    /// EnablePerformanceCounterAccess before calling this method.
5534    pub fn r#clear_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
5535        self.client.send::<PrimaryClearPerformanceCountersRequest>(
5536            (counters,),
5537            0x236831822eff741a,
5538            fidl::encoding::DynamicFlags::empty(),
5539        )
5540    }
5541}
5542
5543#[cfg(target_os = "fuchsia")]
5544impl From<PrimarySynchronousProxy> for zx::Handle {
5545    fn from(value: PrimarySynchronousProxy) -> Self {
5546        value.into_channel().into()
5547    }
5548}
5549
5550#[cfg(target_os = "fuchsia")]
5551impl From<fidl::Channel> for PrimarySynchronousProxy {
5552    fn from(value: fidl::Channel) -> Self {
5553        Self::new(value)
5554    }
5555}
5556
5557#[cfg(target_os = "fuchsia")]
5558impl fidl::endpoints::FromClient for PrimarySynchronousProxy {
5559    type Protocol = PrimaryMarker;
5560
5561    fn from_client(value: fidl::endpoints::ClientEnd<PrimaryMarker>) -> Self {
5562        Self::new(value.into_channel())
5563    }
5564}
5565
5566#[derive(Debug, Clone)]
5567pub struct PrimaryProxy {
5568    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5569}
5570
5571impl fidl::endpoints::Proxy for PrimaryProxy {
5572    type Protocol = PrimaryMarker;
5573
5574    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5575        Self::new(inner)
5576    }
5577
5578    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5579        self.client.into_channel().map_err(|client| Self { client })
5580    }
5581
5582    fn as_channel(&self) -> &::fidl::AsyncChannel {
5583        self.client.as_channel()
5584    }
5585}
5586
5587impl PrimaryProxy {
5588    /// Create a new Proxy for fuchsia.gpu.magma/Primary.
5589    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5590        let protocol_name = <PrimaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5591        Self { client: fidl::client::Client::new(channel, protocol_name) }
5592    }
5593
5594    /// Get a Stream of events from the remote end of the protocol.
5595    ///
5596    /// # Panics
5597    ///
5598    /// Panics if the event stream was already taken.
5599    pub fn take_event_stream(&self) -> PrimaryEventStream {
5600        PrimaryEventStream { event_receiver: self.client.take_event_receiver() }
5601    }
5602
5603    /// Imports an object for use in the system driver.
5604    pub fn r#import_object(
5605        &self,
5606        mut payload: PrimaryImportObjectRequest,
5607    ) -> Result<(), fidl::Error> {
5608        PrimaryProxyInterface::r#import_object(self, payload)
5609    }
5610
5611    /// Destroys the object with `object_id` within this connection.
5612    pub fn r#release_object(
5613        &self,
5614        mut object_id: u64,
5615        mut object_type: ObjectType,
5616    ) -> Result<(), fidl::Error> {
5617        PrimaryProxyInterface::r#release_object(self, object_id, object_type)
5618    }
5619
5620    /// Creates context `context_id` for use in command execution.  A context may be associated
5621    /// with hardware state.
5622    /// DEPRECATED: Please use CreateContext2.
5623    /// TODO(https://fxbug.dev/413030654): Fully deprecate this API.
5624    pub fn r#create_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
5625        PrimaryProxyInterface::r#create_context(self, context_id)
5626    }
5627
5628    /// Creates context `context_id` for use in command execution.  A context may be associated
5629    /// with hardware state.
5630    pub fn r#create_context2(
5631        &self,
5632        mut context_id: u32,
5633        mut priority: Priority,
5634    ) -> Result<(), fidl::Error> {
5635        PrimaryProxyInterface::r#create_context2(self, context_id, priority)
5636    }
5637
5638    /// Destroys context `context_id`.
5639    pub fn r#destroy_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
5640        PrimaryProxyInterface::r#destroy_context(self, context_id)
5641    }
5642
5643    /// Submits command buffers for execution on the hardware, with associated `resources`.
5644    /// `resources` must refer to buffers that have been imported.
5645    /// `wait_semaphores` and `signal_semaphores` must refer to events that have been imported.
5646    /// `wait_semaphores` must all be signaled before execution begins, then are reset.
5647    /// `signal_semaphores` will be signaled after the command buffer is completed.
5648    pub fn r#execute_command(
5649        &self,
5650        mut context_id: u32,
5651        mut resources: &[BufferRange],
5652        mut command_buffers: &[CommandBuffer],
5653        mut wait_semaphores: &[u64],
5654        mut signal_semaphores: &[u64],
5655        mut flags: CommandBufferFlags,
5656    ) -> Result<(), fidl::Error> {
5657        PrimaryProxyInterface::r#execute_command(
5658            self,
5659            context_id,
5660            resources,
5661            command_buffers,
5662            wait_semaphores,
5663            signal_semaphores,
5664            flags,
5665        )
5666    }
5667
5668    /// Submits a series of commands for execution on the hardware without using a command buffer.
5669    /// `semaphores` must refer to events that have been imported, and will be signaled after
5670    /// the commands are completed.
5671    pub fn r#execute_immediate_commands(
5672        &self,
5673        mut context_id: u32,
5674        mut command_data: &[u8],
5675        mut semaphores: &[u64],
5676    ) -> Result<(), fidl::Error> {
5677        PrimaryProxyInterface::r#execute_immediate_commands(
5678            self,
5679            context_id,
5680            command_data,
5681            semaphores,
5682        )
5683    }
5684
5685    /// Submits a series of commands for execution on the hardware without using a command buffer.
5686    /// The number of commands sent should be calculated so that the total message size is less than
5687    /// MAX_INLINE_COMMANDS_DATA_SIZE.
5688    pub fn r#execute_inline_commands(
5689        &self,
5690        mut context_id: u32,
5691        mut commands: &[InlineCommand],
5692    ) -> Result<(), fidl::Error> {
5693        PrimaryProxyInterface::r#execute_inline_commands(self, context_id, commands)
5694    }
5695
5696    /// Incurs a round-trip to the system driver, used to ensure all previous messages have been
5697    /// observed, but not necessarily completed.
5698    pub fn r#flush(
5699        &self,
5700    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5701        PrimaryProxyInterface::r#flush(self)
5702    }
5703
5704    /// Maps a page range onto the hardware in the connection's address space at address `hw_va`.
5705    /// `flags` is a set of flags from MapFlags that specify how the hardware can access the buffer.
5706    pub fn r#map_buffer(&self, mut payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error> {
5707        PrimaryProxyInterface::r#map_buffer(self, payload)
5708    }
5709
5710    /// Releases the mapping at address `hw_va` from the hardware for the given `buffer_id`.
5711    /// Buffers will also be implicitly unmapped when released.
5712    pub fn r#unmap_buffer(
5713        &self,
5714        mut payload: &PrimaryUnmapBufferRequest,
5715    ) -> Result<(), fidl::Error> {
5716        PrimaryProxyInterface::r#unmap_buffer(self, payload)
5717    }
5718
5719    /// Perform an operation on a range of the buffer.
5720    pub fn r#buffer_range_op2(
5721        &self,
5722        mut op: BufferOp,
5723        mut range: &BufferRange,
5724    ) -> Result<(), fidl::Error> {
5725        PrimaryProxyInterface::r#buffer_range_op2(self, op, range)
5726    }
5727
5728    /// Enables the events OnNotifyMessagesConsumed and OnNotifyMemoryImported.
5729    pub fn r#enable_flow_control(&self) -> Result<(), fidl::Error> {
5730        PrimaryProxyInterface::r#enable_flow_control(self)
5731    }
5732
5733    /// Tries to enable performance counter FIDL messages. To be successful, |access_token| must
5734    /// have been returned by PerformanceCounterAccess.GetPerformanceCountToken() from the matching
5735    /// device.
5736    pub fn r#enable_performance_counter_access(
5737        &self,
5738        mut access_token: fidl::Event,
5739    ) -> Result<(), fidl::Error> {
5740        PrimaryProxyInterface::r#enable_performance_counter_access(self, access_token)
5741    }
5742
5743    /// Returns true if any EnablePerformanceCounterAccess message has succeeded.
5744    pub fn r#is_performance_counter_access_allowed(
5745        &self,
5746    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
5747        PrimaryProxyInterface::r#is_performance_counter_access_allowed(self)
5748    }
5749
5750    /// Enables a set of performance counters.  Disables enabled performance counters that are not
5751    /// in the new set. Performance counters will also be automatically disabled on connection
5752    /// close. Performance counter access must have been enabled using
5753    /// EnablePerformanceCounterAccess before calling this method.
5754    pub fn r#enable_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
5755        PrimaryProxyInterface::r#enable_performance_counters(self, counters)
5756    }
5757
5758    /// Creates a pool of buffers that performance counters can be dumped into. Performance counter
5759    /// access must have been enabled using EnablePerformanceCounterAccess before calling this
5760    /// method.
5761    pub fn r#create_performance_counter_buffer_pool(
5762        &self,
5763        mut pool_id: u64,
5764        mut event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
5765    ) -> Result<(), fidl::Error> {
5766        PrimaryProxyInterface::r#create_performance_counter_buffer_pool(
5767            self,
5768            pool_id,
5769            event_channel,
5770        )
5771    }
5772
5773    /// Releases a pool of performance counter buffers. Performance counter access must have been
5774    /// enabled using EnablePerformanceCounterAccess before calling this method.
5775    pub fn r#release_performance_counter_buffer_pool(
5776        &self,
5777        mut pool_id: u64,
5778    ) -> Result<(), fidl::Error> {
5779        PrimaryProxyInterface::r#release_performance_counter_buffer_pool(self, pool_id)
5780    }
5781
5782    /// Adds a set of offsets into buffers to the pool. |offsets[n].buffer_id| is the id of a
5783    /// buffer that was previously imported using ImportBuffer(). The same buffer may be added to
5784    /// multiple pools. The pool will hold on to a reference to the buffer even after ReleaseBuffer
5785    /// is called.  When dumped into this entry, counters will be written starting at
5786    /// |offsets[n].buffer_offset| bytes into the buffer, and up to |offsets[n].buffer_offset| +
5787    /// |offsets[n].buffer_size|. |offsets[n].buffer_size| must be large enough to fit all enabled
5788    /// counters. Performance counter access must have been enabled using
5789    /// EnablePerformanceCounterAccess before calling this method.
5790    pub fn r#add_performance_counter_buffer_offsets_to_pool(
5791        &self,
5792        mut pool_id: u64,
5793        mut offsets: &[BufferRange],
5794    ) -> Result<(), fidl::Error> {
5795        PrimaryProxyInterface::r#add_performance_counter_buffer_offsets_to_pool(
5796            self, pool_id, offsets,
5797        )
5798    }
5799
5800    /// Removes every offset of a buffer from the pool. Once this method is finished being handled
5801    /// on the server, no more dumps will be processed into this buffer. In-flight dumps into this
5802    /// buffer may be lost.  Performance counter access must have been enabled using
5803    /// EnablePerformanceCounterAccess before calling this method.
5804    pub fn r#remove_performance_counter_buffer_from_pool(
5805        &self,
5806        mut pool_id: u64,
5807        mut buffer_id: u64,
5808    ) -> Result<(), fidl::Error> {
5809        PrimaryProxyInterface::r#remove_performance_counter_buffer_from_pool(
5810            self, pool_id, buffer_id,
5811        )
5812    }
5813
5814    /// Triggers dumping of the performance counters into a buffer pool. May fail silently if there
5815    /// are no buffers in the pool. |trigger_id| is an arbitrary ID assigned by the client that can
5816    /// be returned in OnPerformanceCounterReadCompleted. Performance counter access must have been
5817    /// enabled using EnablePerformanceCounterAccess before calling this method.
5818    pub fn r#dump_performance_counters(
5819        &self,
5820        mut pool_id: u64,
5821        mut trigger_id: u32,
5822    ) -> Result<(), fidl::Error> {
5823        PrimaryProxyInterface::r#dump_performance_counters(self, pool_id, trigger_id)
5824    }
5825
5826    /// Sets the values of all listed performance counters to 0. May not be supported by some
5827    /// hardware. Performance counter access must have been enabled using
5828    /// EnablePerformanceCounterAccess before calling this method.
5829    pub fn r#clear_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
5830        PrimaryProxyInterface::r#clear_performance_counters(self, counters)
5831    }
5832}
5833
5834impl PrimaryProxyInterface for PrimaryProxy {
5835    fn r#import_object(&self, mut payload: PrimaryImportObjectRequest) -> Result<(), fidl::Error> {
5836        self.client.send::<PrimaryImportObjectRequest>(
5837            &mut payload,
5838            0x5f5a247abb1d9354,
5839            fidl::encoding::DynamicFlags::empty(),
5840        )
5841    }
5842
5843    fn r#release_object(
5844        &self,
5845        mut object_id: u64,
5846        mut object_type: ObjectType,
5847    ) -> Result<(), fidl::Error> {
5848        self.client.send::<PrimaryReleaseObjectRequest>(
5849            (object_id, object_type),
5850            0x4a65d5885da5e88f,
5851            fidl::encoding::DynamicFlags::empty(),
5852        )
5853    }
5854
5855    fn r#create_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
5856        self.client.send::<PrimaryCreateContextRequest>(
5857            (context_id,),
5858            0x5a9a91c8b88b5da4,
5859            fidl::encoding::DynamicFlags::empty(),
5860        )
5861    }
5862
5863    fn r#create_context2(
5864        &self,
5865        mut context_id: u32,
5866        mut priority: Priority,
5867    ) -> Result<(), fidl::Error> {
5868        self.client.send::<PrimaryCreateContext2Request>(
5869            (context_id, priority),
5870            0x5f7e3a5137e758f6,
5871            fidl::encoding::DynamicFlags::empty(),
5872        )
5873    }
5874
5875    fn r#destroy_context(&self, mut context_id: u32) -> Result<(), fidl::Error> {
5876        self.client.send::<PrimaryDestroyContextRequest>(
5877            (context_id,),
5878            0x26b626e6be162ef0,
5879            fidl::encoding::DynamicFlags::empty(),
5880        )
5881    }
5882
5883    fn r#execute_command(
5884        &self,
5885        mut context_id: u32,
5886        mut resources: &[BufferRange],
5887        mut command_buffers: &[CommandBuffer],
5888        mut wait_semaphores: &[u64],
5889        mut signal_semaphores: &[u64],
5890        mut flags: CommandBufferFlags,
5891    ) -> Result<(), fidl::Error> {
5892        self.client.send::<PrimaryExecuteCommandRequest>(
5893            (context_id, resources, command_buffers, wait_semaphores, signal_semaphores, flags),
5894            0xf2799643aadb0db,
5895            fidl::encoding::DynamicFlags::empty(),
5896        )
5897    }
5898
5899    fn r#execute_immediate_commands(
5900        &self,
5901        mut context_id: u32,
5902        mut command_data: &[u8],
5903        mut semaphores: &[u64],
5904    ) -> Result<(), fidl::Error> {
5905        self.client.send::<PrimaryExecuteImmediateCommandsRequest>(
5906            (context_id, command_data, semaphores),
5907            0x3d7e0dcdbfd4b61f,
5908            fidl::encoding::DynamicFlags::empty(),
5909        )
5910    }
5911
5912    fn r#execute_inline_commands(
5913        &self,
5914        mut context_id: u32,
5915        mut commands: &[InlineCommand],
5916    ) -> Result<(), fidl::Error> {
5917        self.client.send::<PrimaryExecuteInlineCommandsRequest>(
5918            (context_id, commands),
5919            0x766d5c86f35468a6,
5920            fidl::encoding::DynamicFlags::empty(),
5921        )
5922    }
5923
5924    type FlushResponseFut =
5925        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5926    fn r#flush(&self) -> Self::FlushResponseFut {
5927        fn _decode(
5928            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5929        ) -> Result<(), fidl::Error> {
5930            let _response = fidl::client::decode_transaction_body::<
5931                fidl::encoding::EmptyPayload,
5932                fidl::encoding::DefaultFuchsiaResourceDialect,
5933                0x54ccb5572d886039,
5934            >(_buf?)?;
5935            Ok(_response)
5936        }
5937        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
5938            (),
5939            0x54ccb5572d886039,
5940            fidl::encoding::DynamicFlags::empty(),
5941            _decode,
5942        )
5943    }
5944
5945    fn r#map_buffer(&self, mut payload: &PrimaryMapBufferRequest) -> Result<(), fidl::Error> {
5946        self.client.send::<PrimaryMapBufferRequest>(
5947            payload,
5948            0x56baa5d2092c8e33,
5949            fidl::encoding::DynamicFlags::empty(),
5950        )
5951    }
5952
5953    fn r#unmap_buffer(&self, mut payload: &PrimaryUnmapBufferRequest) -> Result<(), fidl::Error> {
5954        self.client.send::<PrimaryUnmapBufferRequest>(
5955            payload,
5956            0x305188ebd8bcd95c,
5957            fidl::encoding::DynamicFlags::empty(),
5958        )
5959    }
5960
5961    fn r#buffer_range_op2(
5962        &self,
5963        mut op: BufferOp,
5964        mut range: &BufferRange,
5965    ) -> Result<(), fidl::Error> {
5966        self.client.send::<PrimaryBufferRangeOp2Request>(
5967            (op, range),
5968            0x4175c8dfef355396,
5969            fidl::encoding::DynamicFlags::empty(),
5970        )
5971    }
5972
5973    fn r#enable_flow_control(&self) -> Result<(), fidl::Error> {
5974        self.client.send::<fidl::encoding::EmptyPayload>(
5975            (),
5976            0x8b5e68f3ee0b22e,
5977            fidl::encoding::DynamicFlags::empty(),
5978        )
5979    }
5980
5981    fn r#enable_performance_counter_access(
5982        &self,
5983        mut access_token: fidl::Event,
5984    ) -> Result<(), fidl::Error> {
5985        self.client.send::<PrimaryEnablePerformanceCounterAccessRequest>(
5986            (access_token,),
5987            0x51b369ac16588831,
5988            fidl::encoding::DynamicFlags::empty(),
5989        )
5990    }
5991
5992    type IsPerformanceCounterAccessAllowedResponseFut =
5993        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
5994    fn r#is_performance_counter_access_allowed(
5995        &self,
5996    ) -> Self::IsPerformanceCounterAccessAllowedResponseFut {
5997        fn _decode(
5998            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5999        ) -> Result<bool, fidl::Error> {
6000            let _response = fidl::client::decode_transaction_body::<
6001                PrimaryIsPerformanceCounterAccessAllowedResponse,
6002                fidl::encoding::DefaultFuchsiaResourceDialect,
6003                0x1933b70c06cc5702,
6004            >(_buf?)?;
6005            Ok(_response.enabled)
6006        }
6007        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
6008            (),
6009            0x1933b70c06cc5702,
6010            fidl::encoding::DynamicFlags::empty(),
6011            _decode,
6012        )
6013    }
6014
6015    fn r#enable_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
6016        self.client.send::<PrimaryEnablePerformanceCountersRequest>(
6017            (counters,),
6018            0x52c4db74b601aaa7,
6019            fidl::encoding::DynamicFlags::empty(),
6020        )
6021    }
6022
6023    fn r#create_performance_counter_buffer_pool(
6024        &self,
6025        mut pool_id: u64,
6026        mut event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
6027    ) -> Result<(), fidl::Error> {
6028        self.client.send::<PrimaryCreatePerformanceCounterBufferPoolRequest>(
6029            (pool_id, event_channel),
6030            0x48ccf6519bbbc638,
6031            fidl::encoding::DynamicFlags::empty(),
6032        )
6033    }
6034
6035    fn r#release_performance_counter_buffer_pool(
6036        &self,
6037        mut pool_id: u64,
6038    ) -> Result<(), fidl::Error> {
6039        self.client.send::<PrimaryReleasePerformanceCounterBufferPoolRequest>(
6040            (pool_id,),
6041            0x18374c4b3ef0b4da,
6042            fidl::encoding::DynamicFlags::empty(),
6043        )
6044    }
6045
6046    fn r#add_performance_counter_buffer_offsets_to_pool(
6047        &self,
6048        mut pool_id: u64,
6049        mut offsets: &[BufferRange],
6050    ) -> Result<(), fidl::Error> {
6051        self.client.send::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
6052            (pool_id, offsets),
6053            0x1f7889571111386b,
6054            fidl::encoding::DynamicFlags::empty(),
6055        )
6056    }
6057
6058    fn r#remove_performance_counter_buffer_from_pool(
6059        &self,
6060        mut pool_id: u64,
6061        mut buffer_id: u64,
6062    ) -> Result<(), fidl::Error> {
6063        self.client.send::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(
6064            (pool_id, buffer_id),
6065            0xbf1275f5a36258e,
6066            fidl::encoding::DynamicFlags::empty(),
6067        )
6068    }
6069
6070    fn r#dump_performance_counters(
6071        &self,
6072        mut pool_id: u64,
6073        mut trigger_id: u32,
6074    ) -> Result<(), fidl::Error> {
6075        self.client.send::<PrimaryDumpPerformanceCountersRequest>(
6076            (pool_id, trigger_id),
6077            0x250b29340be28807,
6078            fidl::encoding::DynamicFlags::empty(),
6079        )
6080    }
6081
6082    fn r#clear_performance_counters(&self, mut counters: &[u64]) -> Result<(), fidl::Error> {
6083        self.client.send::<PrimaryClearPerformanceCountersRequest>(
6084            (counters,),
6085            0x236831822eff741a,
6086            fidl::encoding::DynamicFlags::empty(),
6087        )
6088    }
6089}
6090
6091pub struct PrimaryEventStream {
6092    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6093}
6094
6095impl std::marker::Unpin for PrimaryEventStream {}
6096
6097impl futures::stream::FusedStream for PrimaryEventStream {
6098    fn is_terminated(&self) -> bool {
6099        self.event_receiver.is_terminated()
6100    }
6101}
6102
6103impl futures::Stream for PrimaryEventStream {
6104    type Item = Result<PrimaryEvent, fidl::Error>;
6105
6106    fn poll_next(
6107        mut self: std::pin::Pin<&mut Self>,
6108        cx: &mut std::task::Context<'_>,
6109    ) -> std::task::Poll<Option<Self::Item>> {
6110        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6111            &mut self.event_receiver,
6112            cx
6113        )?) {
6114            Some(buf) => std::task::Poll::Ready(Some(PrimaryEvent::decode(buf))),
6115            None => std::task::Poll::Ready(None),
6116        }
6117    }
6118}
6119
6120#[derive(Debug)]
6121pub enum PrimaryEvent {
6122    OnNotifyMessagesConsumed { count: u64 },
6123    OnNotifyMemoryImported { bytes: u64 },
6124}
6125
6126impl PrimaryEvent {
6127    #[allow(irrefutable_let_patterns)]
6128    pub fn into_on_notify_messages_consumed(self) -> Option<u64> {
6129        if let PrimaryEvent::OnNotifyMessagesConsumed { count } = self {
6130            Some((count))
6131        } else {
6132            None
6133        }
6134    }
6135    #[allow(irrefutable_let_patterns)]
6136    pub fn into_on_notify_memory_imported(self) -> Option<u64> {
6137        if let PrimaryEvent::OnNotifyMemoryImported { bytes } = self { Some((bytes)) } else { None }
6138    }
6139
6140    /// Decodes a message buffer as a [`PrimaryEvent`].
6141    fn decode(
6142        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6143    ) -> Result<PrimaryEvent, fidl::Error> {
6144        let (bytes, _handles) = buf.split_mut();
6145        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6146        debug_assert_eq!(tx_header.tx_id, 0);
6147        match tx_header.ordinal {
6148            0x5e8dd0b0b753ac43 => {
6149                let mut out = fidl::new_empty!(
6150                    PrimaryOnNotifyMessagesConsumedRequest,
6151                    fidl::encoding::DefaultFuchsiaResourceDialect
6152                );
6153                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryOnNotifyMessagesConsumedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6154                Ok((PrimaryEvent::OnNotifyMessagesConsumed { count: out.count }))
6155            }
6156            0x50524b7a3503aba6 => {
6157                let mut out = fidl::new_empty!(
6158                    PrimaryOnNotifyMemoryImportedRequest,
6159                    fidl::encoding::DefaultFuchsiaResourceDialect
6160                );
6161                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryOnNotifyMemoryImportedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
6162                Ok((PrimaryEvent::OnNotifyMemoryImported { bytes: out.bytes }))
6163            }
6164            _ => Err(fidl::Error::UnknownOrdinal {
6165                ordinal: tx_header.ordinal,
6166                protocol_name: <PrimaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6167            }),
6168        }
6169    }
6170}
6171
6172/// A Stream of incoming requests for fuchsia.gpu.magma/Primary.
6173pub struct PrimaryRequestStream {
6174    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6175    is_terminated: bool,
6176}
6177
6178impl std::marker::Unpin for PrimaryRequestStream {}
6179
6180impl futures::stream::FusedStream for PrimaryRequestStream {
6181    fn is_terminated(&self) -> bool {
6182        self.is_terminated
6183    }
6184}
6185
6186impl fidl::endpoints::RequestStream for PrimaryRequestStream {
6187    type Protocol = PrimaryMarker;
6188    type ControlHandle = PrimaryControlHandle;
6189
6190    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6191        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6192    }
6193
6194    fn control_handle(&self) -> Self::ControlHandle {
6195        PrimaryControlHandle { inner: self.inner.clone() }
6196    }
6197
6198    fn into_inner(
6199        self,
6200    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6201    {
6202        (self.inner, self.is_terminated)
6203    }
6204
6205    fn from_inner(
6206        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6207        is_terminated: bool,
6208    ) -> Self {
6209        Self { inner, is_terminated }
6210    }
6211}
6212
6213impl futures::Stream for PrimaryRequestStream {
6214    type Item = Result<PrimaryRequest, fidl::Error>;
6215
6216    fn poll_next(
6217        mut self: std::pin::Pin<&mut Self>,
6218        cx: &mut std::task::Context<'_>,
6219    ) -> std::task::Poll<Option<Self::Item>> {
6220        let this = &mut *self;
6221        if this.inner.check_shutdown(cx) {
6222            this.is_terminated = true;
6223            return std::task::Poll::Ready(None);
6224        }
6225        if this.is_terminated {
6226            panic!("polled PrimaryRequestStream after completion");
6227        }
6228        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6229            |bytes, handles| {
6230                match this.inner.channel().read_etc(cx, bytes, handles) {
6231                    std::task::Poll::Ready(Ok(())) => {}
6232                    std::task::Poll::Pending => return std::task::Poll::Pending,
6233                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6234                        this.is_terminated = true;
6235                        return std::task::Poll::Ready(None);
6236                    }
6237                    std::task::Poll::Ready(Err(e)) => {
6238                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6239                            e.into(),
6240                        ))));
6241                    }
6242                }
6243
6244                // A message has been received from the channel
6245                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6246
6247                std::task::Poll::Ready(Some(match header.ordinal {
6248                    0x5f5a247abb1d9354 => {
6249                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6250                        let mut req = fidl::new_empty!(
6251                            PrimaryImportObjectRequest,
6252                            fidl::encoding::DefaultFuchsiaResourceDialect
6253                        );
6254                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryImportObjectRequest>(&header, _body_bytes, handles, &mut req)?;
6255                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6256                        Ok(PrimaryRequest::ImportObject { payload: req, control_handle })
6257                    }
6258                    0x4a65d5885da5e88f => {
6259                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6260                        let mut req = fidl::new_empty!(
6261                            PrimaryReleaseObjectRequest,
6262                            fidl::encoding::DefaultFuchsiaResourceDialect
6263                        );
6264                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryReleaseObjectRequest>(&header, _body_bytes, handles, &mut req)?;
6265                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6266                        Ok(PrimaryRequest::ReleaseObject {
6267                            object_id: req.object_id,
6268                            object_type: req.object_type,
6269
6270                            control_handle,
6271                        })
6272                    }
6273                    0x5a9a91c8b88b5da4 => {
6274                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6275                        let mut req = fidl::new_empty!(
6276                            PrimaryCreateContextRequest,
6277                            fidl::encoding::DefaultFuchsiaResourceDialect
6278                        );
6279                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryCreateContextRequest>(&header, _body_bytes, handles, &mut req)?;
6280                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6281                        Ok(PrimaryRequest::CreateContext {
6282                            context_id: req.context_id,
6283
6284                            control_handle,
6285                        })
6286                    }
6287                    0x5f7e3a5137e758f6 => {
6288                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6289                        let mut req = fidl::new_empty!(
6290                            PrimaryCreateContext2Request,
6291                            fidl::encoding::DefaultFuchsiaResourceDialect
6292                        );
6293                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryCreateContext2Request>(&header, _body_bytes, handles, &mut req)?;
6294                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6295                        Ok(PrimaryRequest::CreateContext2 {
6296                            context_id: req.context_id,
6297                            priority: req.priority,
6298
6299                            control_handle,
6300                        })
6301                    }
6302                    0x26b626e6be162ef0 => {
6303                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6304                        let mut req = fidl::new_empty!(
6305                            PrimaryDestroyContextRequest,
6306                            fidl::encoding::DefaultFuchsiaResourceDialect
6307                        );
6308                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryDestroyContextRequest>(&header, _body_bytes, handles, &mut req)?;
6309                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6310                        Ok(PrimaryRequest::DestroyContext {
6311                            context_id: req.context_id,
6312
6313                            control_handle,
6314                        })
6315                    }
6316                    0xf2799643aadb0db => {
6317                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6318                        let mut req = fidl::new_empty!(
6319                            PrimaryExecuteCommandRequest,
6320                            fidl::encoding::DefaultFuchsiaResourceDialect
6321                        );
6322                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
6323                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6324                        Ok(PrimaryRequest::ExecuteCommand {
6325                            context_id: req.context_id,
6326                            resources: req.resources,
6327                            command_buffers: req.command_buffers,
6328                            wait_semaphores: req.wait_semaphores,
6329                            signal_semaphores: req.signal_semaphores,
6330                            flags: req.flags,
6331
6332                            control_handle,
6333                        })
6334                    }
6335                    0x3d7e0dcdbfd4b61f => {
6336                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6337                        let mut req = fidl::new_empty!(
6338                            PrimaryExecuteImmediateCommandsRequest,
6339                            fidl::encoding::DefaultFuchsiaResourceDialect
6340                        );
6341                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryExecuteImmediateCommandsRequest>(&header, _body_bytes, handles, &mut req)?;
6342                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6343                        Ok(PrimaryRequest::ExecuteImmediateCommands {
6344                            context_id: req.context_id,
6345                            command_data: req.command_data,
6346                            semaphores: req.semaphores,
6347
6348                            control_handle,
6349                        })
6350                    }
6351                    0x766d5c86f35468a6 => {
6352                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6353                        let mut req = fidl::new_empty!(
6354                            PrimaryExecuteInlineCommandsRequest,
6355                            fidl::encoding::DefaultFuchsiaResourceDialect
6356                        );
6357                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryExecuteInlineCommandsRequest>(&header, _body_bytes, handles, &mut req)?;
6358                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6359                        Ok(PrimaryRequest::ExecuteInlineCommands {
6360                            context_id: req.context_id,
6361                            commands: req.commands,
6362
6363                            control_handle,
6364                        })
6365                    }
6366                    0x54ccb5572d886039 => {
6367                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6368                        let mut req = fidl::new_empty!(
6369                            fidl::encoding::EmptyPayload,
6370                            fidl::encoding::DefaultFuchsiaResourceDialect
6371                        );
6372                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6373                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6374                        Ok(PrimaryRequest::Flush {
6375                            responder: PrimaryFlushResponder {
6376                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6377                                tx_id: header.tx_id,
6378                            },
6379                        })
6380                    }
6381                    0x56baa5d2092c8e33 => {
6382                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6383                        let mut req = fidl::new_empty!(
6384                            PrimaryMapBufferRequest,
6385                            fidl::encoding::DefaultFuchsiaResourceDialect
6386                        );
6387                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryMapBufferRequest>(&header, _body_bytes, handles, &mut req)?;
6388                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6389                        Ok(PrimaryRequest::MapBuffer { payload: req, control_handle })
6390                    }
6391                    0x305188ebd8bcd95c => {
6392                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6393                        let mut req = fidl::new_empty!(
6394                            PrimaryUnmapBufferRequest,
6395                            fidl::encoding::DefaultFuchsiaResourceDialect
6396                        );
6397                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryUnmapBufferRequest>(&header, _body_bytes, handles, &mut req)?;
6398                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6399                        Ok(PrimaryRequest::UnmapBuffer { payload: req, control_handle })
6400                    }
6401                    0x4175c8dfef355396 => {
6402                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6403                        let mut req = fidl::new_empty!(
6404                            PrimaryBufferRangeOp2Request,
6405                            fidl::encoding::DefaultFuchsiaResourceDialect
6406                        );
6407                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryBufferRangeOp2Request>(&header, _body_bytes, handles, &mut req)?;
6408                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6409                        Ok(PrimaryRequest::BufferRangeOp2 {
6410                            op: req.op,
6411                            range: req.range,
6412
6413                            control_handle,
6414                        })
6415                    }
6416                    0x8b5e68f3ee0b22e => {
6417                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6418                        let mut req = fidl::new_empty!(
6419                            fidl::encoding::EmptyPayload,
6420                            fidl::encoding::DefaultFuchsiaResourceDialect
6421                        );
6422                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6423                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6424                        Ok(PrimaryRequest::EnableFlowControl { control_handle })
6425                    }
6426                    0x51b369ac16588831 => {
6427                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6428                        let mut req = fidl::new_empty!(
6429                            PrimaryEnablePerformanceCounterAccessRequest,
6430                            fidl::encoding::DefaultFuchsiaResourceDialect
6431                        );
6432                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryEnablePerformanceCounterAccessRequest>(&header, _body_bytes, handles, &mut req)?;
6433                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6434                        Ok(PrimaryRequest::EnablePerformanceCounterAccess {
6435                            access_token: req.access_token,
6436
6437                            control_handle,
6438                        })
6439                    }
6440                    0x1933b70c06cc5702 => {
6441                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6442                        let mut req = fidl::new_empty!(
6443                            fidl::encoding::EmptyPayload,
6444                            fidl::encoding::DefaultFuchsiaResourceDialect
6445                        );
6446                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6447                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6448                        Ok(PrimaryRequest::IsPerformanceCounterAccessAllowed {
6449                            responder: PrimaryIsPerformanceCounterAccessAllowedResponder {
6450                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6451                                tx_id: header.tx_id,
6452                            },
6453                        })
6454                    }
6455                    0x52c4db74b601aaa7 => {
6456                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6457                        let mut req = fidl::new_empty!(
6458                            PrimaryEnablePerformanceCountersRequest,
6459                            fidl::encoding::DefaultFuchsiaResourceDialect
6460                        );
6461                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryEnablePerformanceCountersRequest>(&header, _body_bytes, handles, &mut req)?;
6462                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6463                        Ok(PrimaryRequest::EnablePerformanceCounters {
6464                            counters: req.counters,
6465
6466                            control_handle,
6467                        })
6468                    }
6469                    0x48ccf6519bbbc638 => {
6470                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6471                        let mut req = fidl::new_empty!(
6472                            PrimaryCreatePerformanceCounterBufferPoolRequest,
6473                            fidl::encoding::DefaultFuchsiaResourceDialect
6474                        );
6475                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryCreatePerformanceCounterBufferPoolRequest>(&header, _body_bytes, handles, &mut req)?;
6476                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6477                        Ok(PrimaryRequest::CreatePerformanceCounterBufferPool {
6478                            pool_id: req.pool_id,
6479                            event_channel: req.event_channel,
6480
6481                            control_handle,
6482                        })
6483                    }
6484                    0x18374c4b3ef0b4da => {
6485                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6486                        let mut req = fidl::new_empty!(
6487                            PrimaryReleasePerformanceCounterBufferPoolRequest,
6488                            fidl::encoding::DefaultFuchsiaResourceDialect
6489                        );
6490                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryReleasePerformanceCounterBufferPoolRequest>(&header, _body_bytes, handles, &mut req)?;
6491                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6492                        Ok(PrimaryRequest::ReleasePerformanceCounterBufferPool {
6493                            pool_id: req.pool_id,
6494
6495                            control_handle,
6496                        })
6497                    }
6498                    0x1f7889571111386b => {
6499                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6500                        let mut req = fidl::new_empty!(
6501                            PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest,
6502                            fidl::encoding::DefaultFuchsiaResourceDialect
6503                        );
6504                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(&header, _body_bytes, handles, &mut req)?;
6505                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6506                        Ok(PrimaryRequest::AddPerformanceCounterBufferOffsetsToPool {
6507                            pool_id: req.pool_id,
6508                            offsets: req.offsets,
6509
6510                            control_handle,
6511                        })
6512                    }
6513                    0xbf1275f5a36258e => {
6514                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6515                        let mut req = fidl::new_empty!(
6516                            PrimaryRemovePerformanceCounterBufferFromPoolRequest,
6517                            fidl::encoding::DefaultFuchsiaResourceDialect
6518                        );
6519                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(&header, _body_bytes, handles, &mut req)?;
6520                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6521                        Ok(PrimaryRequest::RemovePerformanceCounterBufferFromPool {
6522                            pool_id: req.pool_id,
6523                            buffer_id: req.buffer_id,
6524
6525                            control_handle,
6526                        })
6527                    }
6528                    0x250b29340be28807 => {
6529                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6530                        let mut req = fidl::new_empty!(
6531                            PrimaryDumpPerformanceCountersRequest,
6532                            fidl::encoding::DefaultFuchsiaResourceDialect
6533                        );
6534                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryDumpPerformanceCountersRequest>(&header, _body_bytes, handles, &mut req)?;
6535                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6536                        Ok(PrimaryRequest::DumpPerformanceCounters {
6537                            pool_id: req.pool_id,
6538                            trigger_id: req.trigger_id,
6539
6540                            control_handle,
6541                        })
6542                    }
6543                    0x236831822eff741a => {
6544                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6545                        let mut req = fidl::new_empty!(
6546                            PrimaryClearPerformanceCountersRequest,
6547                            fidl::encoding::DefaultFuchsiaResourceDialect
6548                        );
6549                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrimaryClearPerformanceCountersRequest>(&header, _body_bytes, handles, &mut req)?;
6550                        let control_handle = PrimaryControlHandle { inner: this.inner.clone() };
6551                        Ok(PrimaryRequest::ClearPerformanceCounters {
6552                            counters: req.counters,
6553
6554                            control_handle,
6555                        })
6556                    }
6557                    _ => Err(fidl::Error::UnknownOrdinal {
6558                        ordinal: header.ordinal,
6559                        protocol_name:
6560                            <PrimaryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6561                    }),
6562                }))
6563            },
6564        )
6565    }
6566}
6567
6568/// If a system driver error occurs, or if the client sends a message that the client should have
6569/// known is invalid, the connection will be closed and a zx.Status sent via epitaph.
6570#[derive(Debug)]
6571pub enum PrimaryRequest {
6572    /// Imports an object for use in the system driver.
6573    ImportObject { payload: PrimaryImportObjectRequest, control_handle: PrimaryControlHandle },
6574    /// Destroys the object with `object_id` within this connection.
6575    ReleaseObject { object_id: u64, object_type: ObjectType, control_handle: PrimaryControlHandle },
6576    /// Creates context `context_id` for use in command execution.  A context may be associated
6577    /// with hardware state.
6578    /// DEPRECATED: Please use CreateContext2.
6579    /// TODO(https://fxbug.dev/413030654): Fully deprecate this API.
6580    CreateContext { context_id: u32, control_handle: PrimaryControlHandle },
6581    /// Creates context `context_id` for use in command execution.  A context may be associated
6582    /// with hardware state.
6583    CreateContext2 { context_id: u32, priority: Priority, control_handle: PrimaryControlHandle },
6584    /// Destroys context `context_id`.
6585    DestroyContext { context_id: u32, control_handle: PrimaryControlHandle },
6586    /// Submits command buffers for execution on the hardware, with associated `resources`.
6587    /// `resources` must refer to buffers that have been imported.
6588    /// `wait_semaphores` and `signal_semaphores` must refer to events that have been imported.
6589    /// `wait_semaphores` must all be signaled before execution begins, then are reset.
6590    /// `signal_semaphores` will be signaled after the command buffer is completed.
6591    ExecuteCommand {
6592        context_id: u32,
6593        resources: Vec<BufferRange>,
6594        command_buffers: Vec<CommandBuffer>,
6595        wait_semaphores: Vec<u64>,
6596        signal_semaphores: Vec<u64>,
6597        flags: CommandBufferFlags,
6598        control_handle: PrimaryControlHandle,
6599    },
6600    /// Submits a series of commands for execution on the hardware without using a command buffer.
6601    /// `semaphores` must refer to events that have been imported, and will be signaled after
6602    /// the commands are completed.
6603    ExecuteImmediateCommands {
6604        context_id: u32,
6605        command_data: Vec<u8>,
6606        semaphores: Vec<u64>,
6607        control_handle: PrimaryControlHandle,
6608    },
6609    /// Submits a series of commands for execution on the hardware without using a command buffer.
6610    /// The number of commands sent should be calculated so that the total message size is less than
6611    /// MAX_INLINE_COMMANDS_DATA_SIZE.
6612    ExecuteInlineCommands {
6613        context_id: u32,
6614        commands: Vec<InlineCommand>,
6615        control_handle: PrimaryControlHandle,
6616    },
6617    /// Incurs a round-trip to the system driver, used to ensure all previous messages have been
6618    /// observed, but not necessarily completed.
6619    Flush { responder: PrimaryFlushResponder },
6620    /// Maps a page range onto the hardware in the connection's address space at address `hw_va`.
6621    /// `flags` is a set of flags from MapFlags that specify how the hardware can access the buffer.
6622    MapBuffer { payload: PrimaryMapBufferRequest, control_handle: PrimaryControlHandle },
6623    /// Releases the mapping at address `hw_va` from the hardware for the given `buffer_id`.
6624    /// Buffers will also be implicitly unmapped when released.
6625    UnmapBuffer { payload: PrimaryUnmapBufferRequest, control_handle: PrimaryControlHandle },
6626    /// Perform an operation on a range of the buffer.
6627    BufferRangeOp2 { op: BufferOp, range: BufferRange, control_handle: PrimaryControlHandle },
6628    /// Enables the events OnNotifyMessagesConsumed and OnNotifyMemoryImported.
6629    EnableFlowControl { control_handle: PrimaryControlHandle },
6630    /// Tries to enable performance counter FIDL messages. To be successful, |access_token| must
6631    /// have been returned by PerformanceCounterAccess.GetPerformanceCountToken() from the matching
6632    /// device.
6633    EnablePerformanceCounterAccess {
6634        access_token: fidl::Event,
6635        control_handle: PrimaryControlHandle,
6636    },
6637    /// Returns true if any EnablePerformanceCounterAccess message has succeeded.
6638    IsPerformanceCounterAccessAllowed {
6639        responder: PrimaryIsPerformanceCounterAccessAllowedResponder,
6640    },
6641    /// Enables a set of performance counters.  Disables enabled performance counters that are not
6642    /// in the new set. Performance counters will also be automatically disabled on connection
6643    /// close. Performance counter access must have been enabled using
6644    /// EnablePerformanceCounterAccess before calling this method.
6645    EnablePerformanceCounters { counters: Vec<u64>, control_handle: PrimaryControlHandle },
6646    /// Creates a pool of buffers that performance counters can be dumped into. Performance counter
6647    /// access must have been enabled using EnablePerformanceCounterAccess before calling this
6648    /// method.
6649    CreatePerformanceCounterBufferPool {
6650        pool_id: u64,
6651        event_channel: fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
6652        control_handle: PrimaryControlHandle,
6653    },
6654    /// Releases a pool of performance counter buffers. Performance counter access must have been
6655    /// enabled using EnablePerformanceCounterAccess before calling this method.
6656    ReleasePerformanceCounterBufferPool { pool_id: u64, control_handle: PrimaryControlHandle },
6657    /// Adds a set of offsets into buffers to the pool. |offsets[n].buffer_id| is the id of a
6658    /// buffer that was previously imported using ImportBuffer(). The same buffer may be added to
6659    /// multiple pools. The pool will hold on to a reference to the buffer even after ReleaseBuffer
6660    /// is called.  When dumped into this entry, counters will be written starting at
6661    /// |offsets[n].buffer_offset| bytes into the buffer, and up to |offsets[n].buffer_offset| +
6662    /// |offsets[n].buffer_size|. |offsets[n].buffer_size| must be large enough to fit all enabled
6663    /// counters. Performance counter access must have been enabled using
6664    /// EnablePerformanceCounterAccess before calling this method.
6665    AddPerformanceCounterBufferOffsetsToPool {
6666        pool_id: u64,
6667        offsets: Vec<BufferRange>,
6668        control_handle: PrimaryControlHandle,
6669    },
6670    /// Removes every offset of a buffer from the pool. Once this method is finished being handled
6671    /// on the server, no more dumps will be processed into this buffer. In-flight dumps into this
6672    /// buffer may be lost.  Performance counter access must have been enabled using
6673    /// EnablePerformanceCounterAccess before calling this method.
6674    RemovePerformanceCounterBufferFromPool {
6675        pool_id: u64,
6676        buffer_id: u64,
6677        control_handle: PrimaryControlHandle,
6678    },
6679    /// Triggers dumping of the performance counters into a buffer pool. May fail silently if there
6680    /// are no buffers in the pool. |trigger_id| is an arbitrary ID assigned by the client that can
6681    /// be returned in OnPerformanceCounterReadCompleted. Performance counter access must have been
6682    /// enabled using EnablePerformanceCounterAccess before calling this method.
6683    DumpPerformanceCounters { pool_id: u64, trigger_id: u32, control_handle: PrimaryControlHandle },
6684    /// Sets the values of all listed performance counters to 0. May not be supported by some
6685    /// hardware. Performance counter access must have been enabled using
6686    /// EnablePerformanceCounterAccess before calling this method.
6687    ClearPerformanceCounters { counters: Vec<u64>, control_handle: PrimaryControlHandle },
6688}
6689
6690impl PrimaryRequest {
6691    #[allow(irrefutable_let_patterns)]
6692    pub fn into_import_object(self) -> Option<(PrimaryImportObjectRequest, PrimaryControlHandle)> {
6693        if let PrimaryRequest::ImportObject { payload, control_handle } = self {
6694            Some((payload, control_handle))
6695        } else {
6696            None
6697        }
6698    }
6699
6700    #[allow(irrefutable_let_patterns)]
6701    pub fn into_release_object(self) -> Option<(u64, ObjectType, PrimaryControlHandle)> {
6702        if let PrimaryRequest::ReleaseObject { object_id, object_type, control_handle } = self {
6703            Some((object_id, object_type, control_handle))
6704        } else {
6705            None
6706        }
6707    }
6708
6709    #[allow(irrefutable_let_patterns)]
6710    pub fn into_create_context(self) -> Option<(u32, PrimaryControlHandle)> {
6711        if let PrimaryRequest::CreateContext { context_id, control_handle } = self {
6712            Some((context_id, control_handle))
6713        } else {
6714            None
6715        }
6716    }
6717
6718    #[allow(irrefutable_let_patterns)]
6719    pub fn into_create_context2(self) -> Option<(u32, Priority, PrimaryControlHandle)> {
6720        if let PrimaryRequest::CreateContext2 { context_id, priority, control_handle } = self {
6721            Some((context_id, priority, control_handle))
6722        } else {
6723            None
6724        }
6725    }
6726
6727    #[allow(irrefutable_let_patterns)]
6728    pub fn into_destroy_context(self) -> Option<(u32, PrimaryControlHandle)> {
6729        if let PrimaryRequest::DestroyContext { context_id, control_handle } = self {
6730            Some((context_id, control_handle))
6731        } else {
6732            None
6733        }
6734    }
6735
6736    #[allow(irrefutable_let_patterns)]
6737    pub fn into_execute_command(
6738        self,
6739    ) -> Option<(
6740        u32,
6741        Vec<BufferRange>,
6742        Vec<CommandBuffer>,
6743        Vec<u64>,
6744        Vec<u64>,
6745        CommandBufferFlags,
6746        PrimaryControlHandle,
6747    )> {
6748        if let PrimaryRequest::ExecuteCommand {
6749            context_id,
6750            resources,
6751            command_buffers,
6752            wait_semaphores,
6753            signal_semaphores,
6754            flags,
6755            control_handle,
6756        } = self
6757        {
6758            Some((
6759                context_id,
6760                resources,
6761                command_buffers,
6762                wait_semaphores,
6763                signal_semaphores,
6764                flags,
6765                control_handle,
6766            ))
6767        } else {
6768            None
6769        }
6770    }
6771
6772    #[allow(irrefutable_let_patterns)]
6773    pub fn into_execute_immediate_commands(
6774        self,
6775    ) -> Option<(u32, Vec<u8>, Vec<u64>, PrimaryControlHandle)> {
6776        if let PrimaryRequest::ExecuteImmediateCommands {
6777            context_id,
6778            command_data,
6779            semaphores,
6780            control_handle,
6781        } = self
6782        {
6783            Some((context_id, command_data, semaphores, control_handle))
6784        } else {
6785            None
6786        }
6787    }
6788
6789    #[allow(irrefutable_let_patterns)]
6790    pub fn into_execute_inline_commands(
6791        self,
6792    ) -> Option<(u32, Vec<InlineCommand>, PrimaryControlHandle)> {
6793        if let PrimaryRequest::ExecuteInlineCommands { context_id, commands, control_handle } = self
6794        {
6795            Some((context_id, commands, control_handle))
6796        } else {
6797            None
6798        }
6799    }
6800
6801    #[allow(irrefutable_let_patterns)]
6802    pub fn into_flush(self) -> Option<(PrimaryFlushResponder)> {
6803        if let PrimaryRequest::Flush { responder } = self { Some((responder)) } else { None }
6804    }
6805
6806    #[allow(irrefutable_let_patterns)]
6807    pub fn into_map_buffer(self) -> Option<(PrimaryMapBufferRequest, PrimaryControlHandle)> {
6808        if let PrimaryRequest::MapBuffer { payload, control_handle } = self {
6809            Some((payload, control_handle))
6810        } else {
6811            None
6812        }
6813    }
6814
6815    #[allow(irrefutable_let_patterns)]
6816    pub fn into_unmap_buffer(self) -> Option<(PrimaryUnmapBufferRequest, PrimaryControlHandle)> {
6817        if let PrimaryRequest::UnmapBuffer { payload, control_handle } = self {
6818            Some((payload, control_handle))
6819        } else {
6820            None
6821        }
6822    }
6823
6824    #[allow(irrefutable_let_patterns)]
6825    pub fn into_buffer_range_op2(self) -> Option<(BufferOp, BufferRange, PrimaryControlHandle)> {
6826        if let PrimaryRequest::BufferRangeOp2 { op, range, control_handle } = self {
6827            Some((op, range, control_handle))
6828        } else {
6829            None
6830        }
6831    }
6832
6833    #[allow(irrefutable_let_patterns)]
6834    pub fn into_enable_flow_control(self) -> Option<(PrimaryControlHandle)> {
6835        if let PrimaryRequest::EnableFlowControl { control_handle } = self {
6836            Some((control_handle))
6837        } else {
6838            None
6839        }
6840    }
6841
6842    #[allow(irrefutable_let_patterns)]
6843    pub fn into_enable_performance_counter_access(
6844        self,
6845    ) -> Option<(fidl::Event, PrimaryControlHandle)> {
6846        if let PrimaryRequest::EnablePerformanceCounterAccess { access_token, control_handle } =
6847            self
6848        {
6849            Some((access_token, control_handle))
6850        } else {
6851            None
6852        }
6853    }
6854
6855    #[allow(irrefutable_let_patterns)]
6856    pub fn into_is_performance_counter_access_allowed(
6857        self,
6858    ) -> Option<(PrimaryIsPerformanceCounterAccessAllowedResponder)> {
6859        if let PrimaryRequest::IsPerformanceCounterAccessAllowed { responder } = self {
6860            Some((responder))
6861        } else {
6862            None
6863        }
6864    }
6865
6866    #[allow(irrefutable_let_patterns)]
6867    pub fn into_enable_performance_counters(self) -> Option<(Vec<u64>, PrimaryControlHandle)> {
6868        if let PrimaryRequest::EnablePerformanceCounters { counters, control_handle } = self {
6869            Some((counters, control_handle))
6870        } else {
6871            None
6872        }
6873    }
6874
6875    #[allow(irrefutable_let_patterns)]
6876    pub fn into_create_performance_counter_buffer_pool(
6877        self,
6878    ) -> Option<(
6879        u64,
6880        fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
6881        PrimaryControlHandle,
6882    )> {
6883        if let PrimaryRequest::CreatePerformanceCounterBufferPool {
6884            pool_id,
6885            event_channel,
6886            control_handle,
6887        } = self
6888        {
6889            Some((pool_id, event_channel, control_handle))
6890        } else {
6891            None
6892        }
6893    }
6894
6895    #[allow(irrefutable_let_patterns)]
6896    pub fn into_release_performance_counter_buffer_pool(
6897        self,
6898    ) -> Option<(u64, PrimaryControlHandle)> {
6899        if let PrimaryRequest::ReleasePerformanceCounterBufferPool { pool_id, control_handle } =
6900            self
6901        {
6902            Some((pool_id, control_handle))
6903        } else {
6904            None
6905        }
6906    }
6907
6908    #[allow(irrefutable_let_patterns)]
6909    pub fn into_add_performance_counter_buffer_offsets_to_pool(
6910        self,
6911    ) -> Option<(u64, Vec<BufferRange>, PrimaryControlHandle)> {
6912        if let PrimaryRequest::AddPerformanceCounterBufferOffsetsToPool {
6913            pool_id,
6914            offsets,
6915            control_handle,
6916        } = self
6917        {
6918            Some((pool_id, offsets, control_handle))
6919        } else {
6920            None
6921        }
6922    }
6923
6924    #[allow(irrefutable_let_patterns)]
6925    pub fn into_remove_performance_counter_buffer_from_pool(
6926        self,
6927    ) -> Option<(u64, u64, PrimaryControlHandle)> {
6928        if let PrimaryRequest::RemovePerformanceCounterBufferFromPool {
6929            pool_id,
6930            buffer_id,
6931            control_handle,
6932        } = self
6933        {
6934            Some((pool_id, buffer_id, control_handle))
6935        } else {
6936            None
6937        }
6938    }
6939
6940    #[allow(irrefutable_let_patterns)]
6941    pub fn into_dump_performance_counters(self) -> Option<(u64, u32, PrimaryControlHandle)> {
6942        if let PrimaryRequest::DumpPerformanceCounters { pool_id, trigger_id, control_handle } =
6943            self
6944        {
6945            Some((pool_id, trigger_id, control_handle))
6946        } else {
6947            None
6948        }
6949    }
6950
6951    #[allow(irrefutable_let_patterns)]
6952    pub fn into_clear_performance_counters(self) -> Option<(Vec<u64>, PrimaryControlHandle)> {
6953        if let PrimaryRequest::ClearPerformanceCounters { counters, control_handle } = self {
6954            Some((counters, control_handle))
6955        } else {
6956            None
6957        }
6958    }
6959
6960    /// Name of the method defined in FIDL
6961    pub fn method_name(&self) -> &'static str {
6962        match *self {
6963            PrimaryRequest::ImportObject { .. } => "import_object",
6964            PrimaryRequest::ReleaseObject { .. } => "release_object",
6965            PrimaryRequest::CreateContext { .. } => "create_context",
6966            PrimaryRequest::CreateContext2 { .. } => "create_context2",
6967            PrimaryRequest::DestroyContext { .. } => "destroy_context",
6968            PrimaryRequest::ExecuteCommand { .. } => "execute_command",
6969            PrimaryRequest::ExecuteImmediateCommands { .. } => "execute_immediate_commands",
6970            PrimaryRequest::ExecuteInlineCommands { .. } => "execute_inline_commands",
6971            PrimaryRequest::Flush { .. } => "flush",
6972            PrimaryRequest::MapBuffer { .. } => "map_buffer",
6973            PrimaryRequest::UnmapBuffer { .. } => "unmap_buffer",
6974            PrimaryRequest::BufferRangeOp2 { .. } => "buffer_range_op2",
6975            PrimaryRequest::EnableFlowControl { .. } => "enable_flow_control",
6976            PrimaryRequest::EnablePerformanceCounterAccess { .. } => {
6977                "enable_performance_counter_access"
6978            }
6979            PrimaryRequest::IsPerformanceCounterAccessAllowed { .. } => {
6980                "is_performance_counter_access_allowed"
6981            }
6982            PrimaryRequest::EnablePerformanceCounters { .. } => "enable_performance_counters",
6983            PrimaryRequest::CreatePerformanceCounterBufferPool { .. } => {
6984                "create_performance_counter_buffer_pool"
6985            }
6986            PrimaryRequest::ReleasePerformanceCounterBufferPool { .. } => {
6987                "release_performance_counter_buffer_pool"
6988            }
6989            PrimaryRequest::AddPerformanceCounterBufferOffsetsToPool { .. } => {
6990                "add_performance_counter_buffer_offsets_to_pool"
6991            }
6992            PrimaryRequest::RemovePerformanceCounterBufferFromPool { .. } => {
6993                "remove_performance_counter_buffer_from_pool"
6994            }
6995            PrimaryRequest::DumpPerformanceCounters { .. } => "dump_performance_counters",
6996            PrimaryRequest::ClearPerformanceCounters { .. } => "clear_performance_counters",
6997        }
6998    }
6999}
7000
7001#[derive(Debug, Clone)]
7002pub struct PrimaryControlHandle {
7003    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7004}
7005
7006impl fidl::endpoints::ControlHandle for PrimaryControlHandle {
7007    fn shutdown(&self) {
7008        self.inner.shutdown()
7009    }
7010    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7011        self.inner.shutdown_with_epitaph(status)
7012    }
7013
7014    fn is_closed(&self) -> bool {
7015        self.inner.channel().is_closed()
7016    }
7017    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7018        self.inner.channel().on_closed()
7019    }
7020
7021    #[cfg(target_os = "fuchsia")]
7022    fn signal_peer(
7023        &self,
7024        clear_mask: zx::Signals,
7025        set_mask: zx::Signals,
7026    ) -> Result<(), zx_status::Status> {
7027        use fidl::Peered;
7028        self.inner.channel().signal_peer(clear_mask, set_mask)
7029    }
7030}
7031
7032impl PrimaryControlHandle {
7033    pub fn send_on_notify_messages_consumed(&self, mut count: u64) -> Result<(), fidl::Error> {
7034        self.inner.send::<PrimaryOnNotifyMessagesConsumedRequest>(
7035            (count,),
7036            0,
7037            0x5e8dd0b0b753ac43,
7038            fidl::encoding::DynamicFlags::empty(),
7039        )
7040    }
7041
7042    pub fn send_on_notify_memory_imported(&self, mut bytes: u64) -> Result<(), fidl::Error> {
7043        self.inner.send::<PrimaryOnNotifyMemoryImportedRequest>(
7044            (bytes,),
7045            0,
7046            0x50524b7a3503aba6,
7047            fidl::encoding::DynamicFlags::empty(),
7048        )
7049    }
7050}
7051
7052#[must_use = "FIDL methods require a response to be sent"]
7053#[derive(Debug)]
7054pub struct PrimaryFlushResponder {
7055    control_handle: std::mem::ManuallyDrop<PrimaryControlHandle>,
7056    tx_id: u32,
7057}
7058
7059/// Set the the channel to be shutdown (see [`PrimaryControlHandle::shutdown`])
7060/// if the responder is dropped without sending a response, so that the client
7061/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7062impl std::ops::Drop for PrimaryFlushResponder {
7063    fn drop(&mut self) {
7064        self.control_handle.shutdown();
7065        // Safety: drops once, never accessed again
7066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7067    }
7068}
7069
7070impl fidl::endpoints::Responder for PrimaryFlushResponder {
7071    type ControlHandle = PrimaryControlHandle;
7072
7073    fn control_handle(&self) -> &PrimaryControlHandle {
7074        &self.control_handle
7075    }
7076
7077    fn drop_without_shutdown(mut self) {
7078        // Safety: drops once, never accessed again due to mem::forget
7079        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7080        // Prevent Drop from running (which would shut down the channel)
7081        std::mem::forget(self);
7082    }
7083}
7084
7085impl PrimaryFlushResponder {
7086    /// Sends a response to the FIDL transaction.
7087    ///
7088    /// Sets the channel to shutdown if an error occurs.
7089    pub fn send(self) -> Result<(), fidl::Error> {
7090        let _result = self.send_raw();
7091        if _result.is_err() {
7092            self.control_handle.shutdown();
7093        }
7094        self.drop_without_shutdown();
7095        _result
7096    }
7097
7098    /// Similar to "send" but does not shutdown the channel if an error occurs.
7099    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7100        let _result = self.send_raw();
7101        self.drop_without_shutdown();
7102        _result
7103    }
7104
7105    fn send_raw(&self) -> Result<(), fidl::Error> {
7106        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7107            (),
7108            self.tx_id,
7109            0x54ccb5572d886039,
7110            fidl::encoding::DynamicFlags::empty(),
7111        )
7112    }
7113}
7114
7115#[must_use = "FIDL methods require a response to be sent"]
7116#[derive(Debug)]
7117pub struct PrimaryIsPerformanceCounterAccessAllowedResponder {
7118    control_handle: std::mem::ManuallyDrop<PrimaryControlHandle>,
7119    tx_id: u32,
7120}
7121
7122/// Set the the channel to be shutdown (see [`PrimaryControlHandle::shutdown`])
7123/// if the responder is dropped without sending a response, so that the client
7124/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7125impl std::ops::Drop for PrimaryIsPerformanceCounterAccessAllowedResponder {
7126    fn drop(&mut self) {
7127        self.control_handle.shutdown();
7128        // Safety: drops once, never accessed again
7129        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7130    }
7131}
7132
7133impl fidl::endpoints::Responder for PrimaryIsPerformanceCounterAccessAllowedResponder {
7134    type ControlHandle = PrimaryControlHandle;
7135
7136    fn control_handle(&self) -> &PrimaryControlHandle {
7137        &self.control_handle
7138    }
7139
7140    fn drop_without_shutdown(mut self) {
7141        // Safety: drops once, never accessed again due to mem::forget
7142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7143        // Prevent Drop from running (which would shut down the channel)
7144        std::mem::forget(self);
7145    }
7146}
7147
7148impl PrimaryIsPerformanceCounterAccessAllowedResponder {
7149    /// Sends a response to the FIDL transaction.
7150    ///
7151    /// Sets the channel to shutdown if an error occurs.
7152    pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
7153        let _result = self.send_raw(enabled);
7154        if _result.is_err() {
7155            self.control_handle.shutdown();
7156        }
7157        self.drop_without_shutdown();
7158        _result
7159    }
7160
7161    /// Similar to "send" but does not shutdown the channel if an error occurs.
7162    pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
7163        let _result = self.send_raw(enabled);
7164        self.drop_without_shutdown();
7165        _result
7166    }
7167
7168    fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
7169        self.control_handle.inner.send::<PrimaryIsPerformanceCounterAccessAllowedResponse>(
7170            (enabled,),
7171            self.tx_id,
7172            0x1933b70c06cc5702,
7173            fidl::encoding::DynamicFlags::empty(),
7174        )
7175    }
7176}
7177
7178#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7179pub struct TestDeviceMarker;
7180
7181impl fidl::endpoints::ProtocolMarker for TestDeviceMarker {
7182    type Proxy = TestDeviceProxy;
7183    type RequestStream = TestDeviceRequestStream;
7184    #[cfg(target_os = "fuchsia")]
7185    type SynchronousProxy = TestDeviceSynchronousProxy;
7186
7187    const DEBUG_NAME: &'static str = "(anonymous) TestDevice";
7188}
7189
7190pub trait TestDeviceProxyInterface: Send + Sync {
7191    type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
7192        + Send;
7193    fn r#query(&self, query_id: QueryId) -> Self::QueryResponseFut;
7194    fn r#connect2(
7195        &self,
7196        client_id: u64,
7197        primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
7198        notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
7199    ) -> Result<(), fidl::Error>;
7200    fn r#dump_state(&self, dump_type: u32) -> Result<(), fidl::Error>;
7201    type GetIcdListResponseFut: std::future::Future<Output = Result<Vec<IcdInfo>, fidl::Error>>
7202        + Send;
7203    fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut;
7204    type GetUnitTestStatusResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
7205    fn r#get_unit_test_status(&self) -> Self::GetUnitTestStatusResponseFut;
7206}
7207#[derive(Debug)]
7208#[cfg(target_os = "fuchsia")]
7209pub struct TestDeviceSynchronousProxy {
7210    client: fidl::client::sync::Client,
7211}
7212
7213#[cfg(target_os = "fuchsia")]
7214impl fidl::endpoints::SynchronousProxy for TestDeviceSynchronousProxy {
7215    type Proxy = TestDeviceProxy;
7216    type Protocol = TestDeviceMarker;
7217
7218    fn from_channel(inner: fidl::Channel) -> Self {
7219        Self::new(inner)
7220    }
7221
7222    fn into_channel(self) -> fidl::Channel {
7223        self.client.into_channel()
7224    }
7225
7226    fn as_channel(&self) -> &fidl::Channel {
7227        self.client.as_channel()
7228    }
7229}
7230
7231#[cfg(target_os = "fuchsia")]
7232impl TestDeviceSynchronousProxy {
7233    pub fn new(channel: fidl::Channel) -> Self {
7234        let protocol_name = <TestDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7235        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7236    }
7237
7238    pub fn into_channel(self) -> fidl::Channel {
7239        self.client.into_channel()
7240    }
7241
7242    /// Waits until an event arrives and returns it. It is safe for other
7243    /// threads to make concurrent requests while waiting for an event.
7244    pub fn wait_for_event(
7245        &self,
7246        deadline: zx::MonotonicInstant,
7247    ) -> Result<TestDeviceEvent, fidl::Error> {
7248        TestDeviceEvent::decode(self.client.wait_for_event(deadline)?)
7249    }
7250
7251    /// On success, returns a result either in a buffer or a simple value.
7252    pub fn r#query(
7253        &self,
7254        mut query_id: QueryId,
7255        ___deadline: zx::MonotonicInstant,
7256    ) -> Result<DeviceQueryResult, fidl::Error> {
7257        let _response = self
7258            .client
7259            .send_query::<DeviceQueryRequest, fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
7260                (query_id,),
7261                0x627d4c6093b078e7,
7262                fidl::encoding::DynamicFlags::empty(),
7263                ___deadline,
7264            )?;
7265        Ok(_response.map(|x| x))
7266    }
7267
7268    /// Creates a connection to the device comprised of two IPC channels.
7269    /// The primary channel is for the Primary protocol (see below).  The notification channel is
7270    /// used for vendor-specific messages which are sent only in the reverse (server-client)
7271    /// direction, typically in response to client command completion.
7272    pub fn r#connect2(
7273        &self,
7274        mut client_id: u64,
7275        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
7276        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
7277    ) -> Result<(), fidl::Error> {
7278        self.client.send::<DeviceConnect2Request>(
7279            (client_id, primary_channel, notification_channel),
7280            0x3a5b134714c67914,
7281            fidl::encoding::DynamicFlags::empty(),
7282        )
7283    }
7284
7285    /// Dumps driver and hardware state to the log.
7286    pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
7287        self.client.send::<DiagnosticDeviceDumpStateRequest>(
7288            (dump_type,),
7289            0x5420df493d4fa915,
7290            fidl::encoding::DynamicFlags::empty(),
7291        )
7292    }
7293
7294    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
7295    /// descending order of preference.
7296    pub fn r#get_icd_list(
7297        &self,
7298        ___deadline: zx::MonotonicInstant,
7299    ) -> Result<Vec<IcdInfo>, fidl::Error> {
7300        let _response = self
7301            .client
7302            .send_query::<fidl::encoding::EmptyPayload, IcdLoaderDeviceGetIcdListResponse>(
7303                (),
7304                0x7673e76395008257,
7305                fidl::encoding::DynamicFlags::empty(),
7306                ___deadline,
7307            )?;
7308        Ok(_response.icd_list)
7309    }
7310
7311    pub fn r#get_unit_test_status(
7312        &self,
7313        ___deadline: zx::MonotonicInstant,
7314    ) -> Result<i32, fidl::Error> {
7315        let _response = self
7316            .client
7317            .send_query::<fidl::encoding::EmptyPayload, TestDeviceGetUnitTestStatusResponse>(
7318                (),
7319                0x3ebcd9c409c248f1,
7320                fidl::encoding::DynamicFlags::empty(),
7321                ___deadline,
7322            )?;
7323        Ok(_response.status)
7324    }
7325}
7326
7327#[cfg(target_os = "fuchsia")]
7328impl From<TestDeviceSynchronousProxy> for zx::Handle {
7329    fn from(value: TestDeviceSynchronousProxy) -> Self {
7330        value.into_channel().into()
7331    }
7332}
7333
7334#[cfg(target_os = "fuchsia")]
7335impl From<fidl::Channel> for TestDeviceSynchronousProxy {
7336    fn from(value: fidl::Channel) -> Self {
7337        Self::new(value)
7338    }
7339}
7340
7341#[cfg(target_os = "fuchsia")]
7342impl fidl::endpoints::FromClient for TestDeviceSynchronousProxy {
7343    type Protocol = TestDeviceMarker;
7344
7345    fn from_client(value: fidl::endpoints::ClientEnd<TestDeviceMarker>) -> Self {
7346        Self::new(value.into_channel())
7347    }
7348}
7349
7350#[derive(Debug, Clone)]
7351pub struct TestDeviceProxy {
7352    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7353}
7354
7355impl fidl::endpoints::Proxy for TestDeviceProxy {
7356    type Protocol = TestDeviceMarker;
7357
7358    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7359        Self::new(inner)
7360    }
7361
7362    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7363        self.client.into_channel().map_err(|client| Self { client })
7364    }
7365
7366    fn as_channel(&self) -> &::fidl::AsyncChannel {
7367        self.client.as_channel()
7368    }
7369}
7370
7371impl TestDeviceProxy {
7372    /// Create a new Proxy for fuchsia.gpu.magma/TestDevice.
7373    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7374        let protocol_name = <TestDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7375        Self { client: fidl::client::Client::new(channel, protocol_name) }
7376    }
7377
7378    /// Get a Stream of events from the remote end of the protocol.
7379    ///
7380    /// # Panics
7381    ///
7382    /// Panics if the event stream was already taken.
7383    pub fn take_event_stream(&self) -> TestDeviceEventStream {
7384        TestDeviceEventStream { event_receiver: self.client.take_event_receiver() }
7385    }
7386
7387    /// On success, returns a result either in a buffer or a simple value.
7388    pub fn r#query(
7389        &self,
7390        mut query_id: QueryId,
7391    ) -> fidl::client::QueryResponseFut<
7392        DeviceQueryResult,
7393        fidl::encoding::DefaultFuchsiaResourceDialect,
7394    > {
7395        TestDeviceProxyInterface::r#query(self, query_id)
7396    }
7397
7398    /// Creates a connection to the device comprised of two IPC channels.
7399    /// The primary channel is for the Primary protocol (see below).  The notification channel is
7400    /// used for vendor-specific messages which are sent only in the reverse (server-client)
7401    /// direction, typically in response to client command completion.
7402    pub fn r#connect2(
7403        &self,
7404        mut client_id: u64,
7405        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
7406        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
7407    ) -> Result<(), fidl::Error> {
7408        TestDeviceProxyInterface::r#connect2(self, client_id, primary_channel, notification_channel)
7409    }
7410
7411    /// Dumps driver and hardware state to the log.
7412    pub fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
7413        TestDeviceProxyInterface::r#dump_state(self, dump_type)
7414    }
7415
7416    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
7417    /// descending order of preference.
7418    pub fn r#get_icd_list(
7419        &self,
7420    ) -> fidl::client::QueryResponseFut<Vec<IcdInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>
7421    {
7422        TestDeviceProxyInterface::r#get_icd_list(self)
7423    }
7424
7425    pub fn r#get_unit_test_status(
7426        &self,
7427    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
7428        TestDeviceProxyInterface::r#get_unit_test_status(self)
7429    }
7430}
7431
7432impl TestDeviceProxyInterface for TestDeviceProxy {
7433    type QueryResponseFut = fidl::client::QueryResponseFut<
7434        DeviceQueryResult,
7435        fidl::encoding::DefaultFuchsiaResourceDialect,
7436    >;
7437    fn r#query(&self, mut query_id: QueryId) -> Self::QueryResponseFut {
7438        fn _decode(
7439            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7440        ) -> Result<DeviceQueryResult, fidl::Error> {
7441            let _response = fidl::client::decode_transaction_body::<
7442                fidl::encoding::ResultType<DeviceQueryResponse, i32>,
7443                fidl::encoding::DefaultFuchsiaResourceDialect,
7444                0x627d4c6093b078e7,
7445            >(_buf?)?;
7446            Ok(_response.map(|x| x))
7447        }
7448        self.client.send_query_and_decode::<DeviceQueryRequest, DeviceQueryResult>(
7449            (query_id,),
7450            0x627d4c6093b078e7,
7451            fidl::encoding::DynamicFlags::empty(),
7452            _decode,
7453        )
7454    }
7455
7456    fn r#connect2(
7457        &self,
7458        mut client_id: u64,
7459        mut primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
7460        mut notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
7461    ) -> Result<(), fidl::Error> {
7462        self.client.send::<DeviceConnect2Request>(
7463            (client_id, primary_channel, notification_channel),
7464            0x3a5b134714c67914,
7465            fidl::encoding::DynamicFlags::empty(),
7466        )
7467    }
7468
7469    fn r#dump_state(&self, mut dump_type: u32) -> Result<(), fidl::Error> {
7470        self.client.send::<DiagnosticDeviceDumpStateRequest>(
7471            (dump_type,),
7472            0x5420df493d4fa915,
7473            fidl::encoding::DynamicFlags::empty(),
7474        )
7475    }
7476
7477    type GetIcdListResponseFut =
7478        fidl::client::QueryResponseFut<Vec<IcdInfo>, fidl::encoding::DefaultFuchsiaResourceDialect>;
7479    fn r#get_icd_list(&self) -> Self::GetIcdListResponseFut {
7480        fn _decode(
7481            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7482        ) -> Result<Vec<IcdInfo>, fidl::Error> {
7483            let _response = fidl::client::decode_transaction_body::<
7484                IcdLoaderDeviceGetIcdListResponse,
7485                fidl::encoding::DefaultFuchsiaResourceDialect,
7486                0x7673e76395008257,
7487            >(_buf?)?;
7488            Ok(_response.icd_list)
7489        }
7490        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<IcdInfo>>(
7491            (),
7492            0x7673e76395008257,
7493            fidl::encoding::DynamicFlags::empty(),
7494            _decode,
7495        )
7496    }
7497
7498    type GetUnitTestStatusResponseFut =
7499        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
7500    fn r#get_unit_test_status(&self) -> Self::GetUnitTestStatusResponseFut {
7501        fn _decode(
7502            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7503        ) -> Result<i32, fidl::Error> {
7504            let _response = fidl::client::decode_transaction_body::<
7505                TestDeviceGetUnitTestStatusResponse,
7506                fidl::encoding::DefaultFuchsiaResourceDialect,
7507                0x3ebcd9c409c248f1,
7508            >(_buf?)?;
7509            Ok(_response.status)
7510        }
7511        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
7512            (),
7513            0x3ebcd9c409c248f1,
7514            fidl::encoding::DynamicFlags::empty(),
7515            _decode,
7516        )
7517    }
7518}
7519
7520pub struct TestDeviceEventStream {
7521    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7522}
7523
7524impl std::marker::Unpin for TestDeviceEventStream {}
7525
7526impl futures::stream::FusedStream for TestDeviceEventStream {
7527    fn is_terminated(&self) -> bool {
7528        self.event_receiver.is_terminated()
7529    }
7530}
7531
7532impl futures::Stream for TestDeviceEventStream {
7533    type Item = Result<TestDeviceEvent, fidl::Error>;
7534
7535    fn poll_next(
7536        mut self: std::pin::Pin<&mut Self>,
7537        cx: &mut std::task::Context<'_>,
7538    ) -> std::task::Poll<Option<Self::Item>> {
7539        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7540            &mut self.event_receiver,
7541            cx
7542        )?) {
7543            Some(buf) => std::task::Poll::Ready(Some(TestDeviceEvent::decode(buf))),
7544            None => std::task::Poll::Ready(None),
7545        }
7546    }
7547}
7548
7549#[derive(Debug)]
7550pub enum TestDeviceEvent {}
7551
7552impl TestDeviceEvent {
7553    /// Decodes a message buffer as a [`TestDeviceEvent`].
7554    fn decode(
7555        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7556    ) -> Result<TestDeviceEvent, fidl::Error> {
7557        let (bytes, _handles) = buf.split_mut();
7558        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7559        debug_assert_eq!(tx_header.tx_id, 0);
7560        match tx_header.ordinal {
7561            _ => Err(fidl::Error::UnknownOrdinal {
7562                ordinal: tx_header.ordinal,
7563                protocol_name: <TestDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7564            }),
7565        }
7566    }
7567}
7568
7569/// A Stream of incoming requests for fuchsia.gpu.magma/TestDevice.
7570pub struct TestDeviceRequestStream {
7571    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7572    is_terminated: bool,
7573}
7574
7575impl std::marker::Unpin for TestDeviceRequestStream {}
7576
7577impl futures::stream::FusedStream for TestDeviceRequestStream {
7578    fn is_terminated(&self) -> bool {
7579        self.is_terminated
7580    }
7581}
7582
7583impl fidl::endpoints::RequestStream for TestDeviceRequestStream {
7584    type Protocol = TestDeviceMarker;
7585    type ControlHandle = TestDeviceControlHandle;
7586
7587    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7588        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7589    }
7590
7591    fn control_handle(&self) -> Self::ControlHandle {
7592        TestDeviceControlHandle { inner: self.inner.clone() }
7593    }
7594
7595    fn into_inner(
7596        self,
7597    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7598    {
7599        (self.inner, self.is_terminated)
7600    }
7601
7602    fn from_inner(
7603        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7604        is_terminated: bool,
7605    ) -> Self {
7606        Self { inner, is_terminated }
7607    }
7608}
7609
7610impl futures::Stream for TestDeviceRequestStream {
7611    type Item = Result<TestDeviceRequest, fidl::Error>;
7612
7613    fn poll_next(
7614        mut self: std::pin::Pin<&mut Self>,
7615        cx: &mut std::task::Context<'_>,
7616    ) -> std::task::Poll<Option<Self::Item>> {
7617        let this = &mut *self;
7618        if this.inner.check_shutdown(cx) {
7619            this.is_terminated = true;
7620            return std::task::Poll::Ready(None);
7621        }
7622        if this.is_terminated {
7623            panic!("polled TestDeviceRequestStream after completion");
7624        }
7625        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7626            |bytes, handles| {
7627                match this.inner.channel().read_etc(cx, bytes, handles) {
7628                    std::task::Poll::Ready(Ok(())) => {}
7629                    std::task::Poll::Pending => return std::task::Poll::Pending,
7630                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7631                        this.is_terminated = true;
7632                        return std::task::Poll::Ready(None);
7633                    }
7634                    std::task::Poll::Ready(Err(e)) => {
7635                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7636                            e.into(),
7637                        ))));
7638                    }
7639                }
7640
7641                // A message has been received from the channel
7642                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7643
7644                std::task::Poll::Ready(Some(match header.ordinal {
7645                    0x627d4c6093b078e7 => {
7646                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7647                        let mut req = fidl::new_empty!(
7648                            DeviceQueryRequest,
7649                            fidl::encoding::DefaultFuchsiaResourceDialect
7650                        );
7651                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceQueryRequest>(&header, _body_bytes, handles, &mut req)?;
7652                        let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
7653                        Ok(TestDeviceRequest::Query {
7654                            query_id: req.query_id,
7655
7656                            responder: TestDeviceQueryResponder {
7657                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7658                                tx_id: header.tx_id,
7659                            },
7660                        })
7661                    }
7662                    0x3a5b134714c67914 => {
7663                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7664                        let mut req = fidl::new_empty!(
7665                            DeviceConnect2Request,
7666                            fidl::encoding::DefaultFuchsiaResourceDialect
7667                        );
7668                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnect2Request>(&header, _body_bytes, handles, &mut req)?;
7669                        let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
7670                        Ok(TestDeviceRequest::Connect2 {
7671                            client_id: req.client_id,
7672                            primary_channel: req.primary_channel,
7673                            notification_channel: req.notification_channel,
7674
7675                            control_handle,
7676                        })
7677                    }
7678                    0x5420df493d4fa915 => {
7679                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7680                        let mut req = fidl::new_empty!(
7681                            DiagnosticDeviceDumpStateRequest,
7682                            fidl::encoding::DefaultFuchsiaResourceDialect
7683                        );
7684                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticDeviceDumpStateRequest>(&header, _body_bytes, handles, &mut req)?;
7685                        let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
7686                        Ok(TestDeviceRequest::DumpState {
7687                            dump_type: req.dump_type,
7688
7689                            control_handle,
7690                        })
7691                    }
7692                    0x7673e76395008257 => {
7693                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7694                        let mut req = fidl::new_empty!(
7695                            fidl::encoding::EmptyPayload,
7696                            fidl::encoding::DefaultFuchsiaResourceDialect
7697                        );
7698                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7699                        let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
7700                        Ok(TestDeviceRequest::GetIcdList {
7701                            responder: TestDeviceGetIcdListResponder {
7702                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7703                                tx_id: header.tx_id,
7704                            },
7705                        })
7706                    }
7707                    0x3ebcd9c409c248f1 => {
7708                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7709                        let mut req = fidl::new_empty!(
7710                            fidl::encoding::EmptyPayload,
7711                            fidl::encoding::DefaultFuchsiaResourceDialect
7712                        );
7713                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7714                        let control_handle = TestDeviceControlHandle { inner: this.inner.clone() };
7715                        Ok(TestDeviceRequest::GetUnitTestStatus {
7716                            responder: TestDeviceGetUnitTestStatusResponder {
7717                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7718                                tx_id: header.tx_id,
7719                            },
7720                        })
7721                    }
7722                    _ => Err(fidl::Error::UnknownOrdinal {
7723                        ordinal: header.ordinal,
7724                        protocol_name:
7725                            <TestDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7726                    }),
7727                }))
7728            },
7729        )
7730    }
7731}
7732
7733/// Additional device methods for the purposes of testing the MSD and should not be used by ICDs.
7734/// DEPRECATED: Please use TestDevice2.
7735#[derive(Debug)]
7736pub enum TestDeviceRequest {
7737    /// On success, returns a result either in a buffer or a simple value.
7738    Query {
7739        query_id: QueryId,
7740        responder: TestDeviceQueryResponder,
7741    },
7742    /// Creates a connection to the device comprised of two IPC channels.
7743    /// The primary channel is for the Primary protocol (see below).  The notification channel is
7744    /// used for vendor-specific messages which are sent only in the reverse (server-client)
7745    /// direction, typically in response to client command completion.
7746    Connect2 {
7747        client_id: u64,
7748        primary_channel: fidl::endpoints::ServerEnd<PrimaryMarker>,
7749        notification_channel: fidl::endpoints::ServerEnd<NotificationMarker>,
7750        control_handle: TestDeviceControlHandle,
7751    },
7752    /// Dumps driver and hardware state to the log.
7753    DumpState {
7754        dump_type: u32,
7755        control_handle: TestDeviceControlHandle,
7756    },
7757    /// Returns a list of ICDs that can be used with this Magma device. The list is sorted in
7758    /// descending order of preference.
7759    GetIcdList {
7760        responder: TestDeviceGetIcdListResponder,
7761    },
7762    GetUnitTestStatus {
7763        responder: TestDeviceGetUnitTestStatusResponder,
7764    },
7765}
7766
7767impl TestDeviceRequest {
7768    #[allow(irrefutable_let_patterns)]
7769    pub fn into_query(self) -> Option<(QueryId, TestDeviceQueryResponder)> {
7770        if let TestDeviceRequest::Query { query_id, responder } = self {
7771            Some((query_id, responder))
7772        } else {
7773            None
7774        }
7775    }
7776
7777    #[allow(irrefutable_let_patterns)]
7778    pub fn into_connect2(
7779        self,
7780    ) -> Option<(
7781        u64,
7782        fidl::endpoints::ServerEnd<PrimaryMarker>,
7783        fidl::endpoints::ServerEnd<NotificationMarker>,
7784        TestDeviceControlHandle,
7785    )> {
7786        if let TestDeviceRequest::Connect2 {
7787            client_id,
7788            primary_channel,
7789            notification_channel,
7790            control_handle,
7791        } = self
7792        {
7793            Some((client_id, primary_channel, notification_channel, control_handle))
7794        } else {
7795            None
7796        }
7797    }
7798
7799    #[allow(irrefutable_let_patterns)]
7800    pub fn into_dump_state(self) -> Option<(u32, TestDeviceControlHandle)> {
7801        if let TestDeviceRequest::DumpState { dump_type, control_handle } = self {
7802            Some((dump_type, control_handle))
7803        } else {
7804            None
7805        }
7806    }
7807
7808    #[allow(irrefutable_let_patterns)]
7809    pub fn into_get_icd_list(self) -> Option<(TestDeviceGetIcdListResponder)> {
7810        if let TestDeviceRequest::GetIcdList { responder } = self {
7811            Some((responder))
7812        } else {
7813            None
7814        }
7815    }
7816
7817    #[allow(irrefutable_let_patterns)]
7818    pub fn into_get_unit_test_status(self) -> Option<(TestDeviceGetUnitTestStatusResponder)> {
7819        if let TestDeviceRequest::GetUnitTestStatus { responder } = self {
7820            Some((responder))
7821        } else {
7822            None
7823        }
7824    }
7825
7826    /// Name of the method defined in FIDL
7827    pub fn method_name(&self) -> &'static str {
7828        match *self {
7829            TestDeviceRequest::Query { .. } => "query",
7830            TestDeviceRequest::Connect2 { .. } => "connect2",
7831            TestDeviceRequest::DumpState { .. } => "dump_state",
7832            TestDeviceRequest::GetIcdList { .. } => "get_icd_list",
7833            TestDeviceRequest::GetUnitTestStatus { .. } => "get_unit_test_status",
7834        }
7835    }
7836}
7837
7838#[derive(Debug, Clone)]
7839pub struct TestDeviceControlHandle {
7840    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7841}
7842
7843impl fidl::endpoints::ControlHandle for TestDeviceControlHandle {
7844    fn shutdown(&self) {
7845        self.inner.shutdown()
7846    }
7847    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7848        self.inner.shutdown_with_epitaph(status)
7849    }
7850
7851    fn is_closed(&self) -> bool {
7852        self.inner.channel().is_closed()
7853    }
7854    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7855        self.inner.channel().on_closed()
7856    }
7857
7858    #[cfg(target_os = "fuchsia")]
7859    fn signal_peer(
7860        &self,
7861        clear_mask: zx::Signals,
7862        set_mask: zx::Signals,
7863    ) -> Result<(), zx_status::Status> {
7864        use fidl::Peered;
7865        self.inner.channel().signal_peer(clear_mask, set_mask)
7866    }
7867}
7868
7869impl TestDeviceControlHandle {}
7870
7871#[must_use = "FIDL methods require a response to be sent"]
7872#[derive(Debug)]
7873pub struct TestDeviceQueryResponder {
7874    control_handle: std::mem::ManuallyDrop<TestDeviceControlHandle>,
7875    tx_id: u32,
7876}
7877
7878/// Set the the channel to be shutdown (see [`TestDeviceControlHandle::shutdown`])
7879/// if the responder is dropped without sending a response, so that the client
7880/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7881impl std::ops::Drop for TestDeviceQueryResponder {
7882    fn drop(&mut self) {
7883        self.control_handle.shutdown();
7884        // Safety: drops once, never accessed again
7885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7886    }
7887}
7888
7889impl fidl::endpoints::Responder for TestDeviceQueryResponder {
7890    type ControlHandle = TestDeviceControlHandle;
7891
7892    fn control_handle(&self) -> &TestDeviceControlHandle {
7893        &self.control_handle
7894    }
7895
7896    fn drop_without_shutdown(mut self) {
7897        // Safety: drops once, never accessed again due to mem::forget
7898        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7899        // Prevent Drop from running (which would shut down the channel)
7900        std::mem::forget(self);
7901    }
7902}
7903
7904impl TestDeviceQueryResponder {
7905    /// Sends a response to the FIDL transaction.
7906    ///
7907    /// Sets the channel to shutdown if an error occurs.
7908    pub fn send(self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
7909        let _result = self.send_raw(result);
7910        if _result.is_err() {
7911            self.control_handle.shutdown();
7912        }
7913        self.drop_without_shutdown();
7914        _result
7915    }
7916
7917    /// Similar to "send" but does not shutdown the channel if an error occurs.
7918    pub fn send_no_shutdown_on_err(
7919        self,
7920        mut result: Result<DeviceQueryResponse, i32>,
7921    ) -> Result<(), fidl::Error> {
7922        let _result = self.send_raw(result);
7923        self.drop_without_shutdown();
7924        _result
7925    }
7926
7927    fn send_raw(&self, mut result: Result<DeviceQueryResponse, i32>) -> Result<(), fidl::Error> {
7928        self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
7929            result.as_mut().map_err(|e| *e),
7930            self.tx_id,
7931            0x627d4c6093b078e7,
7932            fidl::encoding::DynamicFlags::empty(),
7933        )
7934    }
7935}
7936
7937#[must_use = "FIDL methods require a response to be sent"]
7938#[derive(Debug)]
7939pub struct TestDeviceGetIcdListResponder {
7940    control_handle: std::mem::ManuallyDrop<TestDeviceControlHandle>,
7941    tx_id: u32,
7942}
7943
7944/// Set the the channel to be shutdown (see [`TestDeviceControlHandle::shutdown`])
7945/// if the responder is dropped without sending a response, so that the client
7946/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7947impl std::ops::Drop for TestDeviceGetIcdListResponder {
7948    fn drop(&mut self) {
7949        self.control_handle.shutdown();
7950        // Safety: drops once, never accessed again
7951        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7952    }
7953}
7954
7955impl fidl::endpoints::Responder for TestDeviceGetIcdListResponder {
7956    type ControlHandle = TestDeviceControlHandle;
7957
7958    fn control_handle(&self) -> &TestDeviceControlHandle {
7959        &self.control_handle
7960    }
7961
7962    fn drop_without_shutdown(mut self) {
7963        // Safety: drops once, never accessed again due to mem::forget
7964        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7965        // Prevent Drop from running (which would shut down the channel)
7966        std::mem::forget(self);
7967    }
7968}
7969
7970impl TestDeviceGetIcdListResponder {
7971    /// Sends a response to the FIDL transaction.
7972    ///
7973    /// Sets the channel to shutdown if an error occurs.
7974    pub fn send(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
7975        let _result = self.send_raw(icd_list);
7976        if _result.is_err() {
7977            self.control_handle.shutdown();
7978        }
7979        self.drop_without_shutdown();
7980        _result
7981    }
7982
7983    /// Similar to "send" but does not shutdown the channel if an error occurs.
7984    pub fn send_no_shutdown_on_err(self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
7985        let _result = self.send_raw(icd_list);
7986        self.drop_without_shutdown();
7987        _result
7988    }
7989
7990    fn send_raw(&self, mut icd_list: &[IcdInfo]) -> Result<(), fidl::Error> {
7991        self.control_handle.inner.send::<IcdLoaderDeviceGetIcdListResponse>(
7992            (icd_list,),
7993            self.tx_id,
7994            0x7673e76395008257,
7995            fidl::encoding::DynamicFlags::empty(),
7996        )
7997    }
7998}
7999
8000#[must_use = "FIDL methods require a response to be sent"]
8001#[derive(Debug)]
8002pub struct TestDeviceGetUnitTestStatusResponder {
8003    control_handle: std::mem::ManuallyDrop<TestDeviceControlHandle>,
8004    tx_id: u32,
8005}
8006
8007/// Set the the channel to be shutdown (see [`TestDeviceControlHandle::shutdown`])
8008/// if the responder is dropped without sending a response, so that the client
8009/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8010impl std::ops::Drop for TestDeviceGetUnitTestStatusResponder {
8011    fn drop(&mut self) {
8012        self.control_handle.shutdown();
8013        // Safety: drops once, never accessed again
8014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8015    }
8016}
8017
8018impl fidl::endpoints::Responder for TestDeviceGetUnitTestStatusResponder {
8019    type ControlHandle = TestDeviceControlHandle;
8020
8021    fn control_handle(&self) -> &TestDeviceControlHandle {
8022        &self.control_handle
8023    }
8024
8025    fn drop_without_shutdown(mut self) {
8026        // Safety: drops once, never accessed again due to mem::forget
8027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8028        // Prevent Drop from running (which would shut down the channel)
8029        std::mem::forget(self);
8030    }
8031}
8032
8033impl TestDeviceGetUnitTestStatusResponder {
8034    /// Sends a response to the FIDL transaction.
8035    ///
8036    /// Sets the channel to shutdown if an error occurs.
8037    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
8038        let _result = self.send_raw(status);
8039        if _result.is_err() {
8040            self.control_handle.shutdown();
8041        }
8042        self.drop_without_shutdown();
8043        _result
8044    }
8045
8046    /// Similar to "send" but does not shutdown the channel if an error occurs.
8047    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
8048        let _result = self.send_raw(status);
8049        self.drop_without_shutdown();
8050        _result
8051    }
8052
8053    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
8054        self.control_handle.inner.send::<TestDeviceGetUnitTestStatusResponse>(
8055            (status,),
8056            self.tx_id,
8057            0x3ebcd9c409c248f1,
8058            fidl::encoding::DynamicFlags::empty(),
8059        )
8060    }
8061}
8062
8063#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8064pub struct TestDevice2Marker;
8065
8066impl fidl::endpoints::ProtocolMarker for TestDevice2Marker {
8067    type Proxy = TestDevice2Proxy;
8068    type RequestStream = TestDevice2RequestStream;
8069    #[cfg(target_os = "fuchsia")]
8070    type SynchronousProxy = TestDevice2SynchronousProxy;
8071
8072    const DEBUG_NAME: &'static str = "(anonymous) TestDevice2";
8073}
8074
8075pub trait TestDevice2ProxyInterface: Send + Sync {
8076    type GetUnitTestStatusResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
8077    fn r#get_unit_test_status(&self) -> Self::GetUnitTestStatusResponseFut;
8078}
8079#[derive(Debug)]
8080#[cfg(target_os = "fuchsia")]
8081pub struct TestDevice2SynchronousProxy {
8082    client: fidl::client::sync::Client,
8083}
8084
8085#[cfg(target_os = "fuchsia")]
8086impl fidl::endpoints::SynchronousProxy for TestDevice2SynchronousProxy {
8087    type Proxy = TestDevice2Proxy;
8088    type Protocol = TestDevice2Marker;
8089
8090    fn from_channel(inner: fidl::Channel) -> Self {
8091        Self::new(inner)
8092    }
8093
8094    fn into_channel(self) -> fidl::Channel {
8095        self.client.into_channel()
8096    }
8097
8098    fn as_channel(&self) -> &fidl::Channel {
8099        self.client.as_channel()
8100    }
8101}
8102
8103#[cfg(target_os = "fuchsia")]
8104impl TestDevice2SynchronousProxy {
8105    pub fn new(channel: fidl::Channel) -> Self {
8106        let protocol_name = <TestDevice2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8107        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8108    }
8109
8110    pub fn into_channel(self) -> fidl::Channel {
8111        self.client.into_channel()
8112    }
8113
8114    /// Waits until an event arrives and returns it. It is safe for other
8115    /// threads to make concurrent requests while waiting for an event.
8116    pub fn wait_for_event(
8117        &self,
8118        deadline: zx::MonotonicInstant,
8119    ) -> Result<TestDevice2Event, fidl::Error> {
8120        TestDevice2Event::decode(self.client.wait_for_event(deadline)?)
8121    }
8122
8123    pub fn r#get_unit_test_status(
8124        &self,
8125        ___deadline: zx::MonotonicInstant,
8126    ) -> Result<i32, fidl::Error> {
8127        let _response = self
8128            .client
8129            .send_query::<fidl::encoding::EmptyPayload, TestDevice2GetUnitTestStatusResponse>(
8130                (),
8131                0x5be45b0f097813b2,
8132                fidl::encoding::DynamicFlags::empty(),
8133                ___deadline,
8134            )?;
8135        Ok(_response.status)
8136    }
8137}
8138
8139#[cfg(target_os = "fuchsia")]
8140impl From<TestDevice2SynchronousProxy> for zx::Handle {
8141    fn from(value: TestDevice2SynchronousProxy) -> Self {
8142        value.into_channel().into()
8143    }
8144}
8145
8146#[cfg(target_os = "fuchsia")]
8147impl From<fidl::Channel> for TestDevice2SynchronousProxy {
8148    fn from(value: fidl::Channel) -> Self {
8149        Self::new(value)
8150    }
8151}
8152
8153#[cfg(target_os = "fuchsia")]
8154impl fidl::endpoints::FromClient for TestDevice2SynchronousProxy {
8155    type Protocol = TestDevice2Marker;
8156
8157    fn from_client(value: fidl::endpoints::ClientEnd<TestDevice2Marker>) -> Self {
8158        Self::new(value.into_channel())
8159    }
8160}
8161
8162#[derive(Debug, Clone)]
8163pub struct TestDevice2Proxy {
8164    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8165}
8166
8167impl fidl::endpoints::Proxy for TestDevice2Proxy {
8168    type Protocol = TestDevice2Marker;
8169
8170    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8171        Self::new(inner)
8172    }
8173
8174    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8175        self.client.into_channel().map_err(|client| Self { client })
8176    }
8177
8178    fn as_channel(&self) -> &::fidl::AsyncChannel {
8179        self.client.as_channel()
8180    }
8181}
8182
8183impl TestDevice2Proxy {
8184    /// Create a new Proxy for fuchsia.gpu.magma/TestDevice2.
8185    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8186        let protocol_name = <TestDevice2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8187        Self { client: fidl::client::Client::new(channel, protocol_name) }
8188    }
8189
8190    /// Get a Stream of events from the remote end of the protocol.
8191    ///
8192    /// # Panics
8193    ///
8194    /// Panics if the event stream was already taken.
8195    pub fn take_event_stream(&self) -> TestDevice2EventStream {
8196        TestDevice2EventStream { event_receiver: self.client.take_event_receiver() }
8197    }
8198
8199    pub fn r#get_unit_test_status(
8200        &self,
8201    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
8202        TestDevice2ProxyInterface::r#get_unit_test_status(self)
8203    }
8204}
8205
8206impl TestDevice2ProxyInterface for TestDevice2Proxy {
8207    type GetUnitTestStatusResponseFut =
8208        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
8209    fn r#get_unit_test_status(&self) -> Self::GetUnitTestStatusResponseFut {
8210        fn _decode(
8211            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8212        ) -> Result<i32, fidl::Error> {
8213            let _response = fidl::client::decode_transaction_body::<
8214                TestDevice2GetUnitTestStatusResponse,
8215                fidl::encoding::DefaultFuchsiaResourceDialect,
8216                0x5be45b0f097813b2,
8217            >(_buf?)?;
8218            Ok(_response.status)
8219        }
8220        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
8221            (),
8222            0x5be45b0f097813b2,
8223            fidl::encoding::DynamicFlags::empty(),
8224            _decode,
8225        )
8226    }
8227}
8228
8229pub struct TestDevice2EventStream {
8230    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8231}
8232
8233impl std::marker::Unpin for TestDevice2EventStream {}
8234
8235impl futures::stream::FusedStream for TestDevice2EventStream {
8236    fn is_terminated(&self) -> bool {
8237        self.event_receiver.is_terminated()
8238    }
8239}
8240
8241impl futures::Stream for TestDevice2EventStream {
8242    type Item = Result<TestDevice2Event, fidl::Error>;
8243
8244    fn poll_next(
8245        mut self: std::pin::Pin<&mut Self>,
8246        cx: &mut std::task::Context<'_>,
8247    ) -> std::task::Poll<Option<Self::Item>> {
8248        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8249            &mut self.event_receiver,
8250            cx
8251        )?) {
8252            Some(buf) => std::task::Poll::Ready(Some(TestDevice2Event::decode(buf))),
8253            None => std::task::Poll::Ready(None),
8254        }
8255    }
8256}
8257
8258#[derive(Debug)]
8259pub enum TestDevice2Event {}
8260
8261impl TestDevice2Event {
8262    /// Decodes a message buffer as a [`TestDevice2Event`].
8263    fn decode(
8264        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8265    ) -> Result<TestDevice2Event, fidl::Error> {
8266        let (bytes, _handles) = buf.split_mut();
8267        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8268        debug_assert_eq!(tx_header.tx_id, 0);
8269        match tx_header.ordinal {
8270            _ => Err(fidl::Error::UnknownOrdinal {
8271                ordinal: tx_header.ordinal,
8272                protocol_name: <TestDevice2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8273            }),
8274        }
8275    }
8276}
8277
8278/// A Stream of incoming requests for fuchsia.gpu.magma/TestDevice2.
8279pub struct TestDevice2RequestStream {
8280    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8281    is_terminated: bool,
8282}
8283
8284impl std::marker::Unpin for TestDevice2RequestStream {}
8285
8286impl futures::stream::FusedStream for TestDevice2RequestStream {
8287    fn is_terminated(&self) -> bool {
8288        self.is_terminated
8289    }
8290}
8291
8292impl fidl::endpoints::RequestStream for TestDevice2RequestStream {
8293    type Protocol = TestDevice2Marker;
8294    type ControlHandle = TestDevice2ControlHandle;
8295
8296    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8297        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8298    }
8299
8300    fn control_handle(&self) -> Self::ControlHandle {
8301        TestDevice2ControlHandle { inner: self.inner.clone() }
8302    }
8303
8304    fn into_inner(
8305        self,
8306    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8307    {
8308        (self.inner, self.is_terminated)
8309    }
8310
8311    fn from_inner(
8312        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8313        is_terminated: bool,
8314    ) -> Self {
8315        Self { inner, is_terminated }
8316    }
8317}
8318
8319impl futures::Stream for TestDevice2RequestStream {
8320    type Item = Result<TestDevice2Request, fidl::Error>;
8321
8322    fn poll_next(
8323        mut self: std::pin::Pin<&mut Self>,
8324        cx: &mut std::task::Context<'_>,
8325    ) -> std::task::Poll<Option<Self::Item>> {
8326        let this = &mut *self;
8327        if this.inner.check_shutdown(cx) {
8328            this.is_terminated = true;
8329            return std::task::Poll::Ready(None);
8330        }
8331        if this.is_terminated {
8332            panic!("polled TestDevice2RequestStream after completion");
8333        }
8334        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8335            |bytes, handles| {
8336                match this.inner.channel().read_etc(cx, bytes, handles) {
8337                    std::task::Poll::Ready(Ok(())) => {}
8338                    std::task::Poll::Pending => return std::task::Poll::Pending,
8339                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8340                        this.is_terminated = true;
8341                        return std::task::Poll::Ready(None);
8342                    }
8343                    std::task::Poll::Ready(Err(e)) => {
8344                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8345                            e.into(),
8346                        ))));
8347                    }
8348                }
8349
8350                // A message has been received from the channel
8351                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8352
8353                std::task::Poll::Ready(Some(match header.ordinal {
8354                    0x5be45b0f097813b2 => {
8355                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8356                        let mut req = fidl::new_empty!(
8357                            fidl::encoding::EmptyPayload,
8358                            fidl::encoding::DefaultFuchsiaResourceDialect
8359                        );
8360                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8361                        let control_handle = TestDevice2ControlHandle { inner: this.inner.clone() };
8362                        Ok(TestDevice2Request::GetUnitTestStatus {
8363                            responder: TestDevice2GetUnitTestStatusResponder {
8364                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8365                                tx_id: header.tx_id,
8366                            },
8367                        })
8368                    }
8369                    _ => Err(fidl::Error::UnknownOrdinal {
8370                        ordinal: header.ordinal,
8371                        protocol_name:
8372                            <TestDevice2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8373                    }),
8374                }))
8375            },
8376        )
8377    }
8378}
8379
8380/// Additional methods for reporting tests run in the MSD.
8381#[derive(Debug)]
8382pub enum TestDevice2Request {
8383    GetUnitTestStatus { responder: TestDevice2GetUnitTestStatusResponder },
8384}
8385
8386impl TestDevice2Request {
8387    #[allow(irrefutable_let_patterns)]
8388    pub fn into_get_unit_test_status(self) -> Option<(TestDevice2GetUnitTestStatusResponder)> {
8389        if let TestDevice2Request::GetUnitTestStatus { responder } = self {
8390            Some((responder))
8391        } else {
8392            None
8393        }
8394    }
8395
8396    /// Name of the method defined in FIDL
8397    pub fn method_name(&self) -> &'static str {
8398        match *self {
8399            TestDevice2Request::GetUnitTestStatus { .. } => "get_unit_test_status",
8400        }
8401    }
8402}
8403
8404#[derive(Debug, Clone)]
8405pub struct TestDevice2ControlHandle {
8406    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8407}
8408
8409impl fidl::endpoints::ControlHandle for TestDevice2ControlHandle {
8410    fn shutdown(&self) {
8411        self.inner.shutdown()
8412    }
8413    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8414        self.inner.shutdown_with_epitaph(status)
8415    }
8416
8417    fn is_closed(&self) -> bool {
8418        self.inner.channel().is_closed()
8419    }
8420    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8421        self.inner.channel().on_closed()
8422    }
8423
8424    #[cfg(target_os = "fuchsia")]
8425    fn signal_peer(
8426        &self,
8427        clear_mask: zx::Signals,
8428        set_mask: zx::Signals,
8429    ) -> Result<(), zx_status::Status> {
8430        use fidl::Peered;
8431        self.inner.channel().signal_peer(clear_mask, set_mask)
8432    }
8433}
8434
8435impl TestDevice2ControlHandle {}
8436
8437#[must_use = "FIDL methods require a response to be sent"]
8438#[derive(Debug)]
8439pub struct TestDevice2GetUnitTestStatusResponder {
8440    control_handle: std::mem::ManuallyDrop<TestDevice2ControlHandle>,
8441    tx_id: u32,
8442}
8443
8444/// Set the the channel to be shutdown (see [`TestDevice2ControlHandle::shutdown`])
8445/// if the responder is dropped without sending a response, so that the client
8446/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8447impl std::ops::Drop for TestDevice2GetUnitTestStatusResponder {
8448    fn drop(&mut self) {
8449        self.control_handle.shutdown();
8450        // Safety: drops once, never accessed again
8451        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8452    }
8453}
8454
8455impl fidl::endpoints::Responder for TestDevice2GetUnitTestStatusResponder {
8456    type ControlHandle = TestDevice2ControlHandle;
8457
8458    fn control_handle(&self) -> &TestDevice2ControlHandle {
8459        &self.control_handle
8460    }
8461
8462    fn drop_without_shutdown(mut self) {
8463        // Safety: drops once, never accessed again due to mem::forget
8464        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8465        // Prevent Drop from running (which would shut down the channel)
8466        std::mem::forget(self);
8467    }
8468}
8469
8470impl TestDevice2GetUnitTestStatusResponder {
8471    /// Sends a response to the FIDL transaction.
8472    ///
8473    /// Sets the channel to shutdown if an error occurs.
8474    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
8475        let _result = self.send_raw(status);
8476        if _result.is_err() {
8477            self.control_handle.shutdown();
8478        }
8479        self.drop_without_shutdown();
8480        _result
8481    }
8482
8483    /// Similar to "send" but does not shutdown the channel if an error occurs.
8484    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
8485        let _result = self.send_raw(status);
8486        self.drop_without_shutdown();
8487        _result
8488    }
8489
8490    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
8491        self.control_handle.inner.send::<TestDevice2GetUnitTestStatusResponse>(
8492            (status,),
8493            self.tx_id,
8494            0x5be45b0f097813b2,
8495            fidl::encoding::DynamicFlags::empty(),
8496        )
8497    }
8498}
8499
8500#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8501pub struct DependencyInjectionServiceMarker;
8502
8503#[cfg(target_os = "fuchsia")]
8504impl fidl::endpoints::ServiceMarker for DependencyInjectionServiceMarker {
8505    type Proxy = DependencyInjectionServiceProxy;
8506    type Request = DependencyInjectionServiceRequest;
8507    const SERVICE_NAME: &'static str = "fuchsia.gpu.magma.DependencyInjectionService";
8508}
8509
8510/// A request for one of the member protocols of DependencyInjectionService.
8511///
8512#[cfg(target_os = "fuchsia")]
8513pub enum DependencyInjectionServiceRequest {
8514    Device(DependencyInjectionRequestStream),
8515}
8516
8517#[cfg(target_os = "fuchsia")]
8518impl fidl::endpoints::ServiceRequest for DependencyInjectionServiceRequest {
8519    type Service = DependencyInjectionServiceMarker;
8520
8521    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
8522        match name {
8523            "device" => Self::Device(
8524                <DependencyInjectionRequestStream as fidl::endpoints::RequestStream>::from_channel(
8525                    _channel,
8526                ),
8527            ),
8528            _ => panic!("no such member protocol name for service DependencyInjectionService"),
8529        }
8530    }
8531
8532    fn member_names() -> &'static [&'static str] {
8533        &["device"]
8534    }
8535}
8536#[cfg(target_os = "fuchsia")]
8537pub struct DependencyInjectionServiceProxy(
8538    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
8539);
8540
8541#[cfg(target_os = "fuchsia")]
8542impl fidl::endpoints::ServiceProxy for DependencyInjectionServiceProxy {
8543    type Service = DependencyInjectionServiceMarker;
8544
8545    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
8546        Self(opener)
8547    }
8548}
8549
8550#[cfg(target_os = "fuchsia")]
8551impl DependencyInjectionServiceProxy {
8552    pub fn connect_to_device(&self) -> Result<DependencyInjectionProxy, fidl::Error> {
8553        let (proxy, server_end) = fidl::endpoints::create_proxy::<DependencyInjectionMarker>();
8554        self.connect_channel_to_device(server_end)?;
8555        Ok(proxy)
8556    }
8557
8558    /// Like `connect_to_device`, but returns a sync proxy.
8559    /// See [`Self::connect_to_device`] for more details.
8560    pub fn connect_to_device_sync(
8561        &self,
8562    ) -> Result<DependencyInjectionSynchronousProxy, fidl::Error> {
8563        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DependencyInjectionMarker>();
8564        self.connect_channel_to_device(server_end)?;
8565        Ok(proxy)
8566    }
8567
8568    /// Like `connect_to_device`, but accepts a server end.
8569    /// See [`Self::connect_to_device`] for more details.
8570    pub fn connect_channel_to_device(
8571        &self,
8572        server_end: fidl::endpoints::ServerEnd<DependencyInjectionMarker>,
8573    ) -> Result<(), fidl::Error> {
8574        self.0.open_member("device", server_end.into_channel())
8575    }
8576
8577    pub fn instance_name(&self) -> &str {
8578        self.0.instance_name()
8579    }
8580}
8581
8582#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8583pub struct PerformanceCounterServiceMarker;
8584
8585#[cfg(target_os = "fuchsia")]
8586impl fidl::endpoints::ServiceMarker for PerformanceCounterServiceMarker {
8587    type Proxy = PerformanceCounterServiceProxy;
8588    type Request = PerformanceCounterServiceRequest;
8589    const SERVICE_NAME: &'static str = "fuchsia.gpu.magma.PerformanceCounterService";
8590}
8591
8592/// A request for one of the member protocols of PerformanceCounterService.
8593///
8594#[cfg(target_os = "fuchsia")]
8595pub enum PerformanceCounterServiceRequest {
8596    Access(PerformanceCounterAccessRequestStream),
8597}
8598
8599#[cfg(target_os = "fuchsia")]
8600impl fidl::endpoints::ServiceRequest for PerformanceCounterServiceRequest {
8601    type Service = PerformanceCounterServiceMarker;
8602
8603    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
8604        match name {
8605            "access" => Self::Access(
8606                <PerformanceCounterAccessRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
8607            ),
8608            _ => panic!("no such member protocol name for service PerformanceCounterService"),
8609        }
8610    }
8611
8612    fn member_names() -> &'static [&'static str] {
8613        &["access"]
8614    }
8615}
8616#[cfg(target_os = "fuchsia")]
8617pub struct PerformanceCounterServiceProxy(
8618    #[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>,
8619);
8620
8621#[cfg(target_os = "fuchsia")]
8622impl fidl::endpoints::ServiceProxy for PerformanceCounterServiceProxy {
8623    type Service = PerformanceCounterServiceMarker;
8624
8625    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
8626        Self(opener)
8627    }
8628}
8629
8630#[cfg(target_os = "fuchsia")]
8631impl PerformanceCounterServiceProxy {
8632    pub fn connect_to_access(&self) -> Result<PerformanceCounterAccessProxy, fidl::Error> {
8633        let (proxy, server_end) = fidl::endpoints::create_proxy::<PerformanceCounterAccessMarker>();
8634        self.connect_channel_to_access(server_end)?;
8635        Ok(proxy)
8636    }
8637
8638    /// Like `connect_to_access`, but returns a sync proxy.
8639    /// See [`Self::connect_to_access`] for more details.
8640    pub fn connect_to_access_sync(
8641        &self,
8642    ) -> Result<PerformanceCounterAccessSynchronousProxy, fidl::Error> {
8643        let (proxy, server_end) =
8644            fidl::endpoints::create_sync_proxy::<PerformanceCounterAccessMarker>();
8645        self.connect_channel_to_access(server_end)?;
8646        Ok(proxy)
8647    }
8648
8649    /// Like `connect_to_access`, but accepts a server end.
8650    /// See [`Self::connect_to_access`] for more details.
8651    pub fn connect_channel_to_access(
8652        &self,
8653        server_end: fidl::endpoints::ServerEnd<PerformanceCounterAccessMarker>,
8654    ) -> Result<(), fidl::Error> {
8655        self.0.open_member("access", server_end.into_channel())
8656    }
8657
8658    pub fn instance_name(&self) -> &str {
8659        self.0.instance_name()
8660    }
8661}
8662
8663#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8664pub struct ServiceMarker;
8665
8666#[cfg(target_os = "fuchsia")]
8667impl fidl::endpoints::ServiceMarker for ServiceMarker {
8668    type Proxy = ServiceProxy;
8669    type Request = ServiceRequest;
8670    const SERVICE_NAME: &'static str = "fuchsia.gpu.magma.Service";
8671}
8672
8673/// A request for one of the member protocols of Service.
8674///
8675#[cfg(target_os = "fuchsia")]
8676pub enum ServiceRequest {
8677    Device(CombinedDeviceRequestStream),
8678    PowerElementProvider(PowerElementProviderRequestStream),
8679}
8680
8681#[cfg(target_os = "fuchsia")]
8682impl fidl::endpoints::ServiceRequest for ServiceRequest {
8683    type Service = ServiceMarker;
8684
8685    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
8686        match name {
8687            "device" => Self::Device(
8688                <CombinedDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
8689                    _channel,
8690                ),
8691            ),
8692            "power_element_provider" => Self::PowerElementProvider(
8693                <PowerElementProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(
8694                    _channel,
8695                ),
8696            ),
8697            _ => panic!("no such member protocol name for service Service"),
8698        }
8699    }
8700
8701    fn member_names() -> &'static [&'static str] {
8702        &["device", "power_element_provider"]
8703    }
8704}
8705#[cfg(target_os = "fuchsia")]
8706pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
8707
8708#[cfg(target_os = "fuchsia")]
8709impl fidl::endpoints::ServiceProxy for ServiceProxy {
8710    type Service = ServiceMarker;
8711
8712    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
8713        Self(opener)
8714    }
8715}
8716
8717#[cfg(target_os = "fuchsia")]
8718impl ServiceProxy {
8719    pub fn connect_to_device(&self) -> Result<CombinedDeviceProxy, fidl::Error> {
8720        let (proxy, server_end) = fidl::endpoints::create_proxy::<CombinedDeviceMarker>();
8721        self.connect_channel_to_device(server_end)?;
8722        Ok(proxy)
8723    }
8724
8725    /// Like `connect_to_device`, but returns a sync proxy.
8726    /// See [`Self::connect_to_device`] for more details.
8727    pub fn connect_to_device_sync(&self) -> Result<CombinedDeviceSynchronousProxy, fidl::Error> {
8728        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CombinedDeviceMarker>();
8729        self.connect_channel_to_device(server_end)?;
8730        Ok(proxy)
8731    }
8732
8733    /// Like `connect_to_device`, but accepts a server end.
8734    /// See [`Self::connect_to_device`] for more details.
8735    pub fn connect_channel_to_device(
8736        &self,
8737        server_end: fidl::endpoints::ServerEnd<CombinedDeviceMarker>,
8738    ) -> Result<(), fidl::Error> {
8739        self.0.open_member("device", server_end.into_channel())
8740    }
8741    pub fn connect_to_power_element_provider(
8742        &self,
8743    ) -> Result<PowerElementProviderProxy, fidl::Error> {
8744        let (proxy, server_end) = fidl::endpoints::create_proxy::<PowerElementProviderMarker>();
8745        self.connect_channel_to_power_element_provider(server_end)?;
8746        Ok(proxy)
8747    }
8748
8749    /// Like `connect_to_power_element_provider`, but returns a sync proxy.
8750    /// See [`Self::connect_to_power_element_provider`] for more details.
8751    pub fn connect_to_power_element_provider_sync(
8752        &self,
8753    ) -> Result<PowerElementProviderSynchronousProxy, fidl::Error> {
8754        let (proxy, server_end) =
8755            fidl::endpoints::create_sync_proxy::<PowerElementProviderMarker>();
8756        self.connect_channel_to_power_element_provider(server_end)?;
8757        Ok(proxy)
8758    }
8759
8760    /// Like `connect_to_power_element_provider`, but accepts a server end.
8761    /// See [`Self::connect_to_power_element_provider`] for more details.
8762    pub fn connect_channel_to_power_element_provider(
8763        &self,
8764        server_end: fidl::endpoints::ServerEnd<PowerElementProviderMarker>,
8765    ) -> Result<(), fidl::Error> {
8766        self.0.open_member("power_element_provider", server_end.into_channel())
8767    }
8768
8769    pub fn instance_name(&self) -> &str {
8770        self.0.instance_name()
8771    }
8772}
8773
8774#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8775pub struct TestServiceMarker;
8776
8777#[cfg(target_os = "fuchsia")]
8778impl fidl::endpoints::ServiceMarker for TestServiceMarker {
8779    type Proxy = TestServiceProxy;
8780    type Request = TestServiceRequest;
8781    const SERVICE_NAME: &'static str = "fuchsia.gpu.magma.TestService";
8782}
8783
8784/// A request for one of the member protocols of TestService.
8785///
8786/// This service is only exposed by test MSDs. This should not be used by an ICD.
8787#[cfg(target_os = "fuchsia")]
8788pub enum TestServiceRequest {
8789    Device(CombinedDeviceRequestStream),
8790    PowerElementProvider(PowerElementProviderRequestStream),
8791    TestDevice(TestDevice2RequestStream),
8792}
8793
8794#[cfg(target_os = "fuchsia")]
8795impl fidl::endpoints::ServiceRequest for TestServiceRequest {
8796    type Service = TestServiceMarker;
8797
8798    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
8799        match name {
8800            "device" => Self::Device(
8801                <CombinedDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
8802                    _channel,
8803                ),
8804            ),
8805            "power_element_provider" => Self::PowerElementProvider(
8806                <PowerElementProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(
8807                    _channel,
8808                ),
8809            ),
8810            "test_device" => Self::TestDevice(
8811                <TestDevice2RequestStream as fidl::endpoints::RequestStream>::from_channel(
8812                    _channel,
8813                ),
8814            ),
8815            _ => panic!("no such member protocol name for service TestService"),
8816        }
8817    }
8818
8819    fn member_names() -> &'static [&'static str] {
8820        &["device", "power_element_provider", "test_device"]
8821    }
8822}
8823/// This service is only exposed by test MSDs. This should not be used by an ICD.
8824#[cfg(target_os = "fuchsia")]
8825pub struct TestServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
8826
8827#[cfg(target_os = "fuchsia")]
8828impl fidl::endpoints::ServiceProxy for TestServiceProxy {
8829    type Service = TestServiceMarker;
8830
8831    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
8832        Self(opener)
8833    }
8834}
8835
8836#[cfg(target_os = "fuchsia")]
8837impl TestServiceProxy {
8838    pub fn connect_to_device(&self) -> Result<CombinedDeviceProxy, fidl::Error> {
8839        let (proxy, server_end) = fidl::endpoints::create_proxy::<CombinedDeviceMarker>();
8840        self.connect_channel_to_device(server_end)?;
8841        Ok(proxy)
8842    }
8843
8844    /// Like `connect_to_device`, but returns a sync proxy.
8845    /// See [`Self::connect_to_device`] for more details.
8846    pub fn connect_to_device_sync(&self) -> Result<CombinedDeviceSynchronousProxy, fidl::Error> {
8847        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CombinedDeviceMarker>();
8848        self.connect_channel_to_device(server_end)?;
8849        Ok(proxy)
8850    }
8851
8852    /// Like `connect_to_device`, but accepts a server end.
8853    /// See [`Self::connect_to_device`] for more details.
8854    pub fn connect_channel_to_device(
8855        &self,
8856        server_end: fidl::endpoints::ServerEnd<CombinedDeviceMarker>,
8857    ) -> Result<(), fidl::Error> {
8858        self.0.open_member("device", server_end.into_channel())
8859    }
8860    pub fn connect_to_power_element_provider(
8861        &self,
8862    ) -> Result<PowerElementProviderProxy, fidl::Error> {
8863        let (proxy, server_end) = fidl::endpoints::create_proxy::<PowerElementProviderMarker>();
8864        self.connect_channel_to_power_element_provider(server_end)?;
8865        Ok(proxy)
8866    }
8867
8868    /// Like `connect_to_power_element_provider`, but returns a sync proxy.
8869    /// See [`Self::connect_to_power_element_provider`] for more details.
8870    pub fn connect_to_power_element_provider_sync(
8871        &self,
8872    ) -> Result<PowerElementProviderSynchronousProxy, fidl::Error> {
8873        let (proxy, server_end) =
8874            fidl::endpoints::create_sync_proxy::<PowerElementProviderMarker>();
8875        self.connect_channel_to_power_element_provider(server_end)?;
8876        Ok(proxy)
8877    }
8878
8879    /// Like `connect_to_power_element_provider`, but accepts a server end.
8880    /// See [`Self::connect_to_power_element_provider`] for more details.
8881    pub fn connect_channel_to_power_element_provider(
8882        &self,
8883        server_end: fidl::endpoints::ServerEnd<PowerElementProviderMarker>,
8884    ) -> Result<(), fidl::Error> {
8885        self.0.open_member("power_element_provider", server_end.into_channel())
8886    }
8887    pub fn connect_to_test_device(&self) -> Result<TestDevice2Proxy, fidl::Error> {
8888        let (proxy, server_end) = fidl::endpoints::create_proxy::<TestDevice2Marker>();
8889        self.connect_channel_to_test_device(server_end)?;
8890        Ok(proxy)
8891    }
8892
8893    /// Like `connect_to_test_device`, but returns a sync proxy.
8894    /// See [`Self::connect_to_test_device`] for more details.
8895    pub fn connect_to_test_device_sync(&self) -> Result<TestDevice2SynchronousProxy, fidl::Error> {
8896        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<TestDevice2Marker>();
8897        self.connect_channel_to_test_device(server_end)?;
8898        Ok(proxy)
8899    }
8900
8901    /// Like `connect_to_test_device`, but accepts a server end.
8902    /// See [`Self::connect_to_test_device`] for more details.
8903    pub fn connect_channel_to_test_device(
8904        &self,
8905        server_end: fidl::endpoints::ServerEnd<TestDevice2Marker>,
8906    ) -> Result<(), fidl::Error> {
8907        self.0.open_member("test_device", server_end.into_channel())
8908    }
8909
8910    pub fn instance_name(&self) -> &str {
8911        self.0.instance_name()
8912    }
8913}
8914
8915#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8916pub struct TrustedServiceMarker;
8917
8918#[cfg(target_os = "fuchsia")]
8919impl fidl::endpoints::ServiceMarker for TrustedServiceMarker {
8920    type Proxy = TrustedServiceProxy;
8921    type Request = TrustedServiceRequest;
8922    const SERVICE_NAME: &'static str = "fuchsia.gpu.magma.TrustedService";
8923}
8924
8925/// A request for one of the member protocols of TrustedService.
8926///
8927/// This service has additional abilities above the normal service.
8928#[cfg(target_os = "fuchsia")]
8929pub enum TrustedServiceRequest {
8930    Device(CombinedDeviceRequestStream),
8931    PowerElementProvider(PowerElementProviderRequestStream),
8932    DebugUtils(DebugUtilsRequestStream),
8933}
8934
8935#[cfg(target_os = "fuchsia")]
8936impl fidl::endpoints::ServiceRequest for TrustedServiceRequest {
8937    type Service = TrustedServiceMarker;
8938
8939    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
8940        match name {
8941            "device" => Self::Device(
8942                <CombinedDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
8943                    _channel,
8944                ),
8945            ),
8946            "power_element_provider" => Self::PowerElementProvider(
8947                <PowerElementProviderRequestStream as fidl::endpoints::RequestStream>::from_channel(
8948                    _channel,
8949                ),
8950            ),
8951            "debug_utils" => Self::DebugUtils(
8952                <DebugUtilsRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
8953            ),
8954            _ => panic!("no such member protocol name for service TrustedService"),
8955        }
8956    }
8957
8958    fn member_names() -> &'static [&'static str] {
8959        &["device", "power_element_provider", "debug_utils"]
8960    }
8961}
8962/// This service has additional abilities above the normal service.
8963#[cfg(target_os = "fuchsia")]
8964pub struct TrustedServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
8965
8966#[cfg(target_os = "fuchsia")]
8967impl fidl::endpoints::ServiceProxy for TrustedServiceProxy {
8968    type Service = TrustedServiceMarker;
8969
8970    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
8971        Self(opener)
8972    }
8973}
8974
8975#[cfg(target_os = "fuchsia")]
8976impl TrustedServiceProxy {
8977    pub fn connect_to_device(&self) -> Result<CombinedDeviceProxy, fidl::Error> {
8978        let (proxy, server_end) = fidl::endpoints::create_proxy::<CombinedDeviceMarker>();
8979        self.connect_channel_to_device(server_end)?;
8980        Ok(proxy)
8981    }
8982
8983    /// Like `connect_to_device`, but returns a sync proxy.
8984    /// See [`Self::connect_to_device`] for more details.
8985    pub fn connect_to_device_sync(&self) -> Result<CombinedDeviceSynchronousProxy, fidl::Error> {
8986        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<CombinedDeviceMarker>();
8987        self.connect_channel_to_device(server_end)?;
8988        Ok(proxy)
8989    }
8990
8991    /// Like `connect_to_device`, but accepts a server end.
8992    /// See [`Self::connect_to_device`] for more details.
8993    pub fn connect_channel_to_device(
8994        &self,
8995        server_end: fidl::endpoints::ServerEnd<CombinedDeviceMarker>,
8996    ) -> Result<(), fidl::Error> {
8997        self.0.open_member("device", server_end.into_channel())
8998    }
8999    pub fn connect_to_power_element_provider(
9000        &self,
9001    ) -> Result<PowerElementProviderProxy, fidl::Error> {
9002        let (proxy, server_end) = fidl::endpoints::create_proxy::<PowerElementProviderMarker>();
9003        self.connect_channel_to_power_element_provider(server_end)?;
9004        Ok(proxy)
9005    }
9006
9007    /// Like `connect_to_power_element_provider`, but returns a sync proxy.
9008    /// See [`Self::connect_to_power_element_provider`] for more details.
9009    pub fn connect_to_power_element_provider_sync(
9010        &self,
9011    ) -> Result<PowerElementProviderSynchronousProxy, fidl::Error> {
9012        let (proxy, server_end) =
9013            fidl::endpoints::create_sync_proxy::<PowerElementProviderMarker>();
9014        self.connect_channel_to_power_element_provider(server_end)?;
9015        Ok(proxy)
9016    }
9017
9018    /// Like `connect_to_power_element_provider`, but accepts a server end.
9019    /// See [`Self::connect_to_power_element_provider`] for more details.
9020    pub fn connect_channel_to_power_element_provider(
9021        &self,
9022        server_end: fidl::endpoints::ServerEnd<PowerElementProviderMarker>,
9023    ) -> Result<(), fidl::Error> {
9024        self.0.open_member("power_element_provider", server_end.into_channel())
9025    }
9026    pub fn connect_to_debug_utils(&self) -> Result<DebugUtilsProxy, fidl::Error> {
9027        let (proxy, server_end) = fidl::endpoints::create_proxy::<DebugUtilsMarker>();
9028        self.connect_channel_to_debug_utils(server_end)?;
9029        Ok(proxy)
9030    }
9031
9032    /// Like `connect_to_debug_utils`, but returns a sync proxy.
9033    /// See [`Self::connect_to_debug_utils`] for more details.
9034    pub fn connect_to_debug_utils_sync(&self) -> Result<DebugUtilsSynchronousProxy, fidl::Error> {
9035        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DebugUtilsMarker>();
9036        self.connect_channel_to_debug_utils(server_end)?;
9037        Ok(proxy)
9038    }
9039
9040    /// Like `connect_to_debug_utils`, but accepts a server end.
9041    /// See [`Self::connect_to_debug_utils`] for more details.
9042    pub fn connect_channel_to_debug_utils(
9043        &self,
9044        server_end: fidl::endpoints::ServerEnd<DebugUtilsMarker>,
9045    ) -> Result<(), fidl::Error> {
9046        self.0.open_member("debug_utils", server_end.into_channel())
9047    }
9048
9049    pub fn instance_name(&self) -> &str {
9050        self.0.instance_name()
9051    }
9052}
9053
9054mod internal {
9055    use super::*;
9056
9057    impl fidl::encoding::ResourceTypeMarker for DependencyInjectionSetMemoryPressureProviderRequest {
9058        type Borrowed<'a> = &'a mut Self;
9059        fn take_or_borrow<'a>(
9060            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9061        ) -> Self::Borrowed<'a> {
9062            value
9063        }
9064    }
9065
9066    unsafe impl fidl::encoding::TypeMarker for DependencyInjectionSetMemoryPressureProviderRequest {
9067        type Owned = Self;
9068
9069        #[inline(always)]
9070        fn inline_align(_context: fidl::encoding::Context) -> usize {
9071            4
9072        }
9073
9074        #[inline(always)]
9075        fn inline_size(_context: fidl::encoding::Context) -> usize {
9076            4
9077        }
9078    }
9079
9080    unsafe impl
9081        fidl::encoding::Encode<
9082            DependencyInjectionSetMemoryPressureProviderRequest,
9083            fidl::encoding::DefaultFuchsiaResourceDialect,
9084        > for &mut DependencyInjectionSetMemoryPressureProviderRequest
9085    {
9086        #[inline]
9087        unsafe fn encode(
9088            self,
9089            encoder: &mut fidl::encoding::Encoder<
9090                '_,
9091                fidl::encoding::DefaultFuchsiaResourceDialect,
9092            >,
9093            offset: usize,
9094            _depth: fidl::encoding::Depth,
9095        ) -> fidl::Result<()> {
9096            encoder
9097                .debug_check_bounds::<DependencyInjectionSetMemoryPressureProviderRequest>(offset);
9098            // Delegate to tuple encoding.
9099            fidl::encoding::Encode::<
9100                DependencyInjectionSetMemoryPressureProviderRequest,
9101                fidl::encoding::DefaultFuchsiaResourceDialect,
9102            >::encode(
9103                (<fidl::encoding::Endpoint<
9104                    fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
9105                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9106                    &mut self.provider
9107                ),),
9108                encoder,
9109                offset,
9110                _depth,
9111            )
9112        }
9113    }
9114    unsafe impl<
9115        T0: fidl::encoding::Encode<
9116                fidl::encoding::Endpoint<
9117                    fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
9118                >,
9119                fidl::encoding::DefaultFuchsiaResourceDialect,
9120            >,
9121    >
9122        fidl::encoding::Encode<
9123            DependencyInjectionSetMemoryPressureProviderRequest,
9124            fidl::encoding::DefaultFuchsiaResourceDialect,
9125        > for (T0,)
9126    {
9127        #[inline]
9128        unsafe fn encode(
9129            self,
9130            encoder: &mut fidl::encoding::Encoder<
9131                '_,
9132                fidl::encoding::DefaultFuchsiaResourceDialect,
9133            >,
9134            offset: usize,
9135            depth: fidl::encoding::Depth,
9136        ) -> fidl::Result<()> {
9137            encoder
9138                .debug_check_bounds::<DependencyInjectionSetMemoryPressureProviderRequest>(offset);
9139            // Zero out padding regions. There's no need to apply masks
9140            // because the unmasked parts will be overwritten by fields.
9141            // Write the fields.
9142            self.0.encode(encoder, offset + 0, depth)?;
9143            Ok(())
9144        }
9145    }
9146
9147    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9148        for DependencyInjectionSetMemoryPressureProviderRequest
9149    {
9150        #[inline(always)]
9151        fn new_empty() -> Self {
9152            Self {
9153                provider: fidl::new_empty!(
9154                    fidl::encoding::Endpoint<
9155                        fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
9156                    >,
9157                    fidl::encoding::DefaultFuchsiaResourceDialect
9158                ),
9159            }
9160        }
9161
9162        #[inline]
9163        unsafe fn decode(
9164            &mut self,
9165            decoder: &mut fidl::encoding::Decoder<
9166                '_,
9167                fidl::encoding::DefaultFuchsiaResourceDialect,
9168            >,
9169            offset: usize,
9170            _depth: fidl::encoding::Depth,
9171        ) -> fidl::Result<()> {
9172            decoder.debug_check_bounds::<Self>(offset);
9173            // Verify that padding bytes are zero.
9174            fidl::decode!(
9175                fidl::encoding::Endpoint<
9176                    fidl::endpoints::ClientEnd<fidl_fuchsia_memorypressure::ProviderMarker>,
9177                >,
9178                fidl::encoding::DefaultFuchsiaResourceDialect,
9179                &mut self.provider,
9180                decoder,
9181                offset + 0,
9182                _depth
9183            )?;
9184            Ok(())
9185        }
9186    }
9187
9188    impl fidl::encoding::ResourceTypeMarker for DeviceConnect2Request {
9189        type Borrowed<'a> = &'a mut Self;
9190        fn take_or_borrow<'a>(
9191            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9192        ) -> Self::Borrowed<'a> {
9193            value
9194        }
9195    }
9196
9197    unsafe impl fidl::encoding::TypeMarker for DeviceConnect2Request {
9198        type Owned = Self;
9199
9200        #[inline(always)]
9201        fn inline_align(_context: fidl::encoding::Context) -> usize {
9202            8
9203        }
9204
9205        #[inline(always)]
9206        fn inline_size(_context: fidl::encoding::Context) -> usize {
9207            16
9208        }
9209    }
9210
9211    unsafe impl
9212        fidl::encoding::Encode<DeviceConnect2Request, fidl::encoding::DefaultFuchsiaResourceDialect>
9213        for &mut DeviceConnect2Request
9214    {
9215        #[inline]
9216        unsafe fn encode(
9217            self,
9218            encoder: &mut fidl::encoding::Encoder<
9219                '_,
9220                fidl::encoding::DefaultFuchsiaResourceDialect,
9221            >,
9222            offset: usize,
9223            _depth: fidl::encoding::Depth,
9224        ) -> fidl::Result<()> {
9225            encoder.debug_check_bounds::<DeviceConnect2Request>(offset);
9226            // Delegate to tuple encoding.
9227            fidl::encoding::Encode::<DeviceConnect2Request, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9228                (
9229                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.client_id),
9230                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.primary_channel),
9231                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.notification_channel),
9232                ),
9233                encoder, offset, _depth
9234            )
9235        }
9236    }
9237    unsafe impl<
9238        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
9239        T1: fidl::encoding::Encode<
9240                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
9241                fidl::encoding::DefaultFuchsiaResourceDialect,
9242            >,
9243        T2: fidl::encoding::Encode<
9244                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
9245                fidl::encoding::DefaultFuchsiaResourceDialect,
9246            >,
9247    >
9248        fidl::encoding::Encode<DeviceConnect2Request, fidl::encoding::DefaultFuchsiaResourceDialect>
9249        for (T0, T1, T2)
9250    {
9251        #[inline]
9252        unsafe fn encode(
9253            self,
9254            encoder: &mut fidl::encoding::Encoder<
9255                '_,
9256                fidl::encoding::DefaultFuchsiaResourceDialect,
9257            >,
9258            offset: usize,
9259            depth: fidl::encoding::Depth,
9260        ) -> fidl::Result<()> {
9261            encoder.debug_check_bounds::<DeviceConnect2Request>(offset);
9262            // Zero out padding regions. There's no need to apply masks
9263            // because the unmasked parts will be overwritten by fields.
9264            // Write the fields.
9265            self.0.encode(encoder, offset + 0, depth)?;
9266            self.1.encode(encoder, offset + 8, depth)?;
9267            self.2.encode(encoder, offset + 12, depth)?;
9268            Ok(())
9269        }
9270    }
9271
9272    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9273        for DeviceConnect2Request
9274    {
9275        #[inline(always)]
9276        fn new_empty() -> Self {
9277            Self {
9278                client_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
9279                primary_channel: fidl::new_empty!(
9280                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
9281                    fidl::encoding::DefaultFuchsiaResourceDialect
9282                ),
9283                notification_channel: fidl::new_empty!(
9284                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
9285                    fidl::encoding::DefaultFuchsiaResourceDialect
9286                ),
9287            }
9288        }
9289
9290        #[inline]
9291        unsafe fn decode(
9292            &mut self,
9293            decoder: &mut fidl::encoding::Decoder<
9294                '_,
9295                fidl::encoding::DefaultFuchsiaResourceDialect,
9296            >,
9297            offset: usize,
9298            _depth: fidl::encoding::Depth,
9299        ) -> fidl::Result<()> {
9300            decoder.debug_check_bounds::<Self>(offset);
9301            // Verify that padding bytes are zero.
9302            fidl::decode!(
9303                u64,
9304                fidl::encoding::DefaultFuchsiaResourceDialect,
9305                &mut self.client_id,
9306                decoder,
9307                offset + 0,
9308                _depth
9309            )?;
9310            fidl::decode!(
9311                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrimaryMarker>>,
9312                fidl::encoding::DefaultFuchsiaResourceDialect,
9313                &mut self.primary_channel,
9314                decoder,
9315                offset + 8,
9316                _depth
9317            )?;
9318            fidl::decode!(
9319                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NotificationMarker>>,
9320                fidl::encoding::DefaultFuchsiaResourceDialect,
9321                &mut self.notification_channel,
9322                decoder,
9323                offset + 12,
9324                _depth
9325            )?;
9326            Ok(())
9327        }
9328    }
9329
9330    impl fidl::encoding::ResourceTypeMarker
9331        for PerformanceCounterAccessGetPerformanceCountTokenResponse
9332    {
9333        type Borrowed<'a> = &'a mut Self;
9334        fn take_or_borrow<'a>(
9335            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9336        ) -> Self::Borrowed<'a> {
9337            value
9338        }
9339    }
9340
9341    unsafe impl fidl::encoding::TypeMarker
9342        for PerformanceCounterAccessGetPerformanceCountTokenResponse
9343    {
9344        type Owned = Self;
9345
9346        #[inline(always)]
9347        fn inline_align(_context: fidl::encoding::Context) -> usize {
9348            4
9349        }
9350
9351        #[inline(always)]
9352        fn inline_size(_context: fidl::encoding::Context) -> usize {
9353            4
9354        }
9355    }
9356
9357    unsafe impl
9358        fidl::encoding::Encode<
9359            PerformanceCounterAccessGetPerformanceCountTokenResponse,
9360            fidl::encoding::DefaultFuchsiaResourceDialect,
9361        > for &mut PerformanceCounterAccessGetPerformanceCountTokenResponse
9362    {
9363        #[inline]
9364        unsafe fn encode(
9365            self,
9366            encoder: &mut fidl::encoding::Encoder<
9367                '_,
9368                fidl::encoding::DefaultFuchsiaResourceDialect,
9369            >,
9370            offset: usize,
9371            _depth: fidl::encoding::Depth,
9372        ) -> fidl::Result<()> {
9373            encoder.debug_check_bounds::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
9374                offset,
9375            );
9376            // Delegate to tuple encoding.
9377            fidl::encoding::Encode::<
9378                PerformanceCounterAccessGetPerformanceCountTokenResponse,
9379                fidl::encoding::DefaultFuchsiaResourceDialect,
9380            >::encode(
9381                (<fidl::encoding::HandleType<
9382                    fidl::Event,
9383                    { fidl::ObjectType::EVENT.into_raw() },
9384                    2147483648,
9385                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9386                    &mut self.access_token
9387                ),),
9388                encoder,
9389                offset,
9390                _depth,
9391            )
9392        }
9393    }
9394    unsafe impl<
9395        T0: fidl::encoding::Encode<
9396                fidl::encoding::HandleType<
9397                    fidl::Event,
9398                    { fidl::ObjectType::EVENT.into_raw() },
9399                    2147483648,
9400                >,
9401                fidl::encoding::DefaultFuchsiaResourceDialect,
9402            >,
9403    >
9404        fidl::encoding::Encode<
9405            PerformanceCounterAccessGetPerformanceCountTokenResponse,
9406            fidl::encoding::DefaultFuchsiaResourceDialect,
9407        > for (T0,)
9408    {
9409        #[inline]
9410        unsafe fn encode(
9411            self,
9412            encoder: &mut fidl::encoding::Encoder<
9413                '_,
9414                fidl::encoding::DefaultFuchsiaResourceDialect,
9415            >,
9416            offset: usize,
9417            depth: fidl::encoding::Depth,
9418        ) -> fidl::Result<()> {
9419            encoder.debug_check_bounds::<PerformanceCounterAccessGetPerformanceCountTokenResponse>(
9420                offset,
9421            );
9422            // Zero out padding regions. There's no need to apply masks
9423            // because the unmasked parts will be overwritten by fields.
9424            // Write the fields.
9425            self.0.encode(encoder, offset + 0, depth)?;
9426            Ok(())
9427        }
9428    }
9429
9430    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9431        for PerformanceCounterAccessGetPerformanceCountTokenResponse
9432    {
9433        #[inline(always)]
9434        fn new_empty() -> Self {
9435            Self {
9436                access_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9437            }
9438        }
9439
9440        #[inline]
9441        unsafe fn decode(
9442            &mut self,
9443            decoder: &mut fidl::encoding::Decoder<
9444                '_,
9445                fidl::encoding::DefaultFuchsiaResourceDialect,
9446            >,
9447            offset: usize,
9448            _depth: fidl::encoding::Depth,
9449        ) -> fidl::Result<()> {
9450            decoder.debug_check_bounds::<Self>(offset);
9451            // Verify that padding bytes are zero.
9452            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.access_token, decoder, offset + 0, _depth)?;
9453            Ok(())
9454        }
9455    }
9456
9457    impl fidl::encoding::ResourceTypeMarker for PowerElementProviderGetPowerGoalsResponse {
9458        type Borrowed<'a> = &'a mut Self;
9459        fn take_or_borrow<'a>(
9460            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9461        ) -> Self::Borrowed<'a> {
9462            value
9463        }
9464    }
9465
9466    unsafe impl fidl::encoding::TypeMarker for PowerElementProviderGetPowerGoalsResponse {
9467        type Owned = Self;
9468
9469        #[inline(always)]
9470        fn inline_align(_context: fidl::encoding::Context) -> usize {
9471            8
9472        }
9473
9474        #[inline(always)]
9475        fn inline_size(_context: fidl::encoding::Context) -> usize {
9476            16
9477        }
9478    }
9479
9480    unsafe impl
9481        fidl::encoding::Encode<
9482            PowerElementProviderGetPowerGoalsResponse,
9483            fidl::encoding::DefaultFuchsiaResourceDialect,
9484        > for &mut PowerElementProviderGetPowerGoalsResponse
9485    {
9486        #[inline]
9487        unsafe fn encode(
9488            self,
9489            encoder: &mut fidl::encoding::Encoder<
9490                '_,
9491                fidl::encoding::DefaultFuchsiaResourceDialect,
9492            >,
9493            offset: usize,
9494            _depth: fidl::encoding::Depth,
9495        ) -> fidl::Result<()> {
9496            encoder.debug_check_bounds::<PowerElementProviderGetPowerGoalsResponse>(offset);
9497            // Delegate to tuple encoding.
9498            fidl::encoding::Encode::<PowerElementProviderGetPowerGoalsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9499                (
9500                    <fidl::encoding::UnboundedVector<PowerGoal> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.goals),
9501                ),
9502                encoder, offset, _depth
9503            )
9504        }
9505    }
9506    unsafe impl<
9507        T0: fidl::encoding::Encode<
9508                fidl::encoding::UnboundedVector<PowerGoal>,
9509                fidl::encoding::DefaultFuchsiaResourceDialect,
9510            >,
9511    >
9512        fidl::encoding::Encode<
9513            PowerElementProviderGetPowerGoalsResponse,
9514            fidl::encoding::DefaultFuchsiaResourceDialect,
9515        > for (T0,)
9516    {
9517        #[inline]
9518        unsafe fn encode(
9519            self,
9520            encoder: &mut fidl::encoding::Encoder<
9521                '_,
9522                fidl::encoding::DefaultFuchsiaResourceDialect,
9523            >,
9524            offset: usize,
9525            depth: fidl::encoding::Depth,
9526        ) -> fidl::Result<()> {
9527            encoder.debug_check_bounds::<PowerElementProviderGetPowerGoalsResponse>(offset);
9528            // Zero out padding regions. There's no need to apply masks
9529            // because the unmasked parts will be overwritten by fields.
9530            // Write the fields.
9531            self.0.encode(encoder, offset + 0, depth)?;
9532            Ok(())
9533        }
9534    }
9535
9536    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9537        for PowerElementProviderGetPowerGoalsResponse
9538    {
9539        #[inline(always)]
9540        fn new_empty() -> Self {
9541            Self {
9542                goals: fidl::new_empty!(
9543                    fidl::encoding::UnboundedVector<PowerGoal>,
9544                    fidl::encoding::DefaultFuchsiaResourceDialect
9545                ),
9546            }
9547        }
9548
9549        #[inline]
9550        unsafe fn decode(
9551            &mut self,
9552            decoder: &mut fidl::encoding::Decoder<
9553                '_,
9554                fidl::encoding::DefaultFuchsiaResourceDialect,
9555            >,
9556            offset: usize,
9557            _depth: fidl::encoding::Depth,
9558        ) -> fidl::Result<()> {
9559            decoder.debug_check_bounds::<Self>(offset);
9560            // Verify that padding bytes are zero.
9561            fidl::decode!(
9562                fidl::encoding::UnboundedVector<PowerGoal>,
9563                fidl::encoding::DefaultFuchsiaResourceDialect,
9564                &mut self.goals,
9565                decoder,
9566                offset + 0,
9567                _depth
9568            )?;
9569            Ok(())
9570        }
9571    }
9572
9573    impl fidl::encoding::ResourceTypeMarker for PrimaryCreatePerformanceCounterBufferPoolRequest {
9574        type Borrowed<'a> = &'a mut Self;
9575        fn take_or_borrow<'a>(
9576            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9577        ) -> Self::Borrowed<'a> {
9578            value
9579        }
9580    }
9581
9582    unsafe impl fidl::encoding::TypeMarker for PrimaryCreatePerformanceCounterBufferPoolRequest {
9583        type Owned = Self;
9584
9585        #[inline(always)]
9586        fn inline_align(_context: fidl::encoding::Context) -> usize {
9587            8
9588        }
9589
9590        #[inline(always)]
9591        fn inline_size(_context: fidl::encoding::Context) -> usize {
9592            16
9593        }
9594    }
9595
9596    unsafe impl
9597        fidl::encoding::Encode<
9598            PrimaryCreatePerformanceCounterBufferPoolRequest,
9599            fidl::encoding::DefaultFuchsiaResourceDialect,
9600        > for &mut PrimaryCreatePerformanceCounterBufferPoolRequest
9601    {
9602        #[inline]
9603        unsafe fn encode(
9604            self,
9605            encoder: &mut fidl::encoding::Encoder<
9606                '_,
9607                fidl::encoding::DefaultFuchsiaResourceDialect,
9608            >,
9609            offset: usize,
9610            _depth: fidl::encoding::Depth,
9611        ) -> fidl::Result<()> {
9612            encoder.debug_check_bounds::<PrimaryCreatePerformanceCounterBufferPoolRequest>(offset);
9613            // Delegate to tuple encoding.
9614            fidl::encoding::Encode::<
9615                PrimaryCreatePerformanceCounterBufferPoolRequest,
9616                fidl::encoding::DefaultFuchsiaResourceDialect,
9617            >::encode(
9618                (
9619                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pool_id),
9620                    <fidl::encoding::Endpoint<
9621                        fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
9622                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9623                        &mut self.event_channel,
9624                    ),
9625                ),
9626                encoder,
9627                offset,
9628                _depth,
9629            )
9630        }
9631    }
9632    unsafe impl<
9633        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
9634        T1: fidl::encoding::Encode<
9635                fidl::encoding::Endpoint<
9636                    fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
9637                >,
9638                fidl::encoding::DefaultFuchsiaResourceDialect,
9639            >,
9640    >
9641        fidl::encoding::Encode<
9642            PrimaryCreatePerformanceCounterBufferPoolRequest,
9643            fidl::encoding::DefaultFuchsiaResourceDialect,
9644        > for (T0, T1)
9645    {
9646        #[inline]
9647        unsafe fn encode(
9648            self,
9649            encoder: &mut fidl::encoding::Encoder<
9650                '_,
9651                fidl::encoding::DefaultFuchsiaResourceDialect,
9652            >,
9653            offset: usize,
9654            depth: fidl::encoding::Depth,
9655        ) -> fidl::Result<()> {
9656            encoder.debug_check_bounds::<PrimaryCreatePerformanceCounterBufferPoolRequest>(offset);
9657            // Zero out padding regions. There's no need to apply masks
9658            // because the unmasked parts will be overwritten by fields.
9659            unsafe {
9660                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9661                (ptr as *mut u64).write_unaligned(0);
9662            }
9663            // Write the fields.
9664            self.0.encode(encoder, offset + 0, depth)?;
9665            self.1.encode(encoder, offset + 8, depth)?;
9666            Ok(())
9667        }
9668    }
9669
9670    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9671        for PrimaryCreatePerformanceCounterBufferPoolRequest
9672    {
9673        #[inline(always)]
9674        fn new_empty() -> Self {
9675            Self {
9676                pool_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
9677                event_channel: fidl::new_empty!(
9678                    fidl::encoding::Endpoint<
9679                        fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
9680                    >,
9681                    fidl::encoding::DefaultFuchsiaResourceDialect
9682                ),
9683            }
9684        }
9685
9686        #[inline]
9687        unsafe fn decode(
9688            &mut self,
9689            decoder: &mut fidl::encoding::Decoder<
9690                '_,
9691                fidl::encoding::DefaultFuchsiaResourceDialect,
9692            >,
9693            offset: usize,
9694            _depth: fidl::encoding::Depth,
9695        ) -> fidl::Result<()> {
9696            decoder.debug_check_bounds::<Self>(offset);
9697            // Verify that padding bytes are zero.
9698            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9699            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9700            let mask = 0xffffffff00000000u64;
9701            let maskedval = padval & mask;
9702            if maskedval != 0 {
9703                return Err(fidl::Error::NonZeroPadding {
9704                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9705                });
9706            }
9707            fidl::decode!(
9708                u64,
9709                fidl::encoding::DefaultFuchsiaResourceDialect,
9710                &mut self.pool_id,
9711                decoder,
9712                offset + 0,
9713                _depth
9714            )?;
9715            fidl::decode!(
9716                fidl::encoding::Endpoint<
9717                    fidl::endpoints::ServerEnd<PerformanceCounterEventsMarker>,
9718                >,
9719                fidl::encoding::DefaultFuchsiaResourceDialect,
9720                &mut self.event_channel,
9721                decoder,
9722                offset + 8,
9723                _depth
9724            )?;
9725            Ok(())
9726        }
9727    }
9728
9729    impl fidl::encoding::ResourceTypeMarker for PrimaryEnablePerformanceCounterAccessRequest {
9730        type Borrowed<'a> = &'a mut Self;
9731        fn take_or_borrow<'a>(
9732            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9733        ) -> Self::Borrowed<'a> {
9734            value
9735        }
9736    }
9737
9738    unsafe impl fidl::encoding::TypeMarker for PrimaryEnablePerformanceCounterAccessRequest {
9739        type Owned = Self;
9740
9741        #[inline(always)]
9742        fn inline_align(_context: fidl::encoding::Context) -> usize {
9743            4
9744        }
9745
9746        #[inline(always)]
9747        fn inline_size(_context: fidl::encoding::Context) -> usize {
9748            4
9749        }
9750    }
9751
9752    unsafe impl
9753        fidl::encoding::Encode<
9754            PrimaryEnablePerformanceCounterAccessRequest,
9755            fidl::encoding::DefaultFuchsiaResourceDialect,
9756        > for &mut PrimaryEnablePerformanceCounterAccessRequest
9757    {
9758        #[inline]
9759        unsafe fn encode(
9760            self,
9761            encoder: &mut fidl::encoding::Encoder<
9762                '_,
9763                fidl::encoding::DefaultFuchsiaResourceDialect,
9764            >,
9765            offset: usize,
9766            _depth: fidl::encoding::Depth,
9767        ) -> fidl::Result<()> {
9768            encoder.debug_check_bounds::<PrimaryEnablePerformanceCounterAccessRequest>(offset);
9769            // Delegate to tuple encoding.
9770            fidl::encoding::Encode::<
9771                PrimaryEnablePerformanceCounterAccessRequest,
9772                fidl::encoding::DefaultFuchsiaResourceDialect,
9773            >::encode(
9774                (<fidl::encoding::HandleType<
9775                    fidl::Event,
9776                    { fidl::ObjectType::EVENT.into_raw() },
9777                    2147483648,
9778                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9779                    &mut self.access_token
9780                ),),
9781                encoder,
9782                offset,
9783                _depth,
9784            )
9785        }
9786    }
9787    unsafe impl<
9788        T0: fidl::encoding::Encode<
9789                fidl::encoding::HandleType<
9790                    fidl::Event,
9791                    { fidl::ObjectType::EVENT.into_raw() },
9792                    2147483648,
9793                >,
9794                fidl::encoding::DefaultFuchsiaResourceDialect,
9795            >,
9796    >
9797        fidl::encoding::Encode<
9798            PrimaryEnablePerformanceCounterAccessRequest,
9799            fidl::encoding::DefaultFuchsiaResourceDialect,
9800        > for (T0,)
9801    {
9802        #[inline]
9803        unsafe fn encode(
9804            self,
9805            encoder: &mut fidl::encoding::Encoder<
9806                '_,
9807                fidl::encoding::DefaultFuchsiaResourceDialect,
9808            >,
9809            offset: usize,
9810            depth: fidl::encoding::Depth,
9811        ) -> fidl::Result<()> {
9812            encoder.debug_check_bounds::<PrimaryEnablePerformanceCounterAccessRequest>(offset);
9813            // Zero out padding regions. There's no need to apply masks
9814            // because the unmasked parts will be overwritten by fields.
9815            // Write the fields.
9816            self.0.encode(encoder, offset + 0, depth)?;
9817            Ok(())
9818        }
9819    }
9820
9821    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9822        for PrimaryEnablePerformanceCounterAccessRequest
9823    {
9824        #[inline(always)]
9825        fn new_empty() -> Self {
9826            Self {
9827                access_token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9828            }
9829        }
9830
9831        #[inline]
9832        unsafe fn decode(
9833            &mut self,
9834            decoder: &mut fidl::encoding::Decoder<
9835                '_,
9836                fidl::encoding::DefaultFuchsiaResourceDialect,
9837            >,
9838            offset: usize,
9839            _depth: fidl::encoding::Depth,
9840        ) -> fidl::Result<()> {
9841            decoder.debug_check_bounds::<Self>(offset);
9842            // Verify that padding bytes are zero.
9843            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.access_token, decoder, offset + 0, _depth)?;
9844            Ok(())
9845        }
9846    }
9847
9848    impl PowerElementProviderGetClockSpeedLevelResponse {
9849        #[inline(always)]
9850        fn max_ordinal_present(&self) -> u64 {
9851            if let Some(_) = self.actual_hz {
9852                return 3;
9853            }
9854            if let Some(_) = self.level {
9855                return 2;
9856            }
9857            if let Some(_) = self.token {
9858                return 1;
9859            }
9860            0
9861        }
9862    }
9863
9864    impl fidl::encoding::ResourceTypeMarker for PowerElementProviderGetClockSpeedLevelResponse {
9865        type Borrowed<'a> = &'a mut Self;
9866        fn take_or_borrow<'a>(
9867            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9868        ) -> Self::Borrowed<'a> {
9869            value
9870        }
9871    }
9872
9873    unsafe impl fidl::encoding::TypeMarker for PowerElementProviderGetClockSpeedLevelResponse {
9874        type Owned = Self;
9875
9876        #[inline(always)]
9877        fn inline_align(_context: fidl::encoding::Context) -> usize {
9878            8
9879        }
9880
9881        #[inline(always)]
9882        fn inline_size(_context: fidl::encoding::Context) -> usize {
9883            16
9884        }
9885    }
9886
9887    unsafe impl
9888        fidl::encoding::Encode<
9889            PowerElementProviderGetClockSpeedLevelResponse,
9890            fidl::encoding::DefaultFuchsiaResourceDialect,
9891        > for &mut PowerElementProviderGetClockSpeedLevelResponse
9892    {
9893        unsafe fn encode(
9894            self,
9895            encoder: &mut fidl::encoding::Encoder<
9896                '_,
9897                fidl::encoding::DefaultFuchsiaResourceDialect,
9898            >,
9899            offset: usize,
9900            mut depth: fidl::encoding::Depth,
9901        ) -> fidl::Result<()> {
9902            encoder.debug_check_bounds::<PowerElementProviderGetClockSpeedLevelResponse>(offset);
9903            // Vector header
9904            let max_ordinal: u64 = self.max_ordinal_present();
9905            encoder.write_num(max_ordinal, offset);
9906            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9907            // Calling encoder.out_of_line_offset(0) is not allowed.
9908            if max_ordinal == 0 {
9909                return Ok(());
9910            }
9911            depth.increment()?;
9912            let envelope_size = 8;
9913            let bytes_len = max_ordinal as usize * envelope_size;
9914            #[allow(unused_variables)]
9915            let offset = encoder.out_of_line_offset(bytes_len);
9916            let mut _prev_end_offset: usize = 0;
9917            if 1 > max_ordinal {
9918                return Ok(());
9919            }
9920
9921            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9922            // are envelope_size bytes.
9923            let cur_offset: usize = (1 - 1) * envelope_size;
9924
9925            // Zero reserved fields.
9926            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9927
9928            // Safety:
9929            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9930            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9931            //   envelope_size bytes, there is always sufficient room.
9932            fidl::encoding::encode_in_envelope_optional::<
9933                fidl::encoding::HandleType<
9934                    fidl::Event,
9935                    { fidl::ObjectType::EVENT.into_raw() },
9936                    2147483648,
9937                >,
9938                fidl::encoding::DefaultFuchsiaResourceDialect,
9939            >(
9940                self.token.as_mut().map(
9941                    <fidl::encoding::HandleType<
9942                        fidl::Event,
9943                        { fidl::ObjectType::EVENT.into_raw() },
9944                        2147483648,
9945                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9946                ),
9947                encoder,
9948                offset + cur_offset,
9949                depth,
9950            )?;
9951
9952            _prev_end_offset = cur_offset + envelope_size;
9953            if 2 > max_ordinal {
9954                return Ok(());
9955            }
9956
9957            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9958            // are envelope_size bytes.
9959            let cur_offset: usize = (2 - 1) * envelope_size;
9960
9961            // Zero reserved fields.
9962            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9963
9964            // Safety:
9965            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9966            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9967            //   envelope_size bytes, there is always sufficient room.
9968            fidl::encoding::encode_in_envelope_optional::<
9969                u8,
9970                fidl::encoding::DefaultFuchsiaResourceDialect,
9971            >(
9972                self.level.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
9973                encoder,
9974                offset + cur_offset,
9975                depth,
9976            )?;
9977
9978            _prev_end_offset = cur_offset + envelope_size;
9979            if 3 > max_ordinal {
9980                return Ok(());
9981            }
9982
9983            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9984            // are envelope_size bytes.
9985            let cur_offset: usize = (3 - 1) * envelope_size;
9986
9987            // Zero reserved fields.
9988            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9989
9990            // Safety:
9991            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9992            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9993            //   envelope_size bytes, there is always sufficient room.
9994            fidl::encoding::encode_in_envelope_optional::<
9995                u64,
9996                fidl::encoding::DefaultFuchsiaResourceDialect,
9997            >(
9998                self.actual_hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
9999                encoder,
10000                offset + cur_offset,
10001                depth,
10002            )?;
10003
10004            _prev_end_offset = cur_offset + envelope_size;
10005
10006            Ok(())
10007        }
10008    }
10009
10010    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10011        for PowerElementProviderGetClockSpeedLevelResponse
10012    {
10013        #[inline(always)]
10014        fn new_empty() -> Self {
10015            Self::default()
10016        }
10017
10018        unsafe fn decode(
10019            &mut self,
10020            decoder: &mut fidl::encoding::Decoder<
10021                '_,
10022                fidl::encoding::DefaultFuchsiaResourceDialect,
10023            >,
10024            offset: usize,
10025            mut depth: fidl::encoding::Depth,
10026        ) -> fidl::Result<()> {
10027            decoder.debug_check_bounds::<Self>(offset);
10028            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10029                None => return Err(fidl::Error::NotNullable),
10030                Some(len) => len,
10031            };
10032            // Calling decoder.out_of_line_offset(0) is not allowed.
10033            if len == 0 {
10034                return Ok(());
10035            };
10036            depth.increment()?;
10037            let envelope_size = 8;
10038            let bytes_len = len * envelope_size;
10039            let offset = decoder.out_of_line_offset(bytes_len)?;
10040            // Decode the envelope for each type.
10041            let mut _next_ordinal_to_read = 0;
10042            let mut next_offset = offset;
10043            let end_offset = offset + bytes_len;
10044            _next_ordinal_to_read += 1;
10045            if next_offset >= end_offset {
10046                return Ok(());
10047            }
10048
10049            // Decode unknown envelopes for gaps in ordinals.
10050            while _next_ordinal_to_read < 1 {
10051                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10052                _next_ordinal_to_read += 1;
10053                next_offset += envelope_size;
10054            }
10055
10056            let next_out_of_line = decoder.next_out_of_line();
10057            let handles_before = decoder.remaining_handles();
10058            if let Some((inlined, num_bytes, num_handles)) =
10059                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10060            {
10061                let member_inline_size = <fidl::encoding::HandleType<
10062                    fidl::Event,
10063                    { fidl::ObjectType::EVENT.into_raw() },
10064                    2147483648,
10065                > as fidl::encoding::TypeMarker>::inline_size(
10066                    decoder.context
10067                );
10068                if inlined != (member_inline_size <= 4) {
10069                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10070                }
10071                let inner_offset;
10072                let mut inner_depth = depth.clone();
10073                if inlined {
10074                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10075                    inner_offset = next_offset;
10076                } else {
10077                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10078                    inner_depth.increment()?;
10079                }
10080                let val_ref =
10081                self.token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10082                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10083                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10084                {
10085                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10086                }
10087                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10088                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10089                }
10090            }
10091
10092            next_offset += envelope_size;
10093            _next_ordinal_to_read += 1;
10094            if next_offset >= end_offset {
10095                return Ok(());
10096            }
10097
10098            // Decode unknown envelopes for gaps in ordinals.
10099            while _next_ordinal_to_read < 2 {
10100                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10101                _next_ordinal_to_read += 1;
10102                next_offset += envelope_size;
10103            }
10104
10105            let next_out_of_line = decoder.next_out_of_line();
10106            let handles_before = decoder.remaining_handles();
10107            if let Some((inlined, num_bytes, num_handles)) =
10108                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10109            {
10110                let member_inline_size =
10111                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10112                if inlined != (member_inline_size <= 4) {
10113                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10114                }
10115                let inner_offset;
10116                let mut inner_depth = depth.clone();
10117                if inlined {
10118                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10119                    inner_offset = next_offset;
10120                } else {
10121                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10122                    inner_depth.increment()?;
10123                }
10124                let val_ref = self.level.get_or_insert_with(|| {
10125                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
10126                });
10127                fidl::decode!(
10128                    u8,
10129                    fidl::encoding::DefaultFuchsiaResourceDialect,
10130                    val_ref,
10131                    decoder,
10132                    inner_offset,
10133                    inner_depth
10134                )?;
10135                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10136                {
10137                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10138                }
10139                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10140                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10141                }
10142            }
10143
10144            next_offset += envelope_size;
10145            _next_ordinal_to_read += 1;
10146            if next_offset >= end_offset {
10147                return Ok(());
10148            }
10149
10150            // Decode unknown envelopes for gaps in ordinals.
10151            while _next_ordinal_to_read < 3 {
10152                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10153                _next_ordinal_to_read += 1;
10154                next_offset += envelope_size;
10155            }
10156
10157            let next_out_of_line = decoder.next_out_of_line();
10158            let handles_before = decoder.remaining_handles();
10159            if let Some((inlined, num_bytes, num_handles)) =
10160                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10161            {
10162                let member_inline_size =
10163                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10164                if inlined != (member_inline_size <= 4) {
10165                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10166                }
10167                let inner_offset;
10168                let mut inner_depth = depth.clone();
10169                if inlined {
10170                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10171                    inner_offset = next_offset;
10172                } else {
10173                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10174                    inner_depth.increment()?;
10175                }
10176                let val_ref = self.actual_hz.get_or_insert_with(|| {
10177                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
10178                });
10179                fidl::decode!(
10180                    u64,
10181                    fidl::encoding::DefaultFuchsiaResourceDialect,
10182                    val_ref,
10183                    decoder,
10184                    inner_offset,
10185                    inner_depth
10186                )?;
10187                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10188                {
10189                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10190                }
10191                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10192                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10193                }
10194            }
10195
10196            next_offset += envelope_size;
10197
10198            // Decode the remaining unknown envelopes.
10199            while next_offset < end_offset {
10200                _next_ordinal_to_read += 1;
10201                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10202                next_offset += envelope_size;
10203            }
10204
10205            Ok(())
10206        }
10207    }
10208
10209    impl PowerElementProviderSetClockLimitResponse {
10210        #[inline(always)]
10211        fn max_ordinal_present(&self) -> u64 {
10212            if let Some(_) = self.actual_hz {
10213                return 2;
10214            }
10215            if let Some(_) = self.handle {
10216                return 1;
10217            }
10218            0
10219        }
10220    }
10221
10222    impl fidl::encoding::ResourceTypeMarker for PowerElementProviderSetClockLimitResponse {
10223        type Borrowed<'a> = &'a mut Self;
10224        fn take_or_borrow<'a>(
10225            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10226        ) -> Self::Borrowed<'a> {
10227            value
10228        }
10229    }
10230
10231    unsafe impl fidl::encoding::TypeMarker for PowerElementProviderSetClockLimitResponse {
10232        type Owned = Self;
10233
10234        #[inline(always)]
10235        fn inline_align(_context: fidl::encoding::Context) -> usize {
10236            8
10237        }
10238
10239        #[inline(always)]
10240        fn inline_size(_context: fidl::encoding::Context) -> usize {
10241            16
10242        }
10243    }
10244
10245    unsafe impl
10246        fidl::encoding::Encode<
10247            PowerElementProviderSetClockLimitResponse,
10248            fidl::encoding::DefaultFuchsiaResourceDialect,
10249        > for &mut PowerElementProviderSetClockLimitResponse
10250    {
10251        unsafe fn encode(
10252            self,
10253            encoder: &mut fidl::encoding::Encoder<
10254                '_,
10255                fidl::encoding::DefaultFuchsiaResourceDialect,
10256            >,
10257            offset: usize,
10258            mut depth: fidl::encoding::Depth,
10259        ) -> fidl::Result<()> {
10260            encoder.debug_check_bounds::<PowerElementProviderSetClockLimitResponse>(offset);
10261            // Vector header
10262            let max_ordinal: u64 = self.max_ordinal_present();
10263            encoder.write_num(max_ordinal, offset);
10264            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10265            // Calling encoder.out_of_line_offset(0) is not allowed.
10266            if max_ordinal == 0 {
10267                return Ok(());
10268            }
10269            depth.increment()?;
10270            let envelope_size = 8;
10271            let bytes_len = max_ordinal as usize * envelope_size;
10272            #[allow(unused_variables)]
10273            let offset = encoder.out_of_line_offset(bytes_len);
10274            let mut _prev_end_offset: usize = 0;
10275            if 1 > max_ordinal {
10276                return Ok(());
10277            }
10278
10279            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10280            // are envelope_size bytes.
10281            let cur_offset: usize = (1 - 1) * envelope_size;
10282
10283            // Zero reserved fields.
10284            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10285
10286            // Safety:
10287            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10288            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10289            //   envelope_size bytes, there is always sufficient room.
10290            fidl::encoding::encode_in_envelope_optional::<
10291                fidl::encoding::HandleType<
10292                    fidl::EventPair,
10293                    { fidl::ObjectType::EVENTPAIR.into_raw() },
10294                    2147483648,
10295                >,
10296                fidl::encoding::DefaultFuchsiaResourceDialect,
10297            >(
10298                self.handle.as_mut().map(
10299                    <fidl::encoding::HandleType<
10300                        fidl::EventPair,
10301                        { fidl::ObjectType::EVENTPAIR.into_raw() },
10302                        2147483648,
10303                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10304                ),
10305                encoder,
10306                offset + cur_offset,
10307                depth,
10308            )?;
10309
10310            _prev_end_offset = cur_offset + envelope_size;
10311            if 2 > max_ordinal {
10312                return Ok(());
10313            }
10314
10315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10316            // are envelope_size bytes.
10317            let cur_offset: usize = (2 - 1) * envelope_size;
10318
10319            // Zero reserved fields.
10320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10321
10322            // Safety:
10323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10325            //   envelope_size bytes, there is always sufficient room.
10326            fidl::encoding::encode_in_envelope_optional::<
10327                u64,
10328                fidl::encoding::DefaultFuchsiaResourceDialect,
10329            >(
10330                self.actual_hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10331                encoder,
10332                offset + cur_offset,
10333                depth,
10334            )?;
10335
10336            _prev_end_offset = cur_offset + envelope_size;
10337
10338            Ok(())
10339        }
10340    }
10341
10342    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10343        for PowerElementProviderSetClockLimitResponse
10344    {
10345        #[inline(always)]
10346        fn new_empty() -> Self {
10347            Self::default()
10348        }
10349
10350        unsafe fn decode(
10351            &mut self,
10352            decoder: &mut fidl::encoding::Decoder<
10353                '_,
10354                fidl::encoding::DefaultFuchsiaResourceDialect,
10355            >,
10356            offset: usize,
10357            mut depth: fidl::encoding::Depth,
10358        ) -> fidl::Result<()> {
10359            decoder.debug_check_bounds::<Self>(offset);
10360            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10361                None => return Err(fidl::Error::NotNullable),
10362                Some(len) => len,
10363            };
10364            // Calling decoder.out_of_line_offset(0) is not allowed.
10365            if len == 0 {
10366                return Ok(());
10367            };
10368            depth.increment()?;
10369            let envelope_size = 8;
10370            let bytes_len = len * envelope_size;
10371            let offset = decoder.out_of_line_offset(bytes_len)?;
10372            // Decode the envelope for each type.
10373            let mut _next_ordinal_to_read = 0;
10374            let mut next_offset = offset;
10375            let end_offset = offset + bytes_len;
10376            _next_ordinal_to_read += 1;
10377            if next_offset >= end_offset {
10378                return Ok(());
10379            }
10380
10381            // Decode unknown envelopes for gaps in ordinals.
10382            while _next_ordinal_to_read < 1 {
10383                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10384                _next_ordinal_to_read += 1;
10385                next_offset += envelope_size;
10386            }
10387
10388            let next_out_of_line = decoder.next_out_of_line();
10389            let handles_before = decoder.remaining_handles();
10390            if let Some((inlined, num_bytes, num_handles)) =
10391                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10392            {
10393                let member_inline_size = <fidl::encoding::HandleType<
10394                    fidl::EventPair,
10395                    { fidl::ObjectType::EVENTPAIR.into_raw() },
10396                    2147483648,
10397                > as fidl::encoding::TypeMarker>::inline_size(
10398                    decoder.context
10399                );
10400                if inlined != (member_inline_size <= 4) {
10401                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10402                }
10403                let inner_offset;
10404                let mut inner_depth = depth.clone();
10405                if inlined {
10406                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10407                    inner_offset = next_offset;
10408                } else {
10409                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10410                    inner_depth.increment()?;
10411                }
10412                let val_ref =
10413                self.handle.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10414                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10415                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10416                {
10417                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10418                }
10419                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10420                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10421                }
10422            }
10423
10424            next_offset += envelope_size;
10425            _next_ordinal_to_read += 1;
10426            if next_offset >= end_offset {
10427                return Ok(());
10428            }
10429
10430            // Decode unknown envelopes for gaps in ordinals.
10431            while _next_ordinal_to_read < 2 {
10432                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10433                _next_ordinal_to_read += 1;
10434                next_offset += envelope_size;
10435            }
10436
10437            let next_out_of_line = decoder.next_out_of_line();
10438            let handles_before = decoder.remaining_handles();
10439            if let Some((inlined, num_bytes, num_handles)) =
10440                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10441            {
10442                let member_inline_size =
10443                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10444                if inlined != (member_inline_size <= 4) {
10445                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10446                }
10447                let inner_offset;
10448                let mut inner_depth = depth.clone();
10449                if inlined {
10450                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10451                    inner_offset = next_offset;
10452                } else {
10453                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10454                    inner_depth.increment()?;
10455                }
10456                let val_ref = self.actual_hz.get_or_insert_with(|| {
10457                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
10458                });
10459                fidl::decode!(
10460                    u64,
10461                    fidl::encoding::DefaultFuchsiaResourceDialect,
10462                    val_ref,
10463                    decoder,
10464                    inner_offset,
10465                    inner_depth
10466                )?;
10467                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10468                {
10469                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10470                }
10471                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10472                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10473                }
10474            }
10475
10476            next_offset += envelope_size;
10477
10478            // Decode the remaining unknown envelopes.
10479            while next_offset < end_offset {
10480                _next_ordinal_to_read += 1;
10481                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10482                next_offset += envelope_size;
10483            }
10484
10485            Ok(())
10486        }
10487    }
10488
10489    impl PowerGoal {
10490        #[inline(always)]
10491        fn max_ordinal_present(&self) -> u64 {
10492            if let Some(_) = self.token {
10493                return 2;
10494            }
10495            if let Some(_) = self.type_ {
10496                return 1;
10497            }
10498            0
10499        }
10500    }
10501
10502    impl fidl::encoding::ResourceTypeMarker for PowerGoal {
10503        type Borrowed<'a> = &'a mut Self;
10504        fn take_or_borrow<'a>(
10505            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10506        ) -> Self::Borrowed<'a> {
10507            value
10508        }
10509    }
10510
10511    unsafe impl fidl::encoding::TypeMarker for PowerGoal {
10512        type Owned = Self;
10513
10514        #[inline(always)]
10515        fn inline_align(_context: fidl::encoding::Context) -> usize {
10516            8
10517        }
10518
10519        #[inline(always)]
10520        fn inline_size(_context: fidl::encoding::Context) -> usize {
10521            16
10522        }
10523    }
10524
10525    unsafe impl fidl::encoding::Encode<PowerGoal, fidl::encoding::DefaultFuchsiaResourceDialect>
10526        for &mut PowerGoal
10527    {
10528        unsafe fn encode(
10529            self,
10530            encoder: &mut fidl::encoding::Encoder<
10531                '_,
10532                fidl::encoding::DefaultFuchsiaResourceDialect,
10533            >,
10534            offset: usize,
10535            mut depth: fidl::encoding::Depth,
10536        ) -> fidl::Result<()> {
10537            encoder.debug_check_bounds::<PowerGoal>(offset);
10538            // Vector header
10539            let max_ordinal: u64 = self.max_ordinal_present();
10540            encoder.write_num(max_ordinal, offset);
10541            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10542            // Calling encoder.out_of_line_offset(0) is not allowed.
10543            if max_ordinal == 0 {
10544                return Ok(());
10545            }
10546            depth.increment()?;
10547            let envelope_size = 8;
10548            let bytes_len = max_ordinal as usize * envelope_size;
10549            #[allow(unused_variables)]
10550            let offset = encoder.out_of_line_offset(bytes_len);
10551            let mut _prev_end_offset: usize = 0;
10552            if 1 > max_ordinal {
10553                return Ok(());
10554            }
10555
10556            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10557            // are envelope_size bytes.
10558            let cur_offset: usize = (1 - 1) * envelope_size;
10559
10560            // Zero reserved fields.
10561            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10562
10563            // Safety:
10564            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10565            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10566            //   envelope_size bytes, there is always sufficient room.
10567            fidl::encoding::encode_in_envelope_optional::<
10568                PowerGoalType,
10569                fidl::encoding::DefaultFuchsiaResourceDialect,
10570            >(
10571                self.type_.as_ref().map(<PowerGoalType as fidl::encoding::ValueTypeMarker>::borrow),
10572                encoder,
10573                offset + cur_offset,
10574                depth,
10575            )?;
10576
10577            _prev_end_offset = cur_offset + envelope_size;
10578            if 2 > max_ordinal {
10579                return Ok(());
10580            }
10581
10582            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10583            // are envelope_size bytes.
10584            let cur_offset: usize = (2 - 1) * envelope_size;
10585
10586            // Zero reserved fields.
10587            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10588
10589            // Safety:
10590            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10591            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10592            //   envelope_size bytes, there is always sufficient room.
10593            fidl::encoding::encode_in_envelope_optional::<
10594                fidl::encoding::HandleType<
10595                    fidl::Event,
10596                    { fidl::ObjectType::EVENT.into_raw() },
10597                    2147483648,
10598                >,
10599                fidl::encoding::DefaultFuchsiaResourceDialect,
10600            >(
10601                self.token.as_mut().map(
10602                    <fidl::encoding::HandleType<
10603                        fidl::Event,
10604                        { fidl::ObjectType::EVENT.into_raw() },
10605                        2147483648,
10606                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
10607                ),
10608                encoder,
10609                offset + cur_offset,
10610                depth,
10611            )?;
10612
10613            _prev_end_offset = cur_offset + envelope_size;
10614
10615            Ok(())
10616        }
10617    }
10618
10619    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for PowerGoal {
10620        #[inline(always)]
10621        fn new_empty() -> Self {
10622            Self::default()
10623        }
10624
10625        unsafe fn decode(
10626            &mut self,
10627            decoder: &mut fidl::encoding::Decoder<
10628                '_,
10629                fidl::encoding::DefaultFuchsiaResourceDialect,
10630            >,
10631            offset: usize,
10632            mut depth: fidl::encoding::Depth,
10633        ) -> fidl::Result<()> {
10634            decoder.debug_check_bounds::<Self>(offset);
10635            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10636                None => return Err(fidl::Error::NotNullable),
10637                Some(len) => len,
10638            };
10639            // Calling decoder.out_of_line_offset(0) is not allowed.
10640            if len == 0 {
10641                return Ok(());
10642            };
10643            depth.increment()?;
10644            let envelope_size = 8;
10645            let bytes_len = len * envelope_size;
10646            let offset = decoder.out_of_line_offset(bytes_len)?;
10647            // Decode the envelope for each type.
10648            let mut _next_ordinal_to_read = 0;
10649            let mut next_offset = offset;
10650            let end_offset = offset + bytes_len;
10651            _next_ordinal_to_read += 1;
10652            if next_offset >= end_offset {
10653                return Ok(());
10654            }
10655
10656            // Decode unknown envelopes for gaps in ordinals.
10657            while _next_ordinal_to_read < 1 {
10658                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10659                _next_ordinal_to_read += 1;
10660                next_offset += envelope_size;
10661            }
10662
10663            let next_out_of_line = decoder.next_out_of_line();
10664            let handles_before = decoder.remaining_handles();
10665            if let Some((inlined, num_bytes, num_handles)) =
10666                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10667            {
10668                let member_inline_size =
10669                    <PowerGoalType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10670                if inlined != (member_inline_size <= 4) {
10671                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10672                }
10673                let inner_offset;
10674                let mut inner_depth = depth.clone();
10675                if inlined {
10676                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10677                    inner_offset = next_offset;
10678                } else {
10679                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10680                    inner_depth.increment()?;
10681                }
10682                let val_ref = self.type_.get_or_insert_with(|| {
10683                    fidl::new_empty!(PowerGoalType, fidl::encoding::DefaultFuchsiaResourceDialect)
10684                });
10685                fidl::decode!(
10686                    PowerGoalType,
10687                    fidl::encoding::DefaultFuchsiaResourceDialect,
10688                    val_ref,
10689                    decoder,
10690                    inner_offset,
10691                    inner_depth
10692                )?;
10693                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10694                {
10695                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10696                }
10697                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10698                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10699                }
10700            }
10701
10702            next_offset += envelope_size;
10703            _next_ordinal_to_read += 1;
10704            if next_offset >= end_offset {
10705                return Ok(());
10706            }
10707
10708            // Decode unknown envelopes for gaps in ordinals.
10709            while _next_ordinal_to_read < 2 {
10710                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10711                _next_ordinal_to_read += 1;
10712                next_offset += envelope_size;
10713            }
10714
10715            let next_out_of_line = decoder.next_out_of_line();
10716            let handles_before = decoder.remaining_handles();
10717            if let Some((inlined, num_bytes, num_handles)) =
10718                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10719            {
10720                let member_inline_size = <fidl::encoding::HandleType<
10721                    fidl::Event,
10722                    { fidl::ObjectType::EVENT.into_raw() },
10723                    2147483648,
10724                > as fidl::encoding::TypeMarker>::inline_size(
10725                    decoder.context
10726                );
10727                if inlined != (member_inline_size <= 4) {
10728                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10729                }
10730                let inner_offset;
10731                let mut inner_depth = depth.clone();
10732                if inlined {
10733                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10734                    inner_offset = next_offset;
10735                } else {
10736                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10737                    inner_depth.increment()?;
10738                }
10739                let val_ref =
10740                self.token.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
10741                fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10742                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10743                {
10744                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10745                }
10746                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10747                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10748                }
10749            }
10750
10751            next_offset += envelope_size;
10752
10753            // Decode the remaining unknown envelopes.
10754            while next_offset < end_offset {
10755                _next_ordinal_to_read += 1;
10756                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10757                next_offset += envelope_size;
10758            }
10759
10760            Ok(())
10761        }
10762    }
10763
10764    impl PrimaryImportObjectRequest {
10765        #[inline(always)]
10766        fn max_ordinal_present(&self) -> u64 {
10767            if let Some(_) = self.flags {
10768                return 4;
10769            }
10770            if let Some(_) = self.object_id {
10771                return 3;
10772            }
10773            if let Some(_) = self.object_type {
10774                return 2;
10775            }
10776            if let Some(_) = self.object {
10777                return 1;
10778            }
10779            0
10780        }
10781    }
10782
10783    impl fidl::encoding::ResourceTypeMarker for PrimaryImportObjectRequest {
10784        type Borrowed<'a> = &'a mut Self;
10785        fn take_or_borrow<'a>(
10786            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10787        ) -> Self::Borrowed<'a> {
10788            value
10789        }
10790    }
10791
10792    unsafe impl fidl::encoding::TypeMarker for PrimaryImportObjectRequest {
10793        type Owned = Self;
10794
10795        #[inline(always)]
10796        fn inline_align(_context: fidl::encoding::Context) -> usize {
10797            8
10798        }
10799
10800        #[inline(always)]
10801        fn inline_size(_context: fidl::encoding::Context) -> usize {
10802            16
10803        }
10804    }
10805
10806    unsafe impl
10807        fidl::encoding::Encode<
10808            PrimaryImportObjectRequest,
10809            fidl::encoding::DefaultFuchsiaResourceDialect,
10810        > for &mut PrimaryImportObjectRequest
10811    {
10812        unsafe fn encode(
10813            self,
10814            encoder: &mut fidl::encoding::Encoder<
10815                '_,
10816                fidl::encoding::DefaultFuchsiaResourceDialect,
10817            >,
10818            offset: usize,
10819            mut depth: fidl::encoding::Depth,
10820        ) -> fidl::Result<()> {
10821            encoder.debug_check_bounds::<PrimaryImportObjectRequest>(offset);
10822            // Vector header
10823            let max_ordinal: u64 = self.max_ordinal_present();
10824            encoder.write_num(max_ordinal, offset);
10825            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10826            // Calling encoder.out_of_line_offset(0) is not allowed.
10827            if max_ordinal == 0 {
10828                return Ok(());
10829            }
10830            depth.increment()?;
10831            let envelope_size = 8;
10832            let bytes_len = max_ordinal as usize * envelope_size;
10833            #[allow(unused_variables)]
10834            let offset = encoder.out_of_line_offset(bytes_len);
10835            let mut _prev_end_offset: usize = 0;
10836            if 1 > max_ordinal {
10837                return Ok(());
10838            }
10839
10840            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10841            // are envelope_size bytes.
10842            let cur_offset: usize = (1 - 1) * envelope_size;
10843
10844            // Zero reserved fields.
10845            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10846
10847            // Safety:
10848            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10849            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10850            //   envelope_size bytes, there is always sufficient room.
10851            fidl::encoding::encode_in_envelope_optional::<
10852                Object,
10853                fidl::encoding::DefaultFuchsiaResourceDialect,
10854            >(
10855                self.object
10856                    .as_mut()
10857                    .map(<Object as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10858                encoder,
10859                offset + cur_offset,
10860                depth,
10861            )?;
10862
10863            _prev_end_offset = cur_offset + envelope_size;
10864            if 2 > max_ordinal {
10865                return Ok(());
10866            }
10867
10868            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10869            // are envelope_size bytes.
10870            let cur_offset: usize = (2 - 1) * envelope_size;
10871
10872            // Zero reserved fields.
10873            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10874
10875            // Safety:
10876            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10877            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10878            //   envelope_size bytes, there is always sufficient room.
10879            fidl::encoding::encode_in_envelope_optional::<
10880                ObjectType,
10881                fidl::encoding::DefaultFuchsiaResourceDialect,
10882            >(
10883                self.object_type
10884                    .as_ref()
10885                    .map(<ObjectType as fidl::encoding::ValueTypeMarker>::borrow),
10886                encoder,
10887                offset + cur_offset,
10888                depth,
10889            )?;
10890
10891            _prev_end_offset = cur_offset + envelope_size;
10892            if 3 > max_ordinal {
10893                return Ok(());
10894            }
10895
10896            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10897            // are envelope_size bytes.
10898            let cur_offset: usize = (3 - 1) * envelope_size;
10899
10900            // Zero reserved fields.
10901            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10902
10903            // Safety:
10904            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10905            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10906            //   envelope_size bytes, there is always sufficient room.
10907            fidl::encoding::encode_in_envelope_optional::<
10908                u64,
10909                fidl::encoding::DefaultFuchsiaResourceDialect,
10910            >(
10911                self.object_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10912                encoder,
10913                offset + cur_offset,
10914                depth,
10915            )?;
10916
10917            _prev_end_offset = cur_offset + envelope_size;
10918            if 4 > max_ordinal {
10919                return Ok(());
10920            }
10921
10922            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10923            // are envelope_size bytes.
10924            let cur_offset: usize = (4 - 1) * envelope_size;
10925
10926            // Zero reserved fields.
10927            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10928
10929            // Safety:
10930            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10931            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10932            //   envelope_size bytes, there is always sufficient room.
10933            fidl::encoding::encode_in_envelope_optional::<
10934                ImportFlags,
10935                fidl::encoding::DefaultFuchsiaResourceDialect,
10936            >(
10937                self.flags.as_ref().map(<ImportFlags as fidl::encoding::ValueTypeMarker>::borrow),
10938                encoder,
10939                offset + cur_offset,
10940                depth,
10941            )?;
10942
10943            _prev_end_offset = cur_offset + envelope_size;
10944
10945            Ok(())
10946        }
10947    }
10948
10949    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10950        for PrimaryImportObjectRequest
10951    {
10952        #[inline(always)]
10953        fn new_empty() -> Self {
10954            Self::default()
10955        }
10956
10957        unsafe fn decode(
10958            &mut self,
10959            decoder: &mut fidl::encoding::Decoder<
10960                '_,
10961                fidl::encoding::DefaultFuchsiaResourceDialect,
10962            >,
10963            offset: usize,
10964            mut depth: fidl::encoding::Depth,
10965        ) -> fidl::Result<()> {
10966            decoder.debug_check_bounds::<Self>(offset);
10967            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10968                None => return Err(fidl::Error::NotNullable),
10969                Some(len) => len,
10970            };
10971            // Calling decoder.out_of_line_offset(0) is not allowed.
10972            if len == 0 {
10973                return Ok(());
10974            };
10975            depth.increment()?;
10976            let envelope_size = 8;
10977            let bytes_len = len * envelope_size;
10978            let offset = decoder.out_of_line_offset(bytes_len)?;
10979            // Decode the envelope for each type.
10980            let mut _next_ordinal_to_read = 0;
10981            let mut next_offset = offset;
10982            let end_offset = offset + bytes_len;
10983            _next_ordinal_to_read += 1;
10984            if next_offset >= end_offset {
10985                return Ok(());
10986            }
10987
10988            // Decode unknown envelopes for gaps in ordinals.
10989            while _next_ordinal_to_read < 1 {
10990                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10991                _next_ordinal_to_read += 1;
10992                next_offset += envelope_size;
10993            }
10994
10995            let next_out_of_line = decoder.next_out_of_line();
10996            let handles_before = decoder.remaining_handles();
10997            if let Some((inlined, num_bytes, num_handles)) =
10998                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10999            {
11000                let member_inline_size =
11001                    <Object as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11002                if inlined != (member_inline_size <= 4) {
11003                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11004                }
11005                let inner_offset;
11006                let mut inner_depth = depth.clone();
11007                if inlined {
11008                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11009                    inner_offset = next_offset;
11010                } else {
11011                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11012                    inner_depth.increment()?;
11013                }
11014                let val_ref = self.object.get_or_insert_with(|| {
11015                    fidl::new_empty!(Object, fidl::encoding::DefaultFuchsiaResourceDialect)
11016                });
11017                fidl::decode!(
11018                    Object,
11019                    fidl::encoding::DefaultFuchsiaResourceDialect,
11020                    val_ref,
11021                    decoder,
11022                    inner_offset,
11023                    inner_depth
11024                )?;
11025                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11026                {
11027                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11028                }
11029                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11030                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11031                }
11032            }
11033
11034            next_offset += envelope_size;
11035            _next_ordinal_to_read += 1;
11036            if next_offset >= end_offset {
11037                return Ok(());
11038            }
11039
11040            // Decode unknown envelopes for gaps in ordinals.
11041            while _next_ordinal_to_read < 2 {
11042                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11043                _next_ordinal_to_read += 1;
11044                next_offset += envelope_size;
11045            }
11046
11047            let next_out_of_line = decoder.next_out_of_line();
11048            let handles_before = decoder.remaining_handles();
11049            if let Some((inlined, num_bytes, num_handles)) =
11050                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11051            {
11052                let member_inline_size =
11053                    <ObjectType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11054                if inlined != (member_inline_size <= 4) {
11055                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11056                }
11057                let inner_offset;
11058                let mut inner_depth = depth.clone();
11059                if inlined {
11060                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11061                    inner_offset = next_offset;
11062                } else {
11063                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11064                    inner_depth.increment()?;
11065                }
11066                let val_ref = self.object_type.get_or_insert_with(|| {
11067                    fidl::new_empty!(ObjectType, fidl::encoding::DefaultFuchsiaResourceDialect)
11068                });
11069                fidl::decode!(
11070                    ObjectType,
11071                    fidl::encoding::DefaultFuchsiaResourceDialect,
11072                    val_ref,
11073                    decoder,
11074                    inner_offset,
11075                    inner_depth
11076                )?;
11077                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11078                {
11079                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11080                }
11081                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11082                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11083                }
11084            }
11085
11086            next_offset += envelope_size;
11087            _next_ordinal_to_read += 1;
11088            if next_offset >= end_offset {
11089                return Ok(());
11090            }
11091
11092            // Decode unknown envelopes for gaps in ordinals.
11093            while _next_ordinal_to_read < 3 {
11094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11095                _next_ordinal_to_read += 1;
11096                next_offset += envelope_size;
11097            }
11098
11099            let next_out_of_line = decoder.next_out_of_line();
11100            let handles_before = decoder.remaining_handles();
11101            if let Some((inlined, num_bytes, num_handles)) =
11102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11103            {
11104                let member_inline_size =
11105                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11106                if inlined != (member_inline_size <= 4) {
11107                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11108                }
11109                let inner_offset;
11110                let mut inner_depth = depth.clone();
11111                if inlined {
11112                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11113                    inner_offset = next_offset;
11114                } else {
11115                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11116                    inner_depth.increment()?;
11117                }
11118                let val_ref = self.object_id.get_or_insert_with(|| {
11119                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
11120                });
11121                fidl::decode!(
11122                    u64,
11123                    fidl::encoding::DefaultFuchsiaResourceDialect,
11124                    val_ref,
11125                    decoder,
11126                    inner_offset,
11127                    inner_depth
11128                )?;
11129                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11130                {
11131                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11132                }
11133                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11134                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11135                }
11136            }
11137
11138            next_offset += envelope_size;
11139            _next_ordinal_to_read += 1;
11140            if next_offset >= end_offset {
11141                return Ok(());
11142            }
11143
11144            // Decode unknown envelopes for gaps in ordinals.
11145            while _next_ordinal_to_read < 4 {
11146                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11147                _next_ordinal_to_read += 1;
11148                next_offset += envelope_size;
11149            }
11150
11151            let next_out_of_line = decoder.next_out_of_line();
11152            let handles_before = decoder.remaining_handles();
11153            if let Some((inlined, num_bytes, num_handles)) =
11154                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11155            {
11156                let member_inline_size =
11157                    <ImportFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11158                if inlined != (member_inline_size <= 4) {
11159                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11160                }
11161                let inner_offset;
11162                let mut inner_depth = depth.clone();
11163                if inlined {
11164                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11165                    inner_offset = next_offset;
11166                } else {
11167                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11168                    inner_depth.increment()?;
11169                }
11170                let val_ref = self.flags.get_or_insert_with(|| {
11171                    fidl::new_empty!(ImportFlags, fidl::encoding::DefaultFuchsiaResourceDialect)
11172                });
11173                fidl::decode!(
11174                    ImportFlags,
11175                    fidl::encoding::DefaultFuchsiaResourceDialect,
11176                    val_ref,
11177                    decoder,
11178                    inner_offset,
11179                    inner_depth
11180                )?;
11181                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11182                {
11183                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11184                }
11185                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11186                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11187                }
11188            }
11189
11190            next_offset += envelope_size;
11191
11192            // Decode the remaining unknown envelopes.
11193            while next_offset < end_offset {
11194                _next_ordinal_to_read += 1;
11195                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11196                next_offset += envelope_size;
11197            }
11198
11199            Ok(())
11200        }
11201    }
11202
11203    impl fidl::encoding::ResourceTypeMarker for DeviceQueryResponse {
11204        type Borrowed<'a> = &'a mut Self;
11205        fn take_or_borrow<'a>(
11206            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11207        ) -> Self::Borrowed<'a> {
11208            value
11209        }
11210    }
11211
11212    unsafe impl fidl::encoding::TypeMarker for DeviceQueryResponse {
11213        type Owned = Self;
11214
11215        #[inline(always)]
11216        fn inline_align(_context: fidl::encoding::Context) -> usize {
11217            8
11218        }
11219
11220        #[inline(always)]
11221        fn inline_size(_context: fidl::encoding::Context) -> usize {
11222            16
11223        }
11224    }
11225
11226    unsafe impl
11227        fidl::encoding::Encode<DeviceQueryResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
11228        for &mut DeviceQueryResponse
11229    {
11230        #[inline]
11231        unsafe fn encode(
11232            self,
11233            encoder: &mut fidl::encoding::Encoder<
11234                '_,
11235                fidl::encoding::DefaultFuchsiaResourceDialect,
11236            >,
11237            offset: usize,
11238            _depth: fidl::encoding::Depth,
11239        ) -> fidl::Result<()> {
11240            encoder.debug_check_bounds::<DeviceQueryResponse>(offset);
11241            encoder.write_num::<u64>(self.ordinal(), offset);
11242            match self {
11243                DeviceQueryResponse::SimpleResult(ref val) => fidl::encoding::encode_in_envelope::<
11244                    u64,
11245                    fidl::encoding::DefaultFuchsiaResourceDialect,
11246                >(
11247                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
11248                    encoder,
11249                    offset + 8,
11250                    _depth,
11251                ),
11252                DeviceQueryResponse::BufferResult(ref mut val) => {
11253                    fidl::encoding::encode_in_envelope::<
11254                        fidl::encoding::HandleType<
11255                            fidl::Vmo,
11256                            { fidl::ObjectType::VMO.into_raw() },
11257                            2147483648,
11258                        >,
11259                        fidl::encoding::DefaultFuchsiaResourceDialect,
11260                    >(
11261                        <fidl::encoding::HandleType<
11262                            fidl::Vmo,
11263                            { fidl::ObjectType::VMO.into_raw() },
11264                            2147483648,
11265                        > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11266                            val
11267                        ),
11268                        encoder,
11269                        offset + 8,
11270                        _depth,
11271                    )
11272                }
11273            }
11274        }
11275    }
11276
11277    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11278        for DeviceQueryResponse
11279    {
11280        #[inline(always)]
11281        fn new_empty() -> Self {
11282            Self::SimpleResult(fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect))
11283        }
11284
11285        #[inline]
11286        unsafe fn decode(
11287            &mut self,
11288            decoder: &mut fidl::encoding::Decoder<
11289                '_,
11290                fidl::encoding::DefaultFuchsiaResourceDialect,
11291            >,
11292            offset: usize,
11293            mut depth: fidl::encoding::Depth,
11294        ) -> fidl::Result<()> {
11295            decoder.debug_check_bounds::<Self>(offset);
11296            #[allow(unused_variables)]
11297            let next_out_of_line = decoder.next_out_of_line();
11298            let handles_before = decoder.remaining_handles();
11299            let (ordinal, inlined, num_bytes, num_handles) =
11300                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
11301
11302            let member_inline_size = match ordinal {
11303                1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11304                2 => <fidl::encoding::HandleType<
11305                    fidl::Vmo,
11306                    { fidl::ObjectType::VMO.into_raw() },
11307                    2147483648,
11308                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11309                _ => return Err(fidl::Error::UnknownUnionTag),
11310            };
11311
11312            if inlined != (member_inline_size <= 4) {
11313                return Err(fidl::Error::InvalidInlineBitInEnvelope);
11314            }
11315            let _inner_offset;
11316            if inlined {
11317                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
11318                _inner_offset = offset + 8;
11319            } else {
11320                depth.increment()?;
11321                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11322            }
11323            match ordinal {
11324                1 => {
11325                    #[allow(irrefutable_let_patterns)]
11326                    if let DeviceQueryResponse::SimpleResult(_) = self {
11327                        // Do nothing, read the value into the object
11328                    } else {
11329                        // Initialize `self` to the right variant
11330                        *self = DeviceQueryResponse::SimpleResult(fidl::new_empty!(
11331                            u64,
11332                            fidl::encoding::DefaultFuchsiaResourceDialect
11333                        ));
11334                    }
11335                    #[allow(irrefutable_let_patterns)]
11336                    if let DeviceQueryResponse::SimpleResult(ref mut val) = self {
11337                        fidl::decode!(
11338                            u64,
11339                            fidl::encoding::DefaultFuchsiaResourceDialect,
11340                            val,
11341                            decoder,
11342                            _inner_offset,
11343                            depth
11344                        )?;
11345                    } else {
11346                        unreachable!()
11347                    }
11348                }
11349                2 => {
11350                    #[allow(irrefutable_let_patterns)]
11351                    if let DeviceQueryResponse::BufferResult(_) = self {
11352                        // Do nothing, read the value into the object
11353                    } else {
11354                        // Initialize `self` to the right variant
11355                        *self = DeviceQueryResponse::BufferResult(
11356                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11357                        );
11358                    }
11359                    #[allow(irrefutable_let_patterns)]
11360                    if let DeviceQueryResponse::BufferResult(ref mut val) = self {
11361                        fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
11362                    } else {
11363                        unreachable!()
11364                    }
11365                }
11366                ordinal => panic!("unexpected ordinal {:?}", ordinal),
11367            }
11368            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
11369                return Err(fidl::Error::InvalidNumBytesInEnvelope);
11370            }
11371            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11372                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11373            }
11374            Ok(())
11375        }
11376    }
11377
11378    impl fidl::encoding::ResourceTypeMarker for Object {
11379        type Borrowed<'a> = &'a mut Self;
11380        fn take_or_borrow<'a>(
11381            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11382        ) -> Self::Borrowed<'a> {
11383            value
11384        }
11385    }
11386
11387    unsafe impl fidl::encoding::TypeMarker for Object {
11388        type Owned = Self;
11389
11390        #[inline(always)]
11391        fn inline_align(_context: fidl::encoding::Context) -> usize {
11392            8
11393        }
11394
11395        #[inline(always)]
11396        fn inline_size(_context: fidl::encoding::Context) -> usize {
11397            16
11398        }
11399    }
11400
11401    unsafe impl fidl::encoding::Encode<Object, fidl::encoding::DefaultFuchsiaResourceDialect>
11402        for &mut Object
11403    {
11404        #[inline]
11405        unsafe fn encode(
11406            self,
11407            encoder: &mut fidl::encoding::Encoder<
11408                '_,
11409                fidl::encoding::DefaultFuchsiaResourceDialect,
11410            >,
11411            offset: usize,
11412            _depth: fidl::encoding::Depth,
11413        ) -> fidl::Result<()> {
11414            encoder.debug_check_bounds::<Object>(offset);
11415            encoder.write_num::<u64>(self.ordinal(), offset);
11416            match self {
11417                Object::Semaphore(ref mut val) => fidl::encoding::encode_in_envelope::<
11418                    fidl::encoding::HandleType<
11419                        fidl::Event,
11420                        { fidl::ObjectType::EVENT.into_raw() },
11421                        2147483648,
11422                    >,
11423                    fidl::encoding::DefaultFuchsiaResourceDialect,
11424                >(
11425                    <fidl::encoding::HandleType<
11426                        fidl::Event,
11427                        { fidl::ObjectType::EVENT.into_raw() },
11428                        2147483648,
11429                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11430                        val
11431                    ),
11432                    encoder,
11433                    offset + 8,
11434                    _depth,
11435                ),
11436                Object::Buffer(ref mut val) => fidl::encoding::encode_in_envelope::<
11437                    fidl::encoding::HandleType<
11438                        fidl::Vmo,
11439                        { fidl::ObjectType::VMO.into_raw() },
11440                        2147483648,
11441                    >,
11442                    fidl::encoding::DefaultFuchsiaResourceDialect,
11443                >(
11444                    <fidl::encoding::HandleType<
11445                        fidl::Vmo,
11446                        { fidl::ObjectType::VMO.into_raw() },
11447                        2147483648,
11448                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11449                        val
11450                    ),
11451                    encoder,
11452                    offset + 8,
11453                    _depth,
11454                ),
11455                Object::VmoSemaphore(ref mut val) => fidl::encoding::encode_in_envelope::<
11456                    fidl::encoding::HandleType<
11457                        fidl::Vmo,
11458                        { fidl::ObjectType::VMO.into_raw() },
11459                        2147483648,
11460                    >,
11461                    fidl::encoding::DefaultFuchsiaResourceDialect,
11462                >(
11463                    <fidl::encoding::HandleType<
11464                        fidl::Vmo,
11465                        { fidl::ObjectType::VMO.into_raw() },
11466                        2147483648,
11467                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11468                        val
11469                    ),
11470                    encoder,
11471                    offset + 8,
11472                    _depth,
11473                ),
11474                Object::CounterSemaphore(ref mut val) => fidl::encoding::encode_in_envelope::<
11475                    fidl::encoding::HandleType<
11476                        fidl::Counter,
11477                        { fidl::ObjectType::COUNTER.into_raw() },
11478                        2147483648,
11479                    >,
11480                    fidl::encoding::DefaultFuchsiaResourceDialect,
11481                >(
11482                    <fidl::encoding::HandleType<
11483                        fidl::Counter,
11484                        { fidl::ObjectType::COUNTER.into_raw() },
11485                        2147483648,
11486                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
11487                        val
11488                    ),
11489                    encoder,
11490                    offset + 8,
11491                    _depth,
11492                ),
11493                Object::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
11494            }
11495        }
11496    }
11497
11498    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Object {
11499        #[inline(always)]
11500        fn new_empty() -> Self {
11501            Self::__SourceBreaking { unknown_ordinal: 0 }
11502        }
11503
11504        #[inline]
11505        unsafe fn decode(
11506            &mut self,
11507            decoder: &mut fidl::encoding::Decoder<
11508                '_,
11509                fidl::encoding::DefaultFuchsiaResourceDialect,
11510            >,
11511            offset: usize,
11512            mut depth: fidl::encoding::Depth,
11513        ) -> fidl::Result<()> {
11514            decoder.debug_check_bounds::<Self>(offset);
11515            #[allow(unused_variables)]
11516            let next_out_of_line = decoder.next_out_of_line();
11517            let handles_before = decoder.remaining_handles();
11518            let (ordinal, inlined, num_bytes, num_handles) =
11519                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
11520
11521            let member_inline_size = match ordinal {
11522                1 => <fidl::encoding::HandleType<
11523                    fidl::Event,
11524                    { fidl::ObjectType::EVENT.into_raw() },
11525                    2147483648,
11526                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11527                2 => <fidl::encoding::HandleType<
11528                    fidl::Vmo,
11529                    { fidl::ObjectType::VMO.into_raw() },
11530                    2147483648,
11531                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11532                3 => <fidl::encoding::HandleType<
11533                    fidl::Vmo,
11534                    { fidl::ObjectType::VMO.into_raw() },
11535                    2147483648,
11536                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11537                4 => <fidl::encoding::HandleType<
11538                    fidl::Counter,
11539                    { fidl::ObjectType::COUNTER.into_raw() },
11540                    2147483648,
11541                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11542                0 => return Err(fidl::Error::UnknownUnionTag),
11543                _ => num_bytes as usize,
11544            };
11545
11546            if inlined != (member_inline_size <= 4) {
11547                return Err(fidl::Error::InvalidInlineBitInEnvelope);
11548            }
11549            let _inner_offset;
11550            if inlined {
11551                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
11552                _inner_offset = offset + 8;
11553            } else {
11554                depth.increment()?;
11555                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11556            }
11557            match ordinal {
11558                1 => {
11559                    #[allow(irrefutable_let_patterns)]
11560                    if let Object::Semaphore(_) = self {
11561                        // Do nothing, read the value into the object
11562                    } else {
11563                        // Initialize `self` to the right variant
11564                        *self = Object::Semaphore(
11565                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11566                        );
11567                    }
11568                    #[allow(irrefutable_let_patterns)]
11569                    if let Object::Semaphore(ref mut val) = self {
11570                        fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
11571                    } else {
11572                        unreachable!()
11573                    }
11574                }
11575                2 => {
11576                    #[allow(irrefutable_let_patterns)]
11577                    if let Object::Buffer(_) = self {
11578                        // Do nothing, read the value into the object
11579                    } else {
11580                        // Initialize `self` to the right variant
11581                        *self = Object::Buffer(
11582                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11583                        );
11584                    }
11585                    #[allow(irrefutable_let_patterns)]
11586                    if let Object::Buffer(ref mut val) = self {
11587                        fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
11588                    } else {
11589                        unreachable!()
11590                    }
11591                }
11592                3 => {
11593                    #[allow(irrefutable_let_patterns)]
11594                    if let Object::VmoSemaphore(_) = self {
11595                        // Do nothing, read the value into the object
11596                    } else {
11597                        // Initialize `self` to the right variant
11598                        *self = Object::VmoSemaphore(
11599                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11600                        );
11601                    }
11602                    #[allow(irrefutable_let_patterns)]
11603                    if let Object::VmoSemaphore(ref mut val) = self {
11604                        fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
11605                    } else {
11606                        unreachable!()
11607                    }
11608                }
11609                4 => {
11610                    #[allow(irrefutable_let_patterns)]
11611                    if let Object::CounterSemaphore(_) = self {
11612                        // Do nothing, read the value into the object
11613                    } else {
11614                        // Initialize `self` to the right variant
11615                        *self = Object::CounterSemaphore(
11616                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
11617                        );
11618                    }
11619                    #[allow(irrefutable_let_patterns)]
11620                    if let Object::CounterSemaphore(ref mut val) = self {
11621                        fidl::decode!(fidl::encoding::HandleType<fidl::Counter, { fidl::ObjectType::COUNTER.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
11622                    } else {
11623                        unreachable!()
11624                    }
11625                }
11626                #[allow(deprecated)]
11627                ordinal => {
11628                    for _ in 0..num_handles {
11629                        decoder.drop_next_handle()?;
11630                    }
11631                    *self = Object::__SourceBreaking { unknown_ordinal: ordinal };
11632                }
11633            }
11634            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
11635                return Err(fidl::Error::InvalidNumBytesInEnvelope);
11636            }
11637            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11638                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11639            }
11640            Ok(())
11641        }
11642    }
11643}