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 fdomain_client::fidl::ControlHandle for BoardControlHandle {
274 fn shutdown(&self) {
275 self.inner.shutdown()
276 }
277
278 fn is_closed(&self) -> bool {
279 self.inner.channel().is_closed()
280 }
281 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
282 self.inner.channel().on_closed()
283 }
284}
285
286impl BoardControlHandle {}
287
288#[must_use = "FIDL methods require a response to be sent"]
289#[derive(Debug)]
290pub struct BoardGetInfoResponder {
291 control_handle: std::mem::ManuallyDrop<BoardControlHandle>,
292 tx_id: u32,
293}
294
295impl std::ops::Drop for BoardGetInfoResponder {
299 fn drop(&mut self) {
300 self.control_handle.shutdown();
301 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
303 }
304}
305
306impl fdomain_client::fidl::Responder for BoardGetInfoResponder {
307 type ControlHandle = BoardControlHandle;
308
309 fn control_handle(&self) -> &BoardControlHandle {
310 &self.control_handle
311 }
312
313 fn drop_without_shutdown(mut self) {
314 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
316 std::mem::forget(self);
318 }
319}
320
321impl BoardGetInfoResponder {
322 pub fn send(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
326 let _result = self.send_raw(info);
327 if _result.is_err() {
328 self.control_handle.shutdown();
329 }
330 self.drop_without_shutdown();
331 _result
332 }
333
334 pub fn send_no_shutdown_on_err(self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
336 let _result = self.send_raw(info);
337 self.drop_without_shutdown();
338 _result
339 }
340
341 fn send_raw(&self, mut info: &BoardInfo) -> Result<(), fidl::Error> {
342 self.control_handle.inner.send::<BoardGetInfoResponse>(
343 (info,),
344 self.tx_id,
345 0x878a093531d0904,
346 fidl::encoding::DynamicFlags::empty(),
347 )
348 }
349}
350
351#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
352pub struct DeviceMarker;
353
354impl fdomain_client::fidl::ProtocolMarker for DeviceMarker {
355 type Proxy = DeviceProxy;
356 type RequestStream = DeviceRequestStream;
357
358 const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Device";
359}
360impl fdomain_client::fidl::DiscoverableProtocolMarker for DeviceMarker {}
361
362pub trait DeviceProxyInterface: Send + Sync {
363 type GetInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>> + Send;
364 fn r#get_info(&self) -> Self::GetInfoResponseFut;
365}
366
367#[derive(Debug, Clone)]
368pub struct DeviceProxy {
369 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
370}
371
372impl fdomain_client::fidl::Proxy for DeviceProxy {
373 type Protocol = DeviceMarker;
374
375 fn from_channel(inner: fdomain_client::Channel) -> Self {
376 Self::new(inner)
377 }
378
379 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
380 self.client.into_channel().map_err(|client| Self { client })
381 }
382
383 fn as_channel(&self) -> &fdomain_client::Channel {
384 self.client.as_channel()
385 }
386}
387
388impl DeviceProxy {
389 pub fn new(channel: fdomain_client::Channel) -> Self {
391 let protocol_name = <DeviceMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
392 Self { client: fidl::client::Client::new(channel, protocol_name) }
393 }
394
395 pub fn take_event_stream(&self) -> DeviceEventStream {
401 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
402 }
403
404 pub fn r#get_info(
405 &self,
406 ) -> fidl::client::QueryResponseFut<DeviceInfo, fdomain_client::fidl::FDomainResourceDialect>
407 {
408 DeviceProxyInterface::r#get_info(self)
409 }
410}
411
412impl DeviceProxyInterface for DeviceProxy {
413 type GetInfoResponseFut =
414 fidl::client::QueryResponseFut<DeviceInfo, fdomain_client::fidl::FDomainResourceDialect>;
415 fn r#get_info(&self) -> Self::GetInfoResponseFut {
416 fn _decode(
417 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
418 ) -> Result<DeviceInfo, fidl::Error> {
419 let _response = fidl::client::decode_transaction_body::<
420 DeviceGetInfoResponse,
421 fdomain_client::fidl::FDomainResourceDialect,
422 0x4cc66c5e52b0a7d1,
423 >(_buf?)?;
424 Ok(_response.info)
425 }
426 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
427 (),
428 0x4cc66c5e52b0a7d1,
429 fidl::encoding::DynamicFlags::empty(),
430 _decode,
431 )
432 }
433}
434
435pub struct DeviceEventStream {
436 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
437}
438
439impl std::marker::Unpin for DeviceEventStream {}
440
441impl futures::stream::FusedStream for DeviceEventStream {
442 fn is_terminated(&self) -> bool {
443 self.event_receiver.is_terminated()
444 }
445}
446
447impl futures::Stream for DeviceEventStream {
448 type Item = Result<DeviceEvent, fidl::Error>;
449
450 fn poll_next(
451 mut self: std::pin::Pin<&mut Self>,
452 cx: &mut std::task::Context<'_>,
453 ) -> std::task::Poll<Option<Self::Item>> {
454 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
455 &mut self.event_receiver,
456 cx
457 )?) {
458 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
459 None => std::task::Poll::Ready(None),
460 }
461 }
462}
463
464#[derive(Debug)]
465pub enum DeviceEvent {}
466
467impl DeviceEvent {
468 fn decode(
470 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
471 ) -> Result<DeviceEvent, fidl::Error> {
472 let (bytes, _handles) = buf.split_mut();
473 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
474 debug_assert_eq!(tx_header.tx_id, 0);
475 match tx_header.ordinal {
476 _ => Err(fidl::Error::UnknownOrdinal {
477 ordinal: tx_header.ordinal,
478 protocol_name: <DeviceMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
479 }),
480 }
481 }
482}
483
484pub struct DeviceRequestStream {
486 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
487 is_terminated: bool,
488}
489
490impl std::marker::Unpin for DeviceRequestStream {}
491
492impl futures::stream::FusedStream for DeviceRequestStream {
493 fn is_terminated(&self) -> bool {
494 self.is_terminated
495 }
496}
497
498impl fdomain_client::fidl::RequestStream for DeviceRequestStream {
499 type Protocol = DeviceMarker;
500 type ControlHandle = DeviceControlHandle;
501
502 fn from_channel(channel: fdomain_client::Channel) -> Self {
503 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
504 }
505
506 fn control_handle(&self) -> Self::ControlHandle {
507 DeviceControlHandle { inner: self.inner.clone() }
508 }
509
510 fn into_inner(
511 self,
512 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
513 {
514 (self.inner, self.is_terminated)
515 }
516
517 fn from_inner(
518 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
519 is_terminated: bool,
520 ) -> Self {
521 Self { inner, is_terminated }
522 }
523}
524
525impl futures::Stream for DeviceRequestStream {
526 type Item = Result<DeviceRequest, fidl::Error>;
527
528 fn poll_next(
529 mut self: std::pin::Pin<&mut Self>,
530 cx: &mut std::task::Context<'_>,
531 ) -> std::task::Poll<Option<Self::Item>> {
532 let this = &mut *self;
533 if this.inner.check_shutdown(cx) {
534 this.is_terminated = true;
535 return std::task::Poll::Ready(None);
536 }
537 if this.is_terminated {
538 panic!("polled DeviceRequestStream after completion");
539 }
540 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
541 |bytes, handles| {
542 match this.inner.channel().read_etc(cx, bytes, handles) {
543 std::task::Poll::Ready(Ok(())) => {}
544 std::task::Poll::Pending => return std::task::Poll::Pending,
545 std::task::Poll::Ready(Err(None)) => {
546 this.is_terminated = true;
547 return std::task::Poll::Ready(None);
548 }
549 std::task::Poll::Ready(Err(Some(e))) => {
550 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
551 e.into(),
552 ))));
553 }
554 }
555
556 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
558
559 std::task::Poll::Ready(Some(match header.ordinal {
560 0x4cc66c5e52b0a7d1 => {
561 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
562 let mut req = fidl::new_empty!(
563 fidl::encoding::EmptyPayload,
564 fdomain_client::fidl::FDomainResourceDialect
565 );
566 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
567 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
568 Ok(DeviceRequest::GetInfo {
569 responder: DeviceGetInfoResponder {
570 control_handle: std::mem::ManuallyDrop::new(control_handle),
571 tx_id: header.tx_id,
572 },
573 })
574 }
575 _ => Err(fidl::Error::UnknownOrdinal {
576 ordinal: header.ordinal,
577 protocol_name:
578 <DeviceMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
579 }),
580 }))
581 },
582 )
583 }
584}
585
586#[derive(Debug)]
588pub enum DeviceRequest {
589 GetInfo { responder: DeviceGetInfoResponder },
590}
591
592impl DeviceRequest {
593 #[allow(irrefutable_let_patterns)]
594 pub fn into_get_info(self) -> Option<(DeviceGetInfoResponder)> {
595 if let DeviceRequest::GetInfo { responder } = self { Some((responder)) } else { None }
596 }
597
598 pub fn method_name(&self) -> &'static str {
600 match *self {
601 DeviceRequest::GetInfo { .. } => "get_info",
602 }
603 }
604}
605
606#[derive(Debug, Clone)]
607pub struct DeviceControlHandle {
608 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
609}
610
611impl fdomain_client::fidl::ControlHandle for DeviceControlHandle {
612 fn shutdown(&self) {
613 self.inner.shutdown()
614 }
615
616 fn is_closed(&self) -> bool {
617 self.inner.channel().is_closed()
618 }
619 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
620 self.inner.channel().on_closed()
621 }
622}
623
624impl DeviceControlHandle {}
625
626#[must_use = "FIDL methods require a response to be sent"]
627#[derive(Debug)]
628pub struct DeviceGetInfoResponder {
629 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
630 tx_id: u32,
631}
632
633impl std::ops::Drop for DeviceGetInfoResponder {
637 fn drop(&mut self) {
638 self.control_handle.shutdown();
639 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
641 }
642}
643
644impl fdomain_client::fidl::Responder for DeviceGetInfoResponder {
645 type ControlHandle = DeviceControlHandle;
646
647 fn control_handle(&self) -> &DeviceControlHandle {
648 &self.control_handle
649 }
650
651 fn drop_without_shutdown(mut self) {
652 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
654 std::mem::forget(self);
656 }
657}
658
659impl DeviceGetInfoResponder {
660 pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
664 let _result = self.send_raw(info);
665 if _result.is_err() {
666 self.control_handle.shutdown();
667 }
668 self.drop_without_shutdown();
669 _result
670 }
671
672 pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
674 let _result = self.send_raw(info);
675 self.drop_without_shutdown();
676 _result
677 }
678
679 fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
680 self.control_handle.inner.send::<DeviceGetInfoResponse>(
681 (info,),
682 self.tx_id,
683 0x4cc66c5e52b0a7d1,
684 fidl::encoding::DynamicFlags::empty(),
685 )
686 }
687}
688
689#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
690pub struct ProductMarker;
691
692impl fdomain_client::fidl::ProtocolMarker for ProductMarker {
693 type Proxy = ProductProxy;
694 type RequestStream = ProductRequestStream;
695
696 const DEBUG_NAME: &'static str = "fuchsia.hwinfo.Product";
697}
698impl fdomain_client::fidl::DiscoverableProtocolMarker for ProductMarker {}
699
700pub trait ProductProxyInterface: Send + Sync {
701 type GetInfoResponseFut: std::future::Future<Output = Result<ProductInfo, fidl::Error>> + Send;
702 fn r#get_info(&self) -> Self::GetInfoResponseFut;
703}
704
705#[derive(Debug, Clone)]
706pub struct ProductProxy {
707 client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
708}
709
710impl fdomain_client::fidl::Proxy for ProductProxy {
711 type Protocol = ProductMarker;
712
713 fn from_channel(inner: fdomain_client::Channel) -> Self {
714 Self::new(inner)
715 }
716
717 fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
718 self.client.into_channel().map_err(|client| Self { client })
719 }
720
721 fn as_channel(&self) -> &fdomain_client::Channel {
722 self.client.as_channel()
723 }
724}
725
726impl ProductProxy {
727 pub fn new(channel: fdomain_client::Channel) -> Self {
729 let protocol_name = <ProductMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
730 Self { client: fidl::client::Client::new(channel, protocol_name) }
731 }
732
733 pub fn take_event_stream(&self) -> ProductEventStream {
739 ProductEventStream { event_receiver: self.client.take_event_receiver() }
740 }
741
742 pub fn r#get_info(
743 &self,
744 ) -> fidl::client::QueryResponseFut<ProductInfo, fdomain_client::fidl::FDomainResourceDialect>
745 {
746 ProductProxyInterface::r#get_info(self)
747 }
748}
749
750impl ProductProxyInterface for ProductProxy {
751 type GetInfoResponseFut =
752 fidl::client::QueryResponseFut<ProductInfo, fdomain_client::fidl::FDomainResourceDialect>;
753 fn r#get_info(&self) -> Self::GetInfoResponseFut {
754 fn _decode(
755 mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
756 ) -> Result<ProductInfo, fidl::Error> {
757 let _response = fidl::client::decode_transaction_body::<
758 ProductGetInfoResponse,
759 fdomain_client::fidl::FDomainResourceDialect,
760 0x11a4825cda315828,
761 >(_buf?)?;
762 Ok(_response.info)
763 }
764 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProductInfo>(
765 (),
766 0x11a4825cda315828,
767 fidl::encoding::DynamicFlags::empty(),
768 _decode,
769 )
770 }
771}
772
773pub struct ProductEventStream {
774 event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
775}
776
777impl std::marker::Unpin for ProductEventStream {}
778
779impl futures::stream::FusedStream for ProductEventStream {
780 fn is_terminated(&self) -> bool {
781 self.event_receiver.is_terminated()
782 }
783}
784
785impl futures::Stream for ProductEventStream {
786 type Item = Result<ProductEvent, fidl::Error>;
787
788 fn poll_next(
789 mut self: std::pin::Pin<&mut Self>,
790 cx: &mut std::task::Context<'_>,
791 ) -> std::task::Poll<Option<Self::Item>> {
792 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
793 &mut self.event_receiver,
794 cx
795 )?) {
796 Some(buf) => std::task::Poll::Ready(Some(ProductEvent::decode(buf))),
797 None => std::task::Poll::Ready(None),
798 }
799 }
800}
801
802#[derive(Debug)]
803pub enum ProductEvent {}
804
805impl ProductEvent {
806 fn decode(
808 mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
809 ) -> Result<ProductEvent, fidl::Error> {
810 let (bytes, _handles) = buf.split_mut();
811 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
812 debug_assert_eq!(tx_header.tx_id, 0);
813 match tx_header.ordinal {
814 _ => Err(fidl::Error::UnknownOrdinal {
815 ordinal: tx_header.ordinal,
816 protocol_name: <ProductMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
817 }),
818 }
819 }
820}
821
822pub struct ProductRequestStream {
824 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
825 is_terminated: bool,
826}
827
828impl std::marker::Unpin for ProductRequestStream {}
829
830impl futures::stream::FusedStream for ProductRequestStream {
831 fn is_terminated(&self) -> bool {
832 self.is_terminated
833 }
834}
835
836impl fdomain_client::fidl::RequestStream for ProductRequestStream {
837 type Protocol = ProductMarker;
838 type ControlHandle = ProductControlHandle;
839
840 fn from_channel(channel: fdomain_client::Channel) -> Self {
841 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
842 }
843
844 fn control_handle(&self) -> Self::ControlHandle {
845 ProductControlHandle { inner: self.inner.clone() }
846 }
847
848 fn into_inner(
849 self,
850 ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
851 {
852 (self.inner, self.is_terminated)
853 }
854
855 fn from_inner(
856 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
857 is_terminated: bool,
858 ) -> Self {
859 Self { inner, is_terminated }
860 }
861}
862
863impl futures::Stream for ProductRequestStream {
864 type Item = Result<ProductRequest, fidl::Error>;
865
866 fn poll_next(
867 mut self: std::pin::Pin<&mut Self>,
868 cx: &mut std::task::Context<'_>,
869 ) -> std::task::Poll<Option<Self::Item>> {
870 let this = &mut *self;
871 if this.inner.check_shutdown(cx) {
872 this.is_terminated = true;
873 return std::task::Poll::Ready(None);
874 }
875 if this.is_terminated {
876 panic!("polled ProductRequestStream after completion");
877 }
878 fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
879 |bytes, handles| {
880 match this.inner.channel().read_etc(cx, bytes, handles) {
881 std::task::Poll::Ready(Ok(())) => {}
882 std::task::Poll::Pending => return std::task::Poll::Pending,
883 std::task::Poll::Ready(Err(None)) => {
884 this.is_terminated = true;
885 return std::task::Poll::Ready(None);
886 }
887 std::task::Poll::Ready(Err(Some(e))) => {
888 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
889 e.into(),
890 ))));
891 }
892 }
893
894 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
896
897 std::task::Poll::Ready(Some(match header.ordinal {
898 0x11a4825cda315828 => {
899 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
900 let mut req = fidl::new_empty!(
901 fidl::encoding::EmptyPayload,
902 fdomain_client::fidl::FDomainResourceDialect
903 );
904 fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
905 let control_handle = ProductControlHandle { inner: this.inner.clone() };
906 Ok(ProductRequest::GetInfo {
907 responder: ProductGetInfoResponder {
908 control_handle: std::mem::ManuallyDrop::new(control_handle),
909 tx_id: header.tx_id,
910 },
911 })
912 }
913 _ => Err(fidl::Error::UnknownOrdinal {
914 ordinal: header.ordinal,
915 protocol_name:
916 <ProductMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
917 }),
918 }))
919 },
920 )
921 }
922}
923
924#[derive(Debug)]
926pub enum ProductRequest {
927 GetInfo { responder: ProductGetInfoResponder },
928}
929
930impl ProductRequest {
931 #[allow(irrefutable_let_patterns)]
932 pub fn into_get_info(self) -> Option<(ProductGetInfoResponder)> {
933 if let ProductRequest::GetInfo { responder } = self { Some((responder)) } else { None }
934 }
935
936 pub fn method_name(&self) -> &'static str {
938 match *self {
939 ProductRequest::GetInfo { .. } => "get_info",
940 }
941 }
942}
943
944#[derive(Debug, Clone)]
945pub struct ProductControlHandle {
946 inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
947}
948
949impl fdomain_client::fidl::ControlHandle for ProductControlHandle {
950 fn shutdown(&self) {
951 self.inner.shutdown()
952 }
953
954 fn is_closed(&self) -> bool {
955 self.inner.channel().is_closed()
956 }
957 fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
958 self.inner.channel().on_closed()
959 }
960}
961
962impl ProductControlHandle {}
963
964#[must_use = "FIDL methods require a response to be sent"]
965#[derive(Debug)]
966pub struct ProductGetInfoResponder {
967 control_handle: std::mem::ManuallyDrop<ProductControlHandle>,
968 tx_id: u32,
969}
970
971impl std::ops::Drop for ProductGetInfoResponder {
975 fn drop(&mut self) {
976 self.control_handle.shutdown();
977 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
979 }
980}
981
982impl fdomain_client::fidl::Responder for ProductGetInfoResponder {
983 type ControlHandle = ProductControlHandle;
984
985 fn control_handle(&self) -> &ProductControlHandle {
986 &self.control_handle
987 }
988
989 fn drop_without_shutdown(mut self) {
990 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
992 std::mem::forget(self);
994 }
995}
996
997impl ProductGetInfoResponder {
998 pub fn send(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1002 let _result = self.send_raw(info);
1003 if _result.is_err() {
1004 self.control_handle.shutdown();
1005 }
1006 self.drop_without_shutdown();
1007 _result
1008 }
1009
1010 pub fn send_no_shutdown_on_err(self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1012 let _result = self.send_raw(info);
1013 self.drop_without_shutdown();
1014 _result
1015 }
1016
1017 fn send_raw(&self, mut info: &ProductInfo) -> Result<(), fidl::Error> {
1018 self.control_handle.inner.send::<ProductGetInfoResponse>(
1019 (info,),
1020 self.tx_id,
1021 0x11a4825cda315828,
1022 fidl::encoding::DynamicFlags::empty(),
1023 )
1024 }
1025}
1026
1027mod internal {
1028 use super::*;
1029}