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