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