Skip to main content

fidl_fuchsia_hwinfo/
fidl_fuchsia_hwinfo.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_hwinfo_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct BoardMarker;
16
17impl fidl::endpoints::ProtocolMarker for BoardMarker {
18    type Proxy = BoardProxy;
19    type RequestStream = BoardRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = BoardSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Board";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for BoardMarker {}
26
27pub trait BoardProxyInterface: Send + Sync {
28    type GetInfoResponseFut: std::future::Future<Output = Result<BoardInfo, fidl::Error>> + Send;
29    fn r#get_info(&self) -> Self::GetInfoResponseFut;
30}
31#[derive(Debug)]
32#[cfg(target_os = "fuchsia")]
33pub struct BoardSynchronousProxy {
34    client: fidl::client::sync::Client,
35}
36
37#[cfg(target_os = "fuchsia")]
38impl fidl::endpoints::SynchronousProxy for BoardSynchronousProxy {
39    type Proxy = BoardProxy;
40    type Protocol = BoardMarker;
41
42    fn from_channel(inner: fidl::Channel) -> Self {
43        Self::new(inner)
44    }
45
46    fn into_channel(self) -> fidl::Channel {
47        self.client.into_channel()
48    }
49
50    fn as_channel(&self) -> &fidl::Channel {
51        self.client.as_channel()
52    }
53}
54
55#[cfg(target_os = "fuchsia")]
56impl BoardSynchronousProxy {
57    pub fn new(channel: fidl::Channel) -> Self {
58        Self { client: fidl::client::sync::Client::new(channel) }
59    }
60
61    pub fn into_channel(self) -> fidl::Channel {
62        self.client.into_channel()
63    }
64
65    /// Waits until an event arrives and returns it. It is safe for other
66    /// threads to make concurrent requests while waiting for an event.
67    pub fn wait_for_event(
68        &self,
69        deadline: zx::MonotonicInstant,
70    ) -> Result<BoardEvent, fidl::Error> {
71        BoardEvent::decode(self.client.wait_for_event::<BoardMarker>(deadline)?)
72    }
73
74    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<BoardInfo, fidl::Error> {
75        let _response = self
76            .client
77            .send_query::<fidl::encoding::EmptyPayload, BoardGetInfoResponse, BoardMarker>(
78                (),
79                0x878a093531d0904,
80                fidl::encoding::DynamicFlags::empty(),
81                ___deadline,
82            )?;
83        Ok(_response.info)
84    }
85}
86
87#[cfg(target_os = "fuchsia")]
88impl From<BoardSynchronousProxy> for zx::NullableHandle {
89    fn from(value: BoardSynchronousProxy) -> Self {
90        value.into_channel().into()
91    }
92}
93
94#[cfg(target_os = "fuchsia")]
95impl From<fidl::Channel> for BoardSynchronousProxy {
96    fn from(value: fidl::Channel) -> Self {
97        Self::new(value)
98    }
99}
100
101#[cfg(target_os = "fuchsia")]
102impl fidl::endpoints::FromClient for BoardSynchronousProxy {
103    type Protocol = BoardMarker;
104
105    fn from_client(value: fidl::endpoints::ClientEnd<BoardMarker>) -> Self {
106        Self::new(value.into_channel())
107    }
108}
109
110#[derive(Debug, Clone)]
111pub struct BoardProxy {
112    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
113}
114
115impl fidl::endpoints::Proxy for BoardProxy {
116    type Protocol = BoardMarker;
117
118    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
119        Self::new(inner)
120    }
121
122    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
123        self.client.into_channel().map_err(|client| Self { client })
124    }
125
126    fn as_channel(&self) -> &::fidl::AsyncChannel {
127        self.client.as_channel()
128    }
129}
130
131impl BoardProxy {
132    /// Create a new Proxy for fuchsia.hwinfo/Board.
133    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
134        let protocol_name = <BoardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
135        Self { client: fidl::client::Client::new(channel, protocol_name) }
136    }
137
138    /// Get a Stream of events from the remote end of the protocol.
139    ///
140    /// # Panics
141    ///
142    /// Panics if the event stream was already taken.
143    pub fn take_event_stream(&self) -> BoardEventStream {
144        BoardEventStream { event_receiver: self.client.take_event_receiver() }
145    }
146
147    pub fn r#get_info(
148        &self,
149    ) -> fidl::client::QueryResponseFut<BoardInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
150    {
151        BoardProxyInterface::r#get_info(self)
152    }
153}
154
155impl BoardProxyInterface for BoardProxy {
156    type GetInfoResponseFut =
157        fidl::client::QueryResponseFut<BoardInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
158    fn r#get_info(&self) -> Self::GetInfoResponseFut {
159        fn _decode(
160            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
161        ) -> Result<BoardInfo, fidl::Error> {
162            let _response = fidl::client::decode_transaction_body::<
163                BoardGetInfoResponse,
164                fidl::encoding::DefaultFuchsiaResourceDialect,
165                0x878a093531d0904,
166            >(_buf?)?;
167            Ok(_response.info)
168        }
169        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BoardInfo>(
170            (),
171            0x878a093531d0904,
172            fidl::encoding::DynamicFlags::empty(),
173            _decode,
174        )
175    }
176}
177
178pub struct BoardEventStream {
179    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
180}
181
182impl std::marker::Unpin for BoardEventStream {}
183
184impl futures::stream::FusedStream for BoardEventStream {
185    fn is_terminated(&self) -> bool {
186        self.event_receiver.is_terminated()
187    }
188}
189
190impl futures::Stream for BoardEventStream {
191    type Item = Result<BoardEvent, fidl::Error>;
192
193    fn poll_next(
194        mut self: std::pin::Pin<&mut Self>,
195        cx: &mut std::task::Context<'_>,
196    ) -> std::task::Poll<Option<Self::Item>> {
197        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
198            &mut self.event_receiver,
199            cx
200        )?) {
201            Some(buf) => std::task::Poll::Ready(Some(BoardEvent::decode(buf))),
202            None => std::task::Poll::Ready(None),
203        }
204    }
205}
206
207#[derive(Debug)]
208pub enum BoardEvent {}
209
210impl BoardEvent {
211    /// Decodes a message buffer as a [`BoardEvent`].
212    fn decode(
213        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
214    ) -> Result<BoardEvent, fidl::Error> {
215        let (bytes, _handles) = buf.split_mut();
216        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
217        debug_assert_eq!(tx_header.tx_id, 0);
218        match tx_header.ordinal {
219            _ => Err(fidl::Error::UnknownOrdinal {
220                ordinal: tx_header.ordinal,
221                protocol_name: <BoardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
222            }),
223        }
224    }
225}
226
227/// A Stream of incoming requests for fuchsia.hwinfo/Board.
228pub struct BoardRequestStream {
229    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
230    is_terminated: bool,
231}
232
233impl std::marker::Unpin for BoardRequestStream {}
234
235impl futures::stream::FusedStream for BoardRequestStream {
236    fn is_terminated(&self) -> bool {
237        self.is_terminated
238    }
239}
240
241impl fidl::endpoints::RequestStream for BoardRequestStream {
242    type Protocol = BoardMarker;
243    type ControlHandle = BoardControlHandle;
244
245    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
246        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
247    }
248
249    fn control_handle(&self) -> Self::ControlHandle {
250        BoardControlHandle { inner: self.inner.clone() }
251    }
252
253    fn into_inner(
254        self,
255    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
256    {
257        (self.inner, self.is_terminated)
258    }
259
260    fn from_inner(
261        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
262        is_terminated: bool,
263    ) -> Self {
264        Self { inner, is_terminated }
265    }
266}
267
268impl futures::Stream for BoardRequestStream {
269    type Item = Result<BoardRequest, fidl::Error>;
270
271    fn poll_next(
272        mut self: std::pin::Pin<&mut Self>,
273        cx: &mut std::task::Context<'_>,
274    ) -> std::task::Poll<Option<Self::Item>> {
275        let this = &mut *self;
276        if this.inner.check_shutdown(cx) {
277            this.is_terminated = true;
278            return std::task::Poll::Ready(None);
279        }
280        if this.is_terminated {
281            panic!("polled BoardRequestStream after completion");
282        }
283        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
284            |bytes, handles| {
285                match this.inner.channel().read_etc(cx, bytes, handles) {
286                    std::task::Poll::Ready(Ok(())) => {}
287                    std::task::Poll::Pending => return std::task::Poll::Pending,
288                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
289                        this.is_terminated = true;
290                        return std::task::Poll::Ready(None);
291                    }
292                    std::task::Poll::Ready(Err(e)) => {
293                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
294                            e.into(),
295                        ))));
296                    }
297                }
298
299                // A message has been received from the channel
300                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
301
302                std::task::Poll::Ready(Some(match header.ordinal {
303                    0x878a093531d0904 => {
304                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
305                        let mut req = fidl::new_empty!(
306                            fidl::encoding::EmptyPayload,
307                            fidl::encoding::DefaultFuchsiaResourceDialect
308                        );
309                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
310                        let control_handle = BoardControlHandle { inner: this.inner.clone() };
311                        Ok(BoardRequest::GetInfo {
312                            responder: BoardGetInfoResponder {
313                                control_handle: std::mem::ManuallyDrop::new(control_handle),
314                                tx_id: header.tx_id,
315                            },
316                        })
317                    }
318                    _ => Err(fidl::Error::UnknownOrdinal {
319                        ordinal: header.ordinal,
320                        protocol_name: <BoardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
321                    }),
322                }))
323            },
324        )
325    }
326}
327
328/// Board provides an interface to retrieve hardware-specific information.
329#[derive(Debug)]
330pub enum BoardRequest {
331    GetInfo { responder: BoardGetInfoResponder },
332}
333
334impl BoardRequest {
335    #[allow(irrefutable_let_patterns)]
336    pub fn into_get_info(self) -> Option<(BoardGetInfoResponder)> {
337        if let BoardRequest::GetInfo { responder } = self { Some((responder)) } else { None }
338    }
339
340    /// Name of the method defined in FIDL
341    pub fn method_name(&self) -> &'static str {
342        match *self {
343            BoardRequest::GetInfo { .. } => "get_info",
344        }
345    }
346}
347
348#[derive(Debug, Clone)]
349pub struct BoardControlHandle {
350    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
351}
352
353impl BoardControlHandle {
354    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
355        self.inner.shutdown_with_epitaph(status.into())
356    }
357}
358
359impl fidl::endpoints::ControlHandle for BoardControlHandle {
360    fn shutdown(&self) {
361        self.inner.shutdown()
362    }
363
364    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
365        self.inner.shutdown_with_epitaph(status)
366    }
367
368    fn is_closed(&self) -> bool {
369        self.inner.channel().is_closed()
370    }
371    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
372        self.inner.channel().on_closed()
373    }
374
375    #[cfg(target_os = "fuchsia")]
376    fn signal_peer(
377        &self,
378        clear_mask: zx::Signals,
379        set_mask: zx::Signals,
380    ) -> Result<(), zx_status::Status> {
381        use fidl::Peered;
382        self.inner.channel().signal_peer(clear_mask, set_mask)
383    }
384}
385
386impl BoardControlHandle {}
387
388#[must_use = "FIDL methods require a response to be sent"]
389#[derive(Debug)]
390pub struct BoardGetInfoResponder {
391    control_handle: std::mem::ManuallyDrop<BoardControlHandle>,
392    tx_id: u32,
393}
394
395/// Set the the channel to be shutdown (see [`BoardControlHandle::shutdown`])
396/// if the responder is dropped without sending a response, so that the client
397/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
398impl std::ops::Drop for BoardGetInfoResponder {
399    fn drop(&mut self) {
400        self.control_handle.shutdown();
401        // Safety: drops once, never accessed again
402        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
403    }
404}
405
406impl fidl::endpoints::Responder for BoardGetInfoResponder {
407    type ControlHandle = BoardControlHandle;
408
409    fn control_handle(&self) -> &BoardControlHandle {
410        &self.control_handle
411    }
412
413    fn drop_without_shutdown(mut self) {
414        // Safety: drops once, never accessed again due to mem::forget
415        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
416        // Prevent Drop from running (which would shut down the channel)
417        std::mem::forget(self);
418    }
419}
420
421impl BoardGetInfoResponder {
422    /// Sends a response to the FIDL transaction.
423    ///
424    /// Sets the channel to shutdown if an error occurs.
425    pub fn send(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
426        let _result = self.send_raw(info);
427        if _result.is_err() {
428            self.control_handle.shutdown();
429        }
430        self.drop_without_shutdown();
431        _result
432    }
433
434    /// Similar to "send" but does not shutdown the channel if an error occurs.
435    pub fn send_no_shutdown_on_err(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
436        let _result = self.send_raw(info);
437        self.drop_without_shutdown();
438        _result
439    }
440
441    fn send_raw(&self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
442        self.control_handle.inner.send::<BoardGetInfoResponse>(
443            (info,),
444            self.tx_id,
445            0x878a093531d0904,
446            fidl::encoding::DynamicFlags::empty(),
447        )
448    }
449}
450
451#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
452pub struct DeviceMarker;
453
454impl fidl::endpoints::ProtocolMarker for DeviceMarker {
455    type Proxy = DeviceProxy;
456    type RequestStream = DeviceRequestStream;
457    #[cfg(target_os = "fuchsia")]
458    type SynchronousProxy = DeviceSynchronousProxy;
459
460    const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Device";
461}
462impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
463
464pub trait DeviceProxyInterface: Send + Sync {
465    type GetInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>> + Send;
466    fn r#get_info(&self) -> Self::GetInfoResponseFut;
467}
468#[derive(Debug)]
469#[cfg(target_os = "fuchsia")]
470pub struct DeviceSynchronousProxy {
471    client: fidl::client::sync::Client,
472}
473
474#[cfg(target_os = "fuchsia")]
475impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
476    type Proxy = DeviceProxy;
477    type Protocol = DeviceMarker;
478
479    fn from_channel(inner: fidl::Channel) -> Self {
480        Self::new(inner)
481    }
482
483    fn into_channel(self) -> fidl::Channel {
484        self.client.into_channel()
485    }
486
487    fn as_channel(&self) -> &fidl::Channel {
488        self.client.as_channel()
489    }
490}
491
492#[cfg(target_os = "fuchsia")]
493impl DeviceSynchronousProxy {
494    pub fn new(channel: fidl::Channel) -> Self {
495        Self { client: fidl::client::sync::Client::new(channel) }
496    }
497
498    pub fn into_channel(self) -> fidl::Channel {
499        self.client.into_channel()
500    }
501
502    /// Waits until an event arrives and returns it. It is safe for other
503    /// threads to make concurrent requests while waiting for an event.
504    pub fn wait_for_event(
505        &self,
506        deadline: zx::MonotonicInstant,
507    ) -> Result<DeviceEvent, fidl::Error> {
508        DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
509    }
510
511    pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<DeviceInfo, fidl::Error> {
512        let _response = self
513            .client
514            .send_query::<fidl::encoding::EmptyPayload, DeviceGetInfoResponse, DeviceMarker>(
515                (),
516                0x4cc66c5e52b0a7d1,
517                fidl::encoding::DynamicFlags::empty(),
518                ___deadline,
519            )?;
520        Ok(_response.info)
521    }
522}
523
524#[cfg(target_os = "fuchsia")]
525impl From<DeviceSynchronousProxy> for zx::NullableHandle {
526    fn from(value: DeviceSynchronousProxy) -> Self {
527        value.into_channel().into()
528    }
529}
530
531#[cfg(target_os = "fuchsia")]
532impl From<fidl::Channel> for DeviceSynchronousProxy {
533    fn from(value: fidl::Channel) -> Self {
534        Self::new(value)
535    }
536}
537
538#[cfg(target_os = "fuchsia")]
539impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
540    type Protocol = DeviceMarker;
541
542    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
543        Self::new(value.into_channel())
544    }
545}
546
547#[derive(Debug, Clone)]
548pub struct DeviceProxy {
549    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
550}
551
552impl fidl::endpoints::Proxy for DeviceProxy {
553    type Protocol = DeviceMarker;
554
555    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
556        Self::new(inner)
557    }
558
559    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
560        self.client.into_channel().map_err(|client| Self { client })
561    }
562
563    fn as_channel(&self) -> &::fidl::AsyncChannel {
564        self.client.as_channel()
565    }
566}
567
568impl DeviceProxy {
569    /// Create a new Proxy for fuchsia.hwinfo/Device.
570    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
571        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
572        Self { client: fidl::client::Client::new(channel, protocol_name) }
573    }
574
575    /// Get a Stream of events from the remote end of the protocol.
576    ///
577    /// # Panics
578    ///
579    /// Panics if the event stream was already taken.
580    pub fn take_event_stream(&self) -> DeviceEventStream {
581        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
582    }
583
584    pub fn r#get_info(
585        &self,
586    ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
587    {
588        DeviceProxyInterface::r#get_info(self)
589    }
590}
591
592impl DeviceProxyInterface for DeviceProxy {
593    type GetInfoResponseFut =
594        fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
595    fn r#get_info(&self) -> Self::GetInfoResponseFut {
596        fn _decode(
597            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
598        ) -> Result<DeviceInfo, fidl::Error> {
599            let _response = fidl::client::decode_transaction_body::<
600                DeviceGetInfoResponse,
601                fidl::encoding::DefaultFuchsiaResourceDialect,
602                0x4cc66c5e52b0a7d1,
603            >(_buf?)?;
604            Ok(_response.info)
605        }
606        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
607            (),
608            0x4cc66c5e52b0a7d1,
609            fidl::encoding::DynamicFlags::empty(),
610            _decode,
611        )
612    }
613}
614
615pub struct DeviceEventStream {
616    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
617}
618
619impl std::marker::Unpin for DeviceEventStream {}
620
621impl futures::stream::FusedStream for DeviceEventStream {
622    fn is_terminated(&self) -> bool {
623        self.event_receiver.is_terminated()
624    }
625}
626
627impl futures::Stream for DeviceEventStream {
628    type Item = Result<DeviceEvent, fidl::Error>;
629
630    fn poll_next(
631        mut self: std::pin::Pin<&mut Self>,
632        cx: &mut std::task::Context<'_>,
633    ) -> std::task::Poll<Option<Self::Item>> {
634        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
635            &mut self.event_receiver,
636            cx
637        )?) {
638            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
639            None => std::task::Poll::Ready(None),
640        }
641    }
642}
643
644#[derive(Debug)]
645pub enum DeviceEvent {}
646
647impl DeviceEvent {
648    /// Decodes a message buffer as a [`DeviceEvent`].
649    fn decode(
650        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
651    ) -> Result<DeviceEvent, fidl::Error> {
652        let (bytes, _handles) = buf.split_mut();
653        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
654        debug_assert_eq!(tx_header.tx_id, 0);
655        match tx_header.ordinal {
656            _ => Err(fidl::Error::UnknownOrdinal {
657                ordinal: tx_header.ordinal,
658                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
659            }),
660        }
661    }
662}
663
664/// A Stream of incoming requests for fuchsia.hwinfo/Device.
665pub struct DeviceRequestStream {
666    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
667    is_terminated: bool,
668}
669
670impl std::marker::Unpin for DeviceRequestStream {}
671
672impl futures::stream::FusedStream for DeviceRequestStream {
673    fn is_terminated(&self) -> bool {
674        self.is_terminated
675    }
676}
677
678impl fidl::endpoints::RequestStream for DeviceRequestStream {
679    type Protocol = DeviceMarker;
680    type ControlHandle = DeviceControlHandle;
681
682    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
683        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
684    }
685
686    fn control_handle(&self) -> Self::ControlHandle {
687        DeviceControlHandle { inner: self.inner.clone() }
688    }
689
690    fn into_inner(
691        self,
692    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
693    {
694        (self.inner, self.is_terminated)
695    }
696
697    fn from_inner(
698        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
699        is_terminated: bool,
700    ) -> Self {
701        Self { inner, is_terminated }
702    }
703}
704
705impl futures::Stream for DeviceRequestStream {
706    type Item = Result<DeviceRequest, fidl::Error>;
707
708    fn poll_next(
709        mut self: std::pin::Pin<&mut Self>,
710        cx: &mut std::task::Context<'_>,
711    ) -> std::task::Poll<Option<Self::Item>> {
712        let this = &mut *self;
713        if this.inner.check_shutdown(cx) {
714            this.is_terminated = true;
715            return std::task::Poll::Ready(None);
716        }
717        if this.is_terminated {
718            panic!("polled DeviceRequestStream after completion");
719        }
720        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
721            |bytes, handles| {
722                match this.inner.channel().read_etc(cx, bytes, handles) {
723                    std::task::Poll::Ready(Ok(())) => {}
724                    std::task::Poll::Pending => return std::task::Poll::Pending,
725                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
726                        this.is_terminated = true;
727                        return std::task::Poll::Ready(None);
728                    }
729                    std::task::Poll::Ready(Err(e)) => {
730                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
731                            e.into(),
732                        ))));
733                    }
734                }
735
736                // A message has been received from the channel
737                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
738
739                std::task::Poll::Ready(Some(match header.ordinal {
740                    0x4cc66c5e52b0a7d1 => {
741                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
742                        let mut req = fidl::new_empty!(
743                            fidl::encoding::EmptyPayload,
744                            fidl::encoding::DefaultFuchsiaResourceDialect
745                        );
746                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
747                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
748                        Ok(DeviceRequest::GetInfo {
749                            responder: DeviceGetInfoResponder {
750                                control_handle: std::mem::ManuallyDrop::new(control_handle),
751                                tx_id: header.tx_id,
752                            },
753                        })
754                    }
755                    _ => Err(fidl::Error::UnknownOrdinal {
756                        ordinal: header.ordinal,
757                        protocol_name:
758                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
759                    }),
760                }))
761            },
762        )
763    }
764}
765
766/// Device provides an interface to retrieve device-specific properties.
767#[derive(Debug)]
768pub enum DeviceRequest {
769    GetInfo { responder: DeviceGetInfoResponder },
770}
771
772impl DeviceRequest {
773    #[allow(irrefutable_let_patterns)]
774    pub fn into_get_info(self) -> Option<(DeviceGetInfoResponder)> {
775        if let DeviceRequest::GetInfo { responder } = self { Some((responder)) } else { None }
776    }
777
778    /// Name of the method defined in FIDL
779    pub fn method_name(&self) -> &'static str {
780        match *self {
781            DeviceRequest::GetInfo { .. } => "get_info",
782        }
783    }
784}
785
786#[derive(Debug, Clone)]
787pub struct DeviceControlHandle {
788    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
789}
790
791impl DeviceControlHandle {
792    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
793        self.inner.shutdown_with_epitaph(status.into())
794    }
795}
796
797impl fidl::endpoints::ControlHandle for DeviceControlHandle {
798    fn shutdown(&self) {
799        self.inner.shutdown()
800    }
801
802    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
803        self.inner.shutdown_with_epitaph(status)
804    }
805
806    fn is_closed(&self) -> bool {
807        self.inner.channel().is_closed()
808    }
809    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
810        self.inner.channel().on_closed()
811    }
812
813    #[cfg(target_os = "fuchsia")]
814    fn signal_peer(
815        &self,
816        clear_mask: zx::Signals,
817        set_mask: zx::Signals,
818    ) -> Result<(), zx_status::Status> {
819        use fidl::Peered;
820        self.inner.channel().signal_peer(clear_mask, set_mask)
821    }
822}
823
824impl DeviceControlHandle {}
825
826#[must_use = "FIDL methods require a response to be sent"]
827#[derive(Debug)]
828pub struct DeviceGetInfoResponder {
829    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
830    tx_id: u32,
831}
832
833/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
834/// if the responder is dropped without sending a response, so that the client
835/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
836impl std::ops::Drop for DeviceGetInfoResponder {
837    fn drop(&mut self) {
838        self.control_handle.shutdown();
839        // Safety: drops once, never accessed again
840        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
841    }
842}
843
844impl fidl::endpoints::Responder for DeviceGetInfoResponder {
845    type ControlHandle = DeviceControlHandle;
846
847    fn control_handle(&self) -> &DeviceControlHandle {
848        &self.control_handle
849    }
850
851    fn drop_without_shutdown(mut self) {
852        // Safety: drops once, never accessed again due to mem::forget
853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
854        // Prevent Drop from running (which would shut down the channel)
855        std::mem::forget(self);
856    }
857}
858
859impl DeviceGetInfoResponder {
860    /// Sends a response to the FIDL transaction.
861    ///
862    /// Sets the channel to shutdown if an error occurs.
863    pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
864        let _result = self.send_raw(info);
865        if _result.is_err() {
866            self.control_handle.shutdown();
867        }
868        self.drop_without_shutdown();
869        _result
870    }
871
872    /// Similar to "send" but does not shutdown the channel if an error occurs.
873    pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
874        let _result = self.send_raw(info);
875        self.drop_without_shutdown();
876        _result
877    }
878
879    fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
880        self.control_handle.inner.send::<DeviceGetInfoResponse>(
881            (info,),
882            self.tx_id,
883            0x4cc66c5e52b0a7d1,
884            fidl::encoding::DynamicFlags::empty(),
885        )
886    }
887}
888
889#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
890pub struct ProductMarker;
891
892impl fidl::endpoints::ProtocolMarker for ProductMarker {
893    type Proxy = ProductProxy;
894    type RequestStream = ProductRequestStream;
895    #[cfg(target_os = "fuchsia")]
896    type SynchronousProxy = ProductSynchronousProxy;
897
898    const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Product";
899}
900impl fidl::endpoints::DiscoverableProtocolMarker for ProductMarker {}
901
902pub trait ProductProxyInterface: Send + Sync {
903    type GetInfoResponseFut: std::future::Future<Output = Result<ProductInfo, fidl::Error>> + Send;
904    fn r#get_info(&self) -> Self::GetInfoResponseFut;
905}
906#[derive(Debug)]
907#[cfg(target_os = "fuchsia")]
908pub struct ProductSynchronousProxy {
909    client: fidl::client::sync::Client,
910}
911
912#[cfg(target_os = "fuchsia")]
913impl fidl::endpoints::SynchronousProxy for ProductSynchronousProxy {
914    type Proxy = ProductProxy;
915    type Protocol = ProductMarker;
916
917    fn from_channel(inner: fidl::Channel) -> Self {
918        Self::new(inner)
919    }
920
921    fn into_channel(self) -> fidl::Channel {
922        self.client.into_channel()
923    }
924
925    fn as_channel(&self) -> &fidl::Channel {
926        self.client.as_channel()
927    }
928}
929
930#[cfg(target_os = "fuchsia")]
931impl ProductSynchronousProxy {
932    pub fn new(channel: fidl::Channel) -> Self {
933        Self { client: fidl::client::sync::Client::new(channel) }
934    }
935
936    pub fn into_channel(self) -> fidl::Channel {
937        self.client.into_channel()
938    }
939
940    /// Waits until an event arrives and returns it. It is safe for other
941    /// threads to make concurrent requests while waiting for an event.
942    pub fn wait_for_event(
943        &self,
944        deadline: zx::MonotonicInstant,
945    ) -> Result<ProductEvent, fidl::Error> {
946        ProductEvent::decode(self.client.wait_for_event::<ProductMarker>(deadline)?)
947    }
948
949    pub fn r#get_info(
950        &self,
951        ___deadline: zx::MonotonicInstant,
952    ) -> Result<ProductInfo, fidl::Error> {
953        let _response = self
954            .client
955            .send_query::<fidl::encoding::EmptyPayload, ProductGetInfoResponse, ProductMarker>(
956                (),
957                0x11a4825cda315828,
958                fidl::encoding::DynamicFlags::empty(),
959                ___deadline,
960            )?;
961        Ok(_response.info)
962    }
963}
964
965#[cfg(target_os = "fuchsia")]
966impl From<ProductSynchronousProxy> for zx::NullableHandle {
967    fn from(value: ProductSynchronousProxy) -> Self {
968        value.into_channel().into()
969    }
970}
971
972#[cfg(target_os = "fuchsia")]
973impl From<fidl::Channel> for ProductSynchronousProxy {
974    fn from(value: fidl::Channel) -> Self {
975        Self::new(value)
976    }
977}
978
979#[cfg(target_os = "fuchsia")]
980impl fidl::endpoints::FromClient for ProductSynchronousProxy {
981    type Protocol = ProductMarker;
982
983    fn from_client(value: fidl::endpoints::ClientEnd<ProductMarker>) -> Self {
984        Self::new(value.into_channel())
985    }
986}
987
988#[derive(Debug, Clone)]
989pub struct ProductProxy {
990    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
991}
992
993impl fidl::endpoints::Proxy for ProductProxy {
994    type Protocol = ProductMarker;
995
996    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
997        Self::new(inner)
998    }
999
1000    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1001        self.client.into_channel().map_err(|client| Self { client })
1002    }
1003
1004    fn as_channel(&self) -> &::fidl::AsyncChannel {
1005        self.client.as_channel()
1006    }
1007}
1008
1009impl ProductProxy {
1010    /// Create a new Proxy for fuchsia.hwinfo/Product.
1011    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1012        let protocol_name = <ProductMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1013        Self { client: fidl::client::Client::new(channel, protocol_name) }
1014    }
1015
1016    /// Get a Stream of events from the remote end of the protocol.
1017    ///
1018    /// # Panics
1019    ///
1020    /// Panics if the event stream was already taken.
1021    pub fn take_event_stream(&self) -> ProductEventStream {
1022        ProductEventStream { event_receiver: self.client.take_event_receiver() }
1023    }
1024
1025    pub fn r#get_info(
1026        &self,
1027    ) -> fidl::client::QueryResponseFut<ProductInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1028    {
1029        ProductProxyInterface::r#get_info(self)
1030    }
1031}
1032
1033impl ProductProxyInterface for ProductProxy {
1034    type GetInfoResponseFut =
1035        fidl::client::QueryResponseFut<ProductInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
1036    fn r#get_info(&self) -> Self::GetInfoResponseFut {
1037        fn _decode(
1038            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1039        ) -> Result<ProductInfo, fidl::Error> {
1040            let _response = fidl::client::decode_transaction_body::<
1041                ProductGetInfoResponse,
1042                fidl::encoding::DefaultFuchsiaResourceDialect,
1043                0x11a4825cda315828,
1044            >(_buf?)?;
1045            Ok(_response.info)
1046        }
1047        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProductInfo>(
1048            (),
1049            0x11a4825cda315828,
1050            fidl::encoding::DynamicFlags::empty(),
1051            _decode,
1052        )
1053    }
1054}
1055
1056pub struct ProductEventStream {
1057    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1058}
1059
1060impl std::marker::Unpin for ProductEventStream {}
1061
1062impl futures::stream::FusedStream for ProductEventStream {
1063    fn is_terminated(&self) -> bool {
1064        self.event_receiver.is_terminated()
1065    }
1066}
1067
1068impl futures::Stream for ProductEventStream {
1069    type Item = Result<ProductEvent, fidl::Error>;
1070
1071    fn poll_next(
1072        mut self: std::pin::Pin<&mut Self>,
1073        cx: &mut std::task::Context<'_>,
1074    ) -> std::task::Poll<Option<Self::Item>> {
1075        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1076            &mut self.event_receiver,
1077            cx
1078        )?) {
1079            Some(buf) => std::task::Poll::Ready(Some(ProductEvent::decode(buf))),
1080            None => std::task::Poll::Ready(None),
1081        }
1082    }
1083}
1084
1085#[derive(Debug)]
1086pub enum ProductEvent {}
1087
1088impl ProductEvent {
1089    /// Decodes a message buffer as a [`ProductEvent`].
1090    fn decode(
1091        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1092    ) -> Result<ProductEvent, fidl::Error> {
1093        let (bytes, _handles) = buf.split_mut();
1094        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1095        debug_assert_eq!(tx_header.tx_id, 0);
1096        match tx_header.ordinal {
1097            _ => Err(fidl::Error::UnknownOrdinal {
1098                ordinal: tx_header.ordinal,
1099                protocol_name: <ProductMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1100            }),
1101        }
1102    }
1103}
1104
1105/// A Stream of incoming requests for fuchsia.hwinfo/Product.
1106pub struct ProductRequestStream {
1107    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1108    is_terminated: bool,
1109}
1110
1111impl std::marker::Unpin for ProductRequestStream {}
1112
1113impl futures::stream::FusedStream for ProductRequestStream {
1114    fn is_terminated(&self) -> bool {
1115        self.is_terminated
1116    }
1117}
1118
1119impl fidl::endpoints::RequestStream for ProductRequestStream {
1120    type Protocol = ProductMarker;
1121    type ControlHandle = ProductControlHandle;
1122
1123    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1124        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1125    }
1126
1127    fn control_handle(&self) -> Self::ControlHandle {
1128        ProductControlHandle { inner: self.inner.clone() }
1129    }
1130
1131    fn into_inner(
1132        self,
1133    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1134    {
1135        (self.inner, self.is_terminated)
1136    }
1137
1138    fn from_inner(
1139        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1140        is_terminated: bool,
1141    ) -> Self {
1142        Self { inner, is_terminated }
1143    }
1144}
1145
1146impl futures::Stream for ProductRequestStream {
1147    type Item = Result<ProductRequest, fidl::Error>;
1148
1149    fn poll_next(
1150        mut self: std::pin::Pin<&mut Self>,
1151        cx: &mut std::task::Context<'_>,
1152    ) -> std::task::Poll<Option<Self::Item>> {
1153        let this = &mut *self;
1154        if this.inner.check_shutdown(cx) {
1155            this.is_terminated = true;
1156            return std::task::Poll::Ready(None);
1157        }
1158        if this.is_terminated {
1159            panic!("polled ProductRequestStream after completion");
1160        }
1161        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1162            |bytes, handles| {
1163                match this.inner.channel().read_etc(cx, bytes, handles) {
1164                    std::task::Poll::Ready(Ok(())) => {}
1165                    std::task::Poll::Pending => return std::task::Poll::Pending,
1166                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1167                        this.is_terminated = true;
1168                        return std::task::Poll::Ready(None);
1169                    }
1170                    std::task::Poll::Ready(Err(e)) => {
1171                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1172                            e.into(),
1173                        ))));
1174                    }
1175                }
1176
1177                // A message has been received from the channel
1178                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1179
1180                std::task::Poll::Ready(Some(match header.ordinal {
1181                    0x11a4825cda315828 => {
1182                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1183                        let mut req = fidl::new_empty!(
1184                            fidl::encoding::EmptyPayload,
1185                            fidl::encoding::DefaultFuchsiaResourceDialect
1186                        );
1187                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1188                        let control_handle = ProductControlHandle { inner: this.inner.clone() };
1189                        Ok(ProductRequest::GetInfo {
1190                            responder: ProductGetInfoResponder {
1191                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1192                                tx_id: header.tx_id,
1193                            },
1194                        })
1195                    }
1196                    _ => Err(fidl::Error::UnknownOrdinal {
1197                        ordinal: header.ordinal,
1198                        protocol_name:
1199                            <ProductMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1200                    }),
1201                }))
1202            },
1203        )
1204    }
1205}
1206
1207/// Product provides an interface to retrieve product-specific properties.
1208#[derive(Debug)]
1209pub enum ProductRequest {
1210    GetInfo { responder: ProductGetInfoResponder },
1211}
1212
1213impl ProductRequest {
1214    #[allow(irrefutable_let_patterns)]
1215    pub fn into_get_info(self) -> Option<(ProductGetInfoResponder)> {
1216        if let ProductRequest::GetInfo { responder } = self { Some((responder)) } else { None }
1217    }
1218
1219    /// Name of the method defined in FIDL
1220    pub fn method_name(&self) -> &'static str {
1221        match *self {
1222            ProductRequest::GetInfo { .. } => "get_info",
1223        }
1224    }
1225}
1226
1227#[derive(Debug, Clone)]
1228pub struct ProductControlHandle {
1229    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1230}
1231
1232impl ProductControlHandle {
1233    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1234        self.inner.shutdown_with_epitaph(status.into())
1235    }
1236}
1237
1238impl fidl::endpoints::ControlHandle for ProductControlHandle {
1239    fn shutdown(&self) {
1240        self.inner.shutdown()
1241    }
1242
1243    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1244        self.inner.shutdown_with_epitaph(status)
1245    }
1246
1247    fn is_closed(&self) -> bool {
1248        self.inner.channel().is_closed()
1249    }
1250    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1251        self.inner.channel().on_closed()
1252    }
1253
1254    #[cfg(target_os = "fuchsia")]
1255    fn signal_peer(
1256        &self,
1257        clear_mask: zx::Signals,
1258        set_mask: zx::Signals,
1259    ) -> Result<(), zx_status::Status> {
1260        use fidl::Peered;
1261        self.inner.channel().signal_peer(clear_mask, set_mask)
1262    }
1263}
1264
1265impl ProductControlHandle {}
1266
1267#[must_use = "FIDL methods require a response to be sent"]
1268#[derive(Debug)]
1269pub struct ProductGetInfoResponder {
1270    control_handle: std::mem::ManuallyDrop<ProductControlHandle>,
1271    tx_id: u32,
1272}
1273
1274/// Set the the channel to be shutdown (see [`ProductControlHandle::shutdown`])
1275/// if the responder is dropped without sending a response, so that the client
1276/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1277impl std::ops::Drop for ProductGetInfoResponder {
1278    fn drop(&mut self) {
1279        self.control_handle.shutdown();
1280        // Safety: drops once, never accessed again
1281        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1282    }
1283}
1284
1285impl fidl::endpoints::Responder for ProductGetInfoResponder {
1286    type ControlHandle = ProductControlHandle;
1287
1288    fn control_handle(&self) -> &ProductControlHandle {
1289        &self.control_handle
1290    }
1291
1292    fn drop_without_shutdown(mut self) {
1293        // Safety: drops once, never accessed again due to mem::forget
1294        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1295        // Prevent Drop from running (which would shut down the channel)
1296        std::mem::forget(self);
1297    }
1298}
1299
1300impl ProductGetInfoResponder {
1301    /// Sends a response to the FIDL transaction.
1302    ///
1303    /// Sets the channel to shutdown if an error occurs.
1304    pub fn send(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1305        let _result = self.send_raw(info);
1306        if _result.is_err() {
1307            self.control_handle.shutdown();
1308        }
1309        self.drop_without_shutdown();
1310        _result
1311    }
1312
1313    /// Similar to "send" but does not shutdown the channel if an error occurs.
1314    pub fn send_no_shutdown_on_err(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1315        let _result = self.send_raw(info);
1316        self.drop_without_shutdown();
1317        _result
1318    }
1319
1320    fn send_raw(&self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1321        self.control_handle.inner.send::<ProductGetInfoResponse>(
1322            (info,),
1323            self.tx_id,
1324            0x11a4825cda315828,
1325            fidl::encoding::DynamicFlags::empty(),
1326        )
1327    }
1328}
1329
1330mod internal {
1331    use super::*;
1332}