1#![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 let protocol_name = <BoardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
59 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
60 }
61
62 pub fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 pub fn wait_for_event(
69 &self,
70 deadline: zx::MonotonicInstant,
71 ) -> Result<BoardEvent, fidl::Error> {
72 BoardEvent::decode(self.client.wait_for_event(deadline)?)
73 }
74
75 pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<BoardInfo, fidl::Error> {
76 let _response =
77 self.client.send_query::<fidl::encoding::EmptyPayload, BoardGetInfoResponse>(
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 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 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 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
227pub 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 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#[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 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 fidl::endpoints::ControlHandle for BoardControlHandle {
354 fn shutdown(&self) {
355 self.inner.shutdown()
356 }
357
358 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
359 self.inner.shutdown_with_epitaph(status)
360 }
361
362 fn is_closed(&self) -> bool {
363 self.inner.channel().is_closed()
364 }
365 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
366 self.inner.channel().on_closed()
367 }
368
369 #[cfg(target_os = "fuchsia")]
370 fn signal_peer(
371 &self,
372 clear_mask: zx::Signals,
373 set_mask: zx::Signals,
374 ) -> Result<(), zx_status::Status> {
375 use fidl::Peered;
376 self.inner.channel().signal_peer(clear_mask, set_mask)
377 }
378}
379
380impl BoardControlHandle {}
381
382#[must_use = "FIDL methods require a response to be sent"]
383#[derive(Debug)]
384pub struct BoardGetInfoResponder {
385 control_handle: std::mem::ManuallyDrop<BoardControlHandle>,
386 tx_id: u32,
387}
388
389impl std::ops::Drop for BoardGetInfoResponder {
393 fn drop(&mut self) {
394 self.control_handle.shutdown();
395 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
397 }
398}
399
400impl fidl::endpoints::Responder for BoardGetInfoResponder {
401 type ControlHandle = BoardControlHandle;
402
403 fn control_handle(&self) -> &BoardControlHandle {
404 &self.control_handle
405 }
406
407 fn drop_without_shutdown(mut self) {
408 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
410 std::mem::forget(self);
412 }
413}
414
415impl BoardGetInfoResponder {
416 pub fn send(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
420 let _result = self.send_raw(info);
421 if _result.is_err() {
422 self.control_handle.shutdown();
423 }
424 self.drop_without_shutdown();
425 _result
426 }
427
428 pub fn send_no_shutdown_on_err(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
430 let _result = self.send_raw(info);
431 self.drop_without_shutdown();
432 _result
433 }
434
435 fn send_raw(&self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
436 self.control_handle.inner.send::<BoardGetInfoResponse>(
437 (info,),
438 self.tx_id,
439 0x878a093531d0904,
440 fidl::encoding::DynamicFlags::empty(),
441 )
442 }
443}
444
445#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
446pub struct DeviceMarker;
447
448impl fidl::endpoints::ProtocolMarker for DeviceMarker {
449 type Proxy = DeviceProxy;
450 type RequestStream = DeviceRequestStream;
451 #[cfg(target_os = "fuchsia")]
452 type SynchronousProxy = DeviceSynchronousProxy;
453
454 const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Device";
455}
456impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
457
458pub trait DeviceProxyInterface: Send + Sync {
459 type GetInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>> + Send;
460 fn r#get_info(&self) -> Self::GetInfoResponseFut;
461}
462#[derive(Debug)]
463#[cfg(target_os = "fuchsia")]
464pub struct DeviceSynchronousProxy {
465 client: fidl::client::sync::Client,
466}
467
468#[cfg(target_os = "fuchsia")]
469impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
470 type Proxy = DeviceProxy;
471 type Protocol = DeviceMarker;
472
473 fn from_channel(inner: fidl::Channel) -> Self {
474 Self::new(inner)
475 }
476
477 fn into_channel(self) -> fidl::Channel {
478 self.client.into_channel()
479 }
480
481 fn as_channel(&self) -> &fidl::Channel {
482 self.client.as_channel()
483 }
484}
485
486#[cfg(target_os = "fuchsia")]
487impl DeviceSynchronousProxy {
488 pub fn new(channel: fidl::Channel) -> Self {
489 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
490 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
491 }
492
493 pub fn into_channel(self) -> fidl::Channel {
494 self.client.into_channel()
495 }
496
497 pub fn wait_for_event(
500 &self,
501 deadline: zx::MonotonicInstant,
502 ) -> Result<DeviceEvent, fidl::Error> {
503 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
504 }
505
506 pub fn r#get_info(&self, ___deadline: zx::MonotonicInstant) -> Result<DeviceInfo, fidl::Error> {
507 let _response =
508 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetInfoResponse>(
509 (),
510 0x4cc66c5e52b0a7d1,
511 fidl::encoding::DynamicFlags::empty(),
512 ___deadline,
513 )?;
514 Ok(_response.info)
515 }
516}
517
518#[cfg(target_os = "fuchsia")]
519impl From<DeviceSynchronousProxy> for zx::NullableHandle {
520 fn from(value: DeviceSynchronousProxy) -> Self {
521 value.into_channel().into()
522 }
523}
524
525#[cfg(target_os = "fuchsia")]
526impl From<fidl::Channel> for DeviceSynchronousProxy {
527 fn from(value: fidl::Channel) -> Self {
528 Self::new(value)
529 }
530}
531
532#[cfg(target_os = "fuchsia")]
533impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
534 type Protocol = DeviceMarker;
535
536 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
537 Self::new(value.into_channel())
538 }
539}
540
541#[derive(Debug, Clone)]
542pub struct DeviceProxy {
543 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
544}
545
546impl fidl::endpoints::Proxy for DeviceProxy {
547 type Protocol = DeviceMarker;
548
549 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
550 Self::new(inner)
551 }
552
553 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
554 self.client.into_channel().map_err(|client| Self { client })
555 }
556
557 fn as_channel(&self) -> &::fidl::AsyncChannel {
558 self.client.as_channel()
559 }
560}
561
562impl DeviceProxy {
563 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
565 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
566 Self { client: fidl::client::Client::new(channel, protocol_name) }
567 }
568
569 pub fn take_event_stream(&self) -> DeviceEventStream {
575 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
576 }
577
578 pub fn r#get_info(
579 &self,
580 ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
581 {
582 DeviceProxyInterface::r#get_info(self)
583 }
584}
585
586impl DeviceProxyInterface for DeviceProxy {
587 type GetInfoResponseFut =
588 fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
589 fn r#get_info(&self) -> Self::GetInfoResponseFut {
590 fn _decode(
591 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
592 ) -> Result<DeviceInfo, fidl::Error> {
593 let _response = fidl::client::decode_transaction_body::<
594 DeviceGetInfoResponse,
595 fidl::encoding::DefaultFuchsiaResourceDialect,
596 0x4cc66c5e52b0a7d1,
597 >(_buf?)?;
598 Ok(_response.info)
599 }
600 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
601 (),
602 0x4cc66c5e52b0a7d1,
603 fidl::encoding::DynamicFlags::empty(),
604 _decode,
605 )
606 }
607}
608
609pub struct DeviceEventStream {
610 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
611}
612
613impl std::marker::Unpin for DeviceEventStream {}
614
615impl futures::stream::FusedStream for DeviceEventStream {
616 fn is_terminated(&self) -> bool {
617 self.event_receiver.is_terminated()
618 }
619}
620
621impl futures::Stream for DeviceEventStream {
622 type Item = Result<DeviceEvent, fidl::Error>;
623
624 fn poll_next(
625 mut self: std::pin::Pin<&mut Self>,
626 cx: &mut std::task::Context<'_>,
627 ) -> std::task::Poll<Option<Self::Item>> {
628 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
629 &mut self.event_receiver,
630 cx
631 )?) {
632 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
633 None => std::task::Poll::Ready(None),
634 }
635 }
636}
637
638#[derive(Debug)]
639pub enum DeviceEvent {}
640
641impl DeviceEvent {
642 fn decode(
644 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
645 ) -> Result<DeviceEvent, fidl::Error> {
646 let (bytes, _handles) = buf.split_mut();
647 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
648 debug_assert_eq!(tx_header.tx_id, 0);
649 match tx_header.ordinal {
650 _ => Err(fidl::Error::UnknownOrdinal {
651 ordinal: tx_header.ordinal,
652 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
653 }),
654 }
655 }
656}
657
658pub struct DeviceRequestStream {
660 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
661 is_terminated: bool,
662}
663
664impl std::marker::Unpin for DeviceRequestStream {}
665
666impl futures::stream::FusedStream for DeviceRequestStream {
667 fn is_terminated(&self) -> bool {
668 self.is_terminated
669 }
670}
671
672impl fidl::endpoints::RequestStream for DeviceRequestStream {
673 type Protocol = DeviceMarker;
674 type ControlHandle = DeviceControlHandle;
675
676 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
677 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
678 }
679
680 fn control_handle(&self) -> Self::ControlHandle {
681 DeviceControlHandle { inner: self.inner.clone() }
682 }
683
684 fn into_inner(
685 self,
686 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
687 {
688 (self.inner, self.is_terminated)
689 }
690
691 fn from_inner(
692 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
693 is_terminated: bool,
694 ) -> Self {
695 Self { inner, is_terminated }
696 }
697}
698
699impl futures::Stream for DeviceRequestStream {
700 type Item = Result<DeviceRequest, fidl::Error>;
701
702 fn poll_next(
703 mut self: std::pin::Pin<&mut Self>,
704 cx: &mut std::task::Context<'_>,
705 ) -> std::task::Poll<Option<Self::Item>> {
706 let this = &mut *self;
707 if this.inner.check_shutdown(cx) {
708 this.is_terminated = true;
709 return std::task::Poll::Ready(None);
710 }
711 if this.is_terminated {
712 panic!("polled DeviceRequestStream after completion");
713 }
714 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
715 |bytes, handles| {
716 match this.inner.channel().read_etc(cx, bytes, handles) {
717 std::task::Poll::Ready(Ok(())) => {}
718 std::task::Poll::Pending => return std::task::Poll::Pending,
719 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
720 this.is_terminated = true;
721 return std::task::Poll::Ready(None);
722 }
723 std::task::Poll::Ready(Err(e)) => {
724 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
725 e.into(),
726 ))));
727 }
728 }
729
730 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
732
733 std::task::Poll::Ready(Some(match header.ordinal {
734 0x4cc66c5e52b0a7d1 => {
735 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
736 let mut req = fidl::new_empty!(
737 fidl::encoding::EmptyPayload,
738 fidl::encoding::DefaultFuchsiaResourceDialect
739 );
740 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
741 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
742 Ok(DeviceRequest::GetInfo {
743 responder: DeviceGetInfoResponder {
744 control_handle: std::mem::ManuallyDrop::new(control_handle),
745 tx_id: header.tx_id,
746 },
747 })
748 }
749 _ => Err(fidl::Error::UnknownOrdinal {
750 ordinal: header.ordinal,
751 protocol_name:
752 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
753 }),
754 }))
755 },
756 )
757 }
758}
759
760#[derive(Debug)]
762pub enum DeviceRequest {
763 GetInfo { responder: DeviceGetInfoResponder },
764}
765
766impl DeviceRequest {
767 #[allow(irrefutable_let_patterns)]
768 pub fn into_get_info(self) -> Option<(DeviceGetInfoResponder)> {
769 if let DeviceRequest::GetInfo { responder } = self { Some((responder)) } else { None }
770 }
771
772 pub fn method_name(&self) -> &'static str {
774 match *self {
775 DeviceRequest::GetInfo { .. } => "get_info",
776 }
777 }
778}
779
780#[derive(Debug, Clone)]
781pub struct DeviceControlHandle {
782 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
783}
784
785impl fidl::endpoints::ControlHandle for DeviceControlHandle {
786 fn shutdown(&self) {
787 self.inner.shutdown()
788 }
789
790 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
791 self.inner.shutdown_with_epitaph(status)
792 }
793
794 fn is_closed(&self) -> bool {
795 self.inner.channel().is_closed()
796 }
797 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
798 self.inner.channel().on_closed()
799 }
800
801 #[cfg(target_os = "fuchsia")]
802 fn signal_peer(
803 &self,
804 clear_mask: zx::Signals,
805 set_mask: zx::Signals,
806 ) -> Result<(), zx_status::Status> {
807 use fidl::Peered;
808 self.inner.channel().signal_peer(clear_mask, set_mask)
809 }
810}
811
812impl DeviceControlHandle {}
813
814#[must_use = "FIDL methods require a response to be sent"]
815#[derive(Debug)]
816pub struct DeviceGetInfoResponder {
817 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
818 tx_id: u32,
819}
820
821impl std::ops::Drop for DeviceGetInfoResponder {
825 fn drop(&mut self) {
826 self.control_handle.shutdown();
827 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
829 }
830}
831
832impl fidl::endpoints::Responder for DeviceGetInfoResponder {
833 type ControlHandle = DeviceControlHandle;
834
835 fn control_handle(&self) -> &DeviceControlHandle {
836 &self.control_handle
837 }
838
839 fn drop_without_shutdown(mut self) {
840 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
842 std::mem::forget(self);
844 }
845}
846
847impl DeviceGetInfoResponder {
848 pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
852 let _result = self.send_raw(info);
853 if _result.is_err() {
854 self.control_handle.shutdown();
855 }
856 self.drop_without_shutdown();
857 _result
858 }
859
860 pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
862 let _result = self.send_raw(info);
863 self.drop_without_shutdown();
864 _result
865 }
866
867 fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
868 self.control_handle.inner.send::<DeviceGetInfoResponse>(
869 (info,),
870 self.tx_id,
871 0x4cc66c5e52b0a7d1,
872 fidl::encoding::DynamicFlags::empty(),
873 )
874 }
875}
876
877#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
878pub struct ProductMarker;
879
880impl fidl::endpoints::ProtocolMarker for ProductMarker {
881 type Proxy = ProductProxy;
882 type RequestStream = ProductRequestStream;
883 #[cfg(target_os = "fuchsia")]
884 type SynchronousProxy = ProductSynchronousProxy;
885
886 const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Product";
887}
888impl fidl::endpoints::DiscoverableProtocolMarker for ProductMarker {}
889
890pub trait ProductProxyInterface: Send + Sync {
891 type GetInfoResponseFut: std::future::Future<Output = Result<ProductInfo, fidl::Error>> + Send;
892 fn r#get_info(&self) -> Self::GetInfoResponseFut;
893}
894#[derive(Debug)]
895#[cfg(target_os = "fuchsia")]
896pub struct ProductSynchronousProxy {
897 client: fidl::client::sync::Client,
898}
899
900#[cfg(target_os = "fuchsia")]
901impl fidl::endpoints::SynchronousProxy for ProductSynchronousProxy {
902 type Proxy = ProductProxy;
903 type Protocol = ProductMarker;
904
905 fn from_channel(inner: fidl::Channel) -> Self {
906 Self::new(inner)
907 }
908
909 fn into_channel(self) -> fidl::Channel {
910 self.client.into_channel()
911 }
912
913 fn as_channel(&self) -> &fidl::Channel {
914 self.client.as_channel()
915 }
916}
917
918#[cfg(target_os = "fuchsia")]
919impl ProductSynchronousProxy {
920 pub fn new(channel: fidl::Channel) -> Self {
921 let protocol_name = <ProductMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
922 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
923 }
924
925 pub fn into_channel(self) -> fidl::Channel {
926 self.client.into_channel()
927 }
928
929 pub fn wait_for_event(
932 &self,
933 deadline: zx::MonotonicInstant,
934 ) -> Result<ProductEvent, fidl::Error> {
935 ProductEvent::decode(self.client.wait_for_event(deadline)?)
936 }
937
938 pub fn r#get_info(
939 &self,
940 ___deadline: zx::MonotonicInstant,
941 ) -> Result<ProductInfo, fidl::Error> {
942 let _response =
943 self.client.send_query::<fidl::encoding::EmptyPayload, ProductGetInfoResponse>(
944 (),
945 0x11a4825cda315828,
946 fidl::encoding::DynamicFlags::empty(),
947 ___deadline,
948 )?;
949 Ok(_response.info)
950 }
951}
952
953#[cfg(target_os = "fuchsia")]
954impl From<ProductSynchronousProxy> for zx::NullableHandle {
955 fn from(value: ProductSynchronousProxy) -> Self {
956 value.into_channel().into()
957 }
958}
959
960#[cfg(target_os = "fuchsia")]
961impl From<fidl::Channel> for ProductSynchronousProxy {
962 fn from(value: fidl::Channel) -> Self {
963 Self::new(value)
964 }
965}
966
967#[cfg(target_os = "fuchsia")]
968impl fidl::endpoints::FromClient for ProductSynchronousProxy {
969 type Protocol = ProductMarker;
970
971 fn from_client(value: fidl::endpoints::ClientEnd<ProductMarker>) -> Self {
972 Self::new(value.into_channel())
973 }
974}
975
976#[derive(Debug, Clone)]
977pub struct ProductProxy {
978 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
979}
980
981impl fidl::endpoints::Proxy for ProductProxy {
982 type Protocol = ProductMarker;
983
984 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
985 Self::new(inner)
986 }
987
988 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
989 self.client.into_channel().map_err(|client| Self { client })
990 }
991
992 fn as_channel(&self) -> &::fidl::AsyncChannel {
993 self.client.as_channel()
994 }
995}
996
997impl ProductProxy {
998 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1000 let protocol_name = <ProductMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1001 Self { client: fidl::client::Client::new(channel, protocol_name) }
1002 }
1003
1004 pub fn take_event_stream(&self) -> ProductEventStream {
1010 ProductEventStream { event_receiver: self.client.take_event_receiver() }
1011 }
1012
1013 pub fn r#get_info(
1014 &self,
1015 ) -> fidl::client::QueryResponseFut<ProductInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1016 {
1017 ProductProxyInterface::r#get_info(self)
1018 }
1019}
1020
1021impl ProductProxyInterface for ProductProxy {
1022 type GetInfoResponseFut =
1023 fidl::client::QueryResponseFut<ProductInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
1024 fn r#get_info(&self) -> Self::GetInfoResponseFut {
1025 fn _decode(
1026 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1027 ) -> Result<ProductInfo, fidl::Error> {
1028 let _response = fidl::client::decode_transaction_body::<
1029 ProductGetInfoResponse,
1030 fidl::encoding::DefaultFuchsiaResourceDialect,
1031 0x11a4825cda315828,
1032 >(_buf?)?;
1033 Ok(_response.info)
1034 }
1035 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProductInfo>(
1036 (),
1037 0x11a4825cda315828,
1038 fidl::encoding::DynamicFlags::empty(),
1039 _decode,
1040 )
1041 }
1042}
1043
1044pub struct ProductEventStream {
1045 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1046}
1047
1048impl std::marker::Unpin for ProductEventStream {}
1049
1050impl futures::stream::FusedStream for ProductEventStream {
1051 fn is_terminated(&self) -> bool {
1052 self.event_receiver.is_terminated()
1053 }
1054}
1055
1056impl futures::Stream for ProductEventStream {
1057 type Item = Result<ProductEvent, fidl::Error>;
1058
1059 fn poll_next(
1060 mut self: std::pin::Pin<&mut Self>,
1061 cx: &mut std::task::Context<'_>,
1062 ) -> std::task::Poll<Option<Self::Item>> {
1063 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1064 &mut self.event_receiver,
1065 cx
1066 )?) {
1067 Some(buf) => std::task::Poll::Ready(Some(ProductEvent::decode(buf))),
1068 None => std::task::Poll::Ready(None),
1069 }
1070 }
1071}
1072
1073#[derive(Debug)]
1074pub enum ProductEvent {}
1075
1076impl ProductEvent {
1077 fn decode(
1079 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1080 ) -> Result<ProductEvent, fidl::Error> {
1081 let (bytes, _handles) = buf.split_mut();
1082 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1083 debug_assert_eq!(tx_header.tx_id, 0);
1084 match tx_header.ordinal {
1085 _ => Err(fidl::Error::UnknownOrdinal {
1086 ordinal: tx_header.ordinal,
1087 protocol_name: <ProductMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1088 }),
1089 }
1090 }
1091}
1092
1093pub struct ProductRequestStream {
1095 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1096 is_terminated: bool,
1097}
1098
1099impl std::marker::Unpin for ProductRequestStream {}
1100
1101impl futures::stream::FusedStream for ProductRequestStream {
1102 fn is_terminated(&self) -> bool {
1103 self.is_terminated
1104 }
1105}
1106
1107impl fidl::endpoints::RequestStream for ProductRequestStream {
1108 type Protocol = ProductMarker;
1109 type ControlHandle = ProductControlHandle;
1110
1111 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1112 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1113 }
1114
1115 fn control_handle(&self) -> Self::ControlHandle {
1116 ProductControlHandle { inner: self.inner.clone() }
1117 }
1118
1119 fn into_inner(
1120 self,
1121 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1122 {
1123 (self.inner, self.is_terminated)
1124 }
1125
1126 fn from_inner(
1127 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1128 is_terminated: bool,
1129 ) -> Self {
1130 Self { inner, is_terminated }
1131 }
1132}
1133
1134impl futures::Stream for ProductRequestStream {
1135 type Item = Result<ProductRequest, fidl::Error>;
1136
1137 fn poll_next(
1138 mut self: std::pin::Pin<&mut Self>,
1139 cx: &mut std::task::Context<'_>,
1140 ) -> std::task::Poll<Option<Self::Item>> {
1141 let this = &mut *self;
1142 if this.inner.check_shutdown(cx) {
1143 this.is_terminated = true;
1144 return std::task::Poll::Ready(None);
1145 }
1146 if this.is_terminated {
1147 panic!("polled ProductRequestStream after completion");
1148 }
1149 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1150 |bytes, handles| {
1151 match this.inner.channel().read_etc(cx, bytes, handles) {
1152 std::task::Poll::Ready(Ok(())) => {}
1153 std::task::Poll::Pending => return std::task::Poll::Pending,
1154 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1155 this.is_terminated = true;
1156 return std::task::Poll::Ready(None);
1157 }
1158 std::task::Poll::Ready(Err(e)) => {
1159 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1160 e.into(),
1161 ))));
1162 }
1163 }
1164
1165 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1167
1168 std::task::Poll::Ready(Some(match header.ordinal {
1169 0x11a4825cda315828 => {
1170 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1171 let mut req = fidl::new_empty!(
1172 fidl::encoding::EmptyPayload,
1173 fidl::encoding::DefaultFuchsiaResourceDialect
1174 );
1175 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1176 let control_handle = ProductControlHandle { inner: this.inner.clone() };
1177 Ok(ProductRequest::GetInfo {
1178 responder: ProductGetInfoResponder {
1179 control_handle: std::mem::ManuallyDrop::new(control_handle),
1180 tx_id: header.tx_id,
1181 },
1182 })
1183 }
1184 _ => Err(fidl::Error::UnknownOrdinal {
1185 ordinal: header.ordinal,
1186 protocol_name:
1187 <ProductMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1188 }),
1189 }))
1190 },
1191 )
1192 }
1193}
1194
1195#[derive(Debug)]
1197pub enum ProductRequest {
1198 GetInfo { responder: ProductGetInfoResponder },
1199}
1200
1201impl ProductRequest {
1202 #[allow(irrefutable_let_patterns)]
1203 pub fn into_get_info(self) -> Option<(ProductGetInfoResponder)> {
1204 if let ProductRequest::GetInfo { responder } = self { Some((responder)) } else { None }
1205 }
1206
1207 pub fn method_name(&self) -> &'static str {
1209 match *self {
1210 ProductRequest::GetInfo { .. } => "get_info",
1211 }
1212 }
1213}
1214
1215#[derive(Debug, Clone)]
1216pub struct ProductControlHandle {
1217 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1218}
1219
1220impl fidl::endpoints::ControlHandle for ProductControlHandle {
1221 fn shutdown(&self) {
1222 self.inner.shutdown()
1223 }
1224
1225 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1226 self.inner.shutdown_with_epitaph(status)
1227 }
1228
1229 fn is_closed(&self) -> bool {
1230 self.inner.channel().is_closed()
1231 }
1232 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1233 self.inner.channel().on_closed()
1234 }
1235
1236 #[cfg(target_os = "fuchsia")]
1237 fn signal_peer(
1238 &self,
1239 clear_mask: zx::Signals,
1240 set_mask: zx::Signals,
1241 ) -> Result<(), zx_status::Status> {
1242 use fidl::Peered;
1243 self.inner.channel().signal_peer(clear_mask, set_mask)
1244 }
1245}
1246
1247impl ProductControlHandle {}
1248
1249#[must_use = "FIDL methods require a response to be sent"]
1250#[derive(Debug)]
1251pub struct ProductGetInfoResponder {
1252 control_handle: std::mem::ManuallyDrop<ProductControlHandle>,
1253 tx_id: u32,
1254}
1255
1256impl std::ops::Drop for ProductGetInfoResponder {
1260 fn drop(&mut self) {
1261 self.control_handle.shutdown();
1262 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1264 }
1265}
1266
1267impl fidl::endpoints::Responder for ProductGetInfoResponder {
1268 type ControlHandle = ProductControlHandle;
1269
1270 fn control_handle(&self) -> &ProductControlHandle {
1271 &self.control_handle
1272 }
1273
1274 fn drop_without_shutdown(mut self) {
1275 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1277 std::mem::forget(self);
1279 }
1280}
1281
1282impl ProductGetInfoResponder {
1283 pub fn send(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1287 let _result = self.send_raw(info);
1288 if _result.is_err() {
1289 self.control_handle.shutdown();
1290 }
1291 self.drop_without_shutdown();
1292 _result
1293 }
1294
1295 pub fn send_no_shutdown_on_err(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1297 let _result = self.send_raw(info);
1298 self.drop_without_shutdown();
1299 _result
1300 }
1301
1302 fn send_raw(&self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1303 self.control_handle.inner.send::<ProductGetInfoResponse>(
1304 (info,),
1305 self.tx_id,
1306 0x11a4825cda315828,
1307 fidl::encoding::DynamicFlags::empty(),
1308 )
1309 }
1310}
1311
1312mod internal {
1313 use super::*;
1314}