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