Skip to main content

fidl_fuchsia_driver_lab/
fidl_fuchsia_driver_lab.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_driver_lab_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ProxyOpenSessionRequest {
16    pub context: RunContext,
17    pub mode: SessionMode,
18    pub expectations: Expectations,
19    pub allowlist: Vec<AccessRule>,
20    pub session: fidl::endpoints::ServerEnd<SessionMarker>,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ProxyOpenSessionRequest {}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct SessionOpenGpioRequest {
27    pub resource: u32,
28    pub endpoint: fidl::endpoints::ServerEnd<GpioEndpointMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionOpenGpioRequest {}
32
33#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct SessionOpenI2cRequest {
35    pub resource: u32,
36    pub endpoint: fidl::endpoints::ServerEnd<I2cEndpointMarker>,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionOpenI2cRequest {}
40
41#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
42pub struct SessionOpenSpiRequest {
43    pub resource: u32,
44    pub endpoint: fidl::endpoints::ServerEnd<SpiEndpointMarker>,
45}
46
47impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for SessionOpenSpiRequest {}
48
49#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
50pub struct GpioEndpointMarker;
51
52impl fidl::endpoints::ProtocolMarker for GpioEndpointMarker {
53    type Proxy = GpioEndpointProxy;
54    type RequestStream = GpioEndpointRequestStream;
55    #[cfg(target_os = "fuchsia")]
56    type SynchronousProxy = GpioEndpointSynchronousProxy;
57
58    const DEBUG_NAME: &'static str = "(anonymous) GpioEndpoint";
59}
60pub type GpioEndpointReadResult = Result<(bool, u64, i64), OperationError>;
61pub type GpioEndpointWriteResult = Result<(u64, i64), OperationError>;
62
63pub trait GpioEndpointProxyInterface: Send + Sync {
64    type ReadResponseFut: std::future::Future<Output = Result<GpioEndpointReadResult, fidl::Error>>
65        + Send;
66    fn r#read(&self) -> Self::ReadResponseFut;
67    type WriteResponseFut: std::future::Future<Output = Result<GpioEndpointWriteResult, fidl::Error>>
68        + Send;
69    fn r#write(&self, value: bool) -> Self::WriteResponseFut;
70}
71#[derive(Debug)]
72#[cfg(target_os = "fuchsia")]
73pub struct GpioEndpointSynchronousProxy {
74    client: fidl::client::sync::Client,
75}
76
77#[cfg(target_os = "fuchsia")]
78impl fidl::endpoints::SynchronousProxy for GpioEndpointSynchronousProxy {
79    type Proxy = GpioEndpointProxy;
80    type Protocol = GpioEndpointMarker;
81
82    fn from_channel(inner: fidl::Channel) -> Self {
83        Self::new(inner)
84    }
85
86    fn into_channel(self) -> fidl::Channel {
87        self.client.into_channel()
88    }
89
90    fn as_channel(&self) -> &fidl::Channel {
91        self.client.as_channel()
92    }
93}
94
95#[cfg(target_os = "fuchsia")]
96impl GpioEndpointSynchronousProxy {
97    pub fn new(channel: fidl::Channel) -> Self {
98        Self { client: fidl::client::sync::Client::new(channel) }
99    }
100
101    pub fn into_channel(self) -> fidl::Channel {
102        self.client.into_channel()
103    }
104
105    /// Waits until an event arrives and returns it. It is safe for other
106    /// threads to make concurrent requests while waiting for an event.
107    pub fn wait_for_event(
108        &self,
109        deadline: zx::MonotonicInstant,
110    ) -> Result<GpioEndpointEvent, fidl::Error> {
111        GpioEndpointEvent::decode(self.client.wait_for_event::<GpioEndpointMarker>(deadline)?)
112    }
113
114    pub fn r#read(
115        &self,
116        ___deadline: zx::MonotonicInstant,
117    ) -> Result<GpioEndpointReadResult, fidl::Error> {
118        let _response = self.client.send_query::<
119            fidl::encoding::EmptyPayload,
120            fidl::encoding::FlexibleResultType<GpioReadResult, OperationError>,
121            GpioEndpointMarker,
122        >(
123            (),
124            0xb7efebe5882f6f1,
125            fidl::encoding::DynamicFlags::FLEXIBLE,
126            ___deadline,
127        )?
128        .into_result::<GpioEndpointMarker>("read")?;
129        Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
130    }
131
132    pub fn r#write(
133        &self,
134        mut value: bool,
135        ___deadline: zx::MonotonicInstant,
136    ) -> Result<GpioEndpointWriteResult, fidl::Error> {
137        let _response = self.client.send_query::<
138            GpioEndpointWriteRequest,
139            fidl::encoding::FlexibleResultType<GpioWriteResult, OperationError>,
140            GpioEndpointMarker,
141        >(
142            (value,),
143            0x3d1822432f45c309,
144            fidl::encoding::DynamicFlags::FLEXIBLE,
145            ___deadline,
146        )?
147        .into_result::<GpioEndpointMarker>("write")?;
148        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
149    }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl From<GpioEndpointSynchronousProxy> for zx::NullableHandle {
154    fn from(value: GpioEndpointSynchronousProxy) -> Self {
155        value.into_channel().into()
156    }
157}
158
159#[cfg(target_os = "fuchsia")]
160impl From<fidl::Channel> for GpioEndpointSynchronousProxy {
161    fn from(value: fidl::Channel) -> Self {
162        Self::new(value)
163    }
164}
165
166#[cfg(target_os = "fuchsia")]
167impl fidl::endpoints::FromClient for GpioEndpointSynchronousProxy {
168    type Protocol = GpioEndpointMarker;
169
170    fn from_client(value: fidl::endpoints::ClientEnd<GpioEndpointMarker>) -> Self {
171        Self::new(value.into_channel())
172    }
173}
174
175#[derive(Debug, Clone)]
176pub struct GpioEndpointProxy {
177    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
178}
179
180impl fidl::endpoints::Proxy for GpioEndpointProxy {
181    type Protocol = GpioEndpointMarker;
182
183    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
184        Self::new(inner)
185    }
186
187    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
188        self.client.into_channel().map_err(|client| Self { client })
189    }
190
191    fn as_channel(&self) -> &::fidl::AsyncChannel {
192        self.client.as_channel()
193    }
194}
195
196impl GpioEndpointProxy {
197    /// Create a new Proxy for fuchsia.driver.lab/GpioEndpoint.
198    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
199        let protocol_name = <GpioEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
200        Self { client: fidl::client::Client::new(channel, protocol_name) }
201    }
202
203    /// Get a Stream of events from the remote end of the protocol.
204    ///
205    /// # Panics
206    ///
207    /// Panics if the event stream was already taken.
208    pub fn take_event_stream(&self) -> GpioEndpointEventStream {
209        GpioEndpointEventStream { event_receiver: self.client.take_event_receiver() }
210    }
211
212    pub fn r#read(
213        &self,
214    ) -> fidl::client::QueryResponseFut<
215        GpioEndpointReadResult,
216        fidl::encoding::DefaultFuchsiaResourceDialect,
217    > {
218        GpioEndpointProxyInterface::r#read(self)
219    }
220
221    pub fn r#write(
222        &self,
223        mut value: bool,
224    ) -> fidl::client::QueryResponseFut<
225        GpioEndpointWriteResult,
226        fidl::encoding::DefaultFuchsiaResourceDialect,
227    > {
228        GpioEndpointProxyInterface::r#write(self, value)
229    }
230}
231
232impl GpioEndpointProxyInterface for GpioEndpointProxy {
233    type ReadResponseFut = fidl::client::QueryResponseFut<
234        GpioEndpointReadResult,
235        fidl::encoding::DefaultFuchsiaResourceDialect,
236    >;
237    fn r#read(&self) -> Self::ReadResponseFut {
238        fn _decode(
239            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
240        ) -> Result<GpioEndpointReadResult, fidl::Error> {
241            let _response = fidl::client::decode_transaction_body::<
242                fidl::encoding::FlexibleResultType<GpioReadResult, OperationError>,
243                fidl::encoding::DefaultFuchsiaResourceDialect,
244                0xb7efebe5882f6f1,
245            >(_buf?)?
246            .into_result::<GpioEndpointMarker>("read")?;
247            Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
248        }
249        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, GpioEndpointReadResult>(
250            (),
251            0xb7efebe5882f6f1,
252            fidl::encoding::DynamicFlags::FLEXIBLE,
253            _decode,
254        )
255    }
256
257    type WriteResponseFut = fidl::client::QueryResponseFut<
258        GpioEndpointWriteResult,
259        fidl::encoding::DefaultFuchsiaResourceDialect,
260    >;
261    fn r#write(&self, mut value: bool) -> Self::WriteResponseFut {
262        fn _decode(
263            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
264        ) -> Result<GpioEndpointWriteResult, fidl::Error> {
265            let _response = fidl::client::decode_transaction_body::<
266                fidl::encoding::FlexibleResultType<GpioWriteResult, OperationError>,
267                fidl::encoding::DefaultFuchsiaResourceDialect,
268                0x3d1822432f45c309,
269            >(_buf?)?
270            .into_result::<GpioEndpointMarker>("write")?;
271            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
272        }
273        self.client.send_query_and_decode::<GpioEndpointWriteRequest, GpioEndpointWriteResult>(
274            (value,),
275            0x3d1822432f45c309,
276            fidl::encoding::DynamicFlags::FLEXIBLE,
277            _decode,
278        )
279    }
280}
281
282pub struct GpioEndpointEventStream {
283    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
284}
285
286impl std::marker::Unpin for GpioEndpointEventStream {}
287
288impl futures::stream::FusedStream for GpioEndpointEventStream {
289    fn is_terminated(&self) -> bool {
290        self.event_receiver.is_terminated()
291    }
292}
293
294impl futures::Stream for GpioEndpointEventStream {
295    type Item = Result<GpioEndpointEvent, fidl::Error>;
296
297    fn poll_next(
298        mut self: std::pin::Pin<&mut Self>,
299        cx: &mut std::task::Context<'_>,
300    ) -> std::task::Poll<Option<Self::Item>> {
301        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
302            &mut self.event_receiver,
303            cx
304        )?) {
305            Some(buf) => std::task::Poll::Ready(Some(GpioEndpointEvent::decode(buf))),
306            None => std::task::Poll::Ready(None),
307        }
308    }
309}
310
311#[derive(Debug)]
312pub enum GpioEndpointEvent {
313    #[non_exhaustive]
314    _UnknownEvent {
315        /// Ordinal of the event that was sent.
316        ordinal: u64,
317    },
318}
319
320impl GpioEndpointEvent {
321    /// Decodes a message buffer as a [`GpioEndpointEvent`].
322    fn decode(
323        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
324    ) -> Result<GpioEndpointEvent, fidl::Error> {
325        let (bytes, _handles) = buf.split_mut();
326        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
327        debug_assert_eq!(tx_header.tx_id, 0);
328        match tx_header.ordinal {
329            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
330                Ok(GpioEndpointEvent::_UnknownEvent { ordinal: tx_header.ordinal })
331            }
332            _ => Err(fidl::Error::UnknownOrdinal {
333                ordinal: tx_header.ordinal,
334                protocol_name: <GpioEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
335            }),
336        }
337    }
338}
339
340/// A Stream of incoming requests for fuchsia.driver.lab/GpioEndpoint.
341pub struct GpioEndpointRequestStream {
342    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
343    is_terminated: bool,
344}
345
346impl std::marker::Unpin for GpioEndpointRequestStream {}
347
348impl futures::stream::FusedStream for GpioEndpointRequestStream {
349    fn is_terminated(&self) -> bool {
350        self.is_terminated
351    }
352}
353
354impl fidl::endpoints::RequestStream for GpioEndpointRequestStream {
355    type Protocol = GpioEndpointMarker;
356    type ControlHandle = GpioEndpointControlHandle;
357
358    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
359        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
360    }
361
362    fn control_handle(&self) -> Self::ControlHandle {
363        GpioEndpointControlHandle { inner: self.inner.clone() }
364    }
365
366    fn into_inner(
367        self,
368    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
369    {
370        (self.inner, self.is_terminated)
371    }
372
373    fn from_inner(
374        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
375        is_terminated: bool,
376    ) -> Self {
377        Self { inner, is_terminated }
378    }
379}
380
381impl futures::Stream for GpioEndpointRequestStream {
382    type Item = Result<GpioEndpointRequest, fidl::Error>;
383
384    fn poll_next(
385        mut self: std::pin::Pin<&mut Self>,
386        cx: &mut std::task::Context<'_>,
387    ) -> std::task::Poll<Option<Self::Item>> {
388        let this = &mut *self;
389        if this.inner.check_shutdown(cx) {
390            this.is_terminated = true;
391            return std::task::Poll::Ready(None);
392        }
393        if this.is_terminated {
394            panic!("polled GpioEndpointRequestStream after completion");
395        }
396        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
397            |bytes, handles| {
398                match this.inner.channel().read_etc(cx, bytes, handles) {
399                    std::task::Poll::Ready(Ok(())) => {}
400                    std::task::Poll::Pending => return std::task::Poll::Pending,
401                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
402                        this.is_terminated = true;
403                        return std::task::Poll::Ready(None);
404                    }
405                    std::task::Poll::Ready(Err(e)) => {
406                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
407                            e.into(),
408                        ))));
409                    }
410                }
411
412                // A message has been received from the channel
413                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
414
415                std::task::Poll::Ready(Some(match header.ordinal {
416                    0xb7efebe5882f6f1 => {
417                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
418                        let mut req = fidl::new_empty!(
419                            fidl::encoding::EmptyPayload,
420                            fidl::encoding::DefaultFuchsiaResourceDialect
421                        );
422                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
423                        let control_handle =
424                            GpioEndpointControlHandle { inner: this.inner.clone() };
425                        Ok(GpioEndpointRequest::Read {
426                            responder: GpioEndpointReadResponder {
427                                control_handle: std::mem::ManuallyDrop::new(control_handle),
428                                tx_id: header.tx_id,
429                            },
430                        })
431                    }
432                    0x3d1822432f45c309 => {
433                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
434                        let mut req = fidl::new_empty!(
435                            GpioEndpointWriteRequest,
436                            fidl::encoding::DefaultFuchsiaResourceDialect
437                        );
438                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<GpioEndpointWriteRequest>(&header, _body_bytes, handles, &mut req)?;
439                        let control_handle =
440                            GpioEndpointControlHandle { inner: this.inner.clone() };
441                        Ok(GpioEndpointRequest::Write {
442                            value: req.value,
443
444                            responder: GpioEndpointWriteResponder {
445                                control_handle: std::mem::ManuallyDrop::new(control_handle),
446                                tx_id: header.tx_id,
447                            },
448                        })
449                    }
450                    _ if header.tx_id == 0
451                        && header
452                            .dynamic_flags()
453                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
454                    {
455                        Ok(GpioEndpointRequest::_UnknownMethod {
456                            ordinal: header.ordinal,
457                            control_handle: GpioEndpointControlHandle { inner: this.inner.clone() },
458                            method_type: fidl::MethodType::OneWay,
459                        })
460                    }
461                    _ if header
462                        .dynamic_flags()
463                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
464                    {
465                        this.inner.send_framework_err(
466                            fidl::encoding::FrameworkErr::UnknownMethod,
467                            header.tx_id,
468                            header.ordinal,
469                            header.dynamic_flags(),
470                            (bytes, handles),
471                        )?;
472                        Ok(GpioEndpointRequest::_UnknownMethod {
473                            ordinal: header.ordinal,
474                            control_handle: GpioEndpointControlHandle { inner: this.inner.clone() },
475                            method_type: fidl::MethodType::TwoWay,
476                        })
477                    }
478                    _ => Err(fidl::Error::UnknownOrdinal {
479                        ordinal: header.ordinal,
480                        protocol_name:
481                            <GpioEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
482                    }),
483                }))
484            },
485        )
486    }
487}
488
489/// Typed endpoint for a GPIO protocol resource.
490#[derive(Debug)]
491pub enum GpioEndpointRequest {
492    Read {
493        responder: GpioEndpointReadResponder,
494    },
495    Write {
496        value: bool,
497        responder: GpioEndpointWriteResponder,
498    },
499    /// An interaction was received which does not match any known method.
500    #[non_exhaustive]
501    _UnknownMethod {
502        /// Ordinal of the method that was called.
503        ordinal: u64,
504        control_handle: GpioEndpointControlHandle,
505        method_type: fidl::MethodType,
506    },
507}
508
509impl GpioEndpointRequest {
510    #[allow(irrefutable_let_patterns)]
511    pub fn into_read(self) -> Option<(GpioEndpointReadResponder)> {
512        if let GpioEndpointRequest::Read { responder } = self { Some((responder)) } else { None }
513    }
514
515    #[allow(irrefutable_let_patterns)]
516    pub fn into_write(self) -> Option<(bool, GpioEndpointWriteResponder)> {
517        if let GpioEndpointRequest::Write { value, responder } = self {
518            Some((value, responder))
519        } else {
520            None
521        }
522    }
523
524    /// Name of the method defined in FIDL
525    pub fn method_name(&self) -> &'static str {
526        match *self {
527            GpioEndpointRequest::Read { .. } => "read",
528            GpioEndpointRequest::Write { .. } => "write",
529            GpioEndpointRequest::_UnknownMethod {
530                method_type: fidl::MethodType::OneWay, ..
531            } => "unknown one-way method",
532            GpioEndpointRequest::_UnknownMethod {
533                method_type: fidl::MethodType::TwoWay, ..
534            } => "unknown two-way method",
535        }
536    }
537}
538
539#[derive(Debug, Clone)]
540pub struct GpioEndpointControlHandle {
541    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
542}
543
544impl GpioEndpointControlHandle {
545    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
546        self.inner.shutdown_with_epitaph(status.into())
547    }
548}
549
550impl fidl::endpoints::ControlHandle for GpioEndpointControlHandle {
551    fn shutdown(&self) {
552        self.inner.shutdown()
553    }
554
555    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
556        self.inner.shutdown_with_epitaph(status)
557    }
558
559    fn is_closed(&self) -> bool {
560        self.inner.channel().is_closed()
561    }
562    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
563        self.inner.channel().on_closed()
564    }
565
566    #[cfg(target_os = "fuchsia")]
567    fn signal_peer(
568        &self,
569        clear_mask: zx::Signals,
570        set_mask: zx::Signals,
571    ) -> Result<(), zx_status::Status> {
572        use fidl::Peered;
573        self.inner.channel().signal_peer(clear_mask, set_mask)
574    }
575}
576
577impl GpioEndpointControlHandle {}
578
579#[must_use = "FIDL methods require a response to be sent"]
580#[derive(Debug)]
581pub struct GpioEndpointReadResponder {
582    control_handle: std::mem::ManuallyDrop<GpioEndpointControlHandle>,
583    tx_id: u32,
584}
585
586/// Set the the channel to be shutdown (see [`GpioEndpointControlHandle::shutdown`])
587/// if the responder is dropped without sending a response, so that the client
588/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
589impl std::ops::Drop for GpioEndpointReadResponder {
590    fn drop(&mut self) {
591        self.control_handle.shutdown();
592        // Safety: drops once, never accessed again
593        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
594    }
595}
596
597impl fidl::endpoints::Responder for GpioEndpointReadResponder {
598    type ControlHandle = GpioEndpointControlHandle;
599
600    fn control_handle(&self) -> &GpioEndpointControlHandle {
601        &self.control_handle
602    }
603
604    fn drop_without_shutdown(mut self) {
605        // Safety: drops once, never accessed again due to mem::forget
606        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
607        // Prevent Drop from running (which would shut down the channel)
608        std::mem::forget(self);
609    }
610}
611
612impl GpioEndpointReadResponder {
613    /// Sends a response to the FIDL transaction.
614    ///
615    /// Sets the channel to shutdown if an error occurs.
616    pub fn send(
617        self,
618        mut result: Result<(bool, u64, i64), OperationError>,
619    ) -> Result<(), fidl::Error> {
620        let _result = self.send_raw(result);
621        if _result.is_err() {
622            self.control_handle.shutdown();
623        }
624        self.drop_without_shutdown();
625        _result
626    }
627
628    /// Similar to "send" but does not shutdown the channel if an error occurs.
629    pub fn send_no_shutdown_on_err(
630        self,
631        mut result: Result<(bool, u64, i64), OperationError>,
632    ) -> Result<(), fidl::Error> {
633        let _result = self.send_raw(result);
634        self.drop_without_shutdown();
635        _result
636    }
637
638    fn send_raw(
639        &self,
640        mut result: Result<(bool, u64, i64), OperationError>,
641    ) -> Result<(), fidl::Error> {
642        self.control_handle
643            .inner
644            .send::<fidl::encoding::FlexibleResultType<GpioReadResult, OperationError>>(
645                fidl::encoding::FlexibleResult::new(result),
646                self.tx_id,
647                0xb7efebe5882f6f1,
648                fidl::encoding::DynamicFlags::FLEXIBLE,
649            )
650    }
651}
652
653#[must_use = "FIDL methods require a response to be sent"]
654#[derive(Debug)]
655pub struct GpioEndpointWriteResponder {
656    control_handle: std::mem::ManuallyDrop<GpioEndpointControlHandle>,
657    tx_id: u32,
658}
659
660/// Set the the channel to be shutdown (see [`GpioEndpointControlHandle::shutdown`])
661/// if the responder is dropped without sending a response, so that the client
662/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
663impl std::ops::Drop for GpioEndpointWriteResponder {
664    fn drop(&mut self) {
665        self.control_handle.shutdown();
666        // Safety: drops once, never accessed again
667        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
668    }
669}
670
671impl fidl::endpoints::Responder for GpioEndpointWriteResponder {
672    type ControlHandle = GpioEndpointControlHandle;
673
674    fn control_handle(&self) -> &GpioEndpointControlHandle {
675        &self.control_handle
676    }
677
678    fn drop_without_shutdown(mut self) {
679        // Safety: drops once, never accessed again due to mem::forget
680        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
681        // Prevent Drop from running (which would shut down the channel)
682        std::mem::forget(self);
683    }
684}
685
686impl GpioEndpointWriteResponder {
687    /// Sends a response to the FIDL transaction.
688    ///
689    /// Sets the channel to shutdown if an error occurs.
690    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
691        let _result = self.send_raw(result);
692        if _result.is_err() {
693            self.control_handle.shutdown();
694        }
695        self.drop_without_shutdown();
696        _result
697    }
698
699    /// Similar to "send" but does not shutdown the channel if an error occurs.
700    pub fn send_no_shutdown_on_err(
701        self,
702        mut result: Result<(u64, i64), OperationError>,
703    ) -> Result<(), fidl::Error> {
704        let _result = self.send_raw(result);
705        self.drop_without_shutdown();
706        _result
707    }
708
709    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
710        self.control_handle
711            .inner
712            .send::<fidl::encoding::FlexibleResultType<GpioWriteResult, OperationError>>(
713                fidl::encoding::FlexibleResult::new(result),
714                self.tx_id,
715                0x3d1822432f45c309,
716                fidl::encoding::DynamicFlags::FLEXIBLE,
717            )
718    }
719}
720
721#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
722pub struct I2cEndpointMarker;
723
724impl fidl::endpoints::ProtocolMarker for I2cEndpointMarker {
725    type Proxy = I2cEndpointProxy;
726    type RequestStream = I2cEndpointRequestStream;
727    #[cfg(target_os = "fuchsia")]
728    type SynchronousProxy = I2cEndpointSynchronousProxy;
729
730    const DEBUG_NAME: &'static str = "(anonymous) I2cEndpoint";
731}
732pub type I2cEndpointTransferResult = Result<(Vec<u8>, u64, i64), OperationError>;
733
734pub trait I2cEndpointProxyInterface: Send + Sync {
735    type TransferResponseFut: std::future::Future<Output = Result<I2cEndpointTransferResult, fidl::Error>>
736        + Send;
737    fn r#transfer(&self, write_data: &[u8], read_length: u32) -> Self::TransferResponseFut;
738}
739#[derive(Debug)]
740#[cfg(target_os = "fuchsia")]
741pub struct I2cEndpointSynchronousProxy {
742    client: fidl::client::sync::Client,
743}
744
745#[cfg(target_os = "fuchsia")]
746impl fidl::endpoints::SynchronousProxy for I2cEndpointSynchronousProxy {
747    type Proxy = I2cEndpointProxy;
748    type Protocol = I2cEndpointMarker;
749
750    fn from_channel(inner: fidl::Channel) -> Self {
751        Self::new(inner)
752    }
753
754    fn into_channel(self) -> fidl::Channel {
755        self.client.into_channel()
756    }
757
758    fn as_channel(&self) -> &fidl::Channel {
759        self.client.as_channel()
760    }
761}
762
763#[cfg(target_os = "fuchsia")]
764impl I2cEndpointSynchronousProxy {
765    pub fn new(channel: fidl::Channel) -> Self {
766        Self { client: fidl::client::sync::Client::new(channel) }
767    }
768
769    pub fn into_channel(self) -> fidl::Channel {
770        self.client.into_channel()
771    }
772
773    /// Waits until an event arrives and returns it. It is safe for other
774    /// threads to make concurrent requests while waiting for an event.
775    pub fn wait_for_event(
776        &self,
777        deadline: zx::MonotonicInstant,
778    ) -> Result<I2cEndpointEvent, fidl::Error> {
779        I2cEndpointEvent::decode(self.client.wait_for_event::<I2cEndpointMarker>(deadline)?)
780    }
781
782    pub fn r#transfer(
783        &self,
784        mut write_data: &[u8],
785        mut read_length: u32,
786        ___deadline: zx::MonotonicInstant,
787    ) -> Result<I2cEndpointTransferResult, fidl::Error> {
788        let _response = self.client.send_query::<
789            I2cEndpointTransferRequest,
790            fidl::encoding::FlexibleResultType<I2cTransferResult, OperationError>,
791            I2cEndpointMarker,
792        >(
793            (write_data, read_length,),
794            0xbb27bd944e8143,
795            fidl::encoding::DynamicFlags::FLEXIBLE,
796            ___deadline,
797        )?
798        .into_result::<I2cEndpointMarker>("transfer")?;
799        Ok(_response.map(|x| (x.read_data, x.audit_seq, x.timestamp_ns)))
800    }
801}
802
803#[cfg(target_os = "fuchsia")]
804impl From<I2cEndpointSynchronousProxy> for zx::NullableHandle {
805    fn from(value: I2cEndpointSynchronousProxy) -> Self {
806        value.into_channel().into()
807    }
808}
809
810#[cfg(target_os = "fuchsia")]
811impl From<fidl::Channel> for I2cEndpointSynchronousProxy {
812    fn from(value: fidl::Channel) -> Self {
813        Self::new(value)
814    }
815}
816
817#[cfg(target_os = "fuchsia")]
818impl fidl::endpoints::FromClient for I2cEndpointSynchronousProxy {
819    type Protocol = I2cEndpointMarker;
820
821    fn from_client(value: fidl::endpoints::ClientEnd<I2cEndpointMarker>) -> Self {
822        Self::new(value.into_channel())
823    }
824}
825
826#[derive(Debug, Clone)]
827pub struct I2cEndpointProxy {
828    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
829}
830
831impl fidl::endpoints::Proxy for I2cEndpointProxy {
832    type Protocol = I2cEndpointMarker;
833
834    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
835        Self::new(inner)
836    }
837
838    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
839        self.client.into_channel().map_err(|client| Self { client })
840    }
841
842    fn as_channel(&self) -> &::fidl::AsyncChannel {
843        self.client.as_channel()
844    }
845}
846
847impl I2cEndpointProxy {
848    /// Create a new Proxy for fuchsia.driver.lab/I2cEndpoint.
849    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
850        let protocol_name = <I2cEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
851        Self { client: fidl::client::Client::new(channel, protocol_name) }
852    }
853
854    /// Get a Stream of events from the remote end of the protocol.
855    ///
856    /// # Panics
857    ///
858    /// Panics if the event stream was already taken.
859    pub fn take_event_stream(&self) -> I2cEndpointEventStream {
860        I2cEndpointEventStream { event_receiver: self.client.take_event_receiver() }
861    }
862
863    pub fn r#transfer(
864        &self,
865        mut write_data: &[u8],
866        mut read_length: u32,
867    ) -> fidl::client::QueryResponseFut<
868        I2cEndpointTransferResult,
869        fidl::encoding::DefaultFuchsiaResourceDialect,
870    > {
871        I2cEndpointProxyInterface::r#transfer(self, write_data, read_length)
872    }
873}
874
875impl I2cEndpointProxyInterface for I2cEndpointProxy {
876    type TransferResponseFut = fidl::client::QueryResponseFut<
877        I2cEndpointTransferResult,
878        fidl::encoding::DefaultFuchsiaResourceDialect,
879    >;
880    fn r#transfer(&self, mut write_data: &[u8], mut read_length: u32) -> Self::TransferResponseFut {
881        fn _decode(
882            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
883        ) -> Result<I2cEndpointTransferResult, fidl::Error> {
884            let _response = fidl::client::decode_transaction_body::<
885                fidl::encoding::FlexibleResultType<I2cTransferResult, OperationError>,
886                fidl::encoding::DefaultFuchsiaResourceDialect,
887                0xbb27bd944e8143,
888            >(_buf?)?
889            .into_result::<I2cEndpointMarker>("transfer")?;
890            Ok(_response.map(|x| (x.read_data, x.audit_seq, x.timestamp_ns)))
891        }
892        self.client.send_query_and_decode::<I2cEndpointTransferRequest, I2cEndpointTransferResult>(
893            (write_data, read_length),
894            0xbb27bd944e8143,
895            fidl::encoding::DynamicFlags::FLEXIBLE,
896            _decode,
897        )
898    }
899}
900
901pub struct I2cEndpointEventStream {
902    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
903}
904
905impl std::marker::Unpin for I2cEndpointEventStream {}
906
907impl futures::stream::FusedStream for I2cEndpointEventStream {
908    fn is_terminated(&self) -> bool {
909        self.event_receiver.is_terminated()
910    }
911}
912
913impl futures::Stream for I2cEndpointEventStream {
914    type Item = Result<I2cEndpointEvent, fidl::Error>;
915
916    fn poll_next(
917        mut self: std::pin::Pin<&mut Self>,
918        cx: &mut std::task::Context<'_>,
919    ) -> std::task::Poll<Option<Self::Item>> {
920        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
921            &mut self.event_receiver,
922            cx
923        )?) {
924            Some(buf) => std::task::Poll::Ready(Some(I2cEndpointEvent::decode(buf))),
925            None => std::task::Poll::Ready(None),
926        }
927    }
928}
929
930#[derive(Debug)]
931pub enum I2cEndpointEvent {
932    #[non_exhaustive]
933    _UnknownEvent {
934        /// Ordinal of the event that was sent.
935        ordinal: u64,
936    },
937}
938
939impl I2cEndpointEvent {
940    /// Decodes a message buffer as a [`I2cEndpointEvent`].
941    fn decode(
942        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
943    ) -> Result<I2cEndpointEvent, fidl::Error> {
944        let (bytes, _handles) = buf.split_mut();
945        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
946        debug_assert_eq!(tx_header.tx_id, 0);
947        match tx_header.ordinal {
948            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
949                Ok(I2cEndpointEvent::_UnknownEvent { ordinal: tx_header.ordinal })
950            }
951            _ => Err(fidl::Error::UnknownOrdinal {
952                ordinal: tx_header.ordinal,
953                protocol_name: <I2cEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
954            }),
955        }
956    }
957}
958
959/// A Stream of incoming requests for fuchsia.driver.lab/I2cEndpoint.
960pub struct I2cEndpointRequestStream {
961    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
962    is_terminated: bool,
963}
964
965impl std::marker::Unpin for I2cEndpointRequestStream {}
966
967impl futures::stream::FusedStream for I2cEndpointRequestStream {
968    fn is_terminated(&self) -> bool {
969        self.is_terminated
970    }
971}
972
973impl fidl::endpoints::RequestStream for I2cEndpointRequestStream {
974    type Protocol = I2cEndpointMarker;
975    type ControlHandle = I2cEndpointControlHandle;
976
977    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
978        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
979    }
980
981    fn control_handle(&self) -> Self::ControlHandle {
982        I2cEndpointControlHandle { inner: self.inner.clone() }
983    }
984
985    fn into_inner(
986        self,
987    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
988    {
989        (self.inner, self.is_terminated)
990    }
991
992    fn from_inner(
993        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
994        is_terminated: bool,
995    ) -> Self {
996        Self { inner, is_terminated }
997    }
998}
999
1000impl futures::Stream for I2cEndpointRequestStream {
1001    type Item = Result<I2cEndpointRequest, fidl::Error>;
1002
1003    fn poll_next(
1004        mut self: std::pin::Pin<&mut Self>,
1005        cx: &mut std::task::Context<'_>,
1006    ) -> std::task::Poll<Option<Self::Item>> {
1007        let this = &mut *self;
1008        if this.inner.check_shutdown(cx) {
1009            this.is_terminated = true;
1010            return std::task::Poll::Ready(None);
1011        }
1012        if this.is_terminated {
1013            panic!("polled I2cEndpointRequestStream after completion");
1014        }
1015        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1016            |bytes, handles| {
1017                match this.inner.channel().read_etc(cx, bytes, handles) {
1018                    std::task::Poll::Ready(Ok(())) => {}
1019                    std::task::Poll::Pending => return std::task::Poll::Pending,
1020                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1021                        this.is_terminated = true;
1022                        return std::task::Poll::Ready(None);
1023                    }
1024                    std::task::Poll::Ready(Err(e)) => {
1025                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1026                            e.into(),
1027                        ))));
1028                    }
1029                }
1030
1031                // A message has been received from the channel
1032                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1033
1034                std::task::Poll::Ready(Some(match header.ordinal {
1035                    0xbb27bd944e8143 => {
1036                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1037                        let mut req = fidl::new_empty!(
1038                            I2cEndpointTransferRequest,
1039                            fidl::encoding::DefaultFuchsiaResourceDialect
1040                        );
1041                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<I2cEndpointTransferRequest>(&header, _body_bytes, handles, &mut req)?;
1042                        let control_handle = I2cEndpointControlHandle { inner: this.inner.clone() };
1043                        Ok(I2cEndpointRequest::Transfer {
1044                            write_data: req.write_data,
1045                            read_length: req.read_length,
1046
1047                            responder: I2cEndpointTransferResponder {
1048                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1049                                tx_id: header.tx_id,
1050                            },
1051                        })
1052                    }
1053                    _ if header.tx_id == 0
1054                        && header
1055                            .dynamic_flags()
1056                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1057                    {
1058                        Ok(I2cEndpointRequest::_UnknownMethod {
1059                            ordinal: header.ordinal,
1060                            control_handle: I2cEndpointControlHandle { inner: this.inner.clone() },
1061                            method_type: fidl::MethodType::OneWay,
1062                        })
1063                    }
1064                    _ if header
1065                        .dynamic_flags()
1066                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1067                    {
1068                        this.inner.send_framework_err(
1069                            fidl::encoding::FrameworkErr::UnknownMethod,
1070                            header.tx_id,
1071                            header.ordinal,
1072                            header.dynamic_flags(),
1073                            (bytes, handles),
1074                        )?;
1075                        Ok(I2cEndpointRequest::_UnknownMethod {
1076                            ordinal: header.ordinal,
1077                            control_handle: I2cEndpointControlHandle { inner: this.inner.clone() },
1078                            method_type: fidl::MethodType::TwoWay,
1079                        })
1080                    }
1081                    _ => Err(fidl::Error::UnknownOrdinal {
1082                        ordinal: header.ordinal,
1083                        protocol_name:
1084                            <I2cEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1085                    }),
1086                }))
1087            },
1088        )
1089    }
1090}
1091
1092/// Typed endpoint for an I2C protocol resource.
1093#[derive(Debug)]
1094pub enum I2cEndpointRequest {
1095    Transfer {
1096        write_data: Vec<u8>,
1097        read_length: u32,
1098        responder: I2cEndpointTransferResponder,
1099    },
1100    /// An interaction was received which does not match any known method.
1101    #[non_exhaustive]
1102    _UnknownMethod {
1103        /// Ordinal of the method that was called.
1104        ordinal: u64,
1105        control_handle: I2cEndpointControlHandle,
1106        method_type: fidl::MethodType,
1107    },
1108}
1109
1110impl I2cEndpointRequest {
1111    #[allow(irrefutable_let_patterns)]
1112    pub fn into_transfer(self) -> Option<(Vec<u8>, u32, I2cEndpointTransferResponder)> {
1113        if let I2cEndpointRequest::Transfer { write_data, read_length, responder } = self {
1114            Some((write_data, read_length, responder))
1115        } else {
1116            None
1117        }
1118    }
1119
1120    /// Name of the method defined in FIDL
1121    pub fn method_name(&self) -> &'static str {
1122        match *self {
1123            I2cEndpointRequest::Transfer { .. } => "transfer",
1124            I2cEndpointRequest::_UnknownMethod {
1125                method_type: fidl::MethodType::OneWay, ..
1126            } => "unknown one-way method",
1127            I2cEndpointRequest::_UnknownMethod {
1128                method_type: fidl::MethodType::TwoWay, ..
1129            } => "unknown two-way method",
1130        }
1131    }
1132}
1133
1134#[derive(Debug, Clone)]
1135pub struct I2cEndpointControlHandle {
1136    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1137}
1138
1139impl I2cEndpointControlHandle {
1140    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1141        self.inner.shutdown_with_epitaph(status.into())
1142    }
1143}
1144
1145impl fidl::endpoints::ControlHandle for I2cEndpointControlHandle {
1146    fn shutdown(&self) {
1147        self.inner.shutdown()
1148    }
1149
1150    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1151        self.inner.shutdown_with_epitaph(status)
1152    }
1153
1154    fn is_closed(&self) -> bool {
1155        self.inner.channel().is_closed()
1156    }
1157    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1158        self.inner.channel().on_closed()
1159    }
1160
1161    #[cfg(target_os = "fuchsia")]
1162    fn signal_peer(
1163        &self,
1164        clear_mask: zx::Signals,
1165        set_mask: zx::Signals,
1166    ) -> Result<(), zx_status::Status> {
1167        use fidl::Peered;
1168        self.inner.channel().signal_peer(clear_mask, set_mask)
1169    }
1170}
1171
1172impl I2cEndpointControlHandle {}
1173
1174#[must_use = "FIDL methods require a response to be sent"]
1175#[derive(Debug)]
1176pub struct I2cEndpointTransferResponder {
1177    control_handle: std::mem::ManuallyDrop<I2cEndpointControlHandle>,
1178    tx_id: u32,
1179}
1180
1181/// Set the the channel to be shutdown (see [`I2cEndpointControlHandle::shutdown`])
1182/// if the responder is dropped without sending a response, so that the client
1183/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1184impl std::ops::Drop for I2cEndpointTransferResponder {
1185    fn drop(&mut self) {
1186        self.control_handle.shutdown();
1187        // Safety: drops once, never accessed again
1188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189    }
1190}
1191
1192impl fidl::endpoints::Responder for I2cEndpointTransferResponder {
1193    type ControlHandle = I2cEndpointControlHandle;
1194
1195    fn control_handle(&self) -> &I2cEndpointControlHandle {
1196        &self.control_handle
1197    }
1198
1199    fn drop_without_shutdown(mut self) {
1200        // Safety: drops once, never accessed again due to mem::forget
1201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202        // Prevent Drop from running (which would shut down the channel)
1203        std::mem::forget(self);
1204    }
1205}
1206
1207impl I2cEndpointTransferResponder {
1208    /// Sends a response to the FIDL transaction.
1209    ///
1210    /// Sets the channel to shutdown if an error occurs.
1211    pub fn send(
1212        self,
1213        mut result: Result<(&[u8], u64, i64), OperationError>,
1214    ) -> Result<(), fidl::Error> {
1215        let _result = self.send_raw(result);
1216        if _result.is_err() {
1217            self.control_handle.shutdown();
1218        }
1219        self.drop_without_shutdown();
1220        _result
1221    }
1222
1223    /// Similar to "send" but does not shutdown the channel if an error occurs.
1224    pub fn send_no_shutdown_on_err(
1225        self,
1226        mut result: Result<(&[u8], u64, i64), OperationError>,
1227    ) -> Result<(), fidl::Error> {
1228        let _result = self.send_raw(result);
1229        self.drop_without_shutdown();
1230        _result
1231    }
1232
1233    fn send_raw(
1234        &self,
1235        mut result: Result<(&[u8], u64, i64), OperationError>,
1236    ) -> Result<(), fidl::Error> {
1237        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1238            I2cTransferResult,
1239            OperationError,
1240        >>(
1241            fidl::encoding::FlexibleResult::new(result),
1242            self.tx_id,
1243            0xbb27bd944e8143,
1244            fidl::encoding::DynamicFlags::FLEXIBLE,
1245        )
1246    }
1247}
1248
1249#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1250pub struct Proxy_Marker;
1251
1252impl fidl::endpoints::ProtocolMarker for Proxy_Marker {
1253    type Proxy = Proxy_Proxy;
1254    type RequestStream = Proxy_RequestStream;
1255    #[cfg(target_os = "fuchsia")]
1256    type SynchronousProxy = Proxy_SynchronousProxy;
1257
1258    const DEBUG_NAME: &'static str = "fuchsia.driver.lab.Proxy";
1259}
1260impl fidl::endpoints::DiscoverableProtocolMarker for Proxy_Marker {}
1261pub type ProxyOpenSessionResult = Result<u64, OpenSessionError>;
1262
1263pub trait Proxy_ProxyInterface: Send + Sync {
1264    type DescribeResponseFut: std::future::Future<Output = Result<ProxyDescription, fidl::Error>>
1265        + Send;
1266    fn r#describe(&self) -> Self::DescribeResponseFut;
1267    type OpenSessionResponseFut: std::future::Future<Output = Result<ProxyOpenSessionResult, fidl::Error>>
1268        + Send;
1269    fn r#open_session(
1270        &self,
1271        context: &RunContext,
1272        mode: SessionMode,
1273        expectations: &Expectations,
1274        allowlist: &[AccessRule],
1275        session: fidl::endpoints::ServerEnd<SessionMarker>,
1276    ) -> Self::OpenSessionResponseFut;
1277}
1278#[derive(Debug)]
1279#[cfg(target_os = "fuchsia")]
1280pub struct Proxy_SynchronousProxy {
1281    client: fidl::client::sync::Client,
1282}
1283
1284#[cfg(target_os = "fuchsia")]
1285impl fidl::endpoints::SynchronousProxy for Proxy_SynchronousProxy {
1286    type Proxy = Proxy_Proxy;
1287    type Protocol = Proxy_Marker;
1288
1289    fn from_channel(inner: fidl::Channel) -> Self {
1290        Self::new(inner)
1291    }
1292
1293    fn into_channel(self) -> fidl::Channel {
1294        self.client.into_channel()
1295    }
1296
1297    fn as_channel(&self) -> &fidl::Channel {
1298        self.client.as_channel()
1299    }
1300}
1301
1302#[cfg(target_os = "fuchsia")]
1303impl Proxy_SynchronousProxy {
1304    pub fn new(channel: fidl::Channel) -> Self {
1305        Self { client: fidl::client::sync::Client::new(channel) }
1306    }
1307
1308    pub fn into_channel(self) -> fidl::Channel {
1309        self.client.into_channel()
1310    }
1311
1312    /// Waits until an event arrives and returns it. It is safe for other
1313    /// threads to make concurrent requests while waiting for an event.
1314    pub fn wait_for_event(
1315        &self,
1316        deadline: zx::MonotonicInstant,
1317    ) -> Result<Proxy_Event, fidl::Error> {
1318        Proxy_Event::decode(self.client.wait_for_event::<Proxy_Marker>(deadline)?)
1319    }
1320
1321    /// Identity, resources, limits, and digests of this proxy instance.
1322    pub fn r#describe(
1323        &self,
1324        ___deadline: zx::MonotonicInstant,
1325    ) -> Result<ProxyDescription, fidl::Error> {
1326        let _response = self.client.send_query::<
1327            fidl::encoding::EmptyPayload,
1328            fidl::encoding::FlexibleType<ProxyDescription>,
1329            Proxy_Marker,
1330        >(
1331            (),
1332            0x7a79d503792884fb,
1333            fidl::encoding::DynamicFlags::FLEXIBLE,
1334            ___deadline,
1335        )?
1336        .into_result::<Proxy_Marker>("describe")?;
1337        Ok(_response)
1338    }
1339
1340    /// Opens a session with an exact allowlist. Stale expectations and
1341    /// rejected allowlists create no session and touch no hardware.
1342    pub fn r#open_session(
1343        &self,
1344        mut context: &RunContext,
1345        mut mode: SessionMode,
1346        mut expectations: &Expectations,
1347        mut allowlist: &[AccessRule],
1348        mut session: fidl::endpoints::ServerEnd<SessionMarker>,
1349        ___deadline: zx::MonotonicInstant,
1350    ) -> Result<ProxyOpenSessionResult, fidl::Error> {
1351        let _response = self.client.send_query::<
1352            ProxyOpenSessionRequest,
1353            fidl::encoding::FlexibleResultType<ProxyOpenSessionResponse, OpenSessionError>,
1354            Proxy_Marker,
1355        >(
1356            (context, mode, expectations, allowlist, session,),
1357            0x31decc49da4ed5f4,
1358            fidl::encoding::DynamicFlags::FLEXIBLE,
1359            ___deadline,
1360        )?
1361        .into_result::<Proxy_Marker>("open_session")?;
1362        Ok(_response.map(|x| x.session_id))
1363    }
1364}
1365
1366#[cfg(target_os = "fuchsia")]
1367impl From<Proxy_SynchronousProxy> for zx::NullableHandle {
1368    fn from(value: Proxy_SynchronousProxy) -> Self {
1369        value.into_channel().into()
1370    }
1371}
1372
1373#[cfg(target_os = "fuchsia")]
1374impl From<fidl::Channel> for Proxy_SynchronousProxy {
1375    fn from(value: fidl::Channel) -> Self {
1376        Self::new(value)
1377    }
1378}
1379
1380#[cfg(target_os = "fuchsia")]
1381impl fidl::endpoints::FromClient for Proxy_SynchronousProxy {
1382    type Protocol = Proxy_Marker;
1383
1384    fn from_client(value: fidl::endpoints::ClientEnd<Proxy_Marker>) -> Self {
1385        Self::new(value.into_channel())
1386    }
1387}
1388
1389#[derive(Debug, Clone)]
1390pub struct Proxy_Proxy {
1391    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1392}
1393
1394impl fidl::endpoints::Proxy for Proxy_Proxy {
1395    type Protocol = Proxy_Marker;
1396
1397    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1398        Self::new(inner)
1399    }
1400
1401    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1402        self.client.into_channel().map_err(|client| Self { client })
1403    }
1404
1405    fn as_channel(&self) -> &::fidl::AsyncChannel {
1406        self.client.as_channel()
1407    }
1408}
1409
1410impl Proxy_Proxy {
1411    /// Create a new Proxy for fuchsia.driver.lab/Proxy.
1412    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1413        let protocol_name = <Proxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1414        Self { client: fidl::client::Client::new(channel, protocol_name) }
1415    }
1416
1417    /// Get a Stream of events from the remote end of the protocol.
1418    ///
1419    /// # Panics
1420    ///
1421    /// Panics if the event stream was already taken.
1422    pub fn take_event_stream(&self) -> Proxy_EventStream {
1423        Proxy_EventStream { event_receiver: self.client.take_event_receiver() }
1424    }
1425
1426    /// Identity, resources, limits, and digests of this proxy instance.
1427    pub fn r#describe(
1428        &self,
1429    ) -> fidl::client::QueryResponseFut<
1430        ProxyDescription,
1431        fidl::encoding::DefaultFuchsiaResourceDialect,
1432    > {
1433        Proxy_ProxyInterface::r#describe(self)
1434    }
1435
1436    /// Opens a session with an exact allowlist. Stale expectations and
1437    /// rejected allowlists create no session and touch no hardware.
1438    pub fn r#open_session(
1439        &self,
1440        mut context: &RunContext,
1441        mut mode: SessionMode,
1442        mut expectations: &Expectations,
1443        mut allowlist: &[AccessRule],
1444        mut session: fidl::endpoints::ServerEnd<SessionMarker>,
1445    ) -> fidl::client::QueryResponseFut<
1446        ProxyOpenSessionResult,
1447        fidl::encoding::DefaultFuchsiaResourceDialect,
1448    > {
1449        Proxy_ProxyInterface::r#open_session(self, context, mode, expectations, allowlist, session)
1450    }
1451}
1452
1453impl Proxy_ProxyInterface for Proxy_Proxy {
1454    type DescribeResponseFut = fidl::client::QueryResponseFut<
1455        ProxyDescription,
1456        fidl::encoding::DefaultFuchsiaResourceDialect,
1457    >;
1458    fn r#describe(&self) -> Self::DescribeResponseFut {
1459        fn _decode(
1460            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1461        ) -> Result<ProxyDescription, fidl::Error> {
1462            let _response = fidl::client::decode_transaction_body::<
1463                fidl::encoding::FlexibleType<ProxyDescription>,
1464                fidl::encoding::DefaultFuchsiaResourceDialect,
1465                0x7a79d503792884fb,
1466            >(_buf?)?
1467            .into_result::<Proxy_Marker>("describe")?;
1468            Ok(_response)
1469        }
1470        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProxyDescription>(
1471            (),
1472            0x7a79d503792884fb,
1473            fidl::encoding::DynamicFlags::FLEXIBLE,
1474            _decode,
1475        )
1476    }
1477
1478    type OpenSessionResponseFut = fidl::client::QueryResponseFut<
1479        ProxyOpenSessionResult,
1480        fidl::encoding::DefaultFuchsiaResourceDialect,
1481    >;
1482    fn r#open_session(
1483        &self,
1484        mut context: &RunContext,
1485        mut mode: SessionMode,
1486        mut expectations: &Expectations,
1487        mut allowlist: &[AccessRule],
1488        mut session: fidl::endpoints::ServerEnd<SessionMarker>,
1489    ) -> Self::OpenSessionResponseFut {
1490        fn _decode(
1491            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1492        ) -> Result<ProxyOpenSessionResult, fidl::Error> {
1493            let _response = fidl::client::decode_transaction_body::<
1494                fidl::encoding::FlexibleResultType<ProxyOpenSessionResponse, OpenSessionError>,
1495                fidl::encoding::DefaultFuchsiaResourceDialect,
1496                0x31decc49da4ed5f4,
1497            >(_buf?)?
1498            .into_result::<Proxy_Marker>("open_session")?;
1499            Ok(_response.map(|x| x.session_id))
1500        }
1501        self.client.send_query_and_decode::<ProxyOpenSessionRequest, ProxyOpenSessionResult>(
1502            (context, mode, expectations, allowlist, session),
1503            0x31decc49da4ed5f4,
1504            fidl::encoding::DynamicFlags::FLEXIBLE,
1505            _decode,
1506        )
1507    }
1508}
1509
1510pub struct Proxy_EventStream {
1511    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1512}
1513
1514impl std::marker::Unpin for Proxy_EventStream {}
1515
1516impl futures::stream::FusedStream for Proxy_EventStream {
1517    fn is_terminated(&self) -> bool {
1518        self.event_receiver.is_terminated()
1519    }
1520}
1521
1522impl futures::Stream for Proxy_EventStream {
1523    type Item = Result<Proxy_Event, fidl::Error>;
1524
1525    fn poll_next(
1526        mut self: std::pin::Pin<&mut Self>,
1527        cx: &mut std::task::Context<'_>,
1528    ) -> std::task::Poll<Option<Self::Item>> {
1529        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1530            &mut self.event_receiver,
1531            cx
1532        )?) {
1533            Some(buf) => std::task::Poll::Ready(Some(Proxy_Event::decode(buf))),
1534            None => std::task::Poll::Ready(None),
1535        }
1536    }
1537}
1538
1539#[derive(Debug)]
1540pub enum Proxy_Event {
1541    #[non_exhaustive]
1542    _UnknownEvent {
1543        /// Ordinal of the event that was sent.
1544        ordinal: u64,
1545    },
1546}
1547
1548impl Proxy_Event {
1549    /// Decodes a message buffer as a [`Proxy_Event`].
1550    fn decode(
1551        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1552    ) -> Result<Proxy_Event, fidl::Error> {
1553        let (bytes, _handles) = buf.split_mut();
1554        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1555        debug_assert_eq!(tx_header.tx_id, 0);
1556        match tx_header.ordinal {
1557            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1558                Ok(Proxy_Event::_UnknownEvent { ordinal: tx_header.ordinal })
1559            }
1560            _ => Err(fidl::Error::UnknownOrdinal {
1561                ordinal: tx_header.ordinal,
1562                protocol_name: <Proxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1563            }),
1564        }
1565    }
1566}
1567
1568/// A Stream of incoming requests for fuchsia.driver.lab/Proxy.
1569pub struct Proxy_RequestStream {
1570    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1571    is_terminated: bool,
1572}
1573
1574impl std::marker::Unpin for Proxy_RequestStream {}
1575
1576impl futures::stream::FusedStream for Proxy_RequestStream {
1577    fn is_terminated(&self) -> bool {
1578        self.is_terminated
1579    }
1580}
1581
1582impl fidl::endpoints::RequestStream for Proxy_RequestStream {
1583    type Protocol = Proxy_Marker;
1584    type ControlHandle = Proxy_ControlHandle;
1585
1586    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1587        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1588    }
1589
1590    fn control_handle(&self) -> Self::ControlHandle {
1591        Proxy_ControlHandle { inner: self.inner.clone() }
1592    }
1593
1594    fn into_inner(
1595        self,
1596    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1597    {
1598        (self.inner, self.is_terminated)
1599    }
1600
1601    fn from_inner(
1602        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1603        is_terminated: bool,
1604    ) -> Self {
1605        Self { inner, is_terminated }
1606    }
1607}
1608
1609impl futures::Stream for Proxy_RequestStream {
1610    type Item = Result<Proxy_Request, fidl::Error>;
1611
1612    fn poll_next(
1613        mut self: std::pin::Pin<&mut Self>,
1614        cx: &mut std::task::Context<'_>,
1615    ) -> std::task::Poll<Option<Self::Item>> {
1616        let this = &mut *self;
1617        if this.inner.check_shutdown(cx) {
1618            this.is_terminated = true;
1619            return std::task::Poll::Ready(None);
1620        }
1621        if this.is_terminated {
1622            panic!("polled Proxy_RequestStream after completion");
1623        }
1624        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1625            |bytes, handles| {
1626                match this.inner.channel().read_etc(cx, bytes, handles) {
1627                    std::task::Poll::Ready(Ok(())) => {}
1628                    std::task::Poll::Pending => return std::task::Poll::Pending,
1629                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1630                        this.is_terminated = true;
1631                        return std::task::Poll::Ready(None);
1632                    }
1633                    std::task::Poll::Ready(Err(e)) => {
1634                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1635                            e.into(),
1636                        ))));
1637                    }
1638                }
1639
1640                // A message has been received from the channel
1641                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1642
1643                std::task::Poll::Ready(Some(match header.ordinal {
1644                    0x7a79d503792884fb => {
1645                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1646                        let mut req = fidl::new_empty!(
1647                            fidl::encoding::EmptyPayload,
1648                            fidl::encoding::DefaultFuchsiaResourceDialect
1649                        );
1650                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1651                        let control_handle = Proxy_ControlHandle { inner: this.inner.clone() };
1652                        Ok(Proxy_Request::Describe {
1653                            responder: Proxy_DescribeResponder {
1654                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1655                                tx_id: header.tx_id,
1656                            },
1657                        })
1658                    }
1659                    0x31decc49da4ed5f4 => {
1660                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1661                        let mut req = fidl::new_empty!(
1662                            ProxyOpenSessionRequest,
1663                            fidl::encoding::DefaultFuchsiaResourceDialect
1664                        );
1665                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProxyOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1666                        let control_handle = Proxy_ControlHandle { inner: this.inner.clone() };
1667                        Ok(Proxy_Request::OpenSession {
1668                            context: req.context,
1669                            mode: req.mode,
1670                            expectations: req.expectations,
1671                            allowlist: req.allowlist,
1672                            session: req.session,
1673
1674                            responder: Proxy_OpenSessionResponder {
1675                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1676                                tx_id: header.tx_id,
1677                            },
1678                        })
1679                    }
1680                    _ if header.tx_id == 0
1681                        && header
1682                            .dynamic_flags()
1683                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1684                    {
1685                        Ok(Proxy_Request::_UnknownMethod {
1686                            ordinal: header.ordinal,
1687                            control_handle: Proxy_ControlHandle { inner: this.inner.clone() },
1688                            method_type: fidl::MethodType::OneWay,
1689                        })
1690                    }
1691                    _ if header
1692                        .dynamic_flags()
1693                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1694                    {
1695                        this.inner.send_framework_err(
1696                            fidl::encoding::FrameworkErr::UnknownMethod,
1697                            header.tx_id,
1698                            header.ordinal,
1699                            header.dynamic_flags(),
1700                            (bytes, handles),
1701                        )?;
1702                        Ok(Proxy_Request::_UnknownMethod {
1703                            ordinal: header.ordinal,
1704                            control_handle: Proxy_ControlHandle { inner: this.inner.clone() },
1705                            method_type: fidl::MethodType::TwoWay,
1706                        })
1707                    }
1708                    _ => Err(fidl::Error::UnknownOrdinal {
1709                        ordinal: header.ordinal,
1710                        protocol_name:
1711                            <Proxy_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1712                    }),
1713                }))
1714            },
1715        )
1716    }
1717}
1718
1719#[derive(Debug)]
1720pub enum Proxy_Request {
1721    /// Identity, resources, limits, and digests of this proxy instance.
1722    Describe { responder: Proxy_DescribeResponder },
1723    /// Opens a session with an exact allowlist. Stale expectations and
1724    /// rejected allowlists create no session and touch no hardware.
1725    OpenSession {
1726        context: RunContext,
1727        mode: SessionMode,
1728        expectations: Expectations,
1729        allowlist: Vec<AccessRule>,
1730        session: fidl::endpoints::ServerEnd<SessionMarker>,
1731        responder: Proxy_OpenSessionResponder,
1732    },
1733    /// An interaction was received which does not match any known method.
1734    #[non_exhaustive]
1735    _UnknownMethod {
1736        /// Ordinal of the method that was called.
1737        ordinal: u64,
1738        control_handle: Proxy_ControlHandle,
1739        method_type: fidl::MethodType,
1740    },
1741}
1742
1743impl Proxy_Request {
1744    #[allow(irrefutable_let_patterns)]
1745    pub fn into_describe(self) -> Option<(Proxy_DescribeResponder)> {
1746        if let Proxy_Request::Describe { responder } = self { Some((responder)) } else { None }
1747    }
1748
1749    #[allow(irrefutable_let_patterns)]
1750    pub fn into_open_session(
1751        self,
1752    ) -> Option<(
1753        RunContext,
1754        SessionMode,
1755        Expectations,
1756        Vec<AccessRule>,
1757        fidl::endpoints::ServerEnd<SessionMarker>,
1758        Proxy_OpenSessionResponder,
1759    )> {
1760        if let Proxy_Request::OpenSession {
1761            context,
1762            mode,
1763            expectations,
1764            allowlist,
1765            session,
1766            responder,
1767        } = self
1768        {
1769            Some((context, mode, expectations, allowlist, session, responder))
1770        } else {
1771            None
1772        }
1773    }
1774
1775    /// Name of the method defined in FIDL
1776    pub fn method_name(&self) -> &'static str {
1777        match *self {
1778            Proxy_Request::Describe { .. } => "describe",
1779            Proxy_Request::OpenSession { .. } => "open_session",
1780            Proxy_Request::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1781                "unknown one-way method"
1782            }
1783            Proxy_Request::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1784                "unknown two-way method"
1785            }
1786        }
1787    }
1788}
1789
1790#[derive(Debug, Clone)]
1791pub struct Proxy_ControlHandle {
1792    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1793}
1794
1795impl Proxy_ControlHandle {
1796    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1797        self.inner.shutdown_with_epitaph(status.into())
1798    }
1799}
1800
1801impl fidl::endpoints::ControlHandle for Proxy_ControlHandle {
1802    fn shutdown(&self) {
1803        self.inner.shutdown()
1804    }
1805
1806    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1807        self.inner.shutdown_with_epitaph(status)
1808    }
1809
1810    fn is_closed(&self) -> bool {
1811        self.inner.channel().is_closed()
1812    }
1813    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1814        self.inner.channel().on_closed()
1815    }
1816
1817    #[cfg(target_os = "fuchsia")]
1818    fn signal_peer(
1819        &self,
1820        clear_mask: zx::Signals,
1821        set_mask: zx::Signals,
1822    ) -> Result<(), zx_status::Status> {
1823        use fidl::Peered;
1824        self.inner.channel().signal_peer(clear_mask, set_mask)
1825    }
1826}
1827
1828impl Proxy_ControlHandle {}
1829
1830#[must_use = "FIDL methods require a response to be sent"]
1831#[derive(Debug)]
1832pub struct Proxy_DescribeResponder {
1833    control_handle: std::mem::ManuallyDrop<Proxy_ControlHandle>,
1834    tx_id: u32,
1835}
1836
1837/// Set the the channel to be shutdown (see [`Proxy_ControlHandle::shutdown`])
1838/// if the responder is dropped without sending a response, so that the client
1839/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1840impl std::ops::Drop for Proxy_DescribeResponder {
1841    fn drop(&mut self) {
1842        self.control_handle.shutdown();
1843        // Safety: drops once, never accessed again
1844        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1845    }
1846}
1847
1848impl fidl::endpoints::Responder for Proxy_DescribeResponder {
1849    type ControlHandle = Proxy_ControlHandle;
1850
1851    fn control_handle(&self) -> &Proxy_ControlHandle {
1852        &self.control_handle
1853    }
1854
1855    fn drop_without_shutdown(mut self) {
1856        // Safety: drops once, never accessed again due to mem::forget
1857        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1858        // Prevent Drop from running (which would shut down the channel)
1859        std::mem::forget(self);
1860    }
1861}
1862
1863impl Proxy_DescribeResponder {
1864    /// Sends a response to the FIDL transaction.
1865    ///
1866    /// Sets the channel to shutdown if an error occurs.
1867    pub fn send(self, mut payload: &ProxyDescription) -> Result<(), fidl::Error> {
1868        let _result = self.send_raw(payload);
1869        if _result.is_err() {
1870            self.control_handle.shutdown();
1871        }
1872        self.drop_without_shutdown();
1873        _result
1874    }
1875
1876    /// Similar to "send" but does not shutdown the channel if an error occurs.
1877    pub fn send_no_shutdown_on_err(
1878        self,
1879        mut payload: &ProxyDescription,
1880    ) -> Result<(), fidl::Error> {
1881        let _result = self.send_raw(payload);
1882        self.drop_without_shutdown();
1883        _result
1884    }
1885
1886    fn send_raw(&self, mut payload: &ProxyDescription) -> Result<(), fidl::Error> {
1887        self.control_handle.inner.send::<fidl::encoding::FlexibleType<ProxyDescription>>(
1888            fidl::encoding::Flexible::new(payload),
1889            self.tx_id,
1890            0x7a79d503792884fb,
1891            fidl::encoding::DynamicFlags::FLEXIBLE,
1892        )
1893    }
1894}
1895
1896#[must_use = "FIDL methods require a response to be sent"]
1897#[derive(Debug)]
1898pub struct Proxy_OpenSessionResponder {
1899    control_handle: std::mem::ManuallyDrop<Proxy_ControlHandle>,
1900    tx_id: u32,
1901}
1902
1903/// Set the the channel to be shutdown (see [`Proxy_ControlHandle::shutdown`])
1904/// if the responder is dropped without sending a response, so that the client
1905/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1906impl std::ops::Drop for Proxy_OpenSessionResponder {
1907    fn drop(&mut self) {
1908        self.control_handle.shutdown();
1909        // Safety: drops once, never accessed again
1910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1911    }
1912}
1913
1914impl fidl::endpoints::Responder for Proxy_OpenSessionResponder {
1915    type ControlHandle = Proxy_ControlHandle;
1916
1917    fn control_handle(&self) -> &Proxy_ControlHandle {
1918        &self.control_handle
1919    }
1920
1921    fn drop_without_shutdown(mut self) {
1922        // Safety: drops once, never accessed again due to mem::forget
1923        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1924        // Prevent Drop from running (which would shut down the channel)
1925        std::mem::forget(self);
1926    }
1927}
1928
1929impl Proxy_OpenSessionResponder {
1930    /// Sends a response to the FIDL transaction.
1931    ///
1932    /// Sets the channel to shutdown if an error occurs.
1933    pub fn send(self, mut result: Result<u64, OpenSessionError>) -> Result<(), fidl::Error> {
1934        let _result = self.send_raw(result);
1935        if _result.is_err() {
1936            self.control_handle.shutdown();
1937        }
1938        self.drop_without_shutdown();
1939        _result
1940    }
1941
1942    /// Similar to "send" but does not shutdown the channel if an error occurs.
1943    pub fn send_no_shutdown_on_err(
1944        self,
1945        mut result: Result<u64, OpenSessionError>,
1946    ) -> Result<(), fidl::Error> {
1947        let _result = self.send_raw(result);
1948        self.drop_without_shutdown();
1949        _result
1950    }
1951
1952    fn send_raw(&self, mut result: Result<u64, OpenSessionError>) -> Result<(), fidl::Error> {
1953        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1954            ProxyOpenSessionResponse,
1955            OpenSessionError,
1956        >>(
1957            fidl::encoding::FlexibleResult::new(result.map(|session_id| (session_id,))),
1958            self.tx_id,
1959            0x31decc49da4ed5f4,
1960            fidl::encoding::DynamicFlags::FLEXIBLE,
1961        )
1962    }
1963}
1964
1965#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1966pub struct SessionMarker;
1967
1968impl fidl::endpoints::ProtocolMarker for SessionMarker {
1969    type Proxy = SessionProxy;
1970    type RequestStream = SessionRequestStream;
1971    #[cfg(target_os = "fuchsia")]
1972    type SynchronousProxy = SessionSynchronousProxy;
1973
1974    const DEBUG_NAME: &'static str = "(anonymous) Session";
1975}
1976pub type SessionRead32Result = Result<(u32, u64, i64), OperationError>;
1977pub type SessionSnapshotResult = Result<(Vec<SnapshotItemResult>, bool), OperationError>;
1978pub type SessionWrite32Result = Result<(u32, u64, i64), OperationError>;
1979pub type SessionPoll32Result = Result<(u32, u64, i64), OperationError>;
1980pub type SessionExecuteSequenceResult = Result<(Vec<SequenceItemResult>, bool), OperationError>;
1981pub type SessionGpioReadResult = Result<(bool, u64, i64), OperationError>;
1982pub type SessionGpioWriteResult = Result<(u64, i64), OperationError>;
1983pub type SessionI2cTransferResult = Result<(Vec<u8>, u64, i64), OperationError>;
1984pub type SessionSpiTransmitResult = Result<(Vec<u8>, u64, i64), OperationError>;
1985pub type SessionOpenGpioResult = Result<(), OperationError>;
1986pub type SessionOpenI2cResult = Result<(), OperationError>;
1987pub type SessionOpenSpiResult = Result<(), OperationError>;
1988pub type SessionWaitForInterruptResult = Result<(u32, u64, u64, i64, u64), OperationError>;
1989pub type SessionClockEnableResult = Result<(u64, i64), OperationError>;
1990pub type SessionClockDisableResult = Result<(u64, i64), OperationError>;
1991pub type SessionClockIsEnabledResult = Result<(bool, u64, i64), OperationError>;
1992pub type SessionClockSetRateResult = Result<(u64, i64), OperationError>;
1993pub type SessionClockQueryRateResult = Result<(u64, u64, i64), OperationError>;
1994pub type SessionClockGetRateResult = Result<(u64, u64, i64), OperationError>;
1995pub type SessionResetAssertResult = Result<(u64, i64), OperationError>;
1996pub type SessionResetDeassertResult = Result<(u64, i64), OperationError>;
1997pub type SessionResetToggleResult = Result<(u64, i64), OperationError>;
1998pub type SessionResetStatusResult = Result<(bool, u64, i64), OperationError>;
1999pub type SessionSerialReadResult = Result<(Vec<u8>, u64, i64), OperationError>;
2000pub type SessionSerialWriteResult = Result<(u64, i64), OperationError>;
2001
2002pub trait SessionProxyInterface: Send + Sync {
2003    type Read32ResponseFut: std::future::Future<Output = Result<SessionRead32Result, fidl::Error>>
2004        + Send;
2005    fn r#read32(&self, resource: u32, offset: u64) -> Self::Read32ResponseFut;
2006    type SnapshotResponseFut: std::future::Future<Output = Result<SessionSnapshotResult, fidl::Error>>
2007        + Send;
2008    fn r#snapshot(&self, items: &[SnapshotItem]) -> Self::SnapshotResponseFut;
2009    type ReadAuditResponseFut: std::future::Future<Output = Result<(Vec<AuditEntry>, bool, u64, u64), fidl::Error>>
2010        + Send;
2011    fn r#read_audit(&self, cursor: u64, limit: u32) -> Self::ReadAuditResponseFut;
2012    type Write32ResponseFut: std::future::Future<Output = Result<SessionWrite32Result, fidl::Error>>
2013        + Send;
2014    fn r#write32(
2015        &self,
2016        resource: u32,
2017        offset: u64,
2018        value: u32,
2019        write_mask: u32,
2020        precondition: Option<&WritePrecondition>,
2021        readback: bool,
2022    ) -> Self::Write32ResponseFut;
2023    type Poll32ResponseFut: std::future::Future<Output = Result<SessionPoll32Result, fidl::Error>>
2024        + Send;
2025    fn r#poll32(
2026        &self,
2027        resource: u32,
2028        offset: u64,
2029        expected: u32,
2030        mask: u32,
2031        interval_ns: i64,
2032        timeout_ns: i64,
2033    ) -> Self::Poll32ResponseFut;
2034    type ExecuteSequenceResponseFut: std::future::Future<Output = Result<SessionExecuteSequenceResult, fidl::Error>>
2035        + Send;
2036    fn r#execute_sequence(&self, items: &[SequenceItem]) -> Self::ExecuteSequenceResponseFut;
2037    type GpioReadResponseFut: std::future::Future<Output = Result<SessionGpioReadResult, fidl::Error>>
2038        + Send;
2039    fn r#gpio_read(&self, resource: u32) -> Self::GpioReadResponseFut;
2040    type GpioWriteResponseFut: std::future::Future<Output = Result<SessionGpioWriteResult, fidl::Error>>
2041        + Send;
2042    fn r#gpio_write(&self, resource: u32, value: bool) -> Self::GpioWriteResponseFut;
2043    type I2cTransferResponseFut: std::future::Future<Output = Result<SessionI2cTransferResult, fidl::Error>>
2044        + Send;
2045    fn r#i2c_transfer(
2046        &self,
2047        resource: u32,
2048        write_data: &[u8],
2049        read_length: u32,
2050    ) -> Self::I2cTransferResponseFut;
2051    type SpiTransmitResponseFut: std::future::Future<Output = Result<SessionSpiTransmitResult, fidl::Error>>
2052        + Send;
2053    fn r#spi_transmit(&self, resource: u32, tx_data: &[u8]) -> Self::SpiTransmitResponseFut;
2054    type OpenGpioResponseFut: std::future::Future<Output = Result<SessionOpenGpioResult, fidl::Error>>
2055        + Send;
2056    fn r#open_gpio(
2057        &self,
2058        resource: u32,
2059        endpoint: fidl::endpoints::ServerEnd<GpioEndpointMarker>,
2060    ) -> Self::OpenGpioResponseFut;
2061    type OpenI2cResponseFut: std::future::Future<Output = Result<SessionOpenI2cResult, fidl::Error>>
2062        + Send;
2063    fn r#open_i2c(
2064        &self,
2065        resource: u32,
2066        endpoint: fidl::endpoints::ServerEnd<I2cEndpointMarker>,
2067    ) -> Self::OpenI2cResponseFut;
2068    type OpenSpiResponseFut: std::future::Future<Output = Result<SessionOpenSpiResult, fidl::Error>>
2069        + Send;
2070    fn r#open_spi(
2071        &self,
2072        resource: u32,
2073        endpoint: fidl::endpoints::ServerEnd<SpiEndpointMarker>,
2074    ) -> Self::OpenSpiResponseFut;
2075    type WaitForInterruptResponseFut: std::future::Future<Output = Result<SessionWaitForInterruptResult, fidl::Error>>
2076        + Send;
2077    fn r#wait_for_interrupt(
2078        &self,
2079        resource: u32,
2080        after_sequence: u64,
2081        timeout_ns: i64,
2082    ) -> Self::WaitForInterruptResponseFut;
2083    type ClockEnableResponseFut: std::future::Future<Output = Result<SessionClockEnableResult, fidl::Error>>
2084        + Send;
2085    fn r#clock_enable(&self, resource: u32) -> Self::ClockEnableResponseFut;
2086    type ClockDisableResponseFut: std::future::Future<Output = Result<SessionClockDisableResult, fidl::Error>>
2087        + Send;
2088    fn r#clock_disable(&self, resource: u32) -> Self::ClockDisableResponseFut;
2089    type ClockIsEnabledResponseFut: std::future::Future<Output = Result<SessionClockIsEnabledResult, fidl::Error>>
2090        + Send;
2091    fn r#clock_is_enabled(&self, resource: u32) -> Self::ClockIsEnabledResponseFut;
2092    type ClockSetRateResponseFut: std::future::Future<Output = Result<SessionClockSetRateResult, fidl::Error>>
2093        + Send;
2094    fn r#clock_set_rate(&self, resource: u32, hz: u64) -> Self::ClockSetRateResponseFut;
2095    type ClockQueryRateResponseFut: std::future::Future<Output = Result<SessionClockQueryRateResult, fidl::Error>>
2096        + Send;
2097    fn r#clock_query_rate(&self, resource: u32, hz_in: u64) -> Self::ClockQueryRateResponseFut;
2098    type ClockGetRateResponseFut: std::future::Future<Output = Result<SessionClockGetRateResult, fidl::Error>>
2099        + Send;
2100    fn r#clock_get_rate(&self, resource: u32) -> Self::ClockGetRateResponseFut;
2101    type ResetAssertResponseFut: std::future::Future<Output = Result<SessionResetAssertResult, fidl::Error>>
2102        + Send;
2103    fn r#reset_assert(&self, resource: u32) -> Self::ResetAssertResponseFut;
2104    type ResetDeassertResponseFut: std::future::Future<Output = Result<SessionResetDeassertResult, fidl::Error>>
2105        + Send;
2106    fn r#reset_deassert(&self, resource: u32) -> Self::ResetDeassertResponseFut;
2107    type ResetToggleResponseFut: std::future::Future<Output = Result<SessionResetToggleResult, fidl::Error>>
2108        + Send;
2109    fn r#reset_toggle(&self, resource: u32) -> Self::ResetToggleResponseFut;
2110    type ResetStatusResponseFut: std::future::Future<Output = Result<SessionResetStatusResult, fidl::Error>>
2111        + Send;
2112    fn r#reset_status(&self, resource: u32) -> Self::ResetStatusResponseFut;
2113    type SerialReadResponseFut: std::future::Future<Output = Result<SessionSerialReadResult, fidl::Error>>
2114        + Send;
2115    fn r#serial_read(&self, resource: u32) -> Self::SerialReadResponseFut;
2116    type SerialWriteResponseFut: std::future::Future<Output = Result<SessionSerialWriteResult, fidl::Error>>
2117        + Send;
2118    fn r#serial_write(&self, resource: u32, data: &[u8]) -> Self::SerialWriteResponseFut;
2119}
2120#[derive(Debug)]
2121#[cfg(target_os = "fuchsia")]
2122pub struct SessionSynchronousProxy {
2123    client: fidl::client::sync::Client,
2124}
2125
2126#[cfg(target_os = "fuchsia")]
2127impl fidl::endpoints::SynchronousProxy for SessionSynchronousProxy {
2128    type Proxy = SessionProxy;
2129    type Protocol = SessionMarker;
2130
2131    fn from_channel(inner: fidl::Channel) -> Self {
2132        Self::new(inner)
2133    }
2134
2135    fn into_channel(self) -> fidl::Channel {
2136        self.client.into_channel()
2137    }
2138
2139    fn as_channel(&self) -> &fidl::Channel {
2140        self.client.as_channel()
2141    }
2142}
2143
2144#[cfg(target_os = "fuchsia")]
2145impl SessionSynchronousProxy {
2146    pub fn new(channel: fidl::Channel) -> Self {
2147        Self { client: fidl::client::sync::Client::new(channel) }
2148    }
2149
2150    pub fn into_channel(self) -> fidl::Channel {
2151        self.client.into_channel()
2152    }
2153
2154    /// Waits until an event arrives and returns it. It is safe for other
2155    /// threads to make concurrent requests while waiting for an event.
2156    pub fn wait_for_event(
2157        &self,
2158        deadline: zx::MonotonicInstant,
2159    ) -> Result<SessionEvent, fidl::Error> {
2160        SessionEvent::decode(self.client.wait_for_event::<SessionMarker>(deadline)?)
2161    }
2162
2163    /// One policy-checked, audited 32-bit read.
2164    pub fn r#read32(
2165        &self,
2166        mut resource: u32,
2167        mut offset: u64,
2168        ___deadline: zx::MonotonicInstant,
2169    ) -> Result<SessionRead32Result, fidl::Error> {
2170        let _response = self.client.send_query::<
2171            SessionRead32Request,
2172            fidl::encoding::FlexibleResultType<ReadResult, OperationError>,
2173            SessionMarker,
2174        >(
2175            (resource, offset,),
2176            0x7afec1bfecc09a54,
2177            fidl::encoding::DynamicFlags::FLEXIBLE,
2178            ___deadline,
2179        )?
2180        .into_result::<SessionMarker>("read32")?;
2181        Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
2182    }
2183
2184    /// Bounded snapshot: every item is validated before the first read.
2185    pub fn r#snapshot(
2186        &self,
2187        mut items: &[SnapshotItem],
2188        ___deadline: zx::MonotonicInstant,
2189    ) -> Result<SessionSnapshotResult, fidl::Error> {
2190        let _response = self.client.send_query::<
2191            SessionSnapshotRequest,
2192            fidl::encoding::FlexibleResultType<SnapshotResult, OperationError>,
2193            SessionMarker,
2194        >(
2195            (items,),
2196            0x5fa90e4c39fa72e1,
2197            fidl::encoding::DynamicFlags::FLEXIBLE,
2198            ___deadline,
2199        )?
2200        .into_result::<SessionMarker>("snapshot")?;
2201        Ok(_response.map(|x| (x.results, x.complete)))
2202    }
2203
2204    /// Reads a bounded audit page so the host can drain incrementally and
2205    /// detect gaps.
2206    pub fn r#read_audit(
2207        &self,
2208        mut cursor: u64,
2209        mut limit: u32,
2210        ___deadline: zx::MonotonicInstant,
2211    ) -> Result<(Vec<AuditEntry>, bool, u64, u64), fidl::Error> {
2212        let _response = self.client.send_query::<
2213            SessionReadAuditRequest,
2214            fidl::encoding::FlexibleType<AuditPage>,
2215            SessionMarker,
2216        >(
2217            (cursor, limit,),
2218            0x4906c4144e00f4c4,
2219            fidl::encoding::DynamicFlags::FLEXIBLE,
2220            ___deadline,
2221        )?
2222        .into_result::<SessionMarker>("read_audit")?;
2223        Ok((
2224            _response.entries,
2225            _response.has_oldest,
2226            _response.oldest_retained,
2227            _response.next_cursor,
2228        ))
2229    }
2230
2231    /// One policy-checked, audited 32-bit write with optional precondition,
2232    /// read-modify-write, barrier, and readback.
2233    pub fn r#write32(
2234        &self,
2235        mut resource: u32,
2236        mut offset: u64,
2237        mut value: u32,
2238        mut write_mask: u32,
2239        mut precondition: Option<&WritePrecondition>,
2240        mut readback: bool,
2241        ___deadline: zx::MonotonicInstant,
2242    ) -> Result<SessionWrite32Result, fidl::Error> {
2243        let _response = self.client.send_query::<
2244            SessionWrite32Request,
2245            fidl::encoding::FlexibleResultType<WriteResult, OperationError>,
2246            SessionMarker,
2247        >(
2248            (resource, offset, value, write_mask, precondition, readback,),
2249            0x80dcccde698980c,
2250            fidl::encoding::DynamicFlags::FLEXIBLE,
2251            ___deadline,
2252        )?
2253        .into_result::<SessionMarker>("write32")?;
2254        Ok(_response.map(|x| (x.readback_value, x.audit_seq, x.timestamp_ns)))
2255    }
2256
2257    /// Repeated bounded read until (value & mask) == (expected & mask)
2258    /// or timeout. Uses asynchronous timers on the driver dispatcher.
2259    pub fn r#poll32(
2260        &self,
2261        mut resource: u32,
2262        mut offset: u64,
2263        mut expected: u32,
2264        mut mask: u32,
2265        mut interval_ns: i64,
2266        mut timeout_ns: i64,
2267        ___deadline: zx::MonotonicInstant,
2268    ) -> Result<SessionPoll32Result, fidl::Error> {
2269        let _response = self.client.send_query::<
2270            SessionPoll32Request,
2271            fidl::encoding::FlexibleResultType<PollResult, OperationError>,
2272            SessionMarker,
2273        >(
2274            (resource, offset, expected, mask, interval_ns, timeout_ns,),
2275            0x3b9c26d1582fff7d,
2276            fidl::encoding::DynamicFlags::FLEXIBLE,
2277            ___deadline,
2278        )?
2279        .into_result::<SessionMarker>("poll32")?;
2280        Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
2281    }
2282
2283    /// Bounded ordered sequence of operations. Whole-sequence validation
2284    /// occurs before any hardware operation begins.
2285    pub fn r#execute_sequence(
2286        &self,
2287        mut items: &[SequenceItem],
2288        ___deadline: zx::MonotonicInstant,
2289    ) -> Result<SessionExecuteSequenceResult, fidl::Error> {
2290        let _response = self.client.send_query::<
2291            SessionExecuteSequenceRequest,
2292            fidl::encoding::FlexibleResultType<SequenceResult, OperationError>,
2293            SessionMarker,
2294        >(
2295            (items,),
2296            0xf0500bd7555a614,
2297            fidl::encoding::DynamicFlags::FLEXIBLE,
2298            ___deadline,
2299        )?
2300        .into_result::<SessionMarker>("execute_sequence")?;
2301        Ok(_response.map(|x| (x.results, x.complete)))
2302    }
2303
2304    /// One policy-checked, audited GPIO read.
2305    pub fn r#gpio_read(
2306        &self,
2307        mut resource: u32,
2308        ___deadline: zx::MonotonicInstant,
2309    ) -> Result<SessionGpioReadResult, fidl::Error> {
2310        let _response = self.client.send_query::<
2311            SessionGpioReadRequest,
2312            fidl::encoding::FlexibleResultType<GpioReadResult, OperationError>,
2313            SessionMarker,
2314        >(
2315            (resource,),
2316            0xb01fc817332de51,
2317            fidl::encoding::DynamicFlags::FLEXIBLE,
2318            ___deadline,
2319        )?
2320        .into_result::<SessionMarker>("gpio_read")?;
2321        Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
2322    }
2323
2324    /// One policy-checked, audited GPIO write. Requires mutation lease.
2325    pub fn r#gpio_write(
2326        &self,
2327        mut resource: u32,
2328        mut value: bool,
2329        ___deadline: zx::MonotonicInstant,
2330    ) -> Result<SessionGpioWriteResult, fidl::Error> {
2331        let _response = self.client.send_query::<
2332            SessionGpioWriteRequest,
2333            fidl::encoding::FlexibleResultType<GpioWriteResult, OperationError>,
2334            SessionMarker,
2335        >(
2336            (resource, value,),
2337            0x27cfbd9ffaf5c6e7,
2338            fidl::encoding::DynamicFlags::FLEXIBLE,
2339            ___deadline,
2340        )?
2341        .into_result::<SessionMarker>("gpio_write")?;
2342        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2343    }
2344
2345    /// One policy-checked, audited I2C transfer. Non-empty write requires mutation lease.
2346    pub fn r#i2c_transfer(
2347        &self,
2348        mut resource: u32,
2349        mut write_data: &[u8],
2350        mut read_length: u32,
2351        ___deadline: zx::MonotonicInstant,
2352    ) -> Result<SessionI2cTransferResult, fidl::Error> {
2353        let _response = self.client.send_query::<
2354            SessionI2cTransferRequest,
2355            fidl::encoding::FlexibleResultType<I2cTransferResult, OperationError>,
2356            SessionMarker,
2357        >(
2358            (resource, write_data, read_length,),
2359            0x67016bc41336f298,
2360            fidl::encoding::DynamicFlags::FLEXIBLE,
2361            ___deadline,
2362        )?
2363        .into_result::<SessionMarker>("i2c_transfer")?;
2364        Ok(_response.map(|x| (x.read_data, x.audit_seq, x.timestamp_ns)))
2365    }
2366
2367    /// One policy-checked, audited SPI transmit. Requires mutation lease.
2368    pub fn r#spi_transmit(
2369        &self,
2370        mut resource: u32,
2371        mut tx_data: &[u8],
2372        ___deadline: zx::MonotonicInstant,
2373    ) -> Result<SessionSpiTransmitResult, fidl::Error> {
2374        let _response = self.client.send_query::<
2375            SessionSpiTransmitRequest,
2376            fidl::encoding::FlexibleResultType<SpiTransmitResult, OperationError>,
2377            SessionMarker,
2378        >(
2379            (resource, tx_data,),
2380            0x3429847e2877d4d7,
2381            fidl::encoding::DynamicFlags::FLEXIBLE,
2382            ___deadline,
2383        )?
2384        .into_result::<SessionMarker>("spi_transmit")?;
2385        Ok(_response.map(|x| (x.rx_data, x.audit_seq, x.timestamp_ns)))
2386    }
2387
2388    /// Opens a typed GPIO endpoint bound to this session.
2389    pub fn r#open_gpio(
2390        &self,
2391        mut resource: u32,
2392        mut endpoint: fidl::endpoints::ServerEnd<GpioEndpointMarker>,
2393        ___deadline: zx::MonotonicInstant,
2394    ) -> Result<SessionOpenGpioResult, fidl::Error> {
2395        let _response = self.client.send_query::<
2396            SessionOpenGpioRequest,
2397            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, OperationError>,
2398            SessionMarker,
2399        >(
2400            (resource, endpoint,),
2401            0x5bd9f23cba94897,
2402            fidl::encoding::DynamicFlags::FLEXIBLE,
2403            ___deadline,
2404        )?
2405        .into_result::<SessionMarker>("open_gpio")?;
2406        Ok(_response.map(|x| x))
2407    }
2408
2409    /// Opens a typed I2C endpoint bound to this session.
2410    pub fn r#open_i2c(
2411        &self,
2412        mut resource: u32,
2413        mut endpoint: fidl::endpoints::ServerEnd<I2cEndpointMarker>,
2414        ___deadline: zx::MonotonicInstant,
2415    ) -> Result<SessionOpenI2cResult, fidl::Error> {
2416        let _response = self.client.send_query::<
2417            SessionOpenI2cRequest,
2418            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, OperationError>,
2419            SessionMarker,
2420        >(
2421            (resource, endpoint,),
2422            0x17ba936a44a14633,
2423            fidl::encoding::DynamicFlags::FLEXIBLE,
2424            ___deadline,
2425        )?
2426        .into_result::<SessionMarker>("open_i2c")?;
2427        Ok(_response.map(|x| x))
2428    }
2429
2430    /// Opens a typed SPI endpoint bound to this session.
2431    pub fn r#open_spi(
2432        &self,
2433        mut resource: u32,
2434        mut endpoint: fidl::endpoints::ServerEnd<SpiEndpointMarker>,
2435        ___deadline: zx::MonotonicInstant,
2436    ) -> Result<SessionOpenSpiResult, fidl::Error> {
2437        let _response = self.client.send_query::<
2438            SessionOpenSpiRequest,
2439            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, OperationError>,
2440            SessionMarker,
2441        >(
2442            (resource, endpoint,),
2443            0x3ee7e7cea84dfc9d,
2444            fidl::encoding::DynamicFlags::FLEXIBLE,
2445            ___deadline,
2446        )?
2447        .into_result::<SessionMarker>("open_spi")?;
2448        Ok(_response.map(|x| x))
2449    }
2450
2451    /// Observes an interrupt event. Bounded hanging request that yields when
2452    /// the interrupt sequence exceeds `after_sequence` or upon timeout.
2453    pub fn r#wait_for_interrupt(
2454        &self,
2455        mut resource: u32,
2456        mut after_sequence: u64,
2457        mut timeout_ns: i64,
2458        ___deadline: zx::MonotonicInstant,
2459    ) -> Result<SessionWaitForInterruptResult, fidl::Error> {
2460        let _response = self.client.send_query::<
2461            SessionWaitForInterruptRequest,
2462            fidl::encoding::FlexibleResultType<InterruptResult, OperationError>,
2463            SessionMarker,
2464        >(
2465            (resource, after_sequence, timeout_ns,),
2466            0x276a31c24a164cdb,
2467            fidl::encoding::DynamicFlags::FLEXIBLE,
2468            ___deadline,
2469        )?
2470        .into_result::<SessionMarker>("wait_for_interrupt")?;
2471        Ok(_response.map(|x| (x.resource, x.sequence, x.count, x.timestamp_ns, x.coalesced_count)))
2472    }
2473
2474    /// One policy-checked, audited Clock enable. Requires mutation lease.
2475    pub fn r#clock_enable(
2476        &self,
2477        mut resource: u32,
2478        ___deadline: zx::MonotonicInstant,
2479    ) -> Result<SessionClockEnableResult, fidl::Error> {
2480        let _response = self.client.send_query::<
2481            SessionClockEnableRequest,
2482            fidl::encoding::FlexibleResultType<ClockEnableResult, OperationError>,
2483            SessionMarker,
2484        >(
2485            (resource,),
2486            0x774b563ebff897eb,
2487            fidl::encoding::DynamicFlags::FLEXIBLE,
2488            ___deadline,
2489        )?
2490        .into_result::<SessionMarker>("clock_enable")?;
2491        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2492    }
2493
2494    /// One policy-checked, audited Clock disable. Requires mutation lease.
2495    pub fn r#clock_disable(
2496        &self,
2497        mut resource: u32,
2498        ___deadline: zx::MonotonicInstant,
2499    ) -> Result<SessionClockDisableResult, fidl::Error> {
2500        let _response = self.client.send_query::<
2501            SessionClockDisableRequest,
2502            fidl::encoding::FlexibleResultType<ClockDisableResult, OperationError>,
2503            SessionMarker,
2504        >(
2505            (resource,),
2506            0x642c11d03db8b873,
2507            fidl::encoding::DynamicFlags::FLEXIBLE,
2508            ___deadline,
2509        )?
2510        .into_result::<SessionMarker>("clock_disable")?;
2511        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2512    }
2513
2514    /// One policy-checked, audited Clock is_enabled query.
2515    pub fn r#clock_is_enabled(
2516        &self,
2517        mut resource: u32,
2518        ___deadline: zx::MonotonicInstant,
2519    ) -> Result<SessionClockIsEnabledResult, fidl::Error> {
2520        let _response = self.client.send_query::<
2521            SessionClockIsEnabledRequest,
2522            fidl::encoding::FlexibleResultType<ClockIsEnabledResult, OperationError>,
2523            SessionMarker,
2524        >(
2525            (resource,),
2526            0x36a033a7a1322174,
2527            fidl::encoding::DynamicFlags::FLEXIBLE,
2528            ___deadline,
2529        )?
2530        .into_result::<SessionMarker>("clock_is_enabled")?;
2531        Ok(_response.map(|x| (x.enabled, x.audit_seq, x.timestamp_ns)))
2532    }
2533
2534    /// One policy-checked, audited Clock set_rate. Requires mutation lease.
2535    pub fn r#clock_set_rate(
2536        &self,
2537        mut resource: u32,
2538        mut hz: u64,
2539        ___deadline: zx::MonotonicInstant,
2540    ) -> Result<SessionClockSetRateResult, fidl::Error> {
2541        let _response = self.client.send_query::<
2542            SessionClockSetRateRequest,
2543            fidl::encoding::FlexibleResultType<ClockSetRateResult, OperationError>,
2544            SessionMarker,
2545        >(
2546            (resource, hz,),
2547            0x4dbc4012d4289048,
2548            fidl::encoding::DynamicFlags::FLEXIBLE,
2549            ___deadline,
2550        )?
2551        .into_result::<SessionMarker>("clock_set_rate")?;
2552        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2553    }
2554
2555    /// One policy-checked, audited Clock query_supported_rate query.
2556    pub fn r#clock_query_rate(
2557        &self,
2558        mut resource: u32,
2559        mut hz_in: u64,
2560        ___deadline: zx::MonotonicInstant,
2561    ) -> Result<SessionClockQueryRateResult, fidl::Error> {
2562        let _response = self.client.send_query::<
2563            SessionClockQueryRateRequest,
2564            fidl::encoding::FlexibleResultType<ClockQueryRateResult, OperationError>,
2565            SessionMarker,
2566        >(
2567            (resource, hz_in,),
2568            0x11b9fe61ad09ff5e,
2569            fidl::encoding::DynamicFlags::FLEXIBLE,
2570            ___deadline,
2571        )?
2572        .into_result::<SessionMarker>("clock_query_rate")?;
2573        Ok(_response.map(|x| (x.hz_out, x.audit_seq, x.timestamp_ns)))
2574    }
2575
2576    /// One policy-checked, audited Clock get_rate query.
2577    pub fn r#clock_get_rate(
2578        &self,
2579        mut resource: u32,
2580        ___deadline: zx::MonotonicInstant,
2581    ) -> Result<SessionClockGetRateResult, fidl::Error> {
2582        let _response = self.client.send_query::<
2583            SessionClockGetRateRequest,
2584            fidl::encoding::FlexibleResultType<ClockGetRateResult, OperationError>,
2585            SessionMarker,
2586        >(
2587            (resource,),
2588            0x4f3c0e2259e5e46,
2589            fidl::encoding::DynamicFlags::FLEXIBLE,
2590            ___deadline,
2591        )?
2592        .into_result::<SessionMarker>("clock_get_rate")?;
2593        Ok(_response.map(|x| (x.hz, x.audit_seq, x.timestamp_ns)))
2594    }
2595
2596    /// One policy-checked, audited Reset assert. Requires mutation lease.
2597    pub fn r#reset_assert(
2598        &self,
2599        mut resource: u32,
2600        ___deadline: zx::MonotonicInstant,
2601    ) -> Result<SessionResetAssertResult, fidl::Error> {
2602        let _response = self.client.send_query::<
2603            SessionResetAssertRequest,
2604            fidl::encoding::FlexibleResultType<ResetAssertResult, OperationError>,
2605            SessionMarker,
2606        >(
2607            (resource,),
2608            0x5788d4842384c111,
2609            fidl::encoding::DynamicFlags::FLEXIBLE,
2610            ___deadline,
2611        )?
2612        .into_result::<SessionMarker>("reset_assert")?;
2613        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2614    }
2615
2616    /// One policy-checked, audited Reset deassert. Requires mutation lease.
2617    pub fn r#reset_deassert(
2618        &self,
2619        mut resource: u32,
2620        ___deadline: zx::MonotonicInstant,
2621    ) -> Result<SessionResetDeassertResult, fidl::Error> {
2622        let _response = self.client.send_query::<
2623            SessionResetDeassertRequest,
2624            fidl::encoding::FlexibleResultType<ResetDeassertResult, OperationError>,
2625            SessionMarker,
2626        >(
2627            (resource,),
2628            0x632c13fc5e08d3e2,
2629            fidl::encoding::DynamicFlags::FLEXIBLE,
2630            ___deadline,
2631        )?
2632        .into_result::<SessionMarker>("reset_deassert")?;
2633        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2634    }
2635
2636    /// One policy-checked, audited Reset toggle. Requires mutation lease.
2637    pub fn r#reset_toggle(
2638        &self,
2639        mut resource: u32,
2640        ___deadline: zx::MonotonicInstant,
2641    ) -> Result<SessionResetToggleResult, fidl::Error> {
2642        let _response = self.client.send_query::<
2643            SessionResetToggleRequest,
2644            fidl::encoding::FlexibleResultType<ResetToggleResult, OperationError>,
2645            SessionMarker,
2646        >(
2647            (resource,),
2648            0x2b2b14cb6a5e4c98,
2649            fidl::encoding::DynamicFlags::FLEXIBLE,
2650            ___deadline,
2651        )?
2652        .into_result::<SessionMarker>("reset_toggle")?;
2653        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2654    }
2655
2656    /// One policy-checked, audited Reset status query.
2657    pub fn r#reset_status(
2658        &self,
2659        mut resource: u32,
2660        ___deadline: zx::MonotonicInstant,
2661    ) -> Result<SessionResetStatusResult, fidl::Error> {
2662        let _response = self.client.send_query::<
2663            SessionResetStatusRequest,
2664            fidl::encoding::FlexibleResultType<ResetStatusResult, OperationError>,
2665            SessionMarker,
2666        >(
2667            (resource,),
2668            0x1790a96ce5f3b3d9,
2669            fidl::encoding::DynamicFlags::FLEXIBLE,
2670            ___deadline,
2671        )?
2672        .into_result::<SessionMarker>("reset_status")?;
2673        Ok(_response.map(|x| (x.asserted, x.audit_seq, x.timestamp_ns)))
2674    }
2675
2676    /// One policy-checked, audited Serial read.
2677    pub fn r#serial_read(
2678        &self,
2679        mut resource: u32,
2680        ___deadline: zx::MonotonicInstant,
2681    ) -> Result<SessionSerialReadResult, fidl::Error> {
2682        let _response = self.client.send_query::<
2683            SessionSerialReadRequest,
2684            fidl::encoding::FlexibleResultType<SerialReadResult, OperationError>,
2685            SessionMarker,
2686        >(
2687            (resource,),
2688            0x2b76818805a351fd,
2689            fidl::encoding::DynamicFlags::FLEXIBLE,
2690            ___deadline,
2691        )?
2692        .into_result::<SessionMarker>("serial_read")?;
2693        Ok(_response.map(|x| (x.data, x.audit_seq, x.timestamp_ns)))
2694    }
2695
2696    /// One policy-checked, audited Serial write. Requires mutation lease.
2697    pub fn r#serial_write(
2698        &self,
2699        mut resource: u32,
2700        mut data: &[u8],
2701        ___deadline: zx::MonotonicInstant,
2702    ) -> Result<SessionSerialWriteResult, fidl::Error> {
2703        let _response = self.client.send_query::<
2704            SessionSerialWriteRequest,
2705            fidl::encoding::FlexibleResultType<SerialWriteResult, OperationError>,
2706            SessionMarker,
2707        >(
2708            (resource, data,),
2709            0x5345a3e2317a792f,
2710            fidl::encoding::DynamicFlags::FLEXIBLE,
2711            ___deadline,
2712        )?
2713        .into_result::<SessionMarker>("serial_write")?;
2714        Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
2715    }
2716}
2717
2718#[cfg(target_os = "fuchsia")]
2719impl From<SessionSynchronousProxy> for zx::NullableHandle {
2720    fn from(value: SessionSynchronousProxy) -> Self {
2721        value.into_channel().into()
2722    }
2723}
2724
2725#[cfg(target_os = "fuchsia")]
2726impl From<fidl::Channel> for SessionSynchronousProxy {
2727    fn from(value: fidl::Channel) -> Self {
2728        Self::new(value)
2729    }
2730}
2731
2732#[cfg(target_os = "fuchsia")]
2733impl fidl::endpoints::FromClient for SessionSynchronousProxy {
2734    type Protocol = SessionMarker;
2735
2736    fn from_client(value: fidl::endpoints::ClientEnd<SessionMarker>) -> Self {
2737        Self::new(value.into_channel())
2738    }
2739}
2740
2741#[derive(Debug, Clone)]
2742pub struct SessionProxy {
2743    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2744}
2745
2746impl fidl::endpoints::Proxy for SessionProxy {
2747    type Protocol = SessionMarker;
2748
2749    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2750        Self::new(inner)
2751    }
2752
2753    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2754        self.client.into_channel().map_err(|client| Self { client })
2755    }
2756
2757    fn as_channel(&self) -> &::fidl::AsyncChannel {
2758        self.client.as_channel()
2759    }
2760}
2761
2762impl SessionProxy {
2763    /// Create a new Proxy for fuchsia.driver.lab/Session.
2764    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2765        let protocol_name = <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2766        Self { client: fidl::client::Client::new(channel, protocol_name) }
2767    }
2768
2769    /// Get a Stream of events from the remote end of the protocol.
2770    ///
2771    /// # Panics
2772    ///
2773    /// Panics if the event stream was already taken.
2774    pub fn take_event_stream(&self) -> SessionEventStream {
2775        SessionEventStream { event_receiver: self.client.take_event_receiver() }
2776    }
2777
2778    /// One policy-checked, audited 32-bit read.
2779    pub fn r#read32(
2780        &self,
2781        mut resource: u32,
2782        mut offset: u64,
2783    ) -> fidl::client::QueryResponseFut<
2784        SessionRead32Result,
2785        fidl::encoding::DefaultFuchsiaResourceDialect,
2786    > {
2787        SessionProxyInterface::r#read32(self, resource, offset)
2788    }
2789
2790    /// Bounded snapshot: every item is validated before the first read.
2791    pub fn r#snapshot(
2792        &self,
2793        mut items: &[SnapshotItem],
2794    ) -> fidl::client::QueryResponseFut<
2795        SessionSnapshotResult,
2796        fidl::encoding::DefaultFuchsiaResourceDialect,
2797    > {
2798        SessionProxyInterface::r#snapshot(self, items)
2799    }
2800
2801    /// Reads a bounded audit page so the host can drain incrementally and
2802    /// detect gaps.
2803    pub fn r#read_audit(
2804        &self,
2805        mut cursor: u64,
2806        mut limit: u32,
2807    ) -> fidl::client::QueryResponseFut<
2808        (Vec<AuditEntry>, bool, u64, u64),
2809        fidl::encoding::DefaultFuchsiaResourceDialect,
2810    > {
2811        SessionProxyInterface::r#read_audit(self, cursor, limit)
2812    }
2813
2814    /// One policy-checked, audited 32-bit write with optional precondition,
2815    /// read-modify-write, barrier, and readback.
2816    pub fn r#write32(
2817        &self,
2818        mut resource: u32,
2819        mut offset: u64,
2820        mut value: u32,
2821        mut write_mask: u32,
2822        mut precondition: Option<&WritePrecondition>,
2823        mut readback: bool,
2824    ) -> fidl::client::QueryResponseFut<
2825        SessionWrite32Result,
2826        fidl::encoding::DefaultFuchsiaResourceDialect,
2827    > {
2828        SessionProxyInterface::r#write32(
2829            self,
2830            resource,
2831            offset,
2832            value,
2833            write_mask,
2834            precondition,
2835            readback,
2836        )
2837    }
2838
2839    /// Repeated bounded read until (value & mask) == (expected & mask)
2840    /// or timeout. Uses asynchronous timers on the driver dispatcher.
2841    pub fn r#poll32(
2842        &self,
2843        mut resource: u32,
2844        mut offset: u64,
2845        mut expected: u32,
2846        mut mask: u32,
2847        mut interval_ns: i64,
2848        mut timeout_ns: i64,
2849    ) -> fidl::client::QueryResponseFut<
2850        SessionPoll32Result,
2851        fidl::encoding::DefaultFuchsiaResourceDialect,
2852    > {
2853        SessionProxyInterface::r#poll32(
2854            self,
2855            resource,
2856            offset,
2857            expected,
2858            mask,
2859            interval_ns,
2860            timeout_ns,
2861        )
2862    }
2863
2864    /// Bounded ordered sequence of operations. Whole-sequence validation
2865    /// occurs before any hardware operation begins.
2866    pub fn r#execute_sequence(
2867        &self,
2868        mut items: &[SequenceItem],
2869    ) -> fidl::client::QueryResponseFut<
2870        SessionExecuteSequenceResult,
2871        fidl::encoding::DefaultFuchsiaResourceDialect,
2872    > {
2873        SessionProxyInterface::r#execute_sequence(self, items)
2874    }
2875
2876    /// One policy-checked, audited GPIO read.
2877    pub fn r#gpio_read(
2878        &self,
2879        mut resource: u32,
2880    ) -> fidl::client::QueryResponseFut<
2881        SessionGpioReadResult,
2882        fidl::encoding::DefaultFuchsiaResourceDialect,
2883    > {
2884        SessionProxyInterface::r#gpio_read(self, resource)
2885    }
2886
2887    /// One policy-checked, audited GPIO write. Requires mutation lease.
2888    pub fn r#gpio_write(
2889        &self,
2890        mut resource: u32,
2891        mut value: bool,
2892    ) -> fidl::client::QueryResponseFut<
2893        SessionGpioWriteResult,
2894        fidl::encoding::DefaultFuchsiaResourceDialect,
2895    > {
2896        SessionProxyInterface::r#gpio_write(self, resource, value)
2897    }
2898
2899    /// One policy-checked, audited I2C transfer. Non-empty write requires mutation lease.
2900    pub fn r#i2c_transfer(
2901        &self,
2902        mut resource: u32,
2903        mut write_data: &[u8],
2904        mut read_length: u32,
2905    ) -> fidl::client::QueryResponseFut<
2906        SessionI2cTransferResult,
2907        fidl::encoding::DefaultFuchsiaResourceDialect,
2908    > {
2909        SessionProxyInterface::r#i2c_transfer(self, resource, write_data, read_length)
2910    }
2911
2912    /// One policy-checked, audited SPI transmit. Requires mutation lease.
2913    pub fn r#spi_transmit(
2914        &self,
2915        mut resource: u32,
2916        mut tx_data: &[u8],
2917    ) -> fidl::client::QueryResponseFut<
2918        SessionSpiTransmitResult,
2919        fidl::encoding::DefaultFuchsiaResourceDialect,
2920    > {
2921        SessionProxyInterface::r#spi_transmit(self, resource, tx_data)
2922    }
2923
2924    /// Opens a typed GPIO endpoint bound to this session.
2925    pub fn r#open_gpio(
2926        &self,
2927        mut resource: u32,
2928        mut endpoint: fidl::endpoints::ServerEnd<GpioEndpointMarker>,
2929    ) -> fidl::client::QueryResponseFut<
2930        SessionOpenGpioResult,
2931        fidl::encoding::DefaultFuchsiaResourceDialect,
2932    > {
2933        SessionProxyInterface::r#open_gpio(self, resource, endpoint)
2934    }
2935
2936    /// Opens a typed I2C endpoint bound to this session.
2937    pub fn r#open_i2c(
2938        &self,
2939        mut resource: u32,
2940        mut endpoint: fidl::endpoints::ServerEnd<I2cEndpointMarker>,
2941    ) -> fidl::client::QueryResponseFut<
2942        SessionOpenI2cResult,
2943        fidl::encoding::DefaultFuchsiaResourceDialect,
2944    > {
2945        SessionProxyInterface::r#open_i2c(self, resource, endpoint)
2946    }
2947
2948    /// Opens a typed SPI endpoint bound to this session.
2949    pub fn r#open_spi(
2950        &self,
2951        mut resource: u32,
2952        mut endpoint: fidl::endpoints::ServerEnd<SpiEndpointMarker>,
2953    ) -> fidl::client::QueryResponseFut<
2954        SessionOpenSpiResult,
2955        fidl::encoding::DefaultFuchsiaResourceDialect,
2956    > {
2957        SessionProxyInterface::r#open_spi(self, resource, endpoint)
2958    }
2959
2960    /// Observes an interrupt event. Bounded hanging request that yields when
2961    /// the interrupt sequence exceeds `after_sequence` or upon timeout.
2962    pub fn r#wait_for_interrupt(
2963        &self,
2964        mut resource: u32,
2965        mut after_sequence: u64,
2966        mut timeout_ns: i64,
2967    ) -> fidl::client::QueryResponseFut<
2968        SessionWaitForInterruptResult,
2969        fidl::encoding::DefaultFuchsiaResourceDialect,
2970    > {
2971        SessionProxyInterface::r#wait_for_interrupt(self, resource, after_sequence, timeout_ns)
2972    }
2973
2974    /// One policy-checked, audited Clock enable. Requires mutation lease.
2975    pub fn r#clock_enable(
2976        &self,
2977        mut resource: u32,
2978    ) -> fidl::client::QueryResponseFut<
2979        SessionClockEnableResult,
2980        fidl::encoding::DefaultFuchsiaResourceDialect,
2981    > {
2982        SessionProxyInterface::r#clock_enable(self, resource)
2983    }
2984
2985    /// One policy-checked, audited Clock disable. Requires mutation lease.
2986    pub fn r#clock_disable(
2987        &self,
2988        mut resource: u32,
2989    ) -> fidl::client::QueryResponseFut<
2990        SessionClockDisableResult,
2991        fidl::encoding::DefaultFuchsiaResourceDialect,
2992    > {
2993        SessionProxyInterface::r#clock_disable(self, resource)
2994    }
2995
2996    /// One policy-checked, audited Clock is_enabled query.
2997    pub fn r#clock_is_enabled(
2998        &self,
2999        mut resource: u32,
3000    ) -> fidl::client::QueryResponseFut<
3001        SessionClockIsEnabledResult,
3002        fidl::encoding::DefaultFuchsiaResourceDialect,
3003    > {
3004        SessionProxyInterface::r#clock_is_enabled(self, resource)
3005    }
3006
3007    /// One policy-checked, audited Clock set_rate. Requires mutation lease.
3008    pub fn r#clock_set_rate(
3009        &self,
3010        mut resource: u32,
3011        mut hz: u64,
3012    ) -> fidl::client::QueryResponseFut<
3013        SessionClockSetRateResult,
3014        fidl::encoding::DefaultFuchsiaResourceDialect,
3015    > {
3016        SessionProxyInterface::r#clock_set_rate(self, resource, hz)
3017    }
3018
3019    /// One policy-checked, audited Clock query_supported_rate query.
3020    pub fn r#clock_query_rate(
3021        &self,
3022        mut resource: u32,
3023        mut hz_in: u64,
3024    ) -> fidl::client::QueryResponseFut<
3025        SessionClockQueryRateResult,
3026        fidl::encoding::DefaultFuchsiaResourceDialect,
3027    > {
3028        SessionProxyInterface::r#clock_query_rate(self, resource, hz_in)
3029    }
3030
3031    /// One policy-checked, audited Clock get_rate query.
3032    pub fn r#clock_get_rate(
3033        &self,
3034        mut resource: u32,
3035    ) -> fidl::client::QueryResponseFut<
3036        SessionClockGetRateResult,
3037        fidl::encoding::DefaultFuchsiaResourceDialect,
3038    > {
3039        SessionProxyInterface::r#clock_get_rate(self, resource)
3040    }
3041
3042    /// One policy-checked, audited Reset assert. Requires mutation lease.
3043    pub fn r#reset_assert(
3044        &self,
3045        mut resource: u32,
3046    ) -> fidl::client::QueryResponseFut<
3047        SessionResetAssertResult,
3048        fidl::encoding::DefaultFuchsiaResourceDialect,
3049    > {
3050        SessionProxyInterface::r#reset_assert(self, resource)
3051    }
3052
3053    /// One policy-checked, audited Reset deassert. Requires mutation lease.
3054    pub fn r#reset_deassert(
3055        &self,
3056        mut resource: u32,
3057    ) -> fidl::client::QueryResponseFut<
3058        SessionResetDeassertResult,
3059        fidl::encoding::DefaultFuchsiaResourceDialect,
3060    > {
3061        SessionProxyInterface::r#reset_deassert(self, resource)
3062    }
3063
3064    /// One policy-checked, audited Reset toggle. Requires mutation lease.
3065    pub fn r#reset_toggle(
3066        &self,
3067        mut resource: u32,
3068    ) -> fidl::client::QueryResponseFut<
3069        SessionResetToggleResult,
3070        fidl::encoding::DefaultFuchsiaResourceDialect,
3071    > {
3072        SessionProxyInterface::r#reset_toggle(self, resource)
3073    }
3074
3075    /// One policy-checked, audited Reset status query.
3076    pub fn r#reset_status(
3077        &self,
3078        mut resource: u32,
3079    ) -> fidl::client::QueryResponseFut<
3080        SessionResetStatusResult,
3081        fidl::encoding::DefaultFuchsiaResourceDialect,
3082    > {
3083        SessionProxyInterface::r#reset_status(self, resource)
3084    }
3085
3086    /// One policy-checked, audited Serial read.
3087    pub fn r#serial_read(
3088        &self,
3089        mut resource: u32,
3090    ) -> fidl::client::QueryResponseFut<
3091        SessionSerialReadResult,
3092        fidl::encoding::DefaultFuchsiaResourceDialect,
3093    > {
3094        SessionProxyInterface::r#serial_read(self, resource)
3095    }
3096
3097    /// One policy-checked, audited Serial write. Requires mutation lease.
3098    pub fn r#serial_write(
3099        &self,
3100        mut resource: u32,
3101        mut data: &[u8],
3102    ) -> fidl::client::QueryResponseFut<
3103        SessionSerialWriteResult,
3104        fidl::encoding::DefaultFuchsiaResourceDialect,
3105    > {
3106        SessionProxyInterface::r#serial_write(self, resource, data)
3107    }
3108}
3109
3110impl SessionProxyInterface for SessionProxy {
3111    type Read32ResponseFut = fidl::client::QueryResponseFut<
3112        SessionRead32Result,
3113        fidl::encoding::DefaultFuchsiaResourceDialect,
3114    >;
3115    fn r#read32(&self, mut resource: u32, mut offset: u64) -> Self::Read32ResponseFut {
3116        fn _decode(
3117            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3118        ) -> Result<SessionRead32Result, fidl::Error> {
3119            let _response = fidl::client::decode_transaction_body::<
3120                fidl::encoding::FlexibleResultType<ReadResult, OperationError>,
3121                fidl::encoding::DefaultFuchsiaResourceDialect,
3122                0x7afec1bfecc09a54,
3123            >(_buf?)?
3124            .into_result::<SessionMarker>("read32")?;
3125            Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
3126        }
3127        self.client.send_query_and_decode::<SessionRead32Request, SessionRead32Result>(
3128            (resource, offset),
3129            0x7afec1bfecc09a54,
3130            fidl::encoding::DynamicFlags::FLEXIBLE,
3131            _decode,
3132        )
3133    }
3134
3135    type SnapshotResponseFut = fidl::client::QueryResponseFut<
3136        SessionSnapshotResult,
3137        fidl::encoding::DefaultFuchsiaResourceDialect,
3138    >;
3139    fn r#snapshot(&self, mut items: &[SnapshotItem]) -> Self::SnapshotResponseFut {
3140        fn _decode(
3141            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3142        ) -> Result<SessionSnapshotResult, fidl::Error> {
3143            let _response = fidl::client::decode_transaction_body::<
3144                fidl::encoding::FlexibleResultType<SnapshotResult, OperationError>,
3145                fidl::encoding::DefaultFuchsiaResourceDialect,
3146                0x5fa90e4c39fa72e1,
3147            >(_buf?)?
3148            .into_result::<SessionMarker>("snapshot")?;
3149            Ok(_response.map(|x| (x.results, x.complete)))
3150        }
3151        self.client.send_query_and_decode::<SessionSnapshotRequest, SessionSnapshotResult>(
3152            (items,),
3153            0x5fa90e4c39fa72e1,
3154            fidl::encoding::DynamicFlags::FLEXIBLE,
3155            _decode,
3156        )
3157    }
3158
3159    type ReadAuditResponseFut = fidl::client::QueryResponseFut<
3160        (Vec<AuditEntry>, bool, u64, u64),
3161        fidl::encoding::DefaultFuchsiaResourceDialect,
3162    >;
3163    fn r#read_audit(&self, mut cursor: u64, mut limit: u32) -> Self::ReadAuditResponseFut {
3164        fn _decode(
3165            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3166        ) -> Result<(Vec<AuditEntry>, bool, u64, u64), fidl::Error> {
3167            let _response = fidl::client::decode_transaction_body::<
3168                fidl::encoding::FlexibleType<AuditPage>,
3169                fidl::encoding::DefaultFuchsiaResourceDialect,
3170                0x4906c4144e00f4c4,
3171            >(_buf?)?
3172            .into_result::<SessionMarker>("read_audit")?;
3173            Ok((
3174                _response.entries,
3175                _response.has_oldest,
3176                _response.oldest_retained,
3177                _response.next_cursor,
3178            ))
3179        }
3180        self.client
3181            .send_query_and_decode::<SessionReadAuditRequest, (Vec<AuditEntry>, bool, u64, u64)>(
3182                (cursor, limit),
3183                0x4906c4144e00f4c4,
3184                fidl::encoding::DynamicFlags::FLEXIBLE,
3185                _decode,
3186            )
3187    }
3188
3189    type Write32ResponseFut = fidl::client::QueryResponseFut<
3190        SessionWrite32Result,
3191        fidl::encoding::DefaultFuchsiaResourceDialect,
3192    >;
3193    fn r#write32(
3194        &self,
3195        mut resource: u32,
3196        mut offset: u64,
3197        mut value: u32,
3198        mut write_mask: u32,
3199        mut precondition: Option<&WritePrecondition>,
3200        mut readback: bool,
3201    ) -> Self::Write32ResponseFut {
3202        fn _decode(
3203            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3204        ) -> Result<SessionWrite32Result, fidl::Error> {
3205            let _response = fidl::client::decode_transaction_body::<
3206                fidl::encoding::FlexibleResultType<WriteResult, OperationError>,
3207                fidl::encoding::DefaultFuchsiaResourceDialect,
3208                0x80dcccde698980c,
3209            >(_buf?)?
3210            .into_result::<SessionMarker>("write32")?;
3211            Ok(_response.map(|x| (x.readback_value, x.audit_seq, x.timestamp_ns)))
3212        }
3213        self.client.send_query_and_decode::<SessionWrite32Request, SessionWrite32Result>(
3214            (resource, offset, value, write_mask, precondition, readback),
3215            0x80dcccde698980c,
3216            fidl::encoding::DynamicFlags::FLEXIBLE,
3217            _decode,
3218        )
3219    }
3220
3221    type Poll32ResponseFut = fidl::client::QueryResponseFut<
3222        SessionPoll32Result,
3223        fidl::encoding::DefaultFuchsiaResourceDialect,
3224    >;
3225    fn r#poll32(
3226        &self,
3227        mut resource: u32,
3228        mut offset: u64,
3229        mut expected: u32,
3230        mut mask: u32,
3231        mut interval_ns: i64,
3232        mut timeout_ns: i64,
3233    ) -> Self::Poll32ResponseFut {
3234        fn _decode(
3235            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3236        ) -> Result<SessionPoll32Result, fidl::Error> {
3237            let _response = fidl::client::decode_transaction_body::<
3238                fidl::encoding::FlexibleResultType<PollResult, OperationError>,
3239                fidl::encoding::DefaultFuchsiaResourceDialect,
3240                0x3b9c26d1582fff7d,
3241            >(_buf?)?
3242            .into_result::<SessionMarker>("poll32")?;
3243            Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
3244        }
3245        self.client.send_query_and_decode::<SessionPoll32Request, SessionPoll32Result>(
3246            (resource, offset, expected, mask, interval_ns, timeout_ns),
3247            0x3b9c26d1582fff7d,
3248            fidl::encoding::DynamicFlags::FLEXIBLE,
3249            _decode,
3250        )
3251    }
3252
3253    type ExecuteSequenceResponseFut = fidl::client::QueryResponseFut<
3254        SessionExecuteSequenceResult,
3255        fidl::encoding::DefaultFuchsiaResourceDialect,
3256    >;
3257    fn r#execute_sequence(&self, mut items: &[SequenceItem]) -> Self::ExecuteSequenceResponseFut {
3258        fn _decode(
3259            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3260        ) -> Result<SessionExecuteSequenceResult, fidl::Error> {
3261            let _response = fidl::client::decode_transaction_body::<
3262                fidl::encoding::FlexibleResultType<SequenceResult, OperationError>,
3263                fidl::encoding::DefaultFuchsiaResourceDialect,
3264                0xf0500bd7555a614,
3265            >(_buf?)?
3266            .into_result::<SessionMarker>("execute_sequence")?;
3267            Ok(_response.map(|x| (x.results, x.complete)))
3268        }
3269        self.client
3270            .send_query_and_decode::<SessionExecuteSequenceRequest, SessionExecuteSequenceResult>(
3271                (items,),
3272                0xf0500bd7555a614,
3273                fidl::encoding::DynamicFlags::FLEXIBLE,
3274                _decode,
3275            )
3276    }
3277
3278    type GpioReadResponseFut = fidl::client::QueryResponseFut<
3279        SessionGpioReadResult,
3280        fidl::encoding::DefaultFuchsiaResourceDialect,
3281    >;
3282    fn r#gpio_read(&self, mut resource: u32) -> Self::GpioReadResponseFut {
3283        fn _decode(
3284            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3285        ) -> Result<SessionGpioReadResult, fidl::Error> {
3286            let _response = fidl::client::decode_transaction_body::<
3287                fidl::encoding::FlexibleResultType<GpioReadResult, OperationError>,
3288                fidl::encoding::DefaultFuchsiaResourceDialect,
3289                0xb01fc817332de51,
3290            >(_buf?)?
3291            .into_result::<SessionMarker>("gpio_read")?;
3292            Ok(_response.map(|x| (x.value, x.audit_seq, x.timestamp_ns)))
3293        }
3294        self.client.send_query_and_decode::<SessionGpioReadRequest, SessionGpioReadResult>(
3295            (resource,),
3296            0xb01fc817332de51,
3297            fidl::encoding::DynamicFlags::FLEXIBLE,
3298            _decode,
3299        )
3300    }
3301
3302    type GpioWriteResponseFut = fidl::client::QueryResponseFut<
3303        SessionGpioWriteResult,
3304        fidl::encoding::DefaultFuchsiaResourceDialect,
3305    >;
3306    fn r#gpio_write(&self, mut resource: u32, mut value: bool) -> Self::GpioWriteResponseFut {
3307        fn _decode(
3308            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3309        ) -> Result<SessionGpioWriteResult, fidl::Error> {
3310            let _response = fidl::client::decode_transaction_body::<
3311                fidl::encoding::FlexibleResultType<GpioWriteResult, OperationError>,
3312                fidl::encoding::DefaultFuchsiaResourceDialect,
3313                0x27cfbd9ffaf5c6e7,
3314            >(_buf?)?
3315            .into_result::<SessionMarker>("gpio_write")?;
3316            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3317        }
3318        self.client.send_query_and_decode::<SessionGpioWriteRequest, SessionGpioWriteResult>(
3319            (resource, value),
3320            0x27cfbd9ffaf5c6e7,
3321            fidl::encoding::DynamicFlags::FLEXIBLE,
3322            _decode,
3323        )
3324    }
3325
3326    type I2cTransferResponseFut = fidl::client::QueryResponseFut<
3327        SessionI2cTransferResult,
3328        fidl::encoding::DefaultFuchsiaResourceDialect,
3329    >;
3330    fn r#i2c_transfer(
3331        &self,
3332        mut resource: u32,
3333        mut write_data: &[u8],
3334        mut read_length: u32,
3335    ) -> Self::I2cTransferResponseFut {
3336        fn _decode(
3337            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3338        ) -> Result<SessionI2cTransferResult, fidl::Error> {
3339            let _response = fidl::client::decode_transaction_body::<
3340                fidl::encoding::FlexibleResultType<I2cTransferResult, OperationError>,
3341                fidl::encoding::DefaultFuchsiaResourceDialect,
3342                0x67016bc41336f298,
3343            >(_buf?)?
3344            .into_result::<SessionMarker>("i2c_transfer")?;
3345            Ok(_response.map(|x| (x.read_data, x.audit_seq, x.timestamp_ns)))
3346        }
3347        self.client.send_query_and_decode::<SessionI2cTransferRequest, SessionI2cTransferResult>(
3348            (resource, write_data, read_length),
3349            0x67016bc41336f298,
3350            fidl::encoding::DynamicFlags::FLEXIBLE,
3351            _decode,
3352        )
3353    }
3354
3355    type SpiTransmitResponseFut = fidl::client::QueryResponseFut<
3356        SessionSpiTransmitResult,
3357        fidl::encoding::DefaultFuchsiaResourceDialect,
3358    >;
3359    fn r#spi_transmit(
3360        &self,
3361        mut resource: u32,
3362        mut tx_data: &[u8],
3363    ) -> Self::SpiTransmitResponseFut {
3364        fn _decode(
3365            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3366        ) -> Result<SessionSpiTransmitResult, fidl::Error> {
3367            let _response = fidl::client::decode_transaction_body::<
3368                fidl::encoding::FlexibleResultType<SpiTransmitResult, OperationError>,
3369                fidl::encoding::DefaultFuchsiaResourceDialect,
3370                0x3429847e2877d4d7,
3371            >(_buf?)?
3372            .into_result::<SessionMarker>("spi_transmit")?;
3373            Ok(_response.map(|x| (x.rx_data, x.audit_seq, x.timestamp_ns)))
3374        }
3375        self.client.send_query_and_decode::<SessionSpiTransmitRequest, SessionSpiTransmitResult>(
3376            (resource, tx_data),
3377            0x3429847e2877d4d7,
3378            fidl::encoding::DynamicFlags::FLEXIBLE,
3379            _decode,
3380        )
3381    }
3382
3383    type OpenGpioResponseFut = fidl::client::QueryResponseFut<
3384        SessionOpenGpioResult,
3385        fidl::encoding::DefaultFuchsiaResourceDialect,
3386    >;
3387    fn r#open_gpio(
3388        &self,
3389        mut resource: u32,
3390        mut endpoint: fidl::endpoints::ServerEnd<GpioEndpointMarker>,
3391    ) -> Self::OpenGpioResponseFut {
3392        fn _decode(
3393            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3394        ) -> Result<SessionOpenGpioResult, fidl::Error> {
3395            let _response = fidl::client::decode_transaction_body::<
3396                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, OperationError>,
3397                fidl::encoding::DefaultFuchsiaResourceDialect,
3398                0x5bd9f23cba94897,
3399            >(_buf?)?
3400            .into_result::<SessionMarker>("open_gpio")?;
3401            Ok(_response.map(|x| x))
3402        }
3403        self.client.send_query_and_decode::<SessionOpenGpioRequest, SessionOpenGpioResult>(
3404            (resource, endpoint),
3405            0x5bd9f23cba94897,
3406            fidl::encoding::DynamicFlags::FLEXIBLE,
3407            _decode,
3408        )
3409    }
3410
3411    type OpenI2cResponseFut = fidl::client::QueryResponseFut<
3412        SessionOpenI2cResult,
3413        fidl::encoding::DefaultFuchsiaResourceDialect,
3414    >;
3415    fn r#open_i2c(
3416        &self,
3417        mut resource: u32,
3418        mut endpoint: fidl::endpoints::ServerEnd<I2cEndpointMarker>,
3419    ) -> Self::OpenI2cResponseFut {
3420        fn _decode(
3421            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3422        ) -> Result<SessionOpenI2cResult, fidl::Error> {
3423            let _response = fidl::client::decode_transaction_body::<
3424                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, OperationError>,
3425                fidl::encoding::DefaultFuchsiaResourceDialect,
3426                0x17ba936a44a14633,
3427            >(_buf?)?
3428            .into_result::<SessionMarker>("open_i2c")?;
3429            Ok(_response.map(|x| x))
3430        }
3431        self.client.send_query_and_decode::<SessionOpenI2cRequest, SessionOpenI2cResult>(
3432            (resource, endpoint),
3433            0x17ba936a44a14633,
3434            fidl::encoding::DynamicFlags::FLEXIBLE,
3435            _decode,
3436        )
3437    }
3438
3439    type OpenSpiResponseFut = fidl::client::QueryResponseFut<
3440        SessionOpenSpiResult,
3441        fidl::encoding::DefaultFuchsiaResourceDialect,
3442    >;
3443    fn r#open_spi(
3444        &self,
3445        mut resource: u32,
3446        mut endpoint: fidl::endpoints::ServerEnd<SpiEndpointMarker>,
3447    ) -> Self::OpenSpiResponseFut {
3448        fn _decode(
3449            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3450        ) -> Result<SessionOpenSpiResult, fidl::Error> {
3451            let _response = fidl::client::decode_transaction_body::<
3452                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, OperationError>,
3453                fidl::encoding::DefaultFuchsiaResourceDialect,
3454                0x3ee7e7cea84dfc9d,
3455            >(_buf?)?
3456            .into_result::<SessionMarker>("open_spi")?;
3457            Ok(_response.map(|x| x))
3458        }
3459        self.client.send_query_and_decode::<SessionOpenSpiRequest, SessionOpenSpiResult>(
3460            (resource, endpoint),
3461            0x3ee7e7cea84dfc9d,
3462            fidl::encoding::DynamicFlags::FLEXIBLE,
3463            _decode,
3464        )
3465    }
3466
3467    type WaitForInterruptResponseFut = fidl::client::QueryResponseFut<
3468        SessionWaitForInterruptResult,
3469        fidl::encoding::DefaultFuchsiaResourceDialect,
3470    >;
3471    fn r#wait_for_interrupt(
3472        &self,
3473        mut resource: u32,
3474        mut after_sequence: u64,
3475        mut timeout_ns: i64,
3476    ) -> Self::WaitForInterruptResponseFut {
3477        fn _decode(
3478            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3479        ) -> Result<SessionWaitForInterruptResult, fidl::Error> {
3480            let _response = fidl::client::decode_transaction_body::<
3481                fidl::encoding::FlexibleResultType<InterruptResult, OperationError>,
3482                fidl::encoding::DefaultFuchsiaResourceDialect,
3483                0x276a31c24a164cdb,
3484            >(_buf?)?
3485            .into_result::<SessionMarker>("wait_for_interrupt")?;
3486            Ok(_response
3487                .map(|x| (x.resource, x.sequence, x.count, x.timestamp_ns, x.coalesced_count)))
3488        }
3489        self.client
3490            .send_query_and_decode::<SessionWaitForInterruptRequest, SessionWaitForInterruptResult>(
3491                (resource, after_sequence, timeout_ns),
3492                0x276a31c24a164cdb,
3493                fidl::encoding::DynamicFlags::FLEXIBLE,
3494                _decode,
3495            )
3496    }
3497
3498    type ClockEnableResponseFut = fidl::client::QueryResponseFut<
3499        SessionClockEnableResult,
3500        fidl::encoding::DefaultFuchsiaResourceDialect,
3501    >;
3502    fn r#clock_enable(&self, mut resource: u32) -> Self::ClockEnableResponseFut {
3503        fn _decode(
3504            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3505        ) -> Result<SessionClockEnableResult, fidl::Error> {
3506            let _response = fidl::client::decode_transaction_body::<
3507                fidl::encoding::FlexibleResultType<ClockEnableResult, OperationError>,
3508                fidl::encoding::DefaultFuchsiaResourceDialect,
3509                0x774b563ebff897eb,
3510            >(_buf?)?
3511            .into_result::<SessionMarker>("clock_enable")?;
3512            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3513        }
3514        self.client.send_query_and_decode::<SessionClockEnableRequest, SessionClockEnableResult>(
3515            (resource,),
3516            0x774b563ebff897eb,
3517            fidl::encoding::DynamicFlags::FLEXIBLE,
3518            _decode,
3519        )
3520    }
3521
3522    type ClockDisableResponseFut = fidl::client::QueryResponseFut<
3523        SessionClockDisableResult,
3524        fidl::encoding::DefaultFuchsiaResourceDialect,
3525    >;
3526    fn r#clock_disable(&self, mut resource: u32) -> Self::ClockDisableResponseFut {
3527        fn _decode(
3528            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3529        ) -> Result<SessionClockDisableResult, fidl::Error> {
3530            let _response = fidl::client::decode_transaction_body::<
3531                fidl::encoding::FlexibleResultType<ClockDisableResult, OperationError>,
3532                fidl::encoding::DefaultFuchsiaResourceDialect,
3533                0x642c11d03db8b873,
3534            >(_buf?)?
3535            .into_result::<SessionMarker>("clock_disable")?;
3536            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3537        }
3538        self.client.send_query_and_decode::<SessionClockDisableRequest, SessionClockDisableResult>(
3539            (resource,),
3540            0x642c11d03db8b873,
3541            fidl::encoding::DynamicFlags::FLEXIBLE,
3542            _decode,
3543        )
3544    }
3545
3546    type ClockIsEnabledResponseFut = fidl::client::QueryResponseFut<
3547        SessionClockIsEnabledResult,
3548        fidl::encoding::DefaultFuchsiaResourceDialect,
3549    >;
3550    fn r#clock_is_enabled(&self, mut resource: u32) -> Self::ClockIsEnabledResponseFut {
3551        fn _decode(
3552            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3553        ) -> Result<SessionClockIsEnabledResult, fidl::Error> {
3554            let _response = fidl::client::decode_transaction_body::<
3555                fidl::encoding::FlexibleResultType<ClockIsEnabledResult, OperationError>,
3556                fidl::encoding::DefaultFuchsiaResourceDialect,
3557                0x36a033a7a1322174,
3558            >(_buf?)?
3559            .into_result::<SessionMarker>("clock_is_enabled")?;
3560            Ok(_response.map(|x| (x.enabled, x.audit_seq, x.timestamp_ns)))
3561        }
3562        self.client
3563            .send_query_and_decode::<SessionClockIsEnabledRequest, SessionClockIsEnabledResult>(
3564                (resource,),
3565                0x36a033a7a1322174,
3566                fidl::encoding::DynamicFlags::FLEXIBLE,
3567                _decode,
3568            )
3569    }
3570
3571    type ClockSetRateResponseFut = fidl::client::QueryResponseFut<
3572        SessionClockSetRateResult,
3573        fidl::encoding::DefaultFuchsiaResourceDialect,
3574    >;
3575    fn r#clock_set_rate(&self, mut resource: u32, mut hz: u64) -> Self::ClockSetRateResponseFut {
3576        fn _decode(
3577            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3578        ) -> Result<SessionClockSetRateResult, fidl::Error> {
3579            let _response = fidl::client::decode_transaction_body::<
3580                fidl::encoding::FlexibleResultType<ClockSetRateResult, OperationError>,
3581                fidl::encoding::DefaultFuchsiaResourceDialect,
3582                0x4dbc4012d4289048,
3583            >(_buf?)?
3584            .into_result::<SessionMarker>("clock_set_rate")?;
3585            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3586        }
3587        self.client.send_query_and_decode::<SessionClockSetRateRequest, SessionClockSetRateResult>(
3588            (resource, hz),
3589            0x4dbc4012d4289048,
3590            fidl::encoding::DynamicFlags::FLEXIBLE,
3591            _decode,
3592        )
3593    }
3594
3595    type ClockQueryRateResponseFut = fidl::client::QueryResponseFut<
3596        SessionClockQueryRateResult,
3597        fidl::encoding::DefaultFuchsiaResourceDialect,
3598    >;
3599    fn r#clock_query_rate(
3600        &self,
3601        mut resource: u32,
3602        mut hz_in: u64,
3603    ) -> Self::ClockQueryRateResponseFut {
3604        fn _decode(
3605            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3606        ) -> Result<SessionClockQueryRateResult, fidl::Error> {
3607            let _response = fidl::client::decode_transaction_body::<
3608                fidl::encoding::FlexibleResultType<ClockQueryRateResult, OperationError>,
3609                fidl::encoding::DefaultFuchsiaResourceDialect,
3610                0x11b9fe61ad09ff5e,
3611            >(_buf?)?
3612            .into_result::<SessionMarker>("clock_query_rate")?;
3613            Ok(_response.map(|x| (x.hz_out, x.audit_seq, x.timestamp_ns)))
3614        }
3615        self.client
3616            .send_query_and_decode::<SessionClockQueryRateRequest, SessionClockQueryRateResult>(
3617                (resource, hz_in),
3618                0x11b9fe61ad09ff5e,
3619                fidl::encoding::DynamicFlags::FLEXIBLE,
3620                _decode,
3621            )
3622    }
3623
3624    type ClockGetRateResponseFut = fidl::client::QueryResponseFut<
3625        SessionClockGetRateResult,
3626        fidl::encoding::DefaultFuchsiaResourceDialect,
3627    >;
3628    fn r#clock_get_rate(&self, mut resource: u32) -> Self::ClockGetRateResponseFut {
3629        fn _decode(
3630            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3631        ) -> Result<SessionClockGetRateResult, fidl::Error> {
3632            let _response = fidl::client::decode_transaction_body::<
3633                fidl::encoding::FlexibleResultType<ClockGetRateResult, OperationError>,
3634                fidl::encoding::DefaultFuchsiaResourceDialect,
3635                0x4f3c0e2259e5e46,
3636            >(_buf?)?
3637            .into_result::<SessionMarker>("clock_get_rate")?;
3638            Ok(_response.map(|x| (x.hz, x.audit_seq, x.timestamp_ns)))
3639        }
3640        self.client.send_query_and_decode::<SessionClockGetRateRequest, SessionClockGetRateResult>(
3641            (resource,),
3642            0x4f3c0e2259e5e46,
3643            fidl::encoding::DynamicFlags::FLEXIBLE,
3644            _decode,
3645        )
3646    }
3647
3648    type ResetAssertResponseFut = fidl::client::QueryResponseFut<
3649        SessionResetAssertResult,
3650        fidl::encoding::DefaultFuchsiaResourceDialect,
3651    >;
3652    fn r#reset_assert(&self, mut resource: u32) -> Self::ResetAssertResponseFut {
3653        fn _decode(
3654            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3655        ) -> Result<SessionResetAssertResult, fidl::Error> {
3656            let _response = fidl::client::decode_transaction_body::<
3657                fidl::encoding::FlexibleResultType<ResetAssertResult, OperationError>,
3658                fidl::encoding::DefaultFuchsiaResourceDialect,
3659                0x5788d4842384c111,
3660            >(_buf?)?
3661            .into_result::<SessionMarker>("reset_assert")?;
3662            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3663        }
3664        self.client.send_query_and_decode::<SessionResetAssertRequest, SessionResetAssertResult>(
3665            (resource,),
3666            0x5788d4842384c111,
3667            fidl::encoding::DynamicFlags::FLEXIBLE,
3668            _decode,
3669        )
3670    }
3671
3672    type ResetDeassertResponseFut = fidl::client::QueryResponseFut<
3673        SessionResetDeassertResult,
3674        fidl::encoding::DefaultFuchsiaResourceDialect,
3675    >;
3676    fn r#reset_deassert(&self, mut resource: u32) -> Self::ResetDeassertResponseFut {
3677        fn _decode(
3678            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3679        ) -> Result<SessionResetDeassertResult, fidl::Error> {
3680            let _response = fidl::client::decode_transaction_body::<
3681                fidl::encoding::FlexibleResultType<ResetDeassertResult, OperationError>,
3682                fidl::encoding::DefaultFuchsiaResourceDialect,
3683                0x632c13fc5e08d3e2,
3684            >(_buf?)?
3685            .into_result::<SessionMarker>("reset_deassert")?;
3686            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3687        }
3688        self.client
3689            .send_query_and_decode::<SessionResetDeassertRequest, SessionResetDeassertResult>(
3690                (resource,),
3691                0x632c13fc5e08d3e2,
3692                fidl::encoding::DynamicFlags::FLEXIBLE,
3693                _decode,
3694            )
3695    }
3696
3697    type ResetToggleResponseFut = fidl::client::QueryResponseFut<
3698        SessionResetToggleResult,
3699        fidl::encoding::DefaultFuchsiaResourceDialect,
3700    >;
3701    fn r#reset_toggle(&self, mut resource: u32) -> Self::ResetToggleResponseFut {
3702        fn _decode(
3703            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3704        ) -> Result<SessionResetToggleResult, fidl::Error> {
3705            let _response = fidl::client::decode_transaction_body::<
3706                fidl::encoding::FlexibleResultType<ResetToggleResult, OperationError>,
3707                fidl::encoding::DefaultFuchsiaResourceDialect,
3708                0x2b2b14cb6a5e4c98,
3709            >(_buf?)?
3710            .into_result::<SessionMarker>("reset_toggle")?;
3711            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3712        }
3713        self.client.send_query_and_decode::<SessionResetToggleRequest, SessionResetToggleResult>(
3714            (resource,),
3715            0x2b2b14cb6a5e4c98,
3716            fidl::encoding::DynamicFlags::FLEXIBLE,
3717            _decode,
3718        )
3719    }
3720
3721    type ResetStatusResponseFut = fidl::client::QueryResponseFut<
3722        SessionResetStatusResult,
3723        fidl::encoding::DefaultFuchsiaResourceDialect,
3724    >;
3725    fn r#reset_status(&self, mut resource: u32) -> Self::ResetStatusResponseFut {
3726        fn _decode(
3727            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3728        ) -> Result<SessionResetStatusResult, fidl::Error> {
3729            let _response = fidl::client::decode_transaction_body::<
3730                fidl::encoding::FlexibleResultType<ResetStatusResult, OperationError>,
3731                fidl::encoding::DefaultFuchsiaResourceDialect,
3732                0x1790a96ce5f3b3d9,
3733            >(_buf?)?
3734            .into_result::<SessionMarker>("reset_status")?;
3735            Ok(_response.map(|x| (x.asserted, x.audit_seq, x.timestamp_ns)))
3736        }
3737        self.client.send_query_and_decode::<SessionResetStatusRequest, SessionResetStatusResult>(
3738            (resource,),
3739            0x1790a96ce5f3b3d9,
3740            fidl::encoding::DynamicFlags::FLEXIBLE,
3741            _decode,
3742        )
3743    }
3744
3745    type SerialReadResponseFut = fidl::client::QueryResponseFut<
3746        SessionSerialReadResult,
3747        fidl::encoding::DefaultFuchsiaResourceDialect,
3748    >;
3749    fn r#serial_read(&self, mut resource: u32) -> Self::SerialReadResponseFut {
3750        fn _decode(
3751            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3752        ) -> Result<SessionSerialReadResult, fidl::Error> {
3753            let _response = fidl::client::decode_transaction_body::<
3754                fidl::encoding::FlexibleResultType<SerialReadResult, OperationError>,
3755                fidl::encoding::DefaultFuchsiaResourceDialect,
3756                0x2b76818805a351fd,
3757            >(_buf?)?
3758            .into_result::<SessionMarker>("serial_read")?;
3759            Ok(_response.map(|x| (x.data, x.audit_seq, x.timestamp_ns)))
3760        }
3761        self.client.send_query_and_decode::<SessionSerialReadRequest, SessionSerialReadResult>(
3762            (resource,),
3763            0x2b76818805a351fd,
3764            fidl::encoding::DynamicFlags::FLEXIBLE,
3765            _decode,
3766        )
3767    }
3768
3769    type SerialWriteResponseFut = fidl::client::QueryResponseFut<
3770        SessionSerialWriteResult,
3771        fidl::encoding::DefaultFuchsiaResourceDialect,
3772    >;
3773    fn r#serial_write(&self, mut resource: u32, mut data: &[u8]) -> Self::SerialWriteResponseFut {
3774        fn _decode(
3775            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3776        ) -> Result<SessionSerialWriteResult, fidl::Error> {
3777            let _response = fidl::client::decode_transaction_body::<
3778                fidl::encoding::FlexibleResultType<SerialWriteResult, OperationError>,
3779                fidl::encoding::DefaultFuchsiaResourceDialect,
3780                0x5345a3e2317a792f,
3781            >(_buf?)?
3782            .into_result::<SessionMarker>("serial_write")?;
3783            Ok(_response.map(|x| (x.audit_seq, x.timestamp_ns)))
3784        }
3785        self.client.send_query_and_decode::<SessionSerialWriteRequest, SessionSerialWriteResult>(
3786            (resource, data),
3787            0x5345a3e2317a792f,
3788            fidl::encoding::DynamicFlags::FLEXIBLE,
3789            _decode,
3790        )
3791    }
3792}
3793
3794pub struct SessionEventStream {
3795    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3796}
3797
3798impl std::marker::Unpin for SessionEventStream {}
3799
3800impl futures::stream::FusedStream for SessionEventStream {
3801    fn is_terminated(&self) -> bool {
3802        self.event_receiver.is_terminated()
3803    }
3804}
3805
3806impl futures::Stream for SessionEventStream {
3807    type Item = Result<SessionEvent, fidl::Error>;
3808
3809    fn poll_next(
3810        mut self: std::pin::Pin<&mut Self>,
3811        cx: &mut std::task::Context<'_>,
3812    ) -> std::task::Poll<Option<Self::Item>> {
3813        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3814            &mut self.event_receiver,
3815            cx
3816        )?) {
3817            Some(buf) => std::task::Poll::Ready(Some(SessionEvent::decode(buf))),
3818            None => std::task::Poll::Ready(None),
3819        }
3820    }
3821}
3822
3823#[derive(Debug)]
3824pub enum SessionEvent {
3825    #[non_exhaustive]
3826    _UnknownEvent {
3827        /// Ordinal of the event that was sent.
3828        ordinal: u64,
3829    },
3830}
3831
3832impl SessionEvent {
3833    /// Decodes a message buffer as a [`SessionEvent`].
3834    fn decode(
3835        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3836    ) -> Result<SessionEvent, fidl::Error> {
3837        let (bytes, _handles) = buf.split_mut();
3838        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3839        debug_assert_eq!(tx_header.tx_id, 0);
3840        match tx_header.ordinal {
3841            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3842                Ok(SessionEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3843            }
3844            _ => Err(fidl::Error::UnknownOrdinal {
3845                ordinal: tx_header.ordinal,
3846                protocol_name: <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3847            }),
3848        }
3849    }
3850}
3851
3852/// A Stream of incoming requests for fuchsia.driver.lab/Session.
3853pub struct SessionRequestStream {
3854    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3855    is_terminated: bool,
3856}
3857
3858impl std::marker::Unpin for SessionRequestStream {}
3859
3860impl futures::stream::FusedStream for SessionRequestStream {
3861    fn is_terminated(&self) -> bool {
3862        self.is_terminated
3863    }
3864}
3865
3866impl fidl::endpoints::RequestStream for SessionRequestStream {
3867    type Protocol = SessionMarker;
3868    type ControlHandle = SessionControlHandle;
3869
3870    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3871        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3872    }
3873
3874    fn control_handle(&self) -> Self::ControlHandle {
3875        SessionControlHandle { inner: self.inner.clone() }
3876    }
3877
3878    fn into_inner(
3879        self,
3880    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3881    {
3882        (self.inner, self.is_terminated)
3883    }
3884
3885    fn from_inner(
3886        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3887        is_terminated: bool,
3888    ) -> Self {
3889        Self { inner, is_terminated }
3890    }
3891}
3892
3893impl futures::Stream for SessionRequestStream {
3894    type Item = Result<SessionRequest, fidl::Error>;
3895
3896    fn poll_next(
3897        mut self: std::pin::Pin<&mut Self>,
3898        cx: &mut std::task::Context<'_>,
3899    ) -> std::task::Poll<Option<Self::Item>> {
3900        let this = &mut *self;
3901        if this.inner.check_shutdown(cx) {
3902            this.is_terminated = true;
3903            return std::task::Poll::Ready(None);
3904        }
3905        if this.is_terminated {
3906            panic!("polled SessionRequestStream after completion");
3907        }
3908        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3909            |bytes, handles| {
3910                match this.inner.channel().read_etc(cx, bytes, handles) {
3911                    std::task::Poll::Ready(Ok(())) => {}
3912                    std::task::Poll::Pending => return std::task::Poll::Pending,
3913                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3914                        this.is_terminated = true;
3915                        return std::task::Poll::Ready(None);
3916                    }
3917                    std::task::Poll::Ready(Err(e)) => {
3918                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3919                            e.into(),
3920                        ))));
3921                    }
3922                }
3923
3924                // A message has been received from the channel
3925                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3926
3927                std::task::Poll::Ready(Some(match header.ordinal {
3928                    0x7afec1bfecc09a54 => {
3929                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3930                        let mut req = fidl::new_empty!(
3931                            SessionRead32Request,
3932                            fidl::encoding::DefaultFuchsiaResourceDialect
3933                        );
3934                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionRead32Request>(&header, _body_bytes, handles, &mut req)?;
3935                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
3936                        Ok(SessionRequest::Read32 {
3937                            resource: req.resource,
3938                            offset: req.offset,
3939
3940                            responder: SessionRead32Responder {
3941                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3942                                tx_id: header.tx_id,
3943                            },
3944                        })
3945                    }
3946                    0x5fa90e4c39fa72e1 => {
3947                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3948                        let mut req = fidl::new_empty!(
3949                            SessionSnapshotRequest,
3950                            fidl::encoding::DefaultFuchsiaResourceDialect
3951                        );
3952                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionSnapshotRequest>(&header, _body_bytes, handles, &mut req)?;
3953                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
3954                        Ok(SessionRequest::Snapshot {
3955                            items: req.items,
3956
3957                            responder: SessionSnapshotResponder {
3958                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3959                                tx_id: header.tx_id,
3960                            },
3961                        })
3962                    }
3963                    0x4906c4144e00f4c4 => {
3964                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3965                        let mut req = fidl::new_empty!(
3966                            SessionReadAuditRequest,
3967                            fidl::encoding::DefaultFuchsiaResourceDialect
3968                        );
3969                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionReadAuditRequest>(&header, _body_bytes, handles, &mut req)?;
3970                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
3971                        Ok(SessionRequest::ReadAudit {
3972                            cursor: req.cursor,
3973                            limit: req.limit,
3974
3975                            responder: SessionReadAuditResponder {
3976                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3977                                tx_id: header.tx_id,
3978                            },
3979                        })
3980                    }
3981                    0x80dcccde698980c => {
3982                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3983                        let mut req = fidl::new_empty!(
3984                            SessionWrite32Request,
3985                            fidl::encoding::DefaultFuchsiaResourceDialect
3986                        );
3987                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionWrite32Request>(&header, _body_bytes, handles, &mut req)?;
3988                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
3989                        Ok(SessionRequest::Write32 {
3990                            resource: req.resource,
3991                            offset: req.offset,
3992                            value: req.value,
3993                            write_mask: req.write_mask,
3994                            precondition: req.precondition,
3995                            readback: req.readback,
3996
3997                            responder: SessionWrite32Responder {
3998                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3999                                tx_id: header.tx_id,
4000                            },
4001                        })
4002                    }
4003                    0x3b9c26d1582fff7d => {
4004                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4005                        let mut req = fidl::new_empty!(
4006                            SessionPoll32Request,
4007                            fidl::encoding::DefaultFuchsiaResourceDialect
4008                        );
4009                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionPoll32Request>(&header, _body_bytes, handles, &mut req)?;
4010                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4011                        Ok(SessionRequest::Poll32 {
4012                            resource: req.resource,
4013                            offset: req.offset,
4014                            expected: req.expected,
4015                            mask: req.mask,
4016                            interval_ns: req.interval_ns,
4017                            timeout_ns: req.timeout_ns,
4018
4019                            responder: SessionPoll32Responder {
4020                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4021                                tx_id: header.tx_id,
4022                            },
4023                        })
4024                    }
4025                    0xf0500bd7555a614 => {
4026                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4027                        let mut req = fidl::new_empty!(
4028                            SessionExecuteSequenceRequest,
4029                            fidl::encoding::DefaultFuchsiaResourceDialect
4030                        );
4031                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionExecuteSequenceRequest>(&header, _body_bytes, handles, &mut req)?;
4032                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4033                        Ok(SessionRequest::ExecuteSequence {
4034                            items: req.items,
4035
4036                            responder: SessionExecuteSequenceResponder {
4037                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4038                                tx_id: header.tx_id,
4039                            },
4040                        })
4041                    }
4042                    0xb01fc817332de51 => {
4043                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4044                        let mut req = fidl::new_empty!(
4045                            SessionGpioReadRequest,
4046                            fidl::encoding::DefaultFuchsiaResourceDialect
4047                        );
4048                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionGpioReadRequest>(&header, _body_bytes, handles, &mut req)?;
4049                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4050                        Ok(SessionRequest::GpioRead {
4051                            resource: req.resource,
4052
4053                            responder: SessionGpioReadResponder {
4054                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4055                                tx_id: header.tx_id,
4056                            },
4057                        })
4058                    }
4059                    0x27cfbd9ffaf5c6e7 => {
4060                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4061                        let mut req = fidl::new_empty!(
4062                            SessionGpioWriteRequest,
4063                            fidl::encoding::DefaultFuchsiaResourceDialect
4064                        );
4065                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionGpioWriteRequest>(&header, _body_bytes, handles, &mut req)?;
4066                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4067                        Ok(SessionRequest::GpioWrite {
4068                            resource: req.resource,
4069                            value: req.value,
4070
4071                            responder: SessionGpioWriteResponder {
4072                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4073                                tx_id: header.tx_id,
4074                            },
4075                        })
4076                    }
4077                    0x67016bc41336f298 => {
4078                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4079                        let mut req = fidl::new_empty!(
4080                            SessionI2cTransferRequest,
4081                            fidl::encoding::DefaultFuchsiaResourceDialect
4082                        );
4083                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionI2cTransferRequest>(&header, _body_bytes, handles, &mut req)?;
4084                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4085                        Ok(SessionRequest::I2cTransfer {
4086                            resource: req.resource,
4087                            write_data: req.write_data,
4088                            read_length: req.read_length,
4089
4090                            responder: SessionI2cTransferResponder {
4091                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4092                                tx_id: header.tx_id,
4093                            },
4094                        })
4095                    }
4096                    0x3429847e2877d4d7 => {
4097                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4098                        let mut req = fidl::new_empty!(
4099                            SessionSpiTransmitRequest,
4100                            fidl::encoding::DefaultFuchsiaResourceDialect
4101                        );
4102                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionSpiTransmitRequest>(&header, _body_bytes, handles, &mut req)?;
4103                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4104                        Ok(SessionRequest::SpiTransmit {
4105                            resource: req.resource,
4106                            tx_data: req.tx_data,
4107
4108                            responder: SessionSpiTransmitResponder {
4109                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4110                                tx_id: header.tx_id,
4111                            },
4112                        })
4113                    }
4114                    0x5bd9f23cba94897 => {
4115                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4116                        let mut req = fidl::new_empty!(
4117                            SessionOpenGpioRequest,
4118                            fidl::encoding::DefaultFuchsiaResourceDialect
4119                        );
4120                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOpenGpioRequest>(&header, _body_bytes, handles, &mut req)?;
4121                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4122                        Ok(SessionRequest::OpenGpio {
4123                            resource: req.resource,
4124                            endpoint: req.endpoint,
4125
4126                            responder: SessionOpenGpioResponder {
4127                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4128                                tx_id: header.tx_id,
4129                            },
4130                        })
4131                    }
4132                    0x17ba936a44a14633 => {
4133                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4134                        let mut req = fidl::new_empty!(
4135                            SessionOpenI2cRequest,
4136                            fidl::encoding::DefaultFuchsiaResourceDialect
4137                        );
4138                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOpenI2cRequest>(&header, _body_bytes, handles, &mut req)?;
4139                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4140                        Ok(SessionRequest::OpenI2c {
4141                            resource: req.resource,
4142                            endpoint: req.endpoint,
4143
4144                            responder: SessionOpenI2cResponder {
4145                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4146                                tx_id: header.tx_id,
4147                            },
4148                        })
4149                    }
4150                    0x3ee7e7cea84dfc9d => {
4151                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4152                        let mut req = fidl::new_empty!(
4153                            SessionOpenSpiRequest,
4154                            fidl::encoding::DefaultFuchsiaResourceDialect
4155                        );
4156                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionOpenSpiRequest>(&header, _body_bytes, handles, &mut req)?;
4157                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4158                        Ok(SessionRequest::OpenSpi {
4159                            resource: req.resource,
4160                            endpoint: req.endpoint,
4161
4162                            responder: SessionOpenSpiResponder {
4163                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4164                                tx_id: header.tx_id,
4165                            },
4166                        })
4167                    }
4168                    0x276a31c24a164cdb => {
4169                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4170                        let mut req = fidl::new_empty!(
4171                            SessionWaitForInterruptRequest,
4172                            fidl::encoding::DefaultFuchsiaResourceDialect
4173                        );
4174                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionWaitForInterruptRequest>(&header, _body_bytes, handles, &mut req)?;
4175                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4176                        Ok(SessionRequest::WaitForInterrupt {
4177                            resource: req.resource,
4178                            after_sequence: req.after_sequence,
4179                            timeout_ns: req.timeout_ns,
4180
4181                            responder: SessionWaitForInterruptResponder {
4182                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4183                                tx_id: header.tx_id,
4184                            },
4185                        })
4186                    }
4187                    0x774b563ebff897eb => {
4188                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4189                        let mut req = fidl::new_empty!(
4190                            SessionClockEnableRequest,
4191                            fidl::encoding::DefaultFuchsiaResourceDialect
4192                        );
4193                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionClockEnableRequest>(&header, _body_bytes, handles, &mut req)?;
4194                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4195                        Ok(SessionRequest::ClockEnable {
4196                            resource: req.resource,
4197
4198                            responder: SessionClockEnableResponder {
4199                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4200                                tx_id: header.tx_id,
4201                            },
4202                        })
4203                    }
4204                    0x642c11d03db8b873 => {
4205                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4206                        let mut req = fidl::new_empty!(
4207                            SessionClockDisableRequest,
4208                            fidl::encoding::DefaultFuchsiaResourceDialect
4209                        );
4210                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionClockDisableRequest>(&header, _body_bytes, handles, &mut req)?;
4211                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4212                        Ok(SessionRequest::ClockDisable {
4213                            resource: req.resource,
4214
4215                            responder: SessionClockDisableResponder {
4216                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4217                                tx_id: header.tx_id,
4218                            },
4219                        })
4220                    }
4221                    0x36a033a7a1322174 => {
4222                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4223                        let mut req = fidl::new_empty!(
4224                            SessionClockIsEnabledRequest,
4225                            fidl::encoding::DefaultFuchsiaResourceDialect
4226                        );
4227                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionClockIsEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
4228                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4229                        Ok(SessionRequest::ClockIsEnabled {
4230                            resource: req.resource,
4231
4232                            responder: SessionClockIsEnabledResponder {
4233                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4234                                tx_id: header.tx_id,
4235                            },
4236                        })
4237                    }
4238                    0x4dbc4012d4289048 => {
4239                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4240                        let mut req = fidl::new_empty!(
4241                            SessionClockSetRateRequest,
4242                            fidl::encoding::DefaultFuchsiaResourceDialect
4243                        );
4244                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionClockSetRateRequest>(&header, _body_bytes, handles, &mut req)?;
4245                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4246                        Ok(SessionRequest::ClockSetRate {
4247                            resource: req.resource,
4248                            hz: req.hz,
4249
4250                            responder: SessionClockSetRateResponder {
4251                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4252                                tx_id: header.tx_id,
4253                            },
4254                        })
4255                    }
4256                    0x11b9fe61ad09ff5e => {
4257                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4258                        let mut req = fidl::new_empty!(
4259                            SessionClockQueryRateRequest,
4260                            fidl::encoding::DefaultFuchsiaResourceDialect
4261                        );
4262                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionClockQueryRateRequest>(&header, _body_bytes, handles, &mut req)?;
4263                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4264                        Ok(SessionRequest::ClockQueryRate {
4265                            resource: req.resource,
4266                            hz_in: req.hz_in,
4267
4268                            responder: SessionClockQueryRateResponder {
4269                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4270                                tx_id: header.tx_id,
4271                            },
4272                        })
4273                    }
4274                    0x4f3c0e2259e5e46 => {
4275                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4276                        let mut req = fidl::new_empty!(
4277                            SessionClockGetRateRequest,
4278                            fidl::encoding::DefaultFuchsiaResourceDialect
4279                        );
4280                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionClockGetRateRequest>(&header, _body_bytes, handles, &mut req)?;
4281                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4282                        Ok(SessionRequest::ClockGetRate {
4283                            resource: req.resource,
4284
4285                            responder: SessionClockGetRateResponder {
4286                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4287                                tx_id: header.tx_id,
4288                            },
4289                        })
4290                    }
4291                    0x5788d4842384c111 => {
4292                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4293                        let mut req = fidl::new_empty!(
4294                            SessionResetAssertRequest,
4295                            fidl::encoding::DefaultFuchsiaResourceDialect
4296                        );
4297                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionResetAssertRequest>(&header, _body_bytes, handles, &mut req)?;
4298                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4299                        Ok(SessionRequest::ResetAssert {
4300                            resource: req.resource,
4301
4302                            responder: SessionResetAssertResponder {
4303                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4304                                tx_id: header.tx_id,
4305                            },
4306                        })
4307                    }
4308                    0x632c13fc5e08d3e2 => {
4309                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4310                        let mut req = fidl::new_empty!(
4311                            SessionResetDeassertRequest,
4312                            fidl::encoding::DefaultFuchsiaResourceDialect
4313                        );
4314                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionResetDeassertRequest>(&header, _body_bytes, handles, &mut req)?;
4315                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4316                        Ok(SessionRequest::ResetDeassert {
4317                            resource: req.resource,
4318
4319                            responder: SessionResetDeassertResponder {
4320                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4321                                tx_id: header.tx_id,
4322                            },
4323                        })
4324                    }
4325                    0x2b2b14cb6a5e4c98 => {
4326                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4327                        let mut req = fidl::new_empty!(
4328                            SessionResetToggleRequest,
4329                            fidl::encoding::DefaultFuchsiaResourceDialect
4330                        );
4331                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionResetToggleRequest>(&header, _body_bytes, handles, &mut req)?;
4332                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4333                        Ok(SessionRequest::ResetToggle {
4334                            resource: req.resource,
4335
4336                            responder: SessionResetToggleResponder {
4337                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4338                                tx_id: header.tx_id,
4339                            },
4340                        })
4341                    }
4342                    0x1790a96ce5f3b3d9 => {
4343                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4344                        let mut req = fidl::new_empty!(
4345                            SessionResetStatusRequest,
4346                            fidl::encoding::DefaultFuchsiaResourceDialect
4347                        );
4348                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionResetStatusRequest>(&header, _body_bytes, handles, &mut req)?;
4349                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4350                        Ok(SessionRequest::ResetStatus {
4351                            resource: req.resource,
4352
4353                            responder: SessionResetStatusResponder {
4354                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4355                                tx_id: header.tx_id,
4356                            },
4357                        })
4358                    }
4359                    0x2b76818805a351fd => {
4360                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4361                        let mut req = fidl::new_empty!(
4362                            SessionSerialReadRequest,
4363                            fidl::encoding::DefaultFuchsiaResourceDialect
4364                        );
4365                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionSerialReadRequest>(&header, _body_bytes, handles, &mut req)?;
4366                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4367                        Ok(SessionRequest::SerialRead {
4368                            resource: req.resource,
4369
4370                            responder: SessionSerialReadResponder {
4371                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4372                                tx_id: header.tx_id,
4373                            },
4374                        })
4375                    }
4376                    0x5345a3e2317a792f => {
4377                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4378                        let mut req = fidl::new_empty!(
4379                            SessionSerialWriteRequest,
4380                            fidl::encoding::DefaultFuchsiaResourceDialect
4381                        );
4382                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionSerialWriteRequest>(&header, _body_bytes, handles, &mut req)?;
4383                        let control_handle = SessionControlHandle { inner: this.inner.clone() };
4384                        Ok(SessionRequest::SerialWrite {
4385                            resource: req.resource,
4386                            data: req.data,
4387
4388                            responder: SessionSerialWriteResponder {
4389                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4390                                tx_id: header.tx_id,
4391                            },
4392                        })
4393                    }
4394                    _ if header.tx_id == 0
4395                        && header
4396                            .dynamic_flags()
4397                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4398                    {
4399                        Ok(SessionRequest::_UnknownMethod {
4400                            ordinal: header.ordinal,
4401                            control_handle: SessionControlHandle { inner: this.inner.clone() },
4402                            method_type: fidl::MethodType::OneWay,
4403                        })
4404                    }
4405                    _ if header
4406                        .dynamic_flags()
4407                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4408                    {
4409                        this.inner.send_framework_err(
4410                            fidl::encoding::FrameworkErr::UnknownMethod,
4411                            header.tx_id,
4412                            header.ordinal,
4413                            header.dynamic_flags(),
4414                            (bytes, handles),
4415                        )?;
4416                        Ok(SessionRequest::_UnknownMethod {
4417                            ordinal: header.ordinal,
4418                            control_handle: SessionControlHandle { inner: this.inner.clone() },
4419                            method_type: fidl::MethodType::TwoWay,
4420                        })
4421                    }
4422                    _ => Err(fidl::Error::UnknownOrdinal {
4423                        ordinal: header.ordinal,
4424                        protocol_name:
4425                            <SessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4426                    }),
4427                }))
4428            },
4429        )
4430    }
4431}
4432
4433/// One experiment session. Closing the channel closes the session,
4434/// cancels its pending work, and releases the mutation lease.
4435#[derive(Debug)]
4436pub enum SessionRequest {
4437    /// One policy-checked, audited 32-bit read.
4438    Read32 { resource: u32, offset: u64, responder: SessionRead32Responder },
4439    /// Bounded snapshot: every item is validated before the first read.
4440    Snapshot { items: Vec<SnapshotItem>, responder: SessionSnapshotResponder },
4441    /// Reads a bounded audit page so the host can drain incrementally and
4442    /// detect gaps.
4443    ReadAudit { cursor: u64, limit: u32, responder: SessionReadAuditResponder },
4444    /// One policy-checked, audited 32-bit write with optional precondition,
4445    /// read-modify-write, barrier, and readback.
4446    Write32 {
4447        resource: u32,
4448        offset: u64,
4449        value: u32,
4450        write_mask: u32,
4451        precondition: Option<Box<WritePrecondition>>,
4452        readback: bool,
4453        responder: SessionWrite32Responder,
4454    },
4455    /// Repeated bounded read until (value & mask) == (expected & mask)
4456    /// or timeout. Uses asynchronous timers on the driver dispatcher.
4457    Poll32 {
4458        resource: u32,
4459        offset: u64,
4460        expected: u32,
4461        mask: u32,
4462        interval_ns: i64,
4463        timeout_ns: i64,
4464        responder: SessionPoll32Responder,
4465    },
4466    /// Bounded ordered sequence of operations. Whole-sequence validation
4467    /// occurs before any hardware operation begins.
4468    ExecuteSequence { items: Vec<SequenceItem>, responder: SessionExecuteSequenceResponder },
4469    /// One policy-checked, audited GPIO read.
4470    GpioRead { resource: u32, responder: SessionGpioReadResponder },
4471    /// One policy-checked, audited GPIO write. Requires mutation lease.
4472    GpioWrite { resource: u32, value: bool, responder: SessionGpioWriteResponder },
4473    /// One policy-checked, audited I2C transfer. Non-empty write requires mutation lease.
4474    I2cTransfer {
4475        resource: u32,
4476        write_data: Vec<u8>,
4477        read_length: u32,
4478        responder: SessionI2cTransferResponder,
4479    },
4480    /// One policy-checked, audited SPI transmit. Requires mutation lease.
4481    SpiTransmit { resource: u32, tx_data: Vec<u8>, responder: SessionSpiTransmitResponder },
4482    /// Opens a typed GPIO endpoint bound to this session.
4483    OpenGpio {
4484        resource: u32,
4485        endpoint: fidl::endpoints::ServerEnd<GpioEndpointMarker>,
4486        responder: SessionOpenGpioResponder,
4487    },
4488    /// Opens a typed I2C endpoint bound to this session.
4489    OpenI2c {
4490        resource: u32,
4491        endpoint: fidl::endpoints::ServerEnd<I2cEndpointMarker>,
4492        responder: SessionOpenI2cResponder,
4493    },
4494    /// Opens a typed SPI endpoint bound to this session.
4495    OpenSpi {
4496        resource: u32,
4497        endpoint: fidl::endpoints::ServerEnd<SpiEndpointMarker>,
4498        responder: SessionOpenSpiResponder,
4499    },
4500    /// Observes an interrupt event. Bounded hanging request that yields when
4501    /// the interrupt sequence exceeds `after_sequence` or upon timeout.
4502    WaitForInterrupt {
4503        resource: u32,
4504        after_sequence: u64,
4505        timeout_ns: i64,
4506        responder: SessionWaitForInterruptResponder,
4507    },
4508    /// One policy-checked, audited Clock enable. Requires mutation lease.
4509    ClockEnable { resource: u32, responder: SessionClockEnableResponder },
4510    /// One policy-checked, audited Clock disable. Requires mutation lease.
4511    ClockDisable { resource: u32, responder: SessionClockDisableResponder },
4512    /// One policy-checked, audited Clock is_enabled query.
4513    ClockIsEnabled { resource: u32, responder: SessionClockIsEnabledResponder },
4514    /// One policy-checked, audited Clock set_rate. Requires mutation lease.
4515    ClockSetRate { resource: u32, hz: u64, responder: SessionClockSetRateResponder },
4516    /// One policy-checked, audited Clock query_supported_rate query.
4517    ClockQueryRate { resource: u32, hz_in: u64, responder: SessionClockQueryRateResponder },
4518    /// One policy-checked, audited Clock get_rate query.
4519    ClockGetRate { resource: u32, responder: SessionClockGetRateResponder },
4520    /// One policy-checked, audited Reset assert. Requires mutation lease.
4521    ResetAssert { resource: u32, responder: SessionResetAssertResponder },
4522    /// One policy-checked, audited Reset deassert. Requires mutation lease.
4523    ResetDeassert { resource: u32, responder: SessionResetDeassertResponder },
4524    /// One policy-checked, audited Reset toggle. Requires mutation lease.
4525    ResetToggle { resource: u32, responder: SessionResetToggleResponder },
4526    /// One policy-checked, audited Reset status query.
4527    ResetStatus { resource: u32, responder: SessionResetStatusResponder },
4528    /// One policy-checked, audited Serial read.
4529    SerialRead { resource: u32, responder: SessionSerialReadResponder },
4530    /// One policy-checked, audited Serial write. Requires mutation lease.
4531    SerialWrite { resource: u32, data: Vec<u8>, responder: SessionSerialWriteResponder },
4532    /// An interaction was received which does not match any known method.
4533    #[non_exhaustive]
4534    _UnknownMethod {
4535        /// Ordinal of the method that was called.
4536        ordinal: u64,
4537        control_handle: SessionControlHandle,
4538        method_type: fidl::MethodType,
4539    },
4540}
4541
4542impl SessionRequest {
4543    #[allow(irrefutable_let_patterns)]
4544    pub fn into_read32(self) -> Option<(u32, u64, SessionRead32Responder)> {
4545        if let SessionRequest::Read32 { resource, offset, responder } = self {
4546            Some((resource, offset, responder))
4547        } else {
4548            None
4549        }
4550    }
4551
4552    #[allow(irrefutable_let_patterns)]
4553    pub fn into_snapshot(self) -> Option<(Vec<SnapshotItem>, SessionSnapshotResponder)> {
4554        if let SessionRequest::Snapshot { items, responder } = self {
4555            Some((items, responder))
4556        } else {
4557            None
4558        }
4559    }
4560
4561    #[allow(irrefutable_let_patterns)]
4562    pub fn into_read_audit(self) -> Option<(u64, u32, SessionReadAuditResponder)> {
4563        if let SessionRequest::ReadAudit { cursor, limit, responder } = self {
4564            Some((cursor, limit, responder))
4565        } else {
4566            None
4567        }
4568    }
4569
4570    #[allow(irrefutable_let_patterns)]
4571    pub fn into_write32(
4572        self,
4573    ) -> Option<(u32, u64, u32, u32, Option<Box<WritePrecondition>>, bool, SessionWrite32Responder)>
4574    {
4575        if let SessionRequest::Write32 {
4576            resource,
4577            offset,
4578            value,
4579            write_mask,
4580            precondition,
4581            readback,
4582            responder,
4583        } = self
4584        {
4585            Some((resource, offset, value, write_mask, precondition, readback, responder))
4586        } else {
4587            None
4588        }
4589    }
4590
4591    #[allow(irrefutable_let_patterns)]
4592    pub fn into_poll32(self) -> Option<(u32, u64, u32, u32, i64, i64, SessionPoll32Responder)> {
4593        if let SessionRequest::Poll32 {
4594            resource,
4595            offset,
4596            expected,
4597            mask,
4598            interval_ns,
4599            timeout_ns,
4600            responder,
4601        } = self
4602        {
4603            Some((resource, offset, expected, mask, interval_ns, timeout_ns, responder))
4604        } else {
4605            None
4606        }
4607    }
4608
4609    #[allow(irrefutable_let_patterns)]
4610    pub fn into_execute_sequence(
4611        self,
4612    ) -> Option<(Vec<SequenceItem>, SessionExecuteSequenceResponder)> {
4613        if let SessionRequest::ExecuteSequence { items, responder } = self {
4614            Some((items, responder))
4615        } else {
4616            None
4617        }
4618    }
4619
4620    #[allow(irrefutable_let_patterns)]
4621    pub fn into_gpio_read(self) -> Option<(u32, SessionGpioReadResponder)> {
4622        if let SessionRequest::GpioRead { resource, responder } = self {
4623            Some((resource, responder))
4624        } else {
4625            None
4626        }
4627    }
4628
4629    #[allow(irrefutable_let_patterns)]
4630    pub fn into_gpio_write(self) -> Option<(u32, bool, SessionGpioWriteResponder)> {
4631        if let SessionRequest::GpioWrite { resource, value, responder } = self {
4632            Some((resource, value, responder))
4633        } else {
4634            None
4635        }
4636    }
4637
4638    #[allow(irrefutable_let_patterns)]
4639    pub fn into_i2c_transfer(self) -> Option<(u32, Vec<u8>, u32, SessionI2cTransferResponder)> {
4640        if let SessionRequest::I2cTransfer { resource, write_data, read_length, responder } = self {
4641            Some((resource, write_data, read_length, responder))
4642        } else {
4643            None
4644        }
4645    }
4646
4647    #[allow(irrefutable_let_patterns)]
4648    pub fn into_spi_transmit(self) -> Option<(u32, Vec<u8>, SessionSpiTransmitResponder)> {
4649        if let SessionRequest::SpiTransmit { resource, tx_data, responder } = self {
4650            Some((resource, tx_data, responder))
4651        } else {
4652            None
4653        }
4654    }
4655
4656    #[allow(irrefutable_let_patterns)]
4657    pub fn into_open_gpio(
4658        self,
4659    ) -> Option<(u32, fidl::endpoints::ServerEnd<GpioEndpointMarker>, SessionOpenGpioResponder)>
4660    {
4661        if let SessionRequest::OpenGpio { resource, endpoint, responder } = self {
4662            Some((resource, endpoint, responder))
4663        } else {
4664            None
4665        }
4666    }
4667
4668    #[allow(irrefutable_let_patterns)]
4669    pub fn into_open_i2c(
4670        self,
4671    ) -> Option<(u32, fidl::endpoints::ServerEnd<I2cEndpointMarker>, SessionOpenI2cResponder)> {
4672        if let SessionRequest::OpenI2c { resource, endpoint, responder } = self {
4673            Some((resource, endpoint, responder))
4674        } else {
4675            None
4676        }
4677    }
4678
4679    #[allow(irrefutable_let_patterns)]
4680    pub fn into_open_spi(
4681        self,
4682    ) -> Option<(u32, fidl::endpoints::ServerEnd<SpiEndpointMarker>, SessionOpenSpiResponder)> {
4683        if let SessionRequest::OpenSpi { resource, endpoint, responder } = self {
4684            Some((resource, endpoint, responder))
4685        } else {
4686            None
4687        }
4688    }
4689
4690    #[allow(irrefutable_let_patterns)]
4691    pub fn into_wait_for_interrupt(
4692        self,
4693    ) -> Option<(u32, u64, i64, SessionWaitForInterruptResponder)> {
4694        if let SessionRequest::WaitForInterrupt {
4695            resource,
4696            after_sequence,
4697            timeout_ns,
4698            responder,
4699        } = self
4700        {
4701            Some((resource, after_sequence, timeout_ns, responder))
4702        } else {
4703            None
4704        }
4705    }
4706
4707    #[allow(irrefutable_let_patterns)]
4708    pub fn into_clock_enable(self) -> Option<(u32, SessionClockEnableResponder)> {
4709        if let SessionRequest::ClockEnable { resource, responder } = self {
4710            Some((resource, responder))
4711        } else {
4712            None
4713        }
4714    }
4715
4716    #[allow(irrefutable_let_patterns)]
4717    pub fn into_clock_disable(self) -> Option<(u32, SessionClockDisableResponder)> {
4718        if let SessionRequest::ClockDisable { resource, responder } = self {
4719            Some((resource, responder))
4720        } else {
4721            None
4722        }
4723    }
4724
4725    #[allow(irrefutable_let_patterns)]
4726    pub fn into_clock_is_enabled(self) -> Option<(u32, SessionClockIsEnabledResponder)> {
4727        if let SessionRequest::ClockIsEnabled { resource, responder } = self {
4728            Some((resource, responder))
4729        } else {
4730            None
4731        }
4732    }
4733
4734    #[allow(irrefutable_let_patterns)]
4735    pub fn into_clock_set_rate(self) -> Option<(u32, u64, SessionClockSetRateResponder)> {
4736        if let SessionRequest::ClockSetRate { resource, hz, responder } = self {
4737            Some((resource, hz, responder))
4738        } else {
4739            None
4740        }
4741    }
4742
4743    #[allow(irrefutable_let_patterns)]
4744    pub fn into_clock_query_rate(self) -> Option<(u32, u64, SessionClockQueryRateResponder)> {
4745        if let SessionRequest::ClockQueryRate { resource, hz_in, responder } = self {
4746            Some((resource, hz_in, responder))
4747        } else {
4748            None
4749        }
4750    }
4751
4752    #[allow(irrefutable_let_patterns)]
4753    pub fn into_clock_get_rate(self) -> Option<(u32, SessionClockGetRateResponder)> {
4754        if let SessionRequest::ClockGetRate { resource, responder } = self {
4755            Some((resource, responder))
4756        } else {
4757            None
4758        }
4759    }
4760
4761    #[allow(irrefutable_let_patterns)]
4762    pub fn into_reset_assert(self) -> Option<(u32, SessionResetAssertResponder)> {
4763        if let SessionRequest::ResetAssert { resource, responder } = self {
4764            Some((resource, responder))
4765        } else {
4766            None
4767        }
4768    }
4769
4770    #[allow(irrefutable_let_patterns)]
4771    pub fn into_reset_deassert(self) -> Option<(u32, SessionResetDeassertResponder)> {
4772        if let SessionRequest::ResetDeassert { resource, responder } = self {
4773            Some((resource, responder))
4774        } else {
4775            None
4776        }
4777    }
4778
4779    #[allow(irrefutable_let_patterns)]
4780    pub fn into_reset_toggle(self) -> Option<(u32, SessionResetToggleResponder)> {
4781        if let SessionRequest::ResetToggle { resource, responder } = self {
4782            Some((resource, responder))
4783        } else {
4784            None
4785        }
4786    }
4787
4788    #[allow(irrefutable_let_patterns)]
4789    pub fn into_reset_status(self) -> Option<(u32, SessionResetStatusResponder)> {
4790        if let SessionRequest::ResetStatus { resource, responder } = self {
4791            Some((resource, responder))
4792        } else {
4793            None
4794        }
4795    }
4796
4797    #[allow(irrefutable_let_patterns)]
4798    pub fn into_serial_read(self) -> Option<(u32, SessionSerialReadResponder)> {
4799        if let SessionRequest::SerialRead { resource, responder } = self {
4800            Some((resource, responder))
4801        } else {
4802            None
4803        }
4804    }
4805
4806    #[allow(irrefutable_let_patterns)]
4807    pub fn into_serial_write(self) -> Option<(u32, Vec<u8>, SessionSerialWriteResponder)> {
4808        if let SessionRequest::SerialWrite { resource, data, responder } = self {
4809            Some((resource, data, responder))
4810        } else {
4811            None
4812        }
4813    }
4814
4815    /// Name of the method defined in FIDL
4816    pub fn method_name(&self) -> &'static str {
4817        match *self {
4818            SessionRequest::Read32 { .. } => "read32",
4819            SessionRequest::Snapshot { .. } => "snapshot",
4820            SessionRequest::ReadAudit { .. } => "read_audit",
4821            SessionRequest::Write32 { .. } => "write32",
4822            SessionRequest::Poll32 { .. } => "poll32",
4823            SessionRequest::ExecuteSequence { .. } => "execute_sequence",
4824            SessionRequest::GpioRead { .. } => "gpio_read",
4825            SessionRequest::GpioWrite { .. } => "gpio_write",
4826            SessionRequest::I2cTransfer { .. } => "i2c_transfer",
4827            SessionRequest::SpiTransmit { .. } => "spi_transmit",
4828            SessionRequest::OpenGpio { .. } => "open_gpio",
4829            SessionRequest::OpenI2c { .. } => "open_i2c",
4830            SessionRequest::OpenSpi { .. } => "open_spi",
4831            SessionRequest::WaitForInterrupt { .. } => "wait_for_interrupt",
4832            SessionRequest::ClockEnable { .. } => "clock_enable",
4833            SessionRequest::ClockDisable { .. } => "clock_disable",
4834            SessionRequest::ClockIsEnabled { .. } => "clock_is_enabled",
4835            SessionRequest::ClockSetRate { .. } => "clock_set_rate",
4836            SessionRequest::ClockQueryRate { .. } => "clock_query_rate",
4837            SessionRequest::ClockGetRate { .. } => "clock_get_rate",
4838            SessionRequest::ResetAssert { .. } => "reset_assert",
4839            SessionRequest::ResetDeassert { .. } => "reset_deassert",
4840            SessionRequest::ResetToggle { .. } => "reset_toggle",
4841            SessionRequest::ResetStatus { .. } => "reset_status",
4842            SessionRequest::SerialRead { .. } => "serial_read",
4843            SessionRequest::SerialWrite { .. } => "serial_write",
4844            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4845                "unknown one-way method"
4846            }
4847            SessionRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4848                "unknown two-way method"
4849            }
4850        }
4851    }
4852}
4853
4854#[derive(Debug, Clone)]
4855pub struct SessionControlHandle {
4856    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4857}
4858
4859impl SessionControlHandle {
4860    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4861        self.inner.shutdown_with_epitaph(status.into())
4862    }
4863}
4864
4865impl fidl::endpoints::ControlHandle for SessionControlHandle {
4866    fn shutdown(&self) {
4867        self.inner.shutdown()
4868    }
4869
4870    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4871        self.inner.shutdown_with_epitaph(status)
4872    }
4873
4874    fn is_closed(&self) -> bool {
4875        self.inner.channel().is_closed()
4876    }
4877    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4878        self.inner.channel().on_closed()
4879    }
4880
4881    #[cfg(target_os = "fuchsia")]
4882    fn signal_peer(
4883        &self,
4884        clear_mask: zx::Signals,
4885        set_mask: zx::Signals,
4886    ) -> Result<(), zx_status::Status> {
4887        use fidl::Peered;
4888        self.inner.channel().signal_peer(clear_mask, set_mask)
4889    }
4890}
4891
4892impl SessionControlHandle {}
4893
4894#[must_use = "FIDL methods require a response to be sent"]
4895#[derive(Debug)]
4896pub struct SessionRead32Responder {
4897    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
4898    tx_id: u32,
4899}
4900
4901/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
4902/// if the responder is dropped without sending a response, so that the client
4903/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4904impl std::ops::Drop for SessionRead32Responder {
4905    fn drop(&mut self) {
4906        self.control_handle.shutdown();
4907        // Safety: drops once, never accessed again
4908        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4909    }
4910}
4911
4912impl fidl::endpoints::Responder for SessionRead32Responder {
4913    type ControlHandle = SessionControlHandle;
4914
4915    fn control_handle(&self) -> &SessionControlHandle {
4916        &self.control_handle
4917    }
4918
4919    fn drop_without_shutdown(mut self) {
4920        // Safety: drops once, never accessed again due to mem::forget
4921        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4922        // Prevent Drop from running (which would shut down the channel)
4923        std::mem::forget(self);
4924    }
4925}
4926
4927impl SessionRead32Responder {
4928    /// Sends a response to the FIDL transaction.
4929    ///
4930    /// Sets the channel to shutdown if an error occurs.
4931    pub fn send(
4932        self,
4933        mut result: Result<(u32, u64, i64), OperationError>,
4934    ) -> Result<(), fidl::Error> {
4935        let _result = self.send_raw(result);
4936        if _result.is_err() {
4937            self.control_handle.shutdown();
4938        }
4939        self.drop_without_shutdown();
4940        _result
4941    }
4942
4943    /// Similar to "send" but does not shutdown the channel if an error occurs.
4944    pub fn send_no_shutdown_on_err(
4945        self,
4946        mut result: Result<(u32, u64, i64), OperationError>,
4947    ) -> Result<(), fidl::Error> {
4948        let _result = self.send_raw(result);
4949        self.drop_without_shutdown();
4950        _result
4951    }
4952
4953    fn send_raw(
4954        &self,
4955        mut result: Result<(u32, u64, i64), OperationError>,
4956    ) -> Result<(), fidl::Error> {
4957        self.control_handle
4958            .inner
4959            .send::<fidl::encoding::FlexibleResultType<ReadResult, OperationError>>(
4960                fidl::encoding::FlexibleResult::new(result),
4961                self.tx_id,
4962                0x7afec1bfecc09a54,
4963                fidl::encoding::DynamicFlags::FLEXIBLE,
4964            )
4965    }
4966}
4967
4968#[must_use = "FIDL methods require a response to be sent"]
4969#[derive(Debug)]
4970pub struct SessionSnapshotResponder {
4971    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
4972    tx_id: u32,
4973}
4974
4975/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
4976/// if the responder is dropped without sending a response, so that the client
4977/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4978impl std::ops::Drop for SessionSnapshotResponder {
4979    fn drop(&mut self) {
4980        self.control_handle.shutdown();
4981        // Safety: drops once, never accessed again
4982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4983    }
4984}
4985
4986impl fidl::endpoints::Responder for SessionSnapshotResponder {
4987    type ControlHandle = SessionControlHandle;
4988
4989    fn control_handle(&self) -> &SessionControlHandle {
4990        &self.control_handle
4991    }
4992
4993    fn drop_without_shutdown(mut self) {
4994        // Safety: drops once, never accessed again due to mem::forget
4995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4996        // Prevent Drop from running (which would shut down the channel)
4997        std::mem::forget(self);
4998    }
4999}
5000
5001impl SessionSnapshotResponder {
5002    /// Sends a response to the FIDL transaction.
5003    ///
5004    /// Sets the channel to shutdown if an error occurs.
5005    pub fn send(
5006        self,
5007        mut result: Result<(&[SnapshotItemResult], bool), OperationError>,
5008    ) -> Result<(), fidl::Error> {
5009        let _result = self.send_raw(result);
5010        if _result.is_err() {
5011            self.control_handle.shutdown();
5012        }
5013        self.drop_without_shutdown();
5014        _result
5015    }
5016
5017    /// Similar to "send" but does not shutdown the channel if an error occurs.
5018    pub fn send_no_shutdown_on_err(
5019        self,
5020        mut result: Result<(&[SnapshotItemResult], bool), OperationError>,
5021    ) -> Result<(), fidl::Error> {
5022        let _result = self.send_raw(result);
5023        self.drop_without_shutdown();
5024        _result
5025    }
5026
5027    fn send_raw(
5028        &self,
5029        mut result: Result<(&[SnapshotItemResult], bool), OperationError>,
5030    ) -> Result<(), fidl::Error> {
5031        self.control_handle
5032            .inner
5033            .send::<fidl::encoding::FlexibleResultType<SnapshotResult, OperationError>>(
5034                fidl::encoding::FlexibleResult::new(result),
5035                self.tx_id,
5036                0x5fa90e4c39fa72e1,
5037                fidl::encoding::DynamicFlags::FLEXIBLE,
5038            )
5039    }
5040}
5041
5042#[must_use = "FIDL methods require a response to be sent"]
5043#[derive(Debug)]
5044pub struct SessionReadAuditResponder {
5045    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5046    tx_id: u32,
5047}
5048
5049/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5050/// if the responder is dropped without sending a response, so that the client
5051/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5052impl std::ops::Drop for SessionReadAuditResponder {
5053    fn drop(&mut self) {
5054        self.control_handle.shutdown();
5055        // Safety: drops once, never accessed again
5056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5057    }
5058}
5059
5060impl fidl::endpoints::Responder for SessionReadAuditResponder {
5061    type ControlHandle = SessionControlHandle;
5062
5063    fn control_handle(&self) -> &SessionControlHandle {
5064        &self.control_handle
5065    }
5066
5067    fn drop_without_shutdown(mut self) {
5068        // Safety: drops once, never accessed again due to mem::forget
5069        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5070        // Prevent Drop from running (which would shut down the channel)
5071        std::mem::forget(self);
5072    }
5073}
5074
5075impl SessionReadAuditResponder {
5076    /// Sends a response to the FIDL transaction.
5077    ///
5078    /// Sets the channel to shutdown if an error occurs.
5079    pub fn send(
5080        self,
5081        mut entries: &[AuditEntry],
5082        mut has_oldest: bool,
5083        mut oldest_retained: u64,
5084        mut next_cursor: u64,
5085    ) -> Result<(), fidl::Error> {
5086        let _result = self.send_raw(entries, has_oldest, oldest_retained, next_cursor);
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 entries: &[AuditEntry],
5098        mut has_oldest: bool,
5099        mut oldest_retained: u64,
5100        mut next_cursor: u64,
5101    ) -> Result<(), fidl::Error> {
5102        let _result = self.send_raw(entries, has_oldest, oldest_retained, next_cursor);
5103        self.drop_without_shutdown();
5104        _result
5105    }
5106
5107    fn send_raw(
5108        &self,
5109        mut entries: &[AuditEntry],
5110        mut has_oldest: bool,
5111        mut oldest_retained: u64,
5112        mut next_cursor: u64,
5113    ) -> Result<(), fidl::Error> {
5114        self.control_handle.inner.send::<fidl::encoding::FlexibleType<AuditPage>>(
5115            fidl::encoding::Flexible::new((entries, has_oldest, oldest_retained, next_cursor)),
5116            self.tx_id,
5117            0x4906c4144e00f4c4,
5118            fidl::encoding::DynamicFlags::FLEXIBLE,
5119        )
5120    }
5121}
5122
5123#[must_use = "FIDL methods require a response to be sent"]
5124#[derive(Debug)]
5125pub struct SessionWrite32Responder {
5126    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5127    tx_id: u32,
5128}
5129
5130/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5131/// if the responder is dropped without sending a response, so that the client
5132/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5133impl std::ops::Drop for SessionWrite32Responder {
5134    fn drop(&mut self) {
5135        self.control_handle.shutdown();
5136        // Safety: drops once, never accessed again
5137        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5138    }
5139}
5140
5141impl fidl::endpoints::Responder for SessionWrite32Responder {
5142    type ControlHandle = SessionControlHandle;
5143
5144    fn control_handle(&self) -> &SessionControlHandle {
5145        &self.control_handle
5146    }
5147
5148    fn drop_without_shutdown(mut self) {
5149        // Safety: drops once, never accessed again due to mem::forget
5150        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5151        // Prevent Drop from running (which would shut down the channel)
5152        std::mem::forget(self);
5153    }
5154}
5155
5156impl SessionWrite32Responder {
5157    /// Sends a response to the FIDL transaction.
5158    ///
5159    /// Sets the channel to shutdown if an error occurs.
5160    pub fn send(
5161        self,
5162        mut result: Result<(u32, u64, i64), OperationError>,
5163    ) -> Result<(), fidl::Error> {
5164        let _result = self.send_raw(result);
5165        if _result.is_err() {
5166            self.control_handle.shutdown();
5167        }
5168        self.drop_without_shutdown();
5169        _result
5170    }
5171
5172    /// Similar to "send" but does not shutdown the channel if an error occurs.
5173    pub fn send_no_shutdown_on_err(
5174        self,
5175        mut result: Result<(u32, u64, i64), OperationError>,
5176    ) -> Result<(), fidl::Error> {
5177        let _result = self.send_raw(result);
5178        self.drop_without_shutdown();
5179        _result
5180    }
5181
5182    fn send_raw(
5183        &self,
5184        mut result: Result<(u32, u64, i64), OperationError>,
5185    ) -> Result<(), fidl::Error> {
5186        self.control_handle
5187            .inner
5188            .send::<fidl::encoding::FlexibleResultType<WriteResult, OperationError>>(
5189                fidl::encoding::FlexibleResult::new(result),
5190                self.tx_id,
5191                0x80dcccde698980c,
5192                fidl::encoding::DynamicFlags::FLEXIBLE,
5193            )
5194    }
5195}
5196
5197#[must_use = "FIDL methods require a response to be sent"]
5198#[derive(Debug)]
5199pub struct SessionPoll32Responder {
5200    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5201    tx_id: u32,
5202}
5203
5204/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5205/// if the responder is dropped without sending a response, so that the client
5206/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5207impl std::ops::Drop for SessionPoll32Responder {
5208    fn drop(&mut self) {
5209        self.control_handle.shutdown();
5210        // Safety: drops once, never accessed again
5211        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5212    }
5213}
5214
5215impl fidl::endpoints::Responder for SessionPoll32Responder {
5216    type ControlHandle = SessionControlHandle;
5217
5218    fn control_handle(&self) -> &SessionControlHandle {
5219        &self.control_handle
5220    }
5221
5222    fn drop_without_shutdown(mut self) {
5223        // Safety: drops once, never accessed again due to mem::forget
5224        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5225        // Prevent Drop from running (which would shut down the channel)
5226        std::mem::forget(self);
5227    }
5228}
5229
5230impl SessionPoll32Responder {
5231    /// Sends a response to the FIDL transaction.
5232    ///
5233    /// Sets the channel to shutdown if an error occurs.
5234    pub fn send(
5235        self,
5236        mut result: Result<(u32, u64, i64), OperationError>,
5237    ) -> Result<(), fidl::Error> {
5238        let _result = self.send_raw(result);
5239        if _result.is_err() {
5240            self.control_handle.shutdown();
5241        }
5242        self.drop_without_shutdown();
5243        _result
5244    }
5245
5246    /// Similar to "send" but does not shutdown the channel if an error occurs.
5247    pub fn send_no_shutdown_on_err(
5248        self,
5249        mut result: Result<(u32, u64, i64), OperationError>,
5250    ) -> Result<(), fidl::Error> {
5251        let _result = self.send_raw(result);
5252        self.drop_without_shutdown();
5253        _result
5254    }
5255
5256    fn send_raw(
5257        &self,
5258        mut result: Result<(u32, u64, i64), OperationError>,
5259    ) -> Result<(), fidl::Error> {
5260        self.control_handle
5261            .inner
5262            .send::<fidl::encoding::FlexibleResultType<PollResult, OperationError>>(
5263                fidl::encoding::FlexibleResult::new(result),
5264                self.tx_id,
5265                0x3b9c26d1582fff7d,
5266                fidl::encoding::DynamicFlags::FLEXIBLE,
5267            )
5268    }
5269}
5270
5271#[must_use = "FIDL methods require a response to be sent"]
5272#[derive(Debug)]
5273pub struct SessionExecuteSequenceResponder {
5274    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5275    tx_id: u32,
5276}
5277
5278/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5279/// if the responder is dropped without sending a response, so that the client
5280/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5281impl std::ops::Drop for SessionExecuteSequenceResponder {
5282    fn drop(&mut self) {
5283        self.control_handle.shutdown();
5284        // Safety: drops once, never accessed again
5285        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5286    }
5287}
5288
5289impl fidl::endpoints::Responder for SessionExecuteSequenceResponder {
5290    type ControlHandle = SessionControlHandle;
5291
5292    fn control_handle(&self) -> &SessionControlHandle {
5293        &self.control_handle
5294    }
5295
5296    fn drop_without_shutdown(mut self) {
5297        // Safety: drops once, never accessed again due to mem::forget
5298        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5299        // Prevent Drop from running (which would shut down the channel)
5300        std::mem::forget(self);
5301    }
5302}
5303
5304impl SessionExecuteSequenceResponder {
5305    /// Sends a response to the FIDL transaction.
5306    ///
5307    /// Sets the channel to shutdown if an error occurs.
5308    pub fn send(
5309        self,
5310        mut result: Result<(&[SequenceItemResult], bool), OperationError>,
5311    ) -> Result<(), fidl::Error> {
5312        let _result = self.send_raw(result);
5313        if _result.is_err() {
5314            self.control_handle.shutdown();
5315        }
5316        self.drop_without_shutdown();
5317        _result
5318    }
5319
5320    /// Similar to "send" but does not shutdown the channel if an error occurs.
5321    pub fn send_no_shutdown_on_err(
5322        self,
5323        mut result: Result<(&[SequenceItemResult], bool), OperationError>,
5324    ) -> Result<(), fidl::Error> {
5325        let _result = self.send_raw(result);
5326        self.drop_without_shutdown();
5327        _result
5328    }
5329
5330    fn send_raw(
5331        &self,
5332        mut result: Result<(&[SequenceItemResult], bool), OperationError>,
5333    ) -> Result<(), fidl::Error> {
5334        self.control_handle
5335            .inner
5336            .send::<fidl::encoding::FlexibleResultType<SequenceResult, OperationError>>(
5337                fidl::encoding::FlexibleResult::new(result),
5338                self.tx_id,
5339                0xf0500bd7555a614,
5340                fidl::encoding::DynamicFlags::FLEXIBLE,
5341            )
5342    }
5343}
5344
5345#[must_use = "FIDL methods require a response to be sent"]
5346#[derive(Debug)]
5347pub struct SessionGpioReadResponder {
5348    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5349    tx_id: u32,
5350}
5351
5352/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5353/// if the responder is dropped without sending a response, so that the client
5354/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5355impl std::ops::Drop for SessionGpioReadResponder {
5356    fn drop(&mut self) {
5357        self.control_handle.shutdown();
5358        // Safety: drops once, never accessed again
5359        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5360    }
5361}
5362
5363impl fidl::endpoints::Responder for SessionGpioReadResponder {
5364    type ControlHandle = SessionControlHandle;
5365
5366    fn control_handle(&self) -> &SessionControlHandle {
5367        &self.control_handle
5368    }
5369
5370    fn drop_without_shutdown(mut self) {
5371        // Safety: drops once, never accessed again due to mem::forget
5372        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5373        // Prevent Drop from running (which would shut down the channel)
5374        std::mem::forget(self);
5375    }
5376}
5377
5378impl SessionGpioReadResponder {
5379    /// Sends a response to the FIDL transaction.
5380    ///
5381    /// Sets the channel to shutdown if an error occurs.
5382    pub fn send(
5383        self,
5384        mut result: Result<(bool, u64, i64), OperationError>,
5385    ) -> Result<(), fidl::Error> {
5386        let _result = self.send_raw(result);
5387        if _result.is_err() {
5388            self.control_handle.shutdown();
5389        }
5390        self.drop_without_shutdown();
5391        _result
5392    }
5393
5394    /// Similar to "send" but does not shutdown the channel if an error occurs.
5395    pub fn send_no_shutdown_on_err(
5396        self,
5397        mut result: Result<(bool, u64, i64), OperationError>,
5398    ) -> Result<(), fidl::Error> {
5399        let _result = self.send_raw(result);
5400        self.drop_without_shutdown();
5401        _result
5402    }
5403
5404    fn send_raw(
5405        &self,
5406        mut result: Result<(bool, u64, i64), OperationError>,
5407    ) -> Result<(), fidl::Error> {
5408        self.control_handle
5409            .inner
5410            .send::<fidl::encoding::FlexibleResultType<GpioReadResult, OperationError>>(
5411                fidl::encoding::FlexibleResult::new(result),
5412                self.tx_id,
5413                0xb01fc817332de51,
5414                fidl::encoding::DynamicFlags::FLEXIBLE,
5415            )
5416    }
5417}
5418
5419#[must_use = "FIDL methods require a response to be sent"]
5420#[derive(Debug)]
5421pub struct SessionGpioWriteResponder {
5422    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5423    tx_id: u32,
5424}
5425
5426/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5427/// if the responder is dropped without sending a response, so that the client
5428/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5429impl std::ops::Drop for SessionGpioWriteResponder {
5430    fn drop(&mut self) {
5431        self.control_handle.shutdown();
5432        // Safety: drops once, never accessed again
5433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5434    }
5435}
5436
5437impl fidl::endpoints::Responder for SessionGpioWriteResponder {
5438    type ControlHandle = SessionControlHandle;
5439
5440    fn control_handle(&self) -> &SessionControlHandle {
5441        &self.control_handle
5442    }
5443
5444    fn drop_without_shutdown(mut self) {
5445        // Safety: drops once, never accessed again due to mem::forget
5446        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5447        // Prevent Drop from running (which would shut down the channel)
5448        std::mem::forget(self);
5449    }
5450}
5451
5452impl SessionGpioWriteResponder {
5453    /// Sends a response to the FIDL transaction.
5454    ///
5455    /// Sets the channel to shutdown if an error occurs.
5456    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
5457        let _result = self.send_raw(result);
5458        if _result.is_err() {
5459            self.control_handle.shutdown();
5460        }
5461        self.drop_without_shutdown();
5462        _result
5463    }
5464
5465    /// Similar to "send" but does not shutdown the channel if an error occurs.
5466    pub fn send_no_shutdown_on_err(
5467        self,
5468        mut result: Result<(u64, i64), OperationError>,
5469    ) -> Result<(), fidl::Error> {
5470        let _result = self.send_raw(result);
5471        self.drop_without_shutdown();
5472        _result
5473    }
5474
5475    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
5476        self.control_handle
5477            .inner
5478            .send::<fidl::encoding::FlexibleResultType<GpioWriteResult, OperationError>>(
5479                fidl::encoding::FlexibleResult::new(result),
5480                self.tx_id,
5481                0x27cfbd9ffaf5c6e7,
5482                fidl::encoding::DynamicFlags::FLEXIBLE,
5483            )
5484    }
5485}
5486
5487#[must_use = "FIDL methods require a response to be sent"]
5488#[derive(Debug)]
5489pub struct SessionI2cTransferResponder {
5490    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5491    tx_id: u32,
5492}
5493
5494/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5495/// if the responder is dropped without sending a response, so that the client
5496/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5497impl std::ops::Drop for SessionI2cTransferResponder {
5498    fn drop(&mut self) {
5499        self.control_handle.shutdown();
5500        // Safety: drops once, never accessed again
5501        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5502    }
5503}
5504
5505impl fidl::endpoints::Responder for SessionI2cTransferResponder {
5506    type ControlHandle = SessionControlHandle;
5507
5508    fn control_handle(&self) -> &SessionControlHandle {
5509        &self.control_handle
5510    }
5511
5512    fn drop_without_shutdown(mut self) {
5513        // Safety: drops once, never accessed again due to mem::forget
5514        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5515        // Prevent Drop from running (which would shut down the channel)
5516        std::mem::forget(self);
5517    }
5518}
5519
5520impl SessionI2cTransferResponder {
5521    /// Sends a response to the FIDL transaction.
5522    ///
5523    /// Sets the channel to shutdown if an error occurs.
5524    pub fn send(
5525        self,
5526        mut result: Result<(&[u8], u64, i64), OperationError>,
5527    ) -> Result<(), fidl::Error> {
5528        let _result = self.send_raw(result);
5529        if _result.is_err() {
5530            self.control_handle.shutdown();
5531        }
5532        self.drop_without_shutdown();
5533        _result
5534    }
5535
5536    /// Similar to "send" but does not shutdown the channel if an error occurs.
5537    pub fn send_no_shutdown_on_err(
5538        self,
5539        mut result: Result<(&[u8], u64, i64), OperationError>,
5540    ) -> Result<(), fidl::Error> {
5541        let _result = self.send_raw(result);
5542        self.drop_without_shutdown();
5543        _result
5544    }
5545
5546    fn send_raw(
5547        &self,
5548        mut result: Result<(&[u8], u64, i64), OperationError>,
5549    ) -> Result<(), fidl::Error> {
5550        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5551            I2cTransferResult,
5552            OperationError,
5553        >>(
5554            fidl::encoding::FlexibleResult::new(result),
5555            self.tx_id,
5556            0x67016bc41336f298,
5557            fidl::encoding::DynamicFlags::FLEXIBLE,
5558        )
5559    }
5560}
5561
5562#[must_use = "FIDL methods require a response to be sent"]
5563#[derive(Debug)]
5564pub struct SessionSpiTransmitResponder {
5565    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5566    tx_id: u32,
5567}
5568
5569/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5570/// if the responder is dropped without sending a response, so that the client
5571/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5572impl std::ops::Drop for SessionSpiTransmitResponder {
5573    fn drop(&mut self) {
5574        self.control_handle.shutdown();
5575        // Safety: drops once, never accessed again
5576        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5577    }
5578}
5579
5580impl fidl::endpoints::Responder for SessionSpiTransmitResponder {
5581    type ControlHandle = SessionControlHandle;
5582
5583    fn control_handle(&self) -> &SessionControlHandle {
5584        &self.control_handle
5585    }
5586
5587    fn drop_without_shutdown(mut self) {
5588        // Safety: drops once, never accessed again due to mem::forget
5589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5590        // Prevent Drop from running (which would shut down the channel)
5591        std::mem::forget(self);
5592    }
5593}
5594
5595impl SessionSpiTransmitResponder {
5596    /// Sends a response to the FIDL transaction.
5597    ///
5598    /// Sets the channel to shutdown if an error occurs.
5599    pub fn send(
5600        self,
5601        mut result: Result<(&[u8], u64, i64), OperationError>,
5602    ) -> Result<(), fidl::Error> {
5603        let _result = self.send_raw(result);
5604        if _result.is_err() {
5605            self.control_handle.shutdown();
5606        }
5607        self.drop_without_shutdown();
5608        _result
5609    }
5610
5611    /// Similar to "send" but does not shutdown the channel if an error occurs.
5612    pub fn send_no_shutdown_on_err(
5613        self,
5614        mut result: Result<(&[u8], u64, i64), OperationError>,
5615    ) -> Result<(), fidl::Error> {
5616        let _result = self.send_raw(result);
5617        self.drop_without_shutdown();
5618        _result
5619    }
5620
5621    fn send_raw(
5622        &self,
5623        mut result: Result<(&[u8], u64, i64), OperationError>,
5624    ) -> Result<(), fidl::Error> {
5625        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5626            SpiTransmitResult,
5627            OperationError,
5628        >>(
5629            fidl::encoding::FlexibleResult::new(result),
5630            self.tx_id,
5631            0x3429847e2877d4d7,
5632            fidl::encoding::DynamicFlags::FLEXIBLE,
5633        )
5634    }
5635}
5636
5637#[must_use = "FIDL methods require a response to be sent"]
5638#[derive(Debug)]
5639pub struct SessionOpenGpioResponder {
5640    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5641    tx_id: u32,
5642}
5643
5644/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5645/// if the responder is dropped without sending a response, so that the client
5646/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5647impl std::ops::Drop for SessionOpenGpioResponder {
5648    fn drop(&mut self) {
5649        self.control_handle.shutdown();
5650        // Safety: drops once, never accessed again
5651        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5652    }
5653}
5654
5655impl fidl::endpoints::Responder for SessionOpenGpioResponder {
5656    type ControlHandle = SessionControlHandle;
5657
5658    fn control_handle(&self) -> &SessionControlHandle {
5659        &self.control_handle
5660    }
5661
5662    fn drop_without_shutdown(mut self) {
5663        // Safety: drops once, never accessed again due to mem::forget
5664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5665        // Prevent Drop from running (which would shut down the channel)
5666        std::mem::forget(self);
5667    }
5668}
5669
5670impl SessionOpenGpioResponder {
5671    /// Sends a response to the FIDL transaction.
5672    ///
5673    /// Sets the channel to shutdown if an error occurs.
5674    pub fn send(self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
5675        let _result = self.send_raw(result);
5676        if _result.is_err() {
5677            self.control_handle.shutdown();
5678        }
5679        self.drop_without_shutdown();
5680        _result
5681    }
5682
5683    /// Similar to "send" but does not shutdown the channel if an error occurs.
5684    pub fn send_no_shutdown_on_err(
5685        self,
5686        mut result: Result<(), OperationError>,
5687    ) -> Result<(), fidl::Error> {
5688        let _result = self.send_raw(result);
5689        self.drop_without_shutdown();
5690        _result
5691    }
5692
5693    fn send_raw(&self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
5694        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5695            fidl::encoding::EmptyStruct,
5696            OperationError,
5697        >>(
5698            fidl::encoding::FlexibleResult::new(result),
5699            self.tx_id,
5700            0x5bd9f23cba94897,
5701            fidl::encoding::DynamicFlags::FLEXIBLE,
5702        )
5703    }
5704}
5705
5706#[must_use = "FIDL methods require a response to be sent"]
5707#[derive(Debug)]
5708pub struct SessionOpenI2cResponder {
5709    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5710    tx_id: u32,
5711}
5712
5713/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5714/// if the responder is dropped without sending a response, so that the client
5715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5716impl std::ops::Drop for SessionOpenI2cResponder {
5717    fn drop(&mut self) {
5718        self.control_handle.shutdown();
5719        // Safety: drops once, never accessed again
5720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5721    }
5722}
5723
5724impl fidl::endpoints::Responder for SessionOpenI2cResponder {
5725    type ControlHandle = SessionControlHandle;
5726
5727    fn control_handle(&self) -> &SessionControlHandle {
5728        &self.control_handle
5729    }
5730
5731    fn drop_without_shutdown(mut self) {
5732        // Safety: drops once, never accessed again due to mem::forget
5733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5734        // Prevent Drop from running (which would shut down the channel)
5735        std::mem::forget(self);
5736    }
5737}
5738
5739impl SessionOpenI2cResponder {
5740    /// Sends a response to the FIDL transaction.
5741    ///
5742    /// Sets the channel to shutdown if an error occurs.
5743    pub fn send(self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
5744        let _result = self.send_raw(result);
5745        if _result.is_err() {
5746            self.control_handle.shutdown();
5747        }
5748        self.drop_without_shutdown();
5749        _result
5750    }
5751
5752    /// Similar to "send" but does not shutdown the channel if an error occurs.
5753    pub fn send_no_shutdown_on_err(
5754        self,
5755        mut result: Result<(), OperationError>,
5756    ) -> Result<(), fidl::Error> {
5757        let _result = self.send_raw(result);
5758        self.drop_without_shutdown();
5759        _result
5760    }
5761
5762    fn send_raw(&self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
5763        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5764            fidl::encoding::EmptyStruct,
5765            OperationError,
5766        >>(
5767            fidl::encoding::FlexibleResult::new(result),
5768            self.tx_id,
5769            0x17ba936a44a14633,
5770            fidl::encoding::DynamicFlags::FLEXIBLE,
5771        )
5772    }
5773}
5774
5775#[must_use = "FIDL methods require a response to be sent"]
5776#[derive(Debug)]
5777pub struct SessionOpenSpiResponder {
5778    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5779    tx_id: u32,
5780}
5781
5782/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5783/// if the responder is dropped without sending a response, so that the client
5784/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5785impl std::ops::Drop for SessionOpenSpiResponder {
5786    fn drop(&mut self) {
5787        self.control_handle.shutdown();
5788        // Safety: drops once, never accessed again
5789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5790    }
5791}
5792
5793impl fidl::endpoints::Responder for SessionOpenSpiResponder {
5794    type ControlHandle = SessionControlHandle;
5795
5796    fn control_handle(&self) -> &SessionControlHandle {
5797        &self.control_handle
5798    }
5799
5800    fn drop_without_shutdown(mut self) {
5801        // Safety: drops once, never accessed again due to mem::forget
5802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5803        // Prevent Drop from running (which would shut down the channel)
5804        std::mem::forget(self);
5805    }
5806}
5807
5808impl SessionOpenSpiResponder {
5809    /// Sends a response to the FIDL transaction.
5810    ///
5811    /// Sets the channel to shutdown if an error occurs.
5812    pub fn send(self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
5813        let _result = self.send_raw(result);
5814        if _result.is_err() {
5815            self.control_handle.shutdown();
5816        }
5817        self.drop_without_shutdown();
5818        _result
5819    }
5820
5821    /// Similar to "send" but does not shutdown the channel if an error occurs.
5822    pub fn send_no_shutdown_on_err(
5823        self,
5824        mut result: Result<(), OperationError>,
5825    ) -> Result<(), fidl::Error> {
5826        let _result = self.send_raw(result);
5827        self.drop_without_shutdown();
5828        _result
5829    }
5830
5831    fn send_raw(&self, mut result: Result<(), OperationError>) -> Result<(), fidl::Error> {
5832        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5833            fidl::encoding::EmptyStruct,
5834            OperationError,
5835        >>(
5836            fidl::encoding::FlexibleResult::new(result),
5837            self.tx_id,
5838            0x3ee7e7cea84dfc9d,
5839            fidl::encoding::DynamicFlags::FLEXIBLE,
5840        )
5841    }
5842}
5843
5844#[must_use = "FIDL methods require a response to be sent"]
5845#[derive(Debug)]
5846pub struct SessionWaitForInterruptResponder {
5847    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5848    tx_id: u32,
5849}
5850
5851/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5852/// if the responder is dropped without sending a response, so that the client
5853/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5854impl std::ops::Drop for SessionWaitForInterruptResponder {
5855    fn drop(&mut self) {
5856        self.control_handle.shutdown();
5857        // Safety: drops once, never accessed again
5858        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5859    }
5860}
5861
5862impl fidl::endpoints::Responder for SessionWaitForInterruptResponder {
5863    type ControlHandle = SessionControlHandle;
5864
5865    fn control_handle(&self) -> &SessionControlHandle {
5866        &self.control_handle
5867    }
5868
5869    fn drop_without_shutdown(mut self) {
5870        // Safety: drops once, never accessed again due to mem::forget
5871        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5872        // Prevent Drop from running (which would shut down the channel)
5873        std::mem::forget(self);
5874    }
5875}
5876
5877impl SessionWaitForInterruptResponder {
5878    /// Sends a response to the FIDL transaction.
5879    ///
5880    /// Sets the channel to shutdown if an error occurs.
5881    pub fn send(
5882        self,
5883        mut result: Result<(u32, u64, u64, i64, u64), OperationError>,
5884    ) -> Result<(), fidl::Error> {
5885        let _result = self.send_raw(result);
5886        if _result.is_err() {
5887            self.control_handle.shutdown();
5888        }
5889        self.drop_without_shutdown();
5890        _result
5891    }
5892
5893    /// Similar to "send" but does not shutdown the channel if an error occurs.
5894    pub fn send_no_shutdown_on_err(
5895        self,
5896        mut result: Result<(u32, u64, u64, i64, u64), OperationError>,
5897    ) -> Result<(), fidl::Error> {
5898        let _result = self.send_raw(result);
5899        self.drop_without_shutdown();
5900        _result
5901    }
5902
5903    fn send_raw(
5904        &self,
5905        mut result: Result<(u32, u64, u64, i64, u64), OperationError>,
5906    ) -> Result<(), fidl::Error> {
5907        self.control_handle
5908            .inner
5909            .send::<fidl::encoding::FlexibleResultType<InterruptResult, OperationError>>(
5910                fidl::encoding::FlexibleResult::new(result),
5911                self.tx_id,
5912                0x276a31c24a164cdb,
5913                fidl::encoding::DynamicFlags::FLEXIBLE,
5914            )
5915    }
5916}
5917
5918#[must_use = "FIDL methods require a response to be sent"]
5919#[derive(Debug)]
5920pub struct SessionClockEnableResponder {
5921    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5922    tx_id: u32,
5923}
5924
5925/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5926/// if the responder is dropped without sending a response, so that the client
5927/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5928impl std::ops::Drop for SessionClockEnableResponder {
5929    fn drop(&mut self) {
5930        self.control_handle.shutdown();
5931        // Safety: drops once, never accessed again
5932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5933    }
5934}
5935
5936impl fidl::endpoints::Responder for SessionClockEnableResponder {
5937    type ControlHandle = SessionControlHandle;
5938
5939    fn control_handle(&self) -> &SessionControlHandle {
5940        &self.control_handle
5941    }
5942
5943    fn drop_without_shutdown(mut self) {
5944        // Safety: drops once, never accessed again due to mem::forget
5945        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5946        // Prevent Drop from running (which would shut down the channel)
5947        std::mem::forget(self);
5948    }
5949}
5950
5951impl SessionClockEnableResponder {
5952    /// Sends a response to the FIDL transaction.
5953    ///
5954    /// Sets the channel to shutdown if an error occurs.
5955    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
5956        let _result = self.send_raw(result);
5957        if _result.is_err() {
5958            self.control_handle.shutdown();
5959        }
5960        self.drop_without_shutdown();
5961        _result
5962    }
5963
5964    /// Similar to "send" but does not shutdown the channel if an error occurs.
5965    pub fn send_no_shutdown_on_err(
5966        self,
5967        mut result: Result<(u64, i64), OperationError>,
5968    ) -> Result<(), fidl::Error> {
5969        let _result = self.send_raw(result);
5970        self.drop_without_shutdown();
5971        _result
5972    }
5973
5974    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
5975        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5976            ClockEnableResult,
5977            OperationError,
5978        >>(
5979            fidl::encoding::FlexibleResult::new(result),
5980            self.tx_id,
5981            0x774b563ebff897eb,
5982            fidl::encoding::DynamicFlags::FLEXIBLE,
5983        )
5984    }
5985}
5986
5987#[must_use = "FIDL methods require a response to be sent"]
5988#[derive(Debug)]
5989pub struct SessionClockDisableResponder {
5990    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
5991    tx_id: u32,
5992}
5993
5994/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
5995/// if the responder is dropped without sending a response, so that the client
5996/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5997impl std::ops::Drop for SessionClockDisableResponder {
5998    fn drop(&mut self) {
5999        self.control_handle.shutdown();
6000        // Safety: drops once, never accessed again
6001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6002    }
6003}
6004
6005impl fidl::endpoints::Responder for SessionClockDisableResponder {
6006    type ControlHandle = SessionControlHandle;
6007
6008    fn control_handle(&self) -> &SessionControlHandle {
6009        &self.control_handle
6010    }
6011
6012    fn drop_without_shutdown(mut self) {
6013        // Safety: drops once, never accessed again due to mem::forget
6014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6015        // Prevent Drop from running (which would shut down the channel)
6016        std::mem::forget(self);
6017    }
6018}
6019
6020impl SessionClockDisableResponder {
6021    /// Sends a response to the FIDL transaction.
6022    ///
6023    /// Sets the channel to shutdown if an error occurs.
6024    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6025        let _result = self.send_raw(result);
6026        if _result.is_err() {
6027            self.control_handle.shutdown();
6028        }
6029        self.drop_without_shutdown();
6030        _result
6031    }
6032
6033    /// Similar to "send" but does not shutdown the channel if an error occurs.
6034    pub fn send_no_shutdown_on_err(
6035        self,
6036        mut result: Result<(u64, i64), OperationError>,
6037    ) -> Result<(), fidl::Error> {
6038        let _result = self.send_raw(result);
6039        self.drop_without_shutdown();
6040        _result
6041    }
6042
6043    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6044        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6045            ClockDisableResult,
6046            OperationError,
6047        >>(
6048            fidl::encoding::FlexibleResult::new(result),
6049            self.tx_id,
6050            0x642c11d03db8b873,
6051            fidl::encoding::DynamicFlags::FLEXIBLE,
6052        )
6053    }
6054}
6055
6056#[must_use = "FIDL methods require a response to be sent"]
6057#[derive(Debug)]
6058pub struct SessionClockIsEnabledResponder {
6059    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6060    tx_id: u32,
6061}
6062
6063/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6064/// if the responder is dropped without sending a response, so that the client
6065/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6066impl std::ops::Drop for SessionClockIsEnabledResponder {
6067    fn drop(&mut self) {
6068        self.control_handle.shutdown();
6069        // Safety: drops once, never accessed again
6070        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6071    }
6072}
6073
6074impl fidl::endpoints::Responder for SessionClockIsEnabledResponder {
6075    type ControlHandle = SessionControlHandle;
6076
6077    fn control_handle(&self) -> &SessionControlHandle {
6078        &self.control_handle
6079    }
6080
6081    fn drop_without_shutdown(mut self) {
6082        // Safety: drops once, never accessed again due to mem::forget
6083        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6084        // Prevent Drop from running (which would shut down the channel)
6085        std::mem::forget(self);
6086    }
6087}
6088
6089impl SessionClockIsEnabledResponder {
6090    /// Sends a response to the FIDL transaction.
6091    ///
6092    /// Sets the channel to shutdown if an error occurs.
6093    pub fn send(
6094        self,
6095        mut result: Result<(bool, u64, i64), OperationError>,
6096    ) -> Result<(), fidl::Error> {
6097        let _result = self.send_raw(result);
6098        if _result.is_err() {
6099            self.control_handle.shutdown();
6100        }
6101        self.drop_without_shutdown();
6102        _result
6103    }
6104
6105    /// Similar to "send" but does not shutdown the channel if an error occurs.
6106    pub fn send_no_shutdown_on_err(
6107        self,
6108        mut result: Result<(bool, u64, i64), OperationError>,
6109    ) -> Result<(), fidl::Error> {
6110        let _result = self.send_raw(result);
6111        self.drop_without_shutdown();
6112        _result
6113    }
6114
6115    fn send_raw(
6116        &self,
6117        mut result: Result<(bool, u64, i64), OperationError>,
6118    ) -> Result<(), fidl::Error> {
6119        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6120            ClockIsEnabledResult,
6121            OperationError,
6122        >>(
6123            fidl::encoding::FlexibleResult::new(result),
6124            self.tx_id,
6125            0x36a033a7a1322174,
6126            fidl::encoding::DynamicFlags::FLEXIBLE,
6127        )
6128    }
6129}
6130
6131#[must_use = "FIDL methods require a response to be sent"]
6132#[derive(Debug)]
6133pub struct SessionClockSetRateResponder {
6134    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6135    tx_id: u32,
6136}
6137
6138/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6139/// if the responder is dropped without sending a response, so that the client
6140/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6141impl std::ops::Drop for SessionClockSetRateResponder {
6142    fn drop(&mut self) {
6143        self.control_handle.shutdown();
6144        // Safety: drops once, never accessed again
6145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6146    }
6147}
6148
6149impl fidl::endpoints::Responder for SessionClockSetRateResponder {
6150    type ControlHandle = SessionControlHandle;
6151
6152    fn control_handle(&self) -> &SessionControlHandle {
6153        &self.control_handle
6154    }
6155
6156    fn drop_without_shutdown(mut self) {
6157        // Safety: drops once, never accessed again due to mem::forget
6158        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6159        // Prevent Drop from running (which would shut down the channel)
6160        std::mem::forget(self);
6161    }
6162}
6163
6164impl SessionClockSetRateResponder {
6165    /// Sends a response to the FIDL transaction.
6166    ///
6167    /// Sets the channel to shutdown if an error occurs.
6168    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6169        let _result = self.send_raw(result);
6170        if _result.is_err() {
6171            self.control_handle.shutdown();
6172        }
6173        self.drop_without_shutdown();
6174        _result
6175    }
6176
6177    /// Similar to "send" but does not shutdown the channel if an error occurs.
6178    pub fn send_no_shutdown_on_err(
6179        self,
6180        mut result: Result<(u64, i64), OperationError>,
6181    ) -> Result<(), fidl::Error> {
6182        let _result = self.send_raw(result);
6183        self.drop_without_shutdown();
6184        _result
6185    }
6186
6187    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6188        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6189            ClockSetRateResult,
6190            OperationError,
6191        >>(
6192            fidl::encoding::FlexibleResult::new(result),
6193            self.tx_id,
6194            0x4dbc4012d4289048,
6195            fidl::encoding::DynamicFlags::FLEXIBLE,
6196        )
6197    }
6198}
6199
6200#[must_use = "FIDL methods require a response to be sent"]
6201#[derive(Debug)]
6202pub struct SessionClockQueryRateResponder {
6203    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6204    tx_id: u32,
6205}
6206
6207/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6208/// if the responder is dropped without sending a response, so that the client
6209/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6210impl std::ops::Drop for SessionClockQueryRateResponder {
6211    fn drop(&mut self) {
6212        self.control_handle.shutdown();
6213        // Safety: drops once, never accessed again
6214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6215    }
6216}
6217
6218impl fidl::endpoints::Responder for SessionClockQueryRateResponder {
6219    type ControlHandle = SessionControlHandle;
6220
6221    fn control_handle(&self) -> &SessionControlHandle {
6222        &self.control_handle
6223    }
6224
6225    fn drop_without_shutdown(mut self) {
6226        // Safety: drops once, never accessed again due to mem::forget
6227        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6228        // Prevent Drop from running (which would shut down the channel)
6229        std::mem::forget(self);
6230    }
6231}
6232
6233impl SessionClockQueryRateResponder {
6234    /// Sends a response to the FIDL transaction.
6235    ///
6236    /// Sets the channel to shutdown if an error occurs.
6237    pub fn send(
6238        self,
6239        mut result: Result<(u64, u64, i64), OperationError>,
6240    ) -> Result<(), fidl::Error> {
6241        let _result = self.send_raw(result);
6242        if _result.is_err() {
6243            self.control_handle.shutdown();
6244        }
6245        self.drop_without_shutdown();
6246        _result
6247    }
6248
6249    /// Similar to "send" but does not shutdown the channel if an error occurs.
6250    pub fn send_no_shutdown_on_err(
6251        self,
6252        mut result: Result<(u64, u64, i64), OperationError>,
6253    ) -> Result<(), fidl::Error> {
6254        let _result = self.send_raw(result);
6255        self.drop_without_shutdown();
6256        _result
6257    }
6258
6259    fn send_raw(
6260        &self,
6261        mut result: Result<(u64, u64, i64), OperationError>,
6262    ) -> Result<(), fidl::Error> {
6263        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6264            ClockQueryRateResult,
6265            OperationError,
6266        >>(
6267            fidl::encoding::FlexibleResult::new(result),
6268            self.tx_id,
6269            0x11b9fe61ad09ff5e,
6270            fidl::encoding::DynamicFlags::FLEXIBLE,
6271        )
6272    }
6273}
6274
6275#[must_use = "FIDL methods require a response to be sent"]
6276#[derive(Debug)]
6277pub struct SessionClockGetRateResponder {
6278    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6279    tx_id: u32,
6280}
6281
6282/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6283/// if the responder is dropped without sending a response, so that the client
6284/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6285impl std::ops::Drop for SessionClockGetRateResponder {
6286    fn drop(&mut self) {
6287        self.control_handle.shutdown();
6288        // Safety: drops once, never accessed again
6289        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6290    }
6291}
6292
6293impl fidl::endpoints::Responder for SessionClockGetRateResponder {
6294    type ControlHandle = SessionControlHandle;
6295
6296    fn control_handle(&self) -> &SessionControlHandle {
6297        &self.control_handle
6298    }
6299
6300    fn drop_without_shutdown(mut self) {
6301        // Safety: drops once, never accessed again due to mem::forget
6302        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6303        // Prevent Drop from running (which would shut down the channel)
6304        std::mem::forget(self);
6305    }
6306}
6307
6308impl SessionClockGetRateResponder {
6309    /// Sends a response to the FIDL transaction.
6310    ///
6311    /// Sets the channel to shutdown if an error occurs.
6312    pub fn send(
6313        self,
6314        mut result: Result<(u64, u64, i64), OperationError>,
6315    ) -> Result<(), fidl::Error> {
6316        let _result = self.send_raw(result);
6317        if _result.is_err() {
6318            self.control_handle.shutdown();
6319        }
6320        self.drop_without_shutdown();
6321        _result
6322    }
6323
6324    /// Similar to "send" but does not shutdown the channel if an error occurs.
6325    pub fn send_no_shutdown_on_err(
6326        self,
6327        mut result: Result<(u64, u64, i64), OperationError>,
6328    ) -> Result<(), fidl::Error> {
6329        let _result = self.send_raw(result);
6330        self.drop_without_shutdown();
6331        _result
6332    }
6333
6334    fn send_raw(
6335        &self,
6336        mut result: Result<(u64, u64, i64), OperationError>,
6337    ) -> Result<(), fidl::Error> {
6338        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6339            ClockGetRateResult,
6340            OperationError,
6341        >>(
6342            fidl::encoding::FlexibleResult::new(result),
6343            self.tx_id,
6344            0x4f3c0e2259e5e46,
6345            fidl::encoding::DynamicFlags::FLEXIBLE,
6346        )
6347    }
6348}
6349
6350#[must_use = "FIDL methods require a response to be sent"]
6351#[derive(Debug)]
6352pub struct SessionResetAssertResponder {
6353    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6354    tx_id: u32,
6355}
6356
6357/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6358/// if the responder is dropped without sending a response, so that the client
6359/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6360impl std::ops::Drop for SessionResetAssertResponder {
6361    fn drop(&mut self) {
6362        self.control_handle.shutdown();
6363        // Safety: drops once, never accessed again
6364        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6365    }
6366}
6367
6368impl fidl::endpoints::Responder for SessionResetAssertResponder {
6369    type ControlHandle = SessionControlHandle;
6370
6371    fn control_handle(&self) -> &SessionControlHandle {
6372        &self.control_handle
6373    }
6374
6375    fn drop_without_shutdown(mut self) {
6376        // Safety: drops once, never accessed again due to mem::forget
6377        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6378        // Prevent Drop from running (which would shut down the channel)
6379        std::mem::forget(self);
6380    }
6381}
6382
6383impl SessionResetAssertResponder {
6384    /// Sends a response to the FIDL transaction.
6385    ///
6386    /// Sets the channel to shutdown if an error occurs.
6387    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6388        let _result = self.send_raw(result);
6389        if _result.is_err() {
6390            self.control_handle.shutdown();
6391        }
6392        self.drop_without_shutdown();
6393        _result
6394    }
6395
6396    /// Similar to "send" but does not shutdown the channel if an error occurs.
6397    pub fn send_no_shutdown_on_err(
6398        self,
6399        mut result: Result<(u64, i64), OperationError>,
6400    ) -> Result<(), fidl::Error> {
6401        let _result = self.send_raw(result);
6402        self.drop_without_shutdown();
6403        _result
6404    }
6405
6406    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6407        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6408            ResetAssertResult,
6409            OperationError,
6410        >>(
6411            fidl::encoding::FlexibleResult::new(result),
6412            self.tx_id,
6413            0x5788d4842384c111,
6414            fidl::encoding::DynamicFlags::FLEXIBLE,
6415        )
6416    }
6417}
6418
6419#[must_use = "FIDL methods require a response to be sent"]
6420#[derive(Debug)]
6421pub struct SessionResetDeassertResponder {
6422    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6423    tx_id: u32,
6424}
6425
6426/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6427/// if the responder is dropped without sending a response, so that the client
6428/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6429impl std::ops::Drop for SessionResetDeassertResponder {
6430    fn drop(&mut self) {
6431        self.control_handle.shutdown();
6432        // Safety: drops once, never accessed again
6433        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6434    }
6435}
6436
6437impl fidl::endpoints::Responder for SessionResetDeassertResponder {
6438    type ControlHandle = SessionControlHandle;
6439
6440    fn control_handle(&self) -> &SessionControlHandle {
6441        &self.control_handle
6442    }
6443
6444    fn drop_without_shutdown(mut self) {
6445        // Safety: drops once, never accessed again due to mem::forget
6446        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6447        // Prevent Drop from running (which would shut down the channel)
6448        std::mem::forget(self);
6449    }
6450}
6451
6452impl SessionResetDeassertResponder {
6453    /// Sends a response to the FIDL transaction.
6454    ///
6455    /// Sets the channel to shutdown if an error occurs.
6456    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6457        let _result = self.send_raw(result);
6458        if _result.is_err() {
6459            self.control_handle.shutdown();
6460        }
6461        self.drop_without_shutdown();
6462        _result
6463    }
6464
6465    /// Similar to "send" but does not shutdown the channel if an error occurs.
6466    pub fn send_no_shutdown_on_err(
6467        self,
6468        mut result: Result<(u64, i64), OperationError>,
6469    ) -> Result<(), fidl::Error> {
6470        let _result = self.send_raw(result);
6471        self.drop_without_shutdown();
6472        _result
6473    }
6474
6475    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6476        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6477            ResetDeassertResult,
6478            OperationError,
6479        >>(
6480            fidl::encoding::FlexibleResult::new(result),
6481            self.tx_id,
6482            0x632c13fc5e08d3e2,
6483            fidl::encoding::DynamicFlags::FLEXIBLE,
6484        )
6485    }
6486}
6487
6488#[must_use = "FIDL methods require a response to be sent"]
6489#[derive(Debug)]
6490pub struct SessionResetToggleResponder {
6491    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6492    tx_id: u32,
6493}
6494
6495/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6496/// if the responder is dropped without sending a response, so that the client
6497/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6498impl std::ops::Drop for SessionResetToggleResponder {
6499    fn drop(&mut self) {
6500        self.control_handle.shutdown();
6501        // Safety: drops once, never accessed again
6502        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6503    }
6504}
6505
6506impl fidl::endpoints::Responder for SessionResetToggleResponder {
6507    type ControlHandle = SessionControlHandle;
6508
6509    fn control_handle(&self) -> &SessionControlHandle {
6510        &self.control_handle
6511    }
6512
6513    fn drop_without_shutdown(mut self) {
6514        // Safety: drops once, never accessed again due to mem::forget
6515        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6516        // Prevent Drop from running (which would shut down the channel)
6517        std::mem::forget(self);
6518    }
6519}
6520
6521impl SessionResetToggleResponder {
6522    /// Sends a response to the FIDL transaction.
6523    ///
6524    /// Sets the channel to shutdown if an error occurs.
6525    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6526        let _result = self.send_raw(result);
6527        if _result.is_err() {
6528            self.control_handle.shutdown();
6529        }
6530        self.drop_without_shutdown();
6531        _result
6532    }
6533
6534    /// Similar to "send" but does not shutdown the channel if an error occurs.
6535    pub fn send_no_shutdown_on_err(
6536        self,
6537        mut result: Result<(u64, i64), OperationError>,
6538    ) -> Result<(), fidl::Error> {
6539        let _result = self.send_raw(result);
6540        self.drop_without_shutdown();
6541        _result
6542    }
6543
6544    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6545        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6546            ResetToggleResult,
6547            OperationError,
6548        >>(
6549            fidl::encoding::FlexibleResult::new(result),
6550            self.tx_id,
6551            0x2b2b14cb6a5e4c98,
6552            fidl::encoding::DynamicFlags::FLEXIBLE,
6553        )
6554    }
6555}
6556
6557#[must_use = "FIDL methods require a response to be sent"]
6558#[derive(Debug)]
6559pub struct SessionResetStatusResponder {
6560    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6561    tx_id: u32,
6562}
6563
6564/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6565/// if the responder is dropped without sending a response, so that the client
6566/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6567impl std::ops::Drop for SessionResetStatusResponder {
6568    fn drop(&mut self) {
6569        self.control_handle.shutdown();
6570        // Safety: drops once, never accessed again
6571        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6572    }
6573}
6574
6575impl fidl::endpoints::Responder for SessionResetStatusResponder {
6576    type ControlHandle = SessionControlHandle;
6577
6578    fn control_handle(&self) -> &SessionControlHandle {
6579        &self.control_handle
6580    }
6581
6582    fn drop_without_shutdown(mut self) {
6583        // Safety: drops once, never accessed again due to mem::forget
6584        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6585        // Prevent Drop from running (which would shut down the channel)
6586        std::mem::forget(self);
6587    }
6588}
6589
6590impl SessionResetStatusResponder {
6591    /// Sends a response to the FIDL transaction.
6592    ///
6593    /// Sets the channel to shutdown if an error occurs.
6594    pub fn send(
6595        self,
6596        mut result: Result<(bool, u64, i64), OperationError>,
6597    ) -> Result<(), fidl::Error> {
6598        let _result = self.send_raw(result);
6599        if _result.is_err() {
6600            self.control_handle.shutdown();
6601        }
6602        self.drop_without_shutdown();
6603        _result
6604    }
6605
6606    /// Similar to "send" but does not shutdown the channel if an error occurs.
6607    pub fn send_no_shutdown_on_err(
6608        self,
6609        mut result: Result<(bool, u64, i64), OperationError>,
6610    ) -> Result<(), fidl::Error> {
6611        let _result = self.send_raw(result);
6612        self.drop_without_shutdown();
6613        _result
6614    }
6615
6616    fn send_raw(
6617        &self,
6618        mut result: Result<(bool, u64, i64), OperationError>,
6619    ) -> Result<(), fidl::Error> {
6620        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6621            ResetStatusResult,
6622            OperationError,
6623        >>(
6624            fidl::encoding::FlexibleResult::new(result),
6625            self.tx_id,
6626            0x1790a96ce5f3b3d9,
6627            fidl::encoding::DynamicFlags::FLEXIBLE,
6628        )
6629    }
6630}
6631
6632#[must_use = "FIDL methods require a response to be sent"]
6633#[derive(Debug)]
6634pub struct SessionSerialReadResponder {
6635    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6636    tx_id: u32,
6637}
6638
6639/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6640/// if the responder is dropped without sending a response, so that the client
6641/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6642impl std::ops::Drop for SessionSerialReadResponder {
6643    fn drop(&mut self) {
6644        self.control_handle.shutdown();
6645        // Safety: drops once, never accessed again
6646        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6647    }
6648}
6649
6650impl fidl::endpoints::Responder for SessionSerialReadResponder {
6651    type ControlHandle = SessionControlHandle;
6652
6653    fn control_handle(&self) -> &SessionControlHandle {
6654        &self.control_handle
6655    }
6656
6657    fn drop_without_shutdown(mut self) {
6658        // Safety: drops once, never accessed again due to mem::forget
6659        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6660        // Prevent Drop from running (which would shut down the channel)
6661        std::mem::forget(self);
6662    }
6663}
6664
6665impl SessionSerialReadResponder {
6666    /// Sends a response to the FIDL transaction.
6667    ///
6668    /// Sets the channel to shutdown if an error occurs.
6669    pub fn send(
6670        self,
6671        mut result: Result<(&[u8], u64, i64), OperationError>,
6672    ) -> Result<(), fidl::Error> {
6673        let _result = self.send_raw(result);
6674        if _result.is_err() {
6675            self.control_handle.shutdown();
6676        }
6677        self.drop_without_shutdown();
6678        _result
6679    }
6680
6681    /// Similar to "send" but does not shutdown the channel if an error occurs.
6682    pub fn send_no_shutdown_on_err(
6683        self,
6684        mut result: Result<(&[u8], u64, i64), OperationError>,
6685    ) -> Result<(), fidl::Error> {
6686        let _result = self.send_raw(result);
6687        self.drop_without_shutdown();
6688        _result
6689    }
6690
6691    fn send_raw(
6692        &self,
6693        mut result: Result<(&[u8], u64, i64), OperationError>,
6694    ) -> Result<(), fidl::Error> {
6695        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6696            SerialReadResult,
6697            OperationError,
6698        >>(
6699            fidl::encoding::FlexibleResult::new(result),
6700            self.tx_id,
6701            0x2b76818805a351fd,
6702            fidl::encoding::DynamicFlags::FLEXIBLE,
6703        )
6704    }
6705}
6706
6707#[must_use = "FIDL methods require a response to be sent"]
6708#[derive(Debug)]
6709pub struct SessionSerialWriteResponder {
6710    control_handle: std::mem::ManuallyDrop<SessionControlHandle>,
6711    tx_id: u32,
6712}
6713
6714/// Set the the channel to be shutdown (see [`SessionControlHandle::shutdown`])
6715/// if the responder is dropped without sending a response, so that the client
6716/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6717impl std::ops::Drop for SessionSerialWriteResponder {
6718    fn drop(&mut self) {
6719        self.control_handle.shutdown();
6720        // Safety: drops once, never accessed again
6721        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6722    }
6723}
6724
6725impl fidl::endpoints::Responder for SessionSerialWriteResponder {
6726    type ControlHandle = SessionControlHandle;
6727
6728    fn control_handle(&self) -> &SessionControlHandle {
6729        &self.control_handle
6730    }
6731
6732    fn drop_without_shutdown(mut self) {
6733        // Safety: drops once, never accessed again due to mem::forget
6734        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6735        // Prevent Drop from running (which would shut down the channel)
6736        std::mem::forget(self);
6737    }
6738}
6739
6740impl SessionSerialWriteResponder {
6741    /// Sends a response to the FIDL transaction.
6742    ///
6743    /// Sets the channel to shutdown if an error occurs.
6744    pub fn send(self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6745        let _result = self.send_raw(result);
6746        if _result.is_err() {
6747            self.control_handle.shutdown();
6748        }
6749        self.drop_without_shutdown();
6750        _result
6751    }
6752
6753    /// Similar to "send" but does not shutdown the channel if an error occurs.
6754    pub fn send_no_shutdown_on_err(
6755        self,
6756        mut result: Result<(u64, i64), OperationError>,
6757    ) -> Result<(), fidl::Error> {
6758        let _result = self.send_raw(result);
6759        self.drop_without_shutdown();
6760        _result
6761    }
6762
6763    fn send_raw(&self, mut result: Result<(u64, i64), OperationError>) -> Result<(), fidl::Error> {
6764        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6765            SerialWriteResult,
6766            OperationError,
6767        >>(
6768            fidl::encoding::FlexibleResult::new(result),
6769            self.tx_id,
6770            0x5345a3e2317a792f,
6771            fidl::encoding::DynamicFlags::FLEXIBLE,
6772        )
6773    }
6774}
6775
6776#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6777pub struct SpiEndpointMarker;
6778
6779impl fidl::endpoints::ProtocolMarker for SpiEndpointMarker {
6780    type Proxy = SpiEndpointProxy;
6781    type RequestStream = SpiEndpointRequestStream;
6782    #[cfg(target_os = "fuchsia")]
6783    type SynchronousProxy = SpiEndpointSynchronousProxy;
6784
6785    const DEBUG_NAME: &'static str = "(anonymous) SpiEndpoint";
6786}
6787pub type SpiEndpointTransmitResult = Result<(Vec<u8>, u64, i64), OperationError>;
6788
6789pub trait SpiEndpointProxyInterface: Send + Sync {
6790    type TransmitResponseFut: std::future::Future<Output = Result<SpiEndpointTransmitResult, fidl::Error>>
6791        + Send;
6792    fn r#transmit(&self, tx_data: &[u8]) -> Self::TransmitResponseFut;
6793}
6794#[derive(Debug)]
6795#[cfg(target_os = "fuchsia")]
6796pub struct SpiEndpointSynchronousProxy {
6797    client: fidl::client::sync::Client,
6798}
6799
6800#[cfg(target_os = "fuchsia")]
6801impl fidl::endpoints::SynchronousProxy for SpiEndpointSynchronousProxy {
6802    type Proxy = SpiEndpointProxy;
6803    type Protocol = SpiEndpointMarker;
6804
6805    fn from_channel(inner: fidl::Channel) -> Self {
6806        Self::new(inner)
6807    }
6808
6809    fn into_channel(self) -> fidl::Channel {
6810        self.client.into_channel()
6811    }
6812
6813    fn as_channel(&self) -> &fidl::Channel {
6814        self.client.as_channel()
6815    }
6816}
6817
6818#[cfg(target_os = "fuchsia")]
6819impl SpiEndpointSynchronousProxy {
6820    pub fn new(channel: fidl::Channel) -> Self {
6821        Self { client: fidl::client::sync::Client::new(channel) }
6822    }
6823
6824    pub fn into_channel(self) -> fidl::Channel {
6825        self.client.into_channel()
6826    }
6827
6828    /// Waits until an event arrives and returns it. It is safe for other
6829    /// threads to make concurrent requests while waiting for an event.
6830    pub fn wait_for_event(
6831        &self,
6832        deadline: zx::MonotonicInstant,
6833    ) -> Result<SpiEndpointEvent, fidl::Error> {
6834        SpiEndpointEvent::decode(self.client.wait_for_event::<SpiEndpointMarker>(deadline)?)
6835    }
6836
6837    pub fn r#transmit(
6838        &self,
6839        mut tx_data: &[u8],
6840        ___deadline: zx::MonotonicInstant,
6841    ) -> Result<SpiEndpointTransmitResult, fidl::Error> {
6842        let _response = self.client.send_query::<
6843            SpiEndpointTransmitRequest,
6844            fidl::encoding::FlexibleResultType<SpiTransmitResult, OperationError>,
6845            SpiEndpointMarker,
6846        >(
6847            (tx_data,),
6848            0x71f374cd592ecaa3,
6849            fidl::encoding::DynamicFlags::FLEXIBLE,
6850            ___deadline,
6851        )?
6852        .into_result::<SpiEndpointMarker>("transmit")?;
6853        Ok(_response.map(|x| (x.rx_data, x.audit_seq, x.timestamp_ns)))
6854    }
6855}
6856
6857#[cfg(target_os = "fuchsia")]
6858impl From<SpiEndpointSynchronousProxy> for zx::NullableHandle {
6859    fn from(value: SpiEndpointSynchronousProxy) -> Self {
6860        value.into_channel().into()
6861    }
6862}
6863
6864#[cfg(target_os = "fuchsia")]
6865impl From<fidl::Channel> for SpiEndpointSynchronousProxy {
6866    fn from(value: fidl::Channel) -> Self {
6867        Self::new(value)
6868    }
6869}
6870
6871#[cfg(target_os = "fuchsia")]
6872impl fidl::endpoints::FromClient for SpiEndpointSynchronousProxy {
6873    type Protocol = SpiEndpointMarker;
6874
6875    fn from_client(value: fidl::endpoints::ClientEnd<SpiEndpointMarker>) -> Self {
6876        Self::new(value.into_channel())
6877    }
6878}
6879
6880#[derive(Debug, Clone)]
6881pub struct SpiEndpointProxy {
6882    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6883}
6884
6885impl fidl::endpoints::Proxy for SpiEndpointProxy {
6886    type Protocol = SpiEndpointMarker;
6887
6888    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6889        Self::new(inner)
6890    }
6891
6892    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6893        self.client.into_channel().map_err(|client| Self { client })
6894    }
6895
6896    fn as_channel(&self) -> &::fidl::AsyncChannel {
6897        self.client.as_channel()
6898    }
6899}
6900
6901impl SpiEndpointProxy {
6902    /// Create a new Proxy for fuchsia.driver.lab/SpiEndpoint.
6903    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6904        let protocol_name = <SpiEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6905        Self { client: fidl::client::Client::new(channel, protocol_name) }
6906    }
6907
6908    /// Get a Stream of events from the remote end of the protocol.
6909    ///
6910    /// # Panics
6911    ///
6912    /// Panics if the event stream was already taken.
6913    pub fn take_event_stream(&self) -> SpiEndpointEventStream {
6914        SpiEndpointEventStream { event_receiver: self.client.take_event_receiver() }
6915    }
6916
6917    pub fn r#transmit(
6918        &self,
6919        mut tx_data: &[u8],
6920    ) -> fidl::client::QueryResponseFut<
6921        SpiEndpointTransmitResult,
6922        fidl::encoding::DefaultFuchsiaResourceDialect,
6923    > {
6924        SpiEndpointProxyInterface::r#transmit(self, tx_data)
6925    }
6926}
6927
6928impl SpiEndpointProxyInterface for SpiEndpointProxy {
6929    type TransmitResponseFut = fidl::client::QueryResponseFut<
6930        SpiEndpointTransmitResult,
6931        fidl::encoding::DefaultFuchsiaResourceDialect,
6932    >;
6933    fn r#transmit(&self, mut tx_data: &[u8]) -> Self::TransmitResponseFut {
6934        fn _decode(
6935            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6936        ) -> Result<SpiEndpointTransmitResult, fidl::Error> {
6937            let _response = fidl::client::decode_transaction_body::<
6938                fidl::encoding::FlexibleResultType<SpiTransmitResult, OperationError>,
6939                fidl::encoding::DefaultFuchsiaResourceDialect,
6940                0x71f374cd592ecaa3,
6941            >(_buf?)?
6942            .into_result::<SpiEndpointMarker>("transmit")?;
6943            Ok(_response.map(|x| (x.rx_data, x.audit_seq, x.timestamp_ns)))
6944        }
6945        self.client.send_query_and_decode::<SpiEndpointTransmitRequest, SpiEndpointTransmitResult>(
6946            (tx_data,),
6947            0x71f374cd592ecaa3,
6948            fidl::encoding::DynamicFlags::FLEXIBLE,
6949            _decode,
6950        )
6951    }
6952}
6953
6954pub struct SpiEndpointEventStream {
6955    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6956}
6957
6958impl std::marker::Unpin for SpiEndpointEventStream {}
6959
6960impl futures::stream::FusedStream for SpiEndpointEventStream {
6961    fn is_terminated(&self) -> bool {
6962        self.event_receiver.is_terminated()
6963    }
6964}
6965
6966impl futures::Stream for SpiEndpointEventStream {
6967    type Item = Result<SpiEndpointEvent, fidl::Error>;
6968
6969    fn poll_next(
6970        mut self: std::pin::Pin<&mut Self>,
6971        cx: &mut std::task::Context<'_>,
6972    ) -> std::task::Poll<Option<Self::Item>> {
6973        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6974            &mut self.event_receiver,
6975            cx
6976        )?) {
6977            Some(buf) => std::task::Poll::Ready(Some(SpiEndpointEvent::decode(buf))),
6978            None => std::task::Poll::Ready(None),
6979        }
6980    }
6981}
6982
6983#[derive(Debug)]
6984pub enum SpiEndpointEvent {
6985    #[non_exhaustive]
6986    _UnknownEvent {
6987        /// Ordinal of the event that was sent.
6988        ordinal: u64,
6989    },
6990}
6991
6992impl SpiEndpointEvent {
6993    /// Decodes a message buffer as a [`SpiEndpointEvent`].
6994    fn decode(
6995        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6996    ) -> Result<SpiEndpointEvent, fidl::Error> {
6997        let (bytes, _handles) = buf.split_mut();
6998        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6999        debug_assert_eq!(tx_header.tx_id, 0);
7000        match tx_header.ordinal {
7001            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7002                Ok(SpiEndpointEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7003            }
7004            _ => Err(fidl::Error::UnknownOrdinal {
7005                ordinal: tx_header.ordinal,
7006                protocol_name: <SpiEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7007            }),
7008        }
7009    }
7010}
7011
7012/// A Stream of incoming requests for fuchsia.driver.lab/SpiEndpoint.
7013pub struct SpiEndpointRequestStream {
7014    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7015    is_terminated: bool,
7016}
7017
7018impl std::marker::Unpin for SpiEndpointRequestStream {}
7019
7020impl futures::stream::FusedStream for SpiEndpointRequestStream {
7021    fn is_terminated(&self) -> bool {
7022        self.is_terminated
7023    }
7024}
7025
7026impl fidl::endpoints::RequestStream for SpiEndpointRequestStream {
7027    type Protocol = SpiEndpointMarker;
7028    type ControlHandle = SpiEndpointControlHandle;
7029
7030    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7031        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7032    }
7033
7034    fn control_handle(&self) -> Self::ControlHandle {
7035        SpiEndpointControlHandle { inner: self.inner.clone() }
7036    }
7037
7038    fn into_inner(
7039        self,
7040    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7041    {
7042        (self.inner, self.is_terminated)
7043    }
7044
7045    fn from_inner(
7046        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7047        is_terminated: bool,
7048    ) -> Self {
7049        Self { inner, is_terminated }
7050    }
7051}
7052
7053impl futures::Stream for SpiEndpointRequestStream {
7054    type Item = Result<SpiEndpointRequest, fidl::Error>;
7055
7056    fn poll_next(
7057        mut self: std::pin::Pin<&mut Self>,
7058        cx: &mut std::task::Context<'_>,
7059    ) -> std::task::Poll<Option<Self::Item>> {
7060        let this = &mut *self;
7061        if this.inner.check_shutdown(cx) {
7062            this.is_terminated = true;
7063            return std::task::Poll::Ready(None);
7064        }
7065        if this.is_terminated {
7066            panic!("polled SpiEndpointRequestStream after completion");
7067        }
7068        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7069            |bytes, handles| {
7070                match this.inner.channel().read_etc(cx, bytes, handles) {
7071                    std::task::Poll::Ready(Ok(())) => {}
7072                    std::task::Poll::Pending => return std::task::Poll::Pending,
7073                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7074                        this.is_terminated = true;
7075                        return std::task::Poll::Ready(None);
7076                    }
7077                    std::task::Poll::Ready(Err(e)) => {
7078                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7079                            e.into(),
7080                        ))));
7081                    }
7082                }
7083
7084                // A message has been received from the channel
7085                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7086
7087                std::task::Poll::Ready(Some(match header.ordinal {
7088                    0x71f374cd592ecaa3 => {
7089                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7090                        let mut req = fidl::new_empty!(
7091                            SpiEndpointTransmitRequest,
7092                            fidl::encoding::DefaultFuchsiaResourceDialect
7093                        );
7094                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SpiEndpointTransmitRequest>(&header, _body_bytes, handles, &mut req)?;
7095                        let control_handle = SpiEndpointControlHandle { inner: this.inner.clone() };
7096                        Ok(SpiEndpointRequest::Transmit {
7097                            tx_data: req.tx_data,
7098
7099                            responder: SpiEndpointTransmitResponder {
7100                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7101                                tx_id: header.tx_id,
7102                            },
7103                        })
7104                    }
7105                    _ if header.tx_id == 0
7106                        && header
7107                            .dynamic_flags()
7108                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7109                    {
7110                        Ok(SpiEndpointRequest::_UnknownMethod {
7111                            ordinal: header.ordinal,
7112                            control_handle: SpiEndpointControlHandle { inner: this.inner.clone() },
7113                            method_type: fidl::MethodType::OneWay,
7114                        })
7115                    }
7116                    _ if header
7117                        .dynamic_flags()
7118                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7119                    {
7120                        this.inner.send_framework_err(
7121                            fidl::encoding::FrameworkErr::UnknownMethod,
7122                            header.tx_id,
7123                            header.ordinal,
7124                            header.dynamic_flags(),
7125                            (bytes, handles),
7126                        )?;
7127                        Ok(SpiEndpointRequest::_UnknownMethod {
7128                            ordinal: header.ordinal,
7129                            control_handle: SpiEndpointControlHandle { inner: this.inner.clone() },
7130                            method_type: fidl::MethodType::TwoWay,
7131                        })
7132                    }
7133                    _ => Err(fidl::Error::UnknownOrdinal {
7134                        ordinal: header.ordinal,
7135                        protocol_name:
7136                            <SpiEndpointMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7137                    }),
7138                }))
7139            },
7140        )
7141    }
7142}
7143
7144/// Typed endpoint for a SPI protocol resource.
7145#[derive(Debug)]
7146pub enum SpiEndpointRequest {
7147    Transmit {
7148        tx_data: Vec<u8>,
7149        responder: SpiEndpointTransmitResponder,
7150    },
7151    /// An interaction was received which does not match any known method.
7152    #[non_exhaustive]
7153    _UnknownMethod {
7154        /// Ordinal of the method that was called.
7155        ordinal: u64,
7156        control_handle: SpiEndpointControlHandle,
7157        method_type: fidl::MethodType,
7158    },
7159}
7160
7161impl SpiEndpointRequest {
7162    #[allow(irrefutable_let_patterns)]
7163    pub fn into_transmit(self) -> Option<(Vec<u8>, SpiEndpointTransmitResponder)> {
7164        if let SpiEndpointRequest::Transmit { tx_data, responder } = self {
7165            Some((tx_data, responder))
7166        } else {
7167            None
7168        }
7169    }
7170
7171    /// Name of the method defined in FIDL
7172    pub fn method_name(&self) -> &'static str {
7173        match *self {
7174            SpiEndpointRequest::Transmit { .. } => "transmit",
7175            SpiEndpointRequest::_UnknownMethod {
7176                method_type: fidl::MethodType::OneWay, ..
7177            } => "unknown one-way method",
7178            SpiEndpointRequest::_UnknownMethod {
7179                method_type: fidl::MethodType::TwoWay, ..
7180            } => "unknown two-way method",
7181        }
7182    }
7183}
7184
7185#[derive(Debug, Clone)]
7186pub struct SpiEndpointControlHandle {
7187    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7188}
7189
7190impl SpiEndpointControlHandle {
7191    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7192        self.inner.shutdown_with_epitaph(status.into())
7193    }
7194}
7195
7196impl fidl::endpoints::ControlHandle for SpiEndpointControlHandle {
7197    fn shutdown(&self) {
7198        self.inner.shutdown()
7199    }
7200
7201    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7202        self.inner.shutdown_with_epitaph(status)
7203    }
7204
7205    fn is_closed(&self) -> bool {
7206        self.inner.channel().is_closed()
7207    }
7208    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7209        self.inner.channel().on_closed()
7210    }
7211
7212    #[cfg(target_os = "fuchsia")]
7213    fn signal_peer(
7214        &self,
7215        clear_mask: zx::Signals,
7216        set_mask: zx::Signals,
7217    ) -> Result<(), zx_status::Status> {
7218        use fidl::Peered;
7219        self.inner.channel().signal_peer(clear_mask, set_mask)
7220    }
7221}
7222
7223impl SpiEndpointControlHandle {}
7224
7225#[must_use = "FIDL methods require a response to be sent"]
7226#[derive(Debug)]
7227pub struct SpiEndpointTransmitResponder {
7228    control_handle: std::mem::ManuallyDrop<SpiEndpointControlHandle>,
7229    tx_id: u32,
7230}
7231
7232/// Set the the channel to be shutdown (see [`SpiEndpointControlHandle::shutdown`])
7233/// if the responder is dropped without sending a response, so that the client
7234/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7235impl std::ops::Drop for SpiEndpointTransmitResponder {
7236    fn drop(&mut self) {
7237        self.control_handle.shutdown();
7238        // Safety: drops once, never accessed again
7239        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7240    }
7241}
7242
7243impl fidl::endpoints::Responder for SpiEndpointTransmitResponder {
7244    type ControlHandle = SpiEndpointControlHandle;
7245
7246    fn control_handle(&self) -> &SpiEndpointControlHandle {
7247        &self.control_handle
7248    }
7249
7250    fn drop_without_shutdown(mut self) {
7251        // Safety: drops once, never accessed again due to mem::forget
7252        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7253        // Prevent Drop from running (which would shut down the channel)
7254        std::mem::forget(self);
7255    }
7256}
7257
7258impl SpiEndpointTransmitResponder {
7259    /// Sends a response to the FIDL transaction.
7260    ///
7261    /// Sets the channel to shutdown if an error occurs.
7262    pub fn send(
7263        self,
7264        mut result: Result<(&[u8], u64, i64), OperationError>,
7265    ) -> Result<(), fidl::Error> {
7266        let _result = self.send_raw(result);
7267        if _result.is_err() {
7268            self.control_handle.shutdown();
7269        }
7270        self.drop_without_shutdown();
7271        _result
7272    }
7273
7274    /// Similar to "send" but does not shutdown the channel if an error occurs.
7275    pub fn send_no_shutdown_on_err(
7276        self,
7277        mut result: Result<(&[u8], u64, i64), OperationError>,
7278    ) -> Result<(), fidl::Error> {
7279        let _result = self.send_raw(result);
7280        self.drop_without_shutdown();
7281        _result
7282    }
7283
7284    fn send_raw(
7285        &self,
7286        mut result: Result<(&[u8], u64, i64), OperationError>,
7287    ) -> Result<(), fidl::Error> {
7288        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7289            SpiTransmitResult,
7290            OperationError,
7291        >>(
7292            fidl::encoding::FlexibleResult::new(result),
7293            self.tx_id,
7294            0x71f374cd592ecaa3,
7295            fidl::encoding::DynamicFlags::FLEXIBLE,
7296        )
7297    }
7298}
7299
7300#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7301pub struct ServiceMarker;
7302
7303#[cfg(target_os = "fuchsia")]
7304impl fidl::endpoints::ServiceMarker for ServiceMarker {
7305    type Proxy = ServiceProxy;
7306    type Request = ServiceRequest;
7307    const SERVICE_NAME: &'static str = "fuchsia.driver.lab.Service";
7308}
7309
7310/// A request for one of the member protocols of Service.
7311///
7312#[cfg(target_os = "fuchsia")]
7313pub enum ServiceRequest {
7314    Proxy(Proxy_RequestStream),
7315}
7316
7317#[cfg(target_os = "fuchsia")]
7318impl fidl::endpoints::ServiceRequest for ServiceRequest {
7319    type Service = ServiceMarker;
7320
7321    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
7322        match name {
7323            "proxy" => Self::Proxy(
7324                <Proxy_RequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
7325            ),
7326            _ => panic!("no such member protocol name for service Service"),
7327        }
7328    }
7329
7330    fn member_names() -> &'static [&'static str] {
7331        &["proxy"]
7332    }
7333}
7334#[cfg(target_os = "fuchsia")]
7335pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
7336
7337#[cfg(target_os = "fuchsia")]
7338impl fidl::endpoints::ServiceProxy for ServiceProxy {
7339    type Service = ServiceMarker;
7340
7341    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
7342        Self(opener)
7343    }
7344}
7345
7346#[cfg(target_os = "fuchsia")]
7347impl ServiceProxy {
7348    pub fn connect_to_proxy(&self) -> Result<Proxy_Proxy, fidl::Error> {
7349        let (proxy, server_end) = fidl::endpoints::create_proxy::<Proxy_Marker>();
7350        self.connect_channel_to_proxy(server_end)?;
7351        Ok(proxy)
7352    }
7353
7354    /// Like `connect_to_proxy`, but returns a sync proxy.
7355    /// See [`Self::connect_to_proxy`] for more details.
7356    pub fn connect_to_proxy_sync(&self) -> Result<Proxy_SynchronousProxy, fidl::Error> {
7357        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<Proxy_Marker>();
7358        self.connect_channel_to_proxy(server_end)?;
7359        Ok(proxy)
7360    }
7361
7362    /// Like `connect_to_proxy`, but accepts a server end.
7363    /// See [`Self::connect_to_proxy`] for more details.
7364    pub fn connect_channel_to_proxy(
7365        &self,
7366        server_end: fidl::endpoints::ServerEnd<Proxy_Marker>,
7367    ) -> Result<(), fidl::Error> {
7368        self.0.open_member("proxy", server_end.into_channel())
7369    }
7370
7371    pub fn instance_name(&self) -> &str {
7372        self.0.instance_name()
7373    }
7374}
7375
7376mod internal {
7377    use super::*;
7378
7379    impl fidl::encoding::ResourceTypeMarker for ProxyOpenSessionRequest {
7380        type Borrowed<'a> = &'a mut Self;
7381        fn take_or_borrow<'a>(
7382            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7383        ) -> Self::Borrowed<'a> {
7384            value
7385        }
7386    }
7387
7388    unsafe impl fidl::encoding::TypeMarker for ProxyOpenSessionRequest {
7389        type Owned = Self;
7390
7391        #[inline(always)]
7392        fn inline_align(_context: fidl::encoding::Context) -> usize {
7393            8
7394        }
7395
7396        #[inline(always)]
7397        fn inline_size(_context: fidl::encoding::Context) -> usize {
7398            64
7399        }
7400    }
7401
7402    unsafe impl
7403        fidl::encoding::Encode<
7404            ProxyOpenSessionRequest,
7405            fidl::encoding::DefaultFuchsiaResourceDialect,
7406        > for &mut ProxyOpenSessionRequest
7407    {
7408        #[inline]
7409        unsafe fn encode(
7410            self,
7411            encoder: &mut fidl::encoding::Encoder<
7412                '_,
7413                fidl::encoding::DefaultFuchsiaResourceDialect,
7414            >,
7415            offset: usize,
7416            _depth: fidl::encoding::Depth,
7417        ) -> fidl::Result<()> {
7418            encoder.debug_check_bounds::<ProxyOpenSessionRequest>(offset);
7419            // Delegate to tuple encoding.
7420            fidl::encoding::Encode::<ProxyOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7421                (
7422                    <RunContext as fidl::encoding::ValueTypeMarker>::borrow(&self.context),
7423                    <SessionMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
7424                    <Expectations as fidl::encoding::ValueTypeMarker>::borrow(&self.expectations),
7425                    <fidl::encoding::Vector<AccessRule, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.allowlist),
7426                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
7427                ),
7428                encoder, offset, _depth
7429            )
7430        }
7431    }
7432    unsafe impl<
7433        T0: fidl::encoding::Encode<RunContext, fidl::encoding::DefaultFuchsiaResourceDialect>,
7434        T1: fidl::encoding::Encode<SessionMode, fidl::encoding::DefaultFuchsiaResourceDialect>,
7435        T2: fidl::encoding::Encode<Expectations, fidl::encoding::DefaultFuchsiaResourceDialect>,
7436        T3: fidl::encoding::Encode<
7437                fidl::encoding::Vector<AccessRule, 256>,
7438                fidl::encoding::DefaultFuchsiaResourceDialect,
7439            >,
7440        T4: fidl::encoding::Encode<
7441                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
7442                fidl::encoding::DefaultFuchsiaResourceDialect,
7443            >,
7444    >
7445        fidl::encoding::Encode<
7446            ProxyOpenSessionRequest,
7447            fidl::encoding::DefaultFuchsiaResourceDialect,
7448        > for (T0, T1, T2, T3, T4)
7449    {
7450        #[inline]
7451        unsafe fn encode(
7452            self,
7453            encoder: &mut fidl::encoding::Encoder<
7454                '_,
7455                fidl::encoding::DefaultFuchsiaResourceDialect,
7456            >,
7457            offset: usize,
7458            depth: fidl::encoding::Depth,
7459        ) -> fidl::Result<()> {
7460            encoder.debug_check_bounds::<ProxyOpenSessionRequest>(offset);
7461            // Zero out padding regions. There's no need to apply masks
7462            // because the unmasked parts will be overwritten by fields.
7463            unsafe {
7464                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7465                (ptr as *mut u64).write_unaligned(0);
7466            }
7467            unsafe {
7468                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
7469                (ptr as *mut u64).write_unaligned(0);
7470            }
7471            // Write the fields.
7472            self.0.encode(encoder, offset + 0, depth)?;
7473            self.1.encode(encoder, offset + 16, depth)?;
7474            self.2.encode(encoder, offset + 24, depth)?;
7475            self.3.encode(encoder, offset + 40, depth)?;
7476            self.4.encode(encoder, offset + 56, depth)?;
7477            Ok(())
7478        }
7479    }
7480
7481    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7482        for ProxyOpenSessionRequest
7483    {
7484        #[inline(always)]
7485        fn new_empty() -> Self {
7486            Self {
7487                context: fidl::new_empty!(
7488                    RunContext,
7489                    fidl::encoding::DefaultFuchsiaResourceDialect
7490                ),
7491                mode: fidl::new_empty!(SessionMode, fidl::encoding::DefaultFuchsiaResourceDialect),
7492                expectations: fidl::new_empty!(
7493                    Expectations,
7494                    fidl::encoding::DefaultFuchsiaResourceDialect
7495                ),
7496                allowlist: fidl::new_empty!(fidl::encoding::Vector<AccessRule, 256>, fidl::encoding::DefaultFuchsiaResourceDialect),
7497                session: fidl::new_empty!(
7498                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
7499                    fidl::encoding::DefaultFuchsiaResourceDialect
7500                ),
7501            }
7502        }
7503
7504        #[inline]
7505        unsafe fn decode(
7506            &mut self,
7507            decoder: &mut fidl::encoding::Decoder<
7508                '_,
7509                fidl::encoding::DefaultFuchsiaResourceDialect,
7510            >,
7511            offset: usize,
7512            _depth: fidl::encoding::Depth,
7513        ) -> fidl::Result<()> {
7514            decoder.debug_check_bounds::<Self>(offset);
7515            // Verify that padding bytes are zero.
7516            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7517            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7518            let mask = 0xffffffff00000000u64;
7519            let maskedval = padval & mask;
7520            if maskedval != 0 {
7521                return Err(fidl::Error::NonZeroPadding {
7522                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7523                });
7524            }
7525            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
7526            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7527            let mask = 0xffffffff00000000u64;
7528            let maskedval = padval & mask;
7529            if maskedval != 0 {
7530                return Err(fidl::Error::NonZeroPadding {
7531                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
7532                });
7533            }
7534            fidl::decode!(
7535                RunContext,
7536                fidl::encoding::DefaultFuchsiaResourceDialect,
7537                &mut self.context,
7538                decoder,
7539                offset + 0,
7540                _depth
7541            )?;
7542            fidl::decode!(
7543                SessionMode,
7544                fidl::encoding::DefaultFuchsiaResourceDialect,
7545                &mut self.mode,
7546                decoder,
7547                offset + 16,
7548                _depth
7549            )?;
7550            fidl::decode!(
7551                Expectations,
7552                fidl::encoding::DefaultFuchsiaResourceDialect,
7553                &mut self.expectations,
7554                decoder,
7555                offset + 24,
7556                _depth
7557            )?;
7558            fidl::decode!(fidl::encoding::Vector<AccessRule, 256>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.allowlist, decoder, offset + 40, _depth)?;
7559            fidl::decode!(
7560                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionMarker>>,
7561                fidl::encoding::DefaultFuchsiaResourceDialect,
7562                &mut self.session,
7563                decoder,
7564                offset + 56,
7565                _depth
7566            )?;
7567            Ok(())
7568        }
7569    }
7570
7571    impl fidl::encoding::ResourceTypeMarker for SessionOpenGpioRequest {
7572        type Borrowed<'a> = &'a mut Self;
7573        fn take_or_borrow<'a>(
7574            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7575        ) -> Self::Borrowed<'a> {
7576            value
7577        }
7578    }
7579
7580    unsafe impl fidl::encoding::TypeMarker for SessionOpenGpioRequest {
7581        type Owned = Self;
7582
7583        #[inline(always)]
7584        fn inline_align(_context: fidl::encoding::Context) -> usize {
7585            4
7586        }
7587
7588        #[inline(always)]
7589        fn inline_size(_context: fidl::encoding::Context) -> usize {
7590            8
7591        }
7592    }
7593
7594    unsafe impl
7595        fidl::encoding::Encode<
7596            SessionOpenGpioRequest,
7597            fidl::encoding::DefaultFuchsiaResourceDialect,
7598        > for &mut SessionOpenGpioRequest
7599    {
7600        #[inline]
7601        unsafe fn encode(
7602            self,
7603            encoder: &mut fidl::encoding::Encoder<
7604                '_,
7605                fidl::encoding::DefaultFuchsiaResourceDialect,
7606            >,
7607            offset: usize,
7608            _depth: fidl::encoding::Depth,
7609        ) -> fidl::Result<()> {
7610            encoder.debug_check_bounds::<SessionOpenGpioRequest>(offset);
7611            // Delegate to tuple encoding.
7612            fidl::encoding::Encode::<SessionOpenGpioRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7613                (
7614                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
7615                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GpioEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
7616                ),
7617                encoder, offset, _depth
7618            )
7619        }
7620    }
7621    unsafe impl<
7622        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
7623        T1: fidl::encoding::Encode<
7624                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GpioEndpointMarker>>,
7625                fidl::encoding::DefaultFuchsiaResourceDialect,
7626            >,
7627    >
7628        fidl::encoding::Encode<
7629            SessionOpenGpioRequest,
7630            fidl::encoding::DefaultFuchsiaResourceDialect,
7631        > for (T0, T1)
7632    {
7633        #[inline]
7634        unsafe fn encode(
7635            self,
7636            encoder: &mut fidl::encoding::Encoder<
7637                '_,
7638                fidl::encoding::DefaultFuchsiaResourceDialect,
7639            >,
7640            offset: usize,
7641            depth: fidl::encoding::Depth,
7642        ) -> fidl::Result<()> {
7643            encoder.debug_check_bounds::<SessionOpenGpioRequest>(offset);
7644            // Zero out padding regions. There's no need to apply masks
7645            // because the unmasked parts will be overwritten by fields.
7646            // Write the fields.
7647            self.0.encode(encoder, offset + 0, depth)?;
7648            self.1.encode(encoder, offset + 4, depth)?;
7649            Ok(())
7650        }
7651    }
7652
7653    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7654        for SessionOpenGpioRequest
7655    {
7656        #[inline(always)]
7657        fn new_empty() -> Self {
7658            Self {
7659                resource: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
7660                endpoint: fidl::new_empty!(
7661                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GpioEndpointMarker>>,
7662                    fidl::encoding::DefaultFuchsiaResourceDialect
7663                ),
7664            }
7665        }
7666
7667        #[inline]
7668        unsafe fn decode(
7669            &mut self,
7670            decoder: &mut fidl::encoding::Decoder<
7671                '_,
7672                fidl::encoding::DefaultFuchsiaResourceDialect,
7673            >,
7674            offset: usize,
7675            _depth: fidl::encoding::Depth,
7676        ) -> fidl::Result<()> {
7677            decoder.debug_check_bounds::<Self>(offset);
7678            // Verify that padding bytes are zero.
7679            fidl::decode!(
7680                u32,
7681                fidl::encoding::DefaultFuchsiaResourceDialect,
7682                &mut self.resource,
7683                decoder,
7684                offset + 0,
7685                _depth
7686            )?;
7687            fidl::decode!(
7688                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<GpioEndpointMarker>>,
7689                fidl::encoding::DefaultFuchsiaResourceDialect,
7690                &mut self.endpoint,
7691                decoder,
7692                offset + 4,
7693                _depth
7694            )?;
7695            Ok(())
7696        }
7697    }
7698
7699    impl fidl::encoding::ResourceTypeMarker for SessionOpenI2cRequest {
7700        type Borrowed<'a> = &'a mut Self;
7701        fn take_or_borrow<'a>(
7702            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7703        ) -> Self::Borrowed<'a> {
7704            value
7705        }
7706    }
7707
7708    unsafe impl fidl::encoding::TypeMarker for SessionOpenI2cRequest {
7709        type Owned = Self;
7710
7711        #[inline(always)]
7712        fn inline_align(_context: fidl::encoding::Context) -> usize {
7713            4
7714        }
7715
7716        #[inline(always)]
7717        fn inline_size(_context: fidl::encoding::Context) -> usize {
7718            8
7719        }
7720    }
7721
7722    unsafe impl
7723        fidl::encoding::Encode<SessionOpenI2cRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7724        for &mut SessionOpenI2cRequest
7725    {
7726        #[inline]
7727        unsafe fn encode(
7728            self,
7729            encoder: &mut fidl::encoding::Encoder<
7730                '_,
7731                fidl::encoding::DefaultFuchsiaResourceDialect,
7732            >,
7733            offset: usize,
7734            _depth: fidl::encoding::Depth,
7735        ) -> fidl::Result<()> {
7736            encoder.debug_check_bounds::<SessionOpenI2cRequest>(offset);
7737            // Delegate to tuple encoding.
7738            fidl::encoding::Encode::<SessionOpenI2cRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7739                (
7740                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
7741                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<I2cEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
7742                ),
7743                encoder, offset, _depth
7744            )
7745        }
7746    }
7747    unsafe impl<
7748        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
7749        T1: fidl::encoding::Encode<
7750                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<I2cEndpointMarker>>,
7751                fidl::encoding::DefaultFuchsiaResourceDialect,
7752            >,
7753    >
7754        fidl::encoding::Encode<SessionOpenI2cRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7755        for (T0, T1)
7756    {
7757        #[inline]
7758        unsafe fn encode(
7759            self,
7760            encoder: &mut fidl::encoding::Encoder<
7761                '_,
7762                fidl::encoding::DefaultFuchsiaResourceDialect,
7763            >,
7764            offset: usize,
7765            depth: fidl::encoding::Depth,
7766        ) -> fidl::Result<()> {
7767            encoder.debug_check_bounds::<SessionOpenI2cRequest>(offset);
7768            // Zero out padding regions. There's no need to apply masks
7769            // because the unmasked parts will be overwritten by fields.
7770            // Write the fields.
7771            self.0.encode(encoder, offset + 0, depth)?;
7772            self.1.encode(encoder, offset + 4, depth)?;
7773            Ok(())
7774        }
7775    }
7776
7777    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7778        for SessionOpenI2cRequest
7779    {
7780        #[inline(always)]
7781        fn new_empty() -> Self {
7782            Self {
7783                resource: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
7784                endpoint: fidl::new_empty!(
7785                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<I2cEndpointMarker>>,
7786                    fidl::encoding::DefaultFuchsiaResourceDialect
7787                ),
7788            }
7789        }
7790
7791        #[inline]
7792        unsafe fn decode(
7793            &mut self,
7794            decoder: &mut fidl::encoding::Decoder<
7795                '_,
7796                fidl::encoding::DefaultFuchsiaResourceDialect,
7797            >,
7798            offset: usize,
7799            _depth: fidl::encoding::Depth,
7800        ) -> fidl::Result<()> {
7801            decoder.debug_check_bounds::<Self>(offset);
7802            // Verify that padding bytes are zero.
7803            fidl::decode!(
7804                u32,
7805                fidl::encoding::DefaultFuchsiaResourceDialect,
7806                &mut self.resource,
7807                decoder,
7808                offset + 0,
7809                _depth
7810            )?;
7811            fidl::decode!(
7812                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<I2cEndpointMarker>>,
7813                fidl::encoding::DefaultFuchsiaResourceDialect,
7814                &mut self.endpoint,
7815                decoder,
7816                offset + 4,
7817                _depth
7818            )?;
7819            Ok(())
7820        }
7821    }
7822
7823    impl fidl::encoding::ResourceTypeMarker for SessionOpenSpiRequest {
7824        type Borrowed<'a> = &'a mut Self;
7825        fn take_or_borrow<'a>(
7826            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7827        ) -> Self::Borrowed<'a> {
7828            value
7829        }
7830    }
7831
7832    unsafe impl fidl::encoding::TypeMarker for SessionOpenSpiRequest {
7833        type Owned = Self;
7834
7835        #[inline(always)]
7836        fn inline_align(_context: fidl::encoding::Context) -> usize {
7837            4
7838        }
7839
7840        #[inline(always)]
7841        fn inline_size(_context: fidl::encoding::Context) -> usize {
7842            8
7843        }
7844    }
7845
7846    unsafe impl
7847        fidl::encoding::Encode<SessionOpenSpiRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7848        for &mut SessionOpenSpiRequest
7849    {
7850        #[inline]
7851        unsafe fn encode(
7852            self,
7853            encoder: &mut fidl::encoding::Encoder<
7854                '_,
7855                fidl::encoding::DefaultFuchsiaResourceDialect,
7856            >,
7857            offset: usize,
7858            _depth: fidl::encoding::Depth,
7859        ) -> fidl::Result<()> {
7860            encoder.debug_check_bounds::<SessionOpenSpiRequest>(offset);
7861            // Delegate to tuple encoding.
7862            fidl::encoding::Encode::<SessionOpenSpiRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7863                (
7864                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
7865                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SpiEndpointMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.endpoint),
7866                ),
7867                encoder, offset, _depth
7868            )
7869        }
7870    }
7871    unsafe impl<
7872        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
7873        T1: fidl::encoding::Encode<
7874                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SpiEndpointMarker>>,
7875                fidl::encoding::DefaultFuchsiaResourceDialect,
7876            >,
7877    >
7878        fidl::encoding::Encode<SessionOpenSpiRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
7879        for (T0, T1)
7880    {
7881        #[inline]
7882        unsafe fn encode(
7883            self,
7884            encoder: &mut fidl::encoding::Encoder<
7885                '_,
7886                fidl::encoding::DefaultFuchsiaResourceDialect,
7887            >,
7888            offset: usize,
7889            depth: fidl::encoding::Depth,
7890        ) -> fidl::Result<()> {
7891            encoder.debug_check_bounds::<SessionOpenSpiRequest>(offset);
7892            // Zero out padding regions. There's no need to apply masks
7893            // because the unmasked parts will be overwritten by fields.
7894            // Write the fields.
7895            self.0.encode(encoder, offset + 0, depth)?;
7896            self.1.encode(encoder, offset + 4, depth)?;
7897            Ok(())
7898        }
7899    }
7900
7901    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7902        for SessionOpenSpiRequest
7903    {
7904        #[inline(always)]
7905        fn new_empty() -> Self {
7906            Self {
7907                resource: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
7908                endpoint: fidl::new_empty!(
7909                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SpiEndpointMarker>>,
7910                    fidl::encoding::DefaultFuchsiaResourceDialect
7911                ),
7912            }
7913        }
7914
7915        #[inline]
7916        unsafe fn decode(
7917            &mut self,
7918            decoder: &mut fidl::encoding::Decoder<
7919                '_,
7920                fidl::encoding::DefaultFuchsiaResourceDialect,
7921            >,
7922            offset: usize,
7923            _depth: fidl::encoding::Depth,
7924        ) -> fidl::Result<()> {
7925            decoder.debug_check_bounds::<Self>(offset);
7926            // Verify that padding bytes are zero.
7927            fidl::decode!(
7928                u32,
7929                fidl::encoding::DefaultFuchsiaResourceDialect,
7930                &mut self.resource,
7931                decoder,
7932                offset + 0,
7933                _depth
7934            )?;
7935            fidl::decode!(
7936                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SpiEndpointMarker>>,
7937                fidl::encoding::DefaultFuchsiaResourceDialect,
7938                &mut self.endpoint,
7939                decoder,
7940                offset + 4,
7941                _depth
7942            )?;
7943            Ok(())
7944        }
7945    }
7946}