1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_hwinfo_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
14pub struct BoardMarker;
15
16impl fdomain_client::fidl::ProtocolMarker for BoardMarker {
17 type Proxy = BoardProxy;
18 type RequestStream = BoardRequestStream;
19
20 const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Board";
21}
22impl fdomain_client::fidl::DiscoverableProtocolMarker for BoardMarker {}
23
24pub trait BoardProxyInterface: Send + Sync {
25 type GetInfoResponseFut: std::future::Future<Output = Result<BoardInfo, fidl::Error>> + Send;
26 fn r#get_info(&self) -> Self::GetInfoResponseFut;
27}
28
29#[derive(Debug, Clone)]
30pub struct BoardProxy {
31 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
32}
33
34impl fdomain_client::fidl::Proxy for BoardProxy {
35 type Protocol = BoardMarker;
36
37 fn from_channel(inner: fdomain_client::Channel) -> Self {
38 Self::new(inner)
39 }
40
41 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
42 self.client.into_channel().map_err(|client| Self { client })
43 }
44
45 fn as_channel(&self) -> &fdomain_client::Channel {
46 self.client.as_channel()
47 }
48}
49
50impl BoardProxy {
51 pub fn new(channel: fdomain_client::Channel) -> Self {
53 let protocol_name = <BoardMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
54 Self { client: fidl::client::Client::new(channel, protocol_name) }
55 }
56
57 pub fn take_event_stream(&self) -> BoardEventStream {
63 BoardEventStream { event_receiver: self.client.take_event_receiver() }
64 }
65
66 pub fn r#get_info(
67 &self,
68 ) -> fidl::client::QueryResponseFut<BoardInfo, fdomain_client::fidl::FDomainResourceDialect>
69 {
70 BoardProxyInterface::r#get_info(self)
71 }
72}
73
74impl BoardProxyInterface for BoardProxy {
75 type GetInfoResponseFut =
76 fidl::client::QueryResponseFut<BoardInfo, fdomain_client::fidl::FDomainResourceDialect>;
77 fn r#get_info(&self) -> Self::GetInfoResponseFut {
78 fn _decode(
79 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
80 ) -> Result<BoardInfo, fidl::Error> {
81 let _response = fidl::client::decode_transaction_body::<
82 BoardGetInfoResponse,
83 fdomain_client::fidl::FDomainResourceDialect,
84 0x878a093531d0904,
85 >(_buf?)?;
86 Ok(_response.info)
87 }
88 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, BoardInfo>(
89 (),
90 0x878a093531d0904,
91 fidl::encoding::DynamicFlags::empty(),
92 _decode,
93 )
94 }
95}
96
97pub struct BoardEventStream {
98 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
99}
100
101impl std::marker::Unpin for BoardEventStream {}
102
103impl futures::stream::FusedStream for BoardEventStream {
104 fn is_terminated(&self) -> bool {
105 self.event_receiver.is_terminated()
106 }
107}
108
109impl futures::Stream for BoardEventStream {
110 type Item = Result<BoardEvent, fidl::Error>;
111
112 fn poll_next(
113 mut self: std::pin::Pin<&mut Self>,
114 cx: &mut std::task::Context<'_>,
115 ) -> std::task::Poll<Option<Self::Item>> {
116 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
117 &mut self.event_receiver,
118 cx
119 )?) {
120 Some(buf) => std::task::Poll::Ready(Some(BoardEvent::decode(buf))),
121 None => std::task::Poll::Ready(None),
122 }
123 }
124}
125
126#[derive(Debug)]
127pub enum BoardEvent {}
128
129impl BoardEvent {
130 fn decode(
132 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
133 ) -> Result<BoardEvent, fidl::Error> {
134 let (bytes, _handles) = buf.split_mut();
135 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
136 debug_assert_eq!(tx_header.tx_id, 0);
137 match tx_header.ordinal {
138 _ => Err(fidl::Error::UnknownOrdinal {
139 ordinal: tx_header.ordinal,
140 protocol_name: <BoardMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
141 }),
142 }
143 }
144}
145
146pub struct BoardRequestStream {
148 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
149 is_terminated: bool,
150}
151
152impl std::marker::Unpin for BoardRequestStream {}
153
154impl futures::stream::FusedStream for BoardRequestStream {
155 fn is_terminated(&self) -> bool {
156 self.is_terminated
157 }
158}
159
160impl fdomain_client::fidl::RequestStream for BoardRequestStream {
161 type Protocol = BoardMarker;
162 type ControlHandle = BoardControlHandle;
163
164 fn from_channel(channel: fdomain_client::Channel) -> Self {
165 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
166 }
167
168 fn control_handle(&self) -> Self::ControlHandle {
169 BoardControlHandle { inner: self.inner.clone() }
170 }
171
172 fn into_inner(
173 self,
174 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
175 {
176 (self.inner, self.is_terminated)
177 }
178
179 fn from_inner(
180 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
181 is_terminated: bool,
182 ) -> Self {
183 Self { inner, is_terminated }
184 }
185}
186
187impl futures::Stream for BoardRequestStream {
188 type Item = Result<BoardRequest, fidl::Error>;
189
190 fn poll_next(
191 mut self: std::pin::Pin<&mut Self>,
192 cx: &mut std::task::Context<'_>,
193 ) -> std::task::Poll<Option<Self::Item>> {
194 let this = &mut *self;
195 if this.inner.check_shutdown(cx) {
196 this.is_terminated = true;
197 return std::task::Poll::Ready(None);
198 }
199 if this.is_terminated {
200 panic!("polled BoardRequestStream after completion");
201 }
202 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
203 |bytes, handles| {
204 match this.inner.channel().read_etc(cx, bytes, handles) {
205 std::task::Poll::Ready(Ok(())) => {}
206 std::task::Poll::Pending => return std::task::Poll::Pending,
207 std::task::Poll::Ready(Err(None)) => {
208 this.is_terminated = true;
209 return std::task::Poll::Ready(None);
210 }
211 std::task::Poll::Ready(Err(Some(e))) => {
212 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
213 e.into(),
214 ))));
215 }
216 }
217
218 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
220
221 std::task::Poll::Ready(Some(match header.ordinal {
222 0x878a093531d0904 => {
223 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
224 let mut req = fidl::new_empty!(
225 fidl::encoding::EmptyPayload,
226 fdomain_client::fidl::FDomainResourceDialect
227 );
228 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
229 let control_handle = BoardControlHandle { inner: this.inner.clone() };
230 Ok(BoardRequest::GetInfo {
231 responder: BoardGetInfoResponder {
232 control_handle: std::mem::ManuallyDrop::new(control_handle),
233 tx_id: header.tx_id,
234 },
235 })
236 }
237 _ => Err(fidl::Error::UnknownOrdinal {
238 ordinal: header.ordinal,
239 protocol_name:
240 <BoardMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
241 }),
242 }))
243 },
244 )
245 }
246}
247
248#[derive(Debug)]
250pub enum BoardRequest {
251 GetInfo { responder: BoardGetInfoResponder },
252}
253
254impl BoardRequest {
255 #[allow(irrefutable_let_patterns)]
256 pub fn into_get_info(self) -> Option<(BoardGetInfoResponder)> {
257 if let BoardRequest::GetInfo { responder } = self { Some((responder)) } else { None }
258 }
259
260 pub fn method_name(&self) -> &'static str {
262 match *self {
263 BoardRequest::GetInfo { .. } => "get_info",
264 }
265 }
266}
267
268#[derive(Debug, Clone)]
269pub struct BoardControlHandle {
270 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
271}
272
273impl BoardControlHandle {
274 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
275 self.inner.shutdown_with_epitaph(status.into())
276 }
277}
278
279impl fdomain_client::fidl::ControlHandle for BoardControlHandle {
280 fn shutdown(&self) {
281 self.inner.shutdown()
282 }
283
284 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
285 self.inner.shutdown_with_epitaph(status)
286 }
287
288 fn is_closed(&self) -> bool {
289 self.inner.channel().is_closed()
290 }
291 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
292 self.inner.channel().on_closed()
293 }
294}
295
296impl BoardControlHandle {}
297
298#[must_use = "FIDL methods require a response to be sent"]
299#[derive(Debug)]
300pub struct BoardGetInfoResponder {
301 control_handle: std::mem::ManuallyDrop<BoardControlHandle>,
302 tx_id: u32,
303}
304
305impl std::ops::Drop for BoardGetInfoResponder {
309 fn drop(&mut self) {
310 self.control_handle.shutdown();
311 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
313 }
314}
315
316impl fdomain_client::fidl::Responder for BoardGetInfoResponder {
317 type ControlHandle = BoardControlHandle;
318
319 fn control_handle(&self) -> &BoardControlHandle {
320 &self.control_handle
321 }
322
323 fn drop_without_shutdown(mut self) {
324 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
326 std::mem::forget(self);
328 }
329}
330
331impl BoardGetInfoResponder {
332 pub fn send(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
336 let _result = self.send_raw(info);
337 if _result.is_err() {
338 self.control_handle.shutdown();
339 }
340 self.drop_without_shutdown();
341 _result
342 }
343
344 pub fn send_no_shutdown_on_err(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
346 let _result = self.send_raw(info);
347 self.drop_without_shutdown();
348 _result
349 }
350
351 fn send_raw(&self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
352 self.control_handle.inner.send::<BoardGetInfoResponse>(
353 (info,),
354 self.tx_id,
355 0x878a093531d0904,
356 fidl::encoding::DynamicFlags::empty(),
357 )
358 }
359}
360
361#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
362pub struct DeviceMarker;
363
364impl fdomain_client::fidl::ProtocolMarker for DeviceMarker {
365 type Proxy = DeviceProxy;
366 type RequestStream = DeviceRequestStream;
367
368 const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Device";
369}
370impl fdomain_client::fidl::DiscoverableProtocolMarker for DeviceMarker {}
371
372pub trait DeviceProxyInterface: Send + Sync {
373 type GetInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>> + Send;
374 fn r#get_info(&self) -> Self::GetInfoResponseFut;
375}
376
377#[derive(Debug, Clone)]
378pub struct DeviceProxy {
379 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
380}
381
382impl fdomain_client::fidl::Proxy for DeviceProxy {
383 type Protocol = DeviceMarker;
384
385 fn from_channel(inner: fdomain_client::Channel) -> Self {
386 Self::new(inner)
387 }
388
389 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
390 self.client.into_channel().map_err(|client| Self { client })
391 }
392
393 fn as_channel(&self) -> &fdomain_client::Channel {
394 self.client.as_channel()
395 }
396}
397
398impl DeviceProxy {
399 pub fn new(channel: fdomain_client::Channel) -> Self {
401 let protocol_name = <DeviceMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
402 Self { client: fidl::client::Client::new(channel, protocol_name) }
403 }
404
405 pub fn take_event_stream(&self) -> DeviceEventStream {
411 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
412 }
413
414 pub fn r#get_info(
415 &self,
416 ) -> fidl::client::QueryResponseFut<DeviceInfo, fdomain_client::fidl::FDomainResourceDialect>
417 {
418 DeviceProxyInterface::r#get_info(self)
419 }
420}
421
422impl DeviceProxyInterface for DeviceProxy {
423 type GetInfoResponseFut =
424 fidl::client::QueryResponseFut<DeviceInfo, fdomain_client::fidl::FDomainResourceDialect>;
425 fn r#get_info(&self) -> Self::GetInfoResponseFut {
426 fn _decode(
427 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
428 ) -> Result<DeviceInfo, fidl::Error> {
429 let _response = fidl::client::decode_transaction_body::<
430 DeviceGetInfoResponse,
431 fdomain_client::fidl::FDomainResourceDialect,
432 0x4cc66c5e52b0a7d1,
433 >(_buf?)?;
434 Ok(_response.info)
435 }
436 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
437 (),
438 0x4cc66c5e52b0a7d1,
439 fidl::encoding::DynamicFlags::empty(),
440 _decode,
441 )
442 }
443}
444
445pub struct DeviceEventStream {
446 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
447}
448
449impl std::marker::Unpin for DeviceEventStream {}
450
451impl futures::stream::FusedStream for DeviceEventStream {
452 fn is_terminated(&self) -> bool {
453 self.event_receiver.is_terminated()
454 }
455}
456
457impl futures::Stream for DeviceEventStream {
458 type Item = Result<DeviceEvent, fidl::Error>;
459
460 fn poll_next(
461 mut self: std::pin::Pin<&mut Self>,
462 cx: &mut std::task::Context<'_>,
463 ) -> std::task::Poll<Option<Self::Item>> {
464 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
465 &mut self.event_receiver,
466 cx
467 )?) {
468 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
469 None => std::task::Poll::Ready(None),
470 }
471 }
472}
473
474#[derive(Debug)]
475pub enum DeviceEvent {}
476
477impl DeviceEvent {
478 fn decode(
480 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
481 ) -> Result<DeviceEvent, fidl::Error> {
482 let (bytes, _handles) = buf.split_mut();
483 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
484 debug_assert_eq!(tx_header.tx_id, 0);
485 match tx_header.ordinal {
486 _ => Err(fidl::Error::UnknownOrdinal {
487 ordinal: tx_header.ordinal,
488 protocol_name: <DeviceMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
489 }),
490 }
491 }
492}
493
494pub struct DeviceRequestStream {
496 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
497 is_terminated: bool,
498}
499
500impl std::marker::Unpin for DeviceRequestStream {}
501
502impl futures::stream::FusedStream for DeviceRequestStream {
503 fn is_terminated(&self) -> bool {
504 self.is_terminated
505 }
506}
507
508impl fdomain_client::fidl::RequestStream for DeviceRequestStream {
509 type Protocol = DeviceMarker;
510 type ControlHandle = DeviceControlHandle;
511
512 fn from_channel(channel: fdomain_client::Channel) -> Self {
513 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
514 }
515
516 fn control_handle(&self) -> Self::ControlHandle {
517 DeviceControlHandle { inner: self.inner.clone() }
518 }
519
520 fn into_inner(
521 self,
522 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
523 {
524 (self.inner, self.is_terminated)
525 }
526
527 fn from_inner(
528 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
529 is_terminated: bool,
530 ) -> Self {
531 Self { inner, is_terminated }
532 }
533}
534
535impl futures::Stream for DeviceRequestStream {
536 type Item = Result<DeviceRequest, fidl::Error>;
537
538 fn poll_next(
539 mut self: std::pin::Pin<&mut Self>,
540 cx: &mut std::task::Context<'_>,
541 ) -> std::task::Poll<Option<Self::Item>> {
542 let this = &mut *self;
543 if this.inner.check_shutdown(cx) {
544 this.is_terminated = true;
545 return std::task::Poll::Ready(None);
546 }
547 if this.is_terminated {
548 panic!("polled DeviceRequestStream after completion");
549 }
550 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
551 |bytes, handles| {
552 match this.inner.channel().read_etc(cx, bytes, handles) {
553 std::task::Poll::Ready(Ok(())) => {}
554 std::task::Poll::Pending => return std::task::Poll::Pending,
555 std::task::Poll::Ready(Err(None)) => {
556 this.is_terminated = true;
557 return std::task::Poll::Ready(None);
558 }
559 std::task::Poll::Ready(Err(Some(e))) => {
560 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
561 e.into(),
562 ))));
563 }
564 }
565
566 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
568
569 std::task::Poll::Ready(Some(match header.ordinal {
570 0x4cc66c5e52b0a7d1 => {
571 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
572 let mut req = fidl::new_empty!(
573 fidl::encoding::EmptyPayload,
574 fdomain_client::fidl::FDomainResourceDialect
575 );
576 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
577 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
578 Ok(DeviceRequest::GetInfo {
579 responder: DeviceGetInfoResponder {
580 control_handle: std::mem::ManuallyDrop::new(control_handle),
581 tx_id: header.tx_id,
582 },
583 })
584 }
585 _ => Err(fidl::Error::UnknownOrdinal {
586 ordinal: header.ordinal,
587 protocol_name:
588 <DeviceMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
589 }),
590 }))
591 },
592 )
593 }
594}
595
596#[derive(Debug)]
598pub enum DeviceRequest {
599 GetInfo { responder: DeviceGetInfoResponder },
600}
601
602impl DeviceRequest {
603 #[allow(irrefutable_let_patterns)]
604 pub fn into_get_info(self) -> Option<(DeviceGetInfoResponder)> {
605 if let DeviceRequest::GetInfo { responder } = self { Some((responder)) } else { None }
606 }
607
608 pub fn method_name(&self) -> &'static str {
610 match *self {
611 DeviceRequest::GetInfo { .. } => "get_info",
612 }
613 }
614}
615
616#[derive(Debug, Clone)]
617pub struct DeviceControlHandle {
618 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
619}
620
621impl DeviceControlHandle {
622 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
623 self.inner.shutdown_with_epitaph(status.into())
624 }
625}
626
627impl fdomain_client::fidl::ControlHandle for DeviceControlHandle {
628 fn shutdown(&self) {
629 self.inner.shutdown()
630 }
631
632 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
633 self.inner.shutdown_with_epitaph(status)
634 }
635
636 fn is_closed(&self) -> bool {
637 self.inner.channel().is_closed()
638 }
639 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
640 self.inner.channel().on_closed()
641 }
642}
643
644impl DeviceControlHandle {}
645
646#[must_use = "FIDL methods require a response to be sent"]
647#[derive(Debug)]
648pub struct DeviceGetInfoResponder {
649 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
650 tx_id: u32,
651}
652
653impl std::ops::Drop for DeviceGetInfoResponder {
657 fn drop(&mut self) {
658 self.control_handle.shutdown();
659 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
661 }
662}
663
664impl fdomain_client::fidl::Responder for DeviceGetInfoResponder {
665 type ControlHandle = DeviceControlHandle;
666
667 fn control_handle(&self) -> &DeviceControlHandle {
668 &self.control_handle
669 }
670
671 fn drop_without_shutdown(mut self) {
672 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
674 std::mem::forget(self);
676 }
677}
678
679impl DeviceGetInfoResponder {
680 pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
684 let _result = self.send_raw(info);
685 if _result.is_err() {
686 self.control_handle.shutdown();
687 }
688 self.drop_without_shutdown();
689 _result
690 }
691
692 pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
694 let _result = self.send_raw(info);
695 self.drop_without_shutdown();
696 _result
697 }
698
699 fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
700 self.control_handle.inner.send::<DeviceGetInfoResponse>(
701 (info,),
702 self.tx_id,
703 0x4cc66c5e52b0a7d1,
704 fidl::encoding::DynamicFlags::empty(),
705 )
706 }
707}
708
709#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
710pub struct ProductMarker;
711
712impl fdomain_client::fidl::ProtocolMarker for ProductMarker {
713 type Proxy = ProductProxy;
714 type RequestStream = ProductRequestStream;
715
716 const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Product";
717}
718impl fdomain_client::fidl::DiscoverableProtocolMarker for ProductMarker {}
719
720pub trait ProductProxyInterface: Send + Sync {
721 type GetInfoResponseFut: std::future::Future<Output = Result<ProductInfo, fidl::Error>> + Send;
722 fn r#get_info(&self) -> Self::GetInfoResponseFut;
723}
724
725#[derive(Debug, Clone)]
726pub struct ProductProxy {
727 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
728}
729
730impl fdomain_client::fidl::Proxy for ProductProxy {
731 type Protocol = ProductMarker;
732
733 fn from_channel(inner: fdomain_client::Channel) -> Self {
734 Self::new(inner)
735 }
736
737 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
738 self.client.into_channel().map_err(|client| Self { client })
739 }
740
741 fn as_channel(&self) -> &fdomain_client::Channel {
742 self.client.as_channel()
743 }
744}
745
746impl ProductProxy {
747 pub fn new(channel: fdomain_client::Channel) -> Self {
749 let protocol_name = <ProductMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
750 Self { client: fidl::client::Client::new(channel, protocol_name) }
751 }
752
753 pub fn take_event_stream(&self) -> ProductEventStream {
759 ProductEventStream { event_receiver: self.client.take_event_receiver() }
760 }
761
762 pub fn r#get_info(
763 &self,
764 ) -> fidl::client::QueryResponseFut<ProductInfo, fdomain_client::fidl::FDomainResourceDialect>
765 {
766 ProductProxyInterface::r#get_info(self)
767 }
768}
769
770impl ProductProxyInterface for ProductProxy {
771 type GetInfoResponseFut =
772 fidl::client::QueryResponseFut<ProductInfo, fdomain_client::fidl::FDomainResourceDialect>;
773 fn r#get_info(&self) -> Self::GetInfoResponseFut {
774 fn _decode(
775 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
776 ) -> Result<ProductInfo, fidl::Error> {
777 let _response = fidl::client::decode_transaction_body::<
778 ProductGetInfoResponse,
779 fdomain_client::fidl::FDomainResourceDialect,
780 0x11a4825cda315828,
781 >(_buf?)?;
782 Ok(_response.info)
783 }
784 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProductInfo>(
785 (),
786 0x11a4825cda315828,
787 fidl::encoding::DynamicFlags::empty(),
788 _decode,
789 )
790 }
791}
792
793pub struct ProductEventStream {
794 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
795}
796
797impl std::marker::Unpin for ProductEventStream {}
798
799impl futures::stream::FusedStream for ProductEventStream {
800 fn is_terminated(&self) -> bool {
801 self.event_receiver.is_terminated()
802 }
803}
804
805impl futures::Stream for ProductEventStream {
806 type Item = Result<ProductEvent, fidl::Error>;
807
808 fn poll_next(
809 mut self: std::pin::Pin<&mut Self>,
810 cx: &mut std::task::Context<'_>,
811 ) -> std::task::Poll<Option<Self::Item>> {
812 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
813 &mut self.event_receiver,
814 cx
815 )?) {
816 Some(buf) => std::task::Poll::Ready(Some(ProductEvent::decode(buf))),
817 None => std::task::Poll::Ready(None),
818 }
819 }
820}
821
822#[derive(Debug)]
823pub enum ProductEvent {}
824
825impl ProductEvent {
826 fn decode(
828 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
829 ) -> Result<ProductEvent, fidl::Error> {
830 let (bytes, _handles) = buf.split_mut();
831 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
832 debug_assert_eq!(tx_header.tx_id, 0);
833 match tx_header.ordinal {
834 _ => Err(fidl::Error::UnknownOrdinal {
835 ordinal: tx_header.ordinal,
836 protocol_name: <ProductMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
837 }),
838 }
839 }
840}
841
842pub struct ProductRequestStream {
844 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
845 is_terminated: bool,
846}
847
848impl std::marker::Unpin for ProductRequestStream {}
849
850impl futures::stream::FusedStream for ProductRequestStream {
851 fn is_terminated(&self) -> bool {
852 self.is_terminated
853 }
854}
855
856impl fdomain_client::fidl::RequestStream for ProductRequestStream {
857 type Protocol = ProductMarker;
858 type ControlHandle = ProductControlHandle;
859
860 fn from_channel(channel: fdomain_client::Channel) -> Self {
861 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
862 }
863
864 fn control_handle(&self) -> Self::ControlHandle {
865 ProductControlHandle { inner: self.inner.clone() }
866 }
867
868 fn into_inner(
869 self,
870 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
871 {
872 (self.inner, self.is_terminated)
873 }
874
875 fn from_inner(
876 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
877 is_terminated: bool,
878 ) -> Self {
879 Self { inner, is_terminated }
880 }
881}
882
883impl futures::Stream for ProductRequestStream {
884 type Item = Result<ProductRequest, fidl::Error>;
885
886 fn poll_next(
887 mut self: std::pin::Pin<&mut Self>,
888 cx: &mut std::task::Context<'_>,
889 ) -> std::task::Poll<Option<Self::Item>> {
890 let this = &mut *self;
891 if this.inner.check_shutdown(cx) {
892 this.is_terminated = true;
893 return std::task::Poll::Ready(None);
894 }
895 if this.is_terminated {
896 panic!("polled ProductRequestStream after completion");
897 }
898 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
899 |bytes, handles| {
900 match this.inner.channel().read_etc(cx, bytes, handles) {
901 std::task::Poll::Ready(Ok(())) => {}
902 std::task::Poll::Pending => return std::task::Poll::Pending,
903 std::task::Poll::Ready(Err(None)) => {
904 this.is_terminated = true;
905 return std::task::Poll::Ready(None);
906 }
907 std::task::Poll::Ready(Err(Some(e))) => {
908 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
909 e.into(),
910 ))));
911 }
912 }
913
914 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
916
917 std::task::Poll::Ready(Some(match header.ordinal {
918 0x11a4825cda315828 => {
919 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
920 let mut req = fidl::new_empty!(
921 fidl::encoding::EmptyPayload,
922 fdomain_client::fidl::FDomainResourceDialect
923 );
924 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
925 let control_handle = ProductControlHandle { inner: this.inner.clone() };
926 Ok(ProductRequest::GetInfo {
927 responder: ProductGetInfoResponder {
928 control_handle: std::mem::ManuallyDrop::new(control_handle),
929 tx_id: header.tx_id,
930 },
931 })
932 }
933 _ => Err(fidl::Error::UnknownOrdinal {
934 ordinal: header.ordinal,
935 protocol_name:
936 <ProductMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
937 }),
938 }))
939 },
940 )
941 }
942}
943
944#[derive(Debug)]
946pub enum ProductRequest {
947 GetInfo { responder: ProductGetInfoResponder },
948}
949
950impl ProductRequest {
951 #[allow(irrefutable_let_patterns)]
952 pub fn into_get_info(self) -> Option<(ProductGetInfoResponder)> {
953 if let ProductRequest::GetInfo { responder } = self { Some((responder)) } else { None }
954 }
955
956 pub fn method_name(&self) -> &'static str {
958 match *self {
959 ProductRequest::GetInfo { .. } => "get_info",
960 }
961 }
962}
963
964#[derive(Debug, Clone)]
965pub struct ProductControlHandle {
966 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
967}
968
969impl ProductControlHandle {
970 pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
971 self.inner.shutdown_with_epitaph(status.into())
972 }
973}
974
975impl fdomain_client::fidl::ControlHandle for ProductControlHandle {
976 fn shutdown(&self) {
977 self.inner.shutdown()
978 }
979
980 fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
981 self.inner.shutdown_with_epitaph(status)
982 }
983
984 fn is_closed(&self) -> bool {
985 self.inner.channel().is_closed()
986 }
987 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
988 self.inner.channel().on_closed()
989 }
990}
991
992impl ProductControlHandle {}
993
994#[must_use = "FIDL methods require a response to be sent"]
995#[derive(Debug)]
996pub struct ProductGetInfoResponder {
997 control_handle: std::mem::ManuallyDrop<ProductControlHandle>,
998 tx_id: u32,
999}
1000
1001impl std::ops::Drop for ProductGetInfoResponder {
1005 fn drop(&mut self) {
1006 self.control_handle.shutdown();
1007 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1009 }
1010}
1011
1012impl fdomain_client::fidl::Responder for ProductGetInfoResponder {
1013 type ControlHandle = ProductControlHandle;
1014
1015 fn control_handle(&self) -> &ProductControlHandle {
1016 &self.control_handle
1017 }
1018
1019 fn drop_without_shutdown(mut self) {
1020 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1022 std::mem::forget(self);
1024 }
1025}
1026
1027impl ProductGetInfoResponder {
1028 pub fn send(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1032 let _result = self.send_raw(info);
1033 if _result.is_err() {
1034 self.control_handle.shutdown();
1035 }
1036 self.drop_without_shutdown();
1037 _result
1038 }
1039
1040 pub fn send_no_shutdown_on_err(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1042 let _result = self.send_raw(info);
1043 self.drop_without_shutdown();
1044 _result
1045 }
1046
1047 fn send_raw(&self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1048 self.control_handle.inner.send::<ProductGetInfoResponse>(
1049 (info,),
1050 self.tx_id,
1051 0x11a4825cda315828,
1052 fidl::encoding::DynamicFlags::empty(),
1053 )
1054 }
1055}
1056
1057mod internal {
1058 use super::*;
1059}