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