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_bluetooth_deviceid__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct DeviceIdentificationSetDeviceIdentificationRequest {
16 pub records: Vec<DeviceIdentificationRecord>,
17 pub token: fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for DeviceIdentificationSetDeviceIdentificationRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct DeviceIdentificationMarker;
27
28impl fidl::endpoints::ProtocolMarker for DeviceIdentificationMarker {
29 type Proxy = DeviceIdentificationProxy;
30 type RequestStream = DeviceIdentificationRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = DeviceIdentificationSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.deviceid.DeviceIdentification";
35}
36impl fidl::endpoints::DiscoverableProtocolMarker for DeviceIdentificationMarker {}
37pub type DeviceIdentificationSetDeviceIdentificationResult = Result<(), i32>;
38
39pub trait DeviceIdentificationProxyInterface: Send + Sync {
40 type SetDeviceIdentificationResponseFut: std::future::Future<
41 Output = Result<DeviceIdentificationSetDeviceIdentificationResult, fidl::Error>,
42 > + Send;
43 fn r#set_device_identification(
44 &self,
45 records: &[DeviceIdentificationRecord],
46 token: fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
47 ) -> Self::SetDeviceIdentificationResponseFut;
48}
49#[derive(Debug)]
50#[cfg(target_os = "fuchsia")]
51pub struct DeviceIdentificationSynchronousProxy {
52 client: fidl::client::sync::Client,
53}
54
55#[cfg(target_os = "fuchsia")]
56impl fidl::endpoints::SynchronousProxy for DeviceIdentificationSynchronousProxy {
57 type Proxy = DeviceIdentificationProxy;
58 type Protocol = DeviceIdentificationMarker;
59
60 fn from_channel(inner: fidl::Channel) -> Self {
61 Self::new(inner)
62 }
63
64 fn into_channel(self) -> fidl::Channel {
65 self.client.into_channel()
66 }
67
68 fn as_channel(&self) -> &fidl::Channel {
69 self.client.as_channel()
70 }
71}
72
73#[cfg(target_os = "fuchsia")]
74impl DeviceIdentificationSynchronousProxy {
75 pub fn new(channel: fidl::Channel) -> Self {
76 let protocol_name =
77 <DeviceIdentificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
78 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
79 }
80
81 pub fn into_channel(self) -> fidl::Channel {
82 self.client.into_channel()
83 }
84
85 pub fn wait_for_event(
88 &self,
89 deadline: zx::MonotonicInstant,
90 ) -> Result<DeviceIdentificationEvent, fidl::Error> {
91 DeviceIdentificationEvent::decode(self.client.wait_for_event(deadline)?)
92 }
93
94 pub fn r#set_device_identification(
118 &self,
119 mut records: &[DeviceIdentificationRecord],
120 mut token: fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
121 ___deadline: zx::MonotonicInstant,
122 ) -> Result<DeviceIdentificationSetDeviceIdentificationResult, fidl::Error> {
123 let _response = self.client.send_query::<
124 DeviceIdentificationSetDeviceIdentificationRequest,
125 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
126 >(
127 (records, token,),
128 0x12ada3cb3fbcbd0a,
129 fidl::encoding::DynamicFlags::empty(),
130 ___deadline,
131 )?;
132 Ok(_response.map(|x| x))
133 }
134}
135
136#[cfg(target_os = "fuchsia")]
137impl From<DeviceIdentificationSynchronousProxy> for zx::Handle {
138 fn from(value: DeviceIdentificationSynchronousProxy) -> Self {
139 value.into_channel().into()
140 }
141}
142
143#[cfg(target_os = "fuchsia")]
144impl From<fidl::Channel> for DeviceIdentificationSynchronousProxy {
145 fn from(value: fidl::Channel) -> Self {
146 Self::new(value)
147 }
148}
149
150#[cfg(target_os = "fuchsia")]
151impl fidl::endpoints::FromClient for DeviceIdentificationSynchronousProxy {
152 type Protocol = DeviceIdentificationMarker;
153
154 fn from_client(value: fidl::endpoints::ClientEnd<DeviceIdentificationMarker>) -> Self {
155 Self::new(value.into_channel())
156 }
157}
158
159#[derive(Debug, Clone)]
160pub struct DeviceIdentificationProxy {
161 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
162}
163
164impl fidl::endpoints::Proxy for DeviceIdentificationProxy {
165 type Protocol = DeviceIdentificationMarker;
166
167 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
168 Self::new(inner)
169 }
170
171 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
172 self.client.into_channel().map_err(|client| Self { client })
173 }
174
175 fn as_channel(&self) -> &::fidl::AsyncChannel {
176 self.client.as_channel()
177 }
178}
179
180impl DeviceIdentificationProxy {
181 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
183 let protocol_name =
184 <DeviceIdentificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
185 Self { client: fidl::client::Client::new(channel, protocol_name) }
186 }
187
188 pub fn take_event_stream(&self) -> DeviceIdentificationEventStream {
194 DeviceIdentificationEventStream { event_receiver: self.client.take_event_receiver() }
195 }
196
197 pub fn r#set_device_identification(
221 &self,
222 mut records: &[DeviceIdentificationRecord],
223 mut token: fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
224 ) -> fidl::client::QueryResponseFut<
225 DeviceIdentificationSetDeviceIdentificationResult,
226 fidl::encoding::DefaultFuchsiaResourceDialect,
227 > {
228 DeviceIdentificationProxyInterface::r#set_device_identification(self, records, token)
229 }
230}
231
232impl DeviceIdentificationProxyInterface for DeviceIdentificationProxy {
233 type SetDeviceIdentificationResponseFut = fidl::client::QueryResponseFut<
234 DeviceIdentificationSetDeviceIdentificationResult,
235 fidl::encoding::DefaultFuchsiaResourceDialect,
236 >;
237 fn r#set_device_identification(
238 &self,
239 mut records: &[DeviceIdentificationRecord],
240 mut token: fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
241 ) -> Self::SetDeviceIdentificationResponseFut {
242 fn _decode(
243 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
244 ) -> Result<DeviceIdentificationSetDeviceIdentificationResult, fidl::Error> {
245 let _response = fidl::client::decode_transaction_body::<
246 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
247 fidl::encoding::DefaultFuchsiaResourceDialect,
248 0x12ada3cb3fbcbd0a,
249 >(_buf?)?;
250 Ok(_response.map(|x| x))
251 }
252 self.client.send_query_and_decode::<
253 DeviceIdentificationSetDeviceIdentificationRequest,
254 DeviceIdentificationSetDeviceIdentificationResult,
255 >(
256 (records, token,),
257 0x12ada3cb3fbcbd0a,
258 fidl::encoding::DynamicFlags::empty(),
259 _decode,
260 )
261 }
262}
263
264pub struct DeviceIdentificationEventStream {
265 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
266}
267
268impl std::marker::Unpin for DeviceIdentificationEventStream {}
269
270impl futures::stream::FusedStream for DeviceIdentificationEventStream {
271 fn is_terminated(&self) -> bool {
272 self.event_receiver.is_terminated()
273 }
274}
275
276impl futures::Stream for DeviceIdentificationEventStream {
277 type Item = Result<DeviceIdentificationEvent, fidl::Error>;
278
279 fn poll_next(
280 mut self: std::pin::Pin<&mut Self>,
281 cx: &mut std::task::Context<'_>,
282 ) -> std::task::Poll<Option<Self::Item>> {
283 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
284 &mut self.event_receiver,
285 cx
286 )?) {
287 Some(buf) => std::task::Poll::Ready(Some(DeviceIdentificationEvent::decode(buf))),
288 None => std::task::Poll::Ready(None),
289 }
290 }
291}
292
293#[derive(Debug)]
294pub enum DeviceIdentificationEvent {}
295
296impl DeviceIdentificationEvent {
297 fn decode(
299 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
300 ) -> Result<DeviceIdentificationEvent, fidl::Error> {
301 let (bytes, _handles) = buf.split_mut();
302 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
303 debug_assert_eq!(tx_header.tx_id, 0);
304 match tx_header.ordinal {
305 _ => Err(fidl::Error::UnknownOrdinal {
306 ordinal: tx_header.ordinal,
307 protocol_name:
308 <DeviceIdentificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
309 }),
310 }
311 }
312}
313
314pub struct DeviceIdentificationRequestStream {
316 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
317 is_terminated: bool,
318}
319
320impl std::marker::Unpin for DeviceIdentificationRequestStream {}
321
322impl futures::stream::FusedStream for DeviceIdentificationRequestStream {
323 fn is_terminated(&self) -> bool {
324 self.is_terminated
325 }
326}
327
328impl fidl::endpoints::RequestStream for DeviceIdentificationRequestStream {
329 type Protocol = DeviceIdentificationMarker;
330 type ControlHandle = DeviceIdentificationControlHandle;
331
332 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
333 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
334 }
335
336 fn control_handle(&self) -> Self::ControlHandle {
337 DeviceIdentificationControlHandle { inner: self.inner.clone() }
338 }
339
340 fn into_inner(
341 self,
342 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
343 {
344 (self.inner, self.is_terminated)
345 }
346
347 fn from_inner(
348 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
349 is_terminated: bool,
350 ) -> Self {
351 Self { inner, is_terminated }
352 }
353}
354
355impl futures::Stream for DeviceIdentificationRequestStream {
356 type Item = Result<DeviceIdentificationRequest, fidl::Error>;
357
358 fn poll_next(
359 mut self: std::pin::Pin<&mut Self>,
360 cx: &mut std::task::Context<'_>,
361 ) -> std::task::Poll<Option<Self::Item>> {
362 let this = &mut *self;
363 if this.inner.check_shutdown(cx) {
364 this.is_terminated = true;
365 return std::task::Poll::Ready(None);
366 }
367 if this.is_terminated {
368 panic!("polled DeviceIdentificationRequestStream after completion");
369 }
370 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
371 |bytes, handles| {
372 match this.inner.channel().read_etc(cx, bytes, handles) {
373 std::task::Poll::Ready(Ok(())) => {}
374 std::task::Poll::Pending => return std::task::Poll::Pending,
375 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
376 this.is_terminated = true;
377 return std::task::Poll::Ready(None);
378 }
379 std::task::Poll::Ready(Err(e)) => {
380 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
381 e.into(),
382 ))))
383 }
384 }
385
386 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
388
389 std::task::Poll::Ready(Some(match header.ordinal {
390 0x12ada3cb3fbcbd0a => {
391 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
392 let mut req = fidl::new_empty!(DeviceIdentificationSetDeviceIdentificationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
393 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceIdentificationSetDeviceIdentificationRequest>(&header, _body_bytes, handles, &mut req)?;
394 let control_handle = DeviceIdentificationControlHandle {
395 inner: this.inner.clone(),
396 };
397 Ok(DeviceIdentificationRequest::SetDeviceIdentification {records: req.records,
398token: req.token,
399
400 responder: DeviceIdentificationSetDeviceIdentificationResponder {
401 control_handle: std::mem::ManuallyDrop::new(control_handle),
402 tx_id: header.tx_id,
403 },
404 })
405 }
406 _ => Err(fidl::Error::UnknownOrdinal {
407 ordinal: header.ordinal,
408 protocol_name: <DeviceIdentificationMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
409 }),
410 }))
411 },
412 )
413 }
414}
415
416#[derive(Debug)]
418pub enum DeviceIdentificationRequest {
419 SetDeviceIdentification {
443 records: Vec<DeviceIdentificationRecord>,
444 token: fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
445 responder: DeviceIdentificationSetDeviceIdentificationResponder,
446 },
447}
448
449impl DeviceIdentificationRequest {
450 #[allow(irrefutable_let_patterns)]
451 pub fn into_set_device_identification(
452 self,
453 ) -> Option<(
454 Vec<DeviceIdentificationRecord>,
455 fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
456 DeviceIdentificationSetDeviceIdentificationResponder,
457 )> {
458 if let DeviceIdentificationRequest::SetDeviceIdentification { records, token, responder } =
459 self
460 {
461 Some((records, token, responder))
462 } else {
463 None
464 }
465 }
466
467 pub fn method_name(&self) -> &'static str {
469 match *self {
470 DeviceIdentificationRequest::SetDeviceIdentification { .. } => {
471 "set_device_identification"
472 }
473 }
474 }
475}
476
477#[derive(Debug, Clone)]
478pub struct DeviceIdentificationControlHandle {
479 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
480}
481
482impl fidl::endpoints::ControlHandle for DeviceIdentificationControlHandle {
483 fn shutdown(&self) {
484 self.inner.shutdown()
485 }
486 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
487 self.inner.shutdown_with_epitaph(status)
488 }
489
490 fn is_closed(&self) -> bool {
491 self.inner.channel().is_closed()
492 }
493 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
494 self.inner.channel().on_closed()
495 }
496
497 #[cfg(target_os = "fuchsia")]
498 fn signal_peer(
499 &self,
500 clear_mask: zx::Signals,
501 set_mask: zx::Signals,
502 ) -> Result<(), zx_status::Status> {
503 use fidl::Peered;
504 self.inner.channel().signal_peer(clear_mask, set_mask)
505 }
506}
507
508impl DeviceIdentificationControlHandle {}
509
510#[must_use = "FIDL methods require a response to be sent"]
511#[derive(Debug)]
512pub struct DeviceIdentificationSetDeviceIdentificationResponder {
513 control_handle: std::mem::ManuallyDrop<DeviceIdentificationControlHandle>,
514 tx_id: u32,
515}
516
517impl std::ops::Drop for DeviceIdentificationSetDeviceIdentificationResponder {
521 fn drop(&mut self) {
522 self.control_handle.shutdown();
523 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
525 }
526}
527
528impl fidl::endpoints::Responder for DeviceIdentificationSetDeviceIdentificationResponder {
529 type ControlHandle = DeviceIdentificationControlHandle;
530
531 fn control_handle(&self) -> &DeviceIdentificationControlHandle {
532 &self.control_handle
533 }
534
535 fn drop_without_shutdown(mut self) {
536 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
538 std::mem::forget(self);
540 }
541}
542
543impl DeviceIdentificationSetDeviceIdentificationResponder {
544 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
548 let _result = self.send_raw(result);
549 if _result.is_err() {
550 self.control_handle.shutdown();
551 }
552 self.drop_without_shutdown();
553 _result
554 }
555
556 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
558 let _result = self.send_raw(result);
559 self.drop_without_shutdown();
560 _result
561 }
562
563 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
564 self.control_handle
565 .inner
566 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
567 result,
568 self.tx_id,
569 0x12ada3cb3fbcbd0a,
570 fidl::encoding::DynamicFlags::empty(),
571 )
572 }
573}
574
575#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
576pub struct DeviceIdentificationHandleMarker;
577
578impl fidl::endpoints::ProtocolMarker for DeviceIdentificationHandleMarker {
579 type Proxy = DeviceIdentificationHandleProxy;
580 type RequestStream = DeviceIdentificationHandleRequestStream;
581 #[cfg(target_os = "fuchsia")]
582 type SynchronousProxy = DeviceIdentificationHandleSynchronousProxy;
583
584 const DEBUG_NAME: &'static str = "(anonymous) DeviceIdentificationHandle";
585}
586
587pub trait DeviceIdentificationHandleProxyInterface: Send + Sync {}
588#[derive(Debug)]
589#[cfg(target_os = "fuchsia")]
590pub struct DeviceIdentificationHandleSynchronousProxy {
591 client: fidl::client::sync::Client,
592}
593
594#[cfg(target_os = "fuchsia")]
595impl fidl::endpoints::SynchronousProxy for DeviceIdentificationHandleSynchronousProxy {
596 type Proxy = DeviceIdentificationHandleProxy;
597 type Protocol = DeviceIdentificationHandleMarker;
598
599 fn from_channel(inner: fidl::Channel) -> Self {
600 Self::new(inner)
601 }
602
603 fn into_channel(self) -> fidl::Channel {
604 self.client.into_channel()
605 }
606
607 fn as_channel(&self) -> &fidl::Channel {
608 self.client.as_channel()
609 }
610}
611
612#[cfg(target_os = "fuchsia")]
613impl DeviceIdentificationHandleSynchronousProxy {
614 pub fn new(channel: fidl::Channel) -> Self {
615 let protocol_name =
616 <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
617 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
618 }
619
620 pub fn into_channel(self) -> fidl::Channel {
621 self.client.into_channel()
622 }
623
624 pub fn wait_for_event(
627 &self,
628 deadline: zx::MonotonicInstant,
629 ) -> Result<DeviceIdentificationHandleEvent, fidl::Error> {
630 DeviceIdentificationHandleEvent::decode(self.client.wait_for_event(deadline)?)
631 }
632}
633
634#[cfg(target_os = "fuchsia")]
635impl From<DeviceIdentificationHandleSynchronousProxy> for zx::Handle {
636 fn from(value: DeviceIdentificationHandleSynchronousProxy) -> Self {
637 value.into_channel().into()
638 }
639}
640
641#[cfg(target_os = "fuchsia")]
642impl From<fidl::Channel> for DeviceIdentificationHandleSynchronousProxy {
643 fn from(value: fidl::Channel) -> Self {
644 Self::new(value)
645 }
646}
647
648#[cfg(target_os = "fuchsia")]
649impl fidl::endpoints::FromClient for DeviceIdentificationHandleSynchronousProxy {
650 type Protocol = DeviceIdentificationHandleMarker;
651
652 fn from_client(value: fidl::endpoints::ClientEnd<DeviceIdentificationHandleMarker>) -> Self {
653 Self::new(value.into_channel())
654 }
655}
656
657#[derive(Debug, Clone)]
658pub struct DeviceIdentificationHandleProxy {
659 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
660}
661
662impl fidl::endpoints::Proxy for DeviceIdentificationHandleProxy {
663 type Protocol = DeviceIdentificationHandleMarker;
664
665 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
666 Self::new(inner)
667 }
668
669 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
670 self.client.into_channel().map_err(|client| Self { client })
671 }
672
673 fn as_channel(&self) -> &::fidl::AsyncChannel {
674 self.client.as_channel()
675 }
676}
677
678impl DeviceIdentificationHandleProxy {
679 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
681 let protocol_name =
682 <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
683 Self { client: fidl::client::Client::new(channel, protocol_name) }
684 }
685
686 pub fn take_event_stream(&self) -> DeviceIdentificationHandleEventStream {
692 DeviceIdentificationHandleEventStream { event_receiver: self.client.take_event_receiver() }
693 }
694}
695
696impl DeviceIdentificationHandleProxyInterface for DeviceIdentificationHandleProxy {}
697
698pub struct DeviceIdentificationHandleEventStream {
699 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
700}
701
702impl std::marker::Unpin for DeviceIdentificationHandleEventStream {}
703
704impl futures::stream::FusedStream for DeviceIdentificationHandleEventStream {
705 fn is_terminated(&self) -> bool {
706 self.event_receiver.is_terminated()
707 }
708}
709
710impl futures::Stream for DeviceIdentificationHandleEventStream {
711 type Item = Result<DeviceIdentificationHandleEvent, fidl::Error>;
712
713 fn poll_next(
714 mut self: std::pin::Pin<&mut Self>,
715 cx: &mut std::task::Context<'_>,
716 ) -> std::task::Poll<Option<Self::Item>> {
717 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
718 &mut self.event_receiver,
719 cx
720 )?) {
721 Some(buf) => std::task::Poll::Ready(Some(DeviceIdentificationHandleEvent::decode(buf))),
722 None => std::task::Poll::Ready(None),
723 }
724 }
725}
726
727#[derive(Debug)]
728pub enum DeviceIdentificationHandleEvent {}
729
730impl DeviceIdentificationHandleEvent {
731 fn decode(
733 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
734 ) -> Result<DeviceIdentificationHandleEvent, fidl::Error> {
735 let (bytes, _handles) = buf.split_mut();
736 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
737 debug_assert_eq!(tx_header.tx_id, 0);
738 match tx_header.ordinal {
739 _ => Err(fidl::Error::UnknownOrdinal {
740 ordinal: tx_header.ordinal,
741 protocol_name: <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
742 })
743 }
744 }
745}
746
747pub struct DeviceIdentificationHandleRequestStream {
749 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
750 is_terminated: bool,
751}
752
753impl std::marker::Unpin for DeviceIdentificationHandleRequestStream {}
754
755impl futures::stream::FusedStream for DeviceIdentificationHandleRequestStream {
756 fn is_terminated(&self) -> bool {
757 self.is_terminated
758 }
759}
760
761impl fidl::endpoints::RequestStream for DeviceIdentificationHandleRequestStream {
762 type Protocol = DeviceIdentificationHandleMarker;
763 type ControlHandle = DeviceIdentificationHandleControlHandle;
764
765 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
766 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
767 }
768
769 fn control_handle(&self) -> Self::ControlHandle {
770 DeviceIdentificationHandleControlHandle { inner: self.inner.clone() }
771 }
772
773 fn into_inner(
774 self,
775 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
776 {
777 (self.inner, self.is_terminated)
778 }
779
780 fn from_inner(
781 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
782 is_terminated: bool,
783 ) -> Self {
784 Self { inner, is_terminated }
785 }
786}
787
788impl futures::Stream for DeviceIdentificationHandleRequestStream {
789 type Item = Result<DeviceIdentificationHandleRequest, fidl::Error>;
790
791 fn poll_next(
792 mut self: std::pin::Pin<&mut Self>,
793 cx: &mut std::task::Context<'_>,
794 ) -> std::task::Poll<Option<Self::Item>> {
795 let this = &mut *self;
796 if this.inner.check_shutdown(cx) {
797 this.is_terminated = true;
798 return std::task::Poll::Ready(None);
799 }
800 if this.is_terminated {
801 panic!("polled DeviceIdentificationHandleRequestStream after completion");
802 }
803 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
804 |bytes, handles| {
805 match this.inner.channel().read_etc(cx, bytes, handles) {
806 std::task::Poll::Ready(Ok(())) => {}
807 std::task::Poll::Pending => return std::task::Poll::Pending,
808 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
809 this.is_terminated = true;
810 return std::task::Poll::Ready(None);
811 }
812 std::task::Poll::Ready(Err(e)) => {
813 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
814 e.into(),
815 ))))
816 }
817 }
818
819 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
821
822 std::task::Poll::Ready(Some(match header.ordinal {
823 _ => Err(fidl::Error::UnknownOrdinal {
824 ordinal: header.ordinal,
825 protocol_name: <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
826 }),
827 }))
828 },
829 )
830 }
831}
832
833#[derive(Debug)]
836pub enum DeviceIdentificationHandleRequest {}
837
838impl DeviceIdentificationHandleRequest {
839 pub fn method_name(&self) -> &'static str {
841 match *self {}
842 }
843}
844
845#[derive(Debug, Clone)]
846pub struct DeviceIdentificationHandleControlHandle {
847 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
848}
849
850impl fidl::endpoints::ControlHandle for DeviceIdentificationHandleControlHandle {
851 fn shutdown(&self) {
852 self.inner.shutdown()
853 }
854 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
855 self.inner.shutdown_with_epitaph(status)
856 }
857
858 fn is_closed(&self) -> bool {
859 self.inner.channel().is_closed()
860 }
861 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
862 self.inner.channel().on_closed()
863 }
864
865 #[cfg(target_os = "fuchsia")]
866 fn signal_peer(
867 &self,
868 clear_mask: zx::Signals,
869 set_mask: zx::Signals,
870 ) -> Result<(), zx_status::Status> {
871 use fidl::Peered;
872 self.inner.channel().signal_peer(clear_mask, set_mask)
873 }
874}
875
876impl DeviceIdentificationHandleControlHandle {}
877
878mod internal {
879 use super::*;
880
881 impl fidl::encoding::ResourceTypeMarker for DeviceIdentificationSetDeviceIdentificationRequest {
882 type Borrowed<'a> = &'a mut Self;
883 fn take_or_borrow<'a>(
884 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
885 ) -> Self::Borrowed<'a> {
886 value
887 }
888 }
889
890 unsafe impl fidl::encoding::TypeMarker for DeviceIdentificationSetDeviceIdentificationRequest {
891 type Owned = Self;
892
893 #[inline(always)]
894 fn inline_align(_context: fidl::encoding::Context) -> usize {
895 8
896 }
897
898 #[inline(always)]
899 fn inline_size(_context: fidl::encoding::Context) -> usize {
900 24
901 }
902 }
903
904 unsafe impl
905 fidl::encoding::Encode<
906 DeviceIdentificationSetDeviceIdentificationRequest,
907 fidl::encoding::DefaultFuchsiaResourceDialect,
908 > for &mut DeviceIdentificationSetDeviceIdentificationRequest
909 {
910 #[inline]
911 unsafe fn encode(
912 self,
913 encoder: &mut fidl::encoding::Encoder<
914 '_,
915 fidl::encoding::DefaultFuchsiaResourceDialect,
916 >,
917 offset: usize,
918 _depth: fidl::encoding::Depth,
919 ) -> fidl::Result<()> {
920 encoder
921 .debug_check_bounds::<DeviceIdentificationSetDeviceIdentificationRequest>(offset);
922 fidl::encoding::Encode::<DeviceIdentificationSetDeviceIdentificationRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
924 (
925 <fidl::encoding::Vector<DeviceIdentificationRecord, 3> as fidl::encoding::ValueTypeMarker>::borrow(&self.records),
926 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
927 ),
928 encoder, offset, _depth
929 )
930 }
931 }
932 unsafe impl<
933 T0: fidl::encoding::Encode<
934 fidl::encoding::Vector<DeviceIdentificationRecord, 3>,
935 fidl::encoding::DefaultFuchsiaResourceDialect,
936 >,
937 T1: fidl::encoding::Encode<
938 fidl::encoding::Endpoint<
939 fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
940 >,
941 fidl::encoding::DefaultFuchsiaResourceDialect,
942 >,
943 >
944 fidl::encoding::Encode<
945 DeviceIdentificationSetDeviceIdentificationRequest,
946 fidl::encoding::DefaultFuchsiaResourceDialect,
947 > for (T0, T1)
948 {
949 #[inline]
950 unsafe fn encode(
951 self,
952 encoder: &mut fidl::encoding::Encoder<
953 '_,
954 fidl::encoding::DefaultFuchsiaResourceDialect,
955 >,
956 offset: usize,
957 depth: fidl::encoding::Depth,
958 ) -> fidl::Result<()> {
959 encoder
960 .debug_check_bounds::<DeviceIdentificationSetDeviceIdentificationRequest>(offset);
961 unsafe {
964 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
965 (ptr as *mut u64).write_unaligned(0);
966 }
967 self.0.encode(encoder, offset + 0, depth)?;
969 self.1.encode(encoder, offset + 16, depth)?;
970 Ok(())
971 }
972 }
973
974 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
975 for DeviceIdentificationSetDeviceIdentificationRequest
976 {
977 #[inline(always)]
978 fn new_empty() -> Self {
979 Self {
980 records: fidl::new_empty!(fidl::encoding::Vector<DeviceIdentificationRecord, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
981 token: fidl::new_empty!(
982 fidl::encoding::Endpoint<
983 fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
984 >,
985 fidl::encoding::DefaultFuchsiaResourceDialect
986 ),
987 }
988 }
989
990 #[inline]
991 unsafe fn decode(
992 &mut self,
993 decoder: &mut fidl::encoding::Decoder<
994 '_,
995 fidl::encoding::DefaultFuchsiaResourceDialect,
996 >,
997 offset: usize,
998 _depth: fidl::encoding::Depth,
999 ) -> fidl::Result<()> {
1000 decoder.debug_check_bounds::<Self>(offset);
1001 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1003 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1004 let mask = 0xffffffff00000000u64;
1005 let maskedval = padval & mask;
1006 if maskedval != 0 {
1007 return Err(fidl::Error::NonZeroPadding {
1008 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1009 });
1010 }
1011 fidl::decode!(fidl::encoding::Vector<DeviceIdentificationRecord, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.records, decoder, offset + 0, _depth)?;
1012 fidl::decode!(
1013 fidl::encoding::Endpoint<
1014 fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
1015 >,
1016 fidl::encoding::DefaultFuchsiaResourceDialect,
1017 &mut self.token,
1018 decoder,
1019 offset + 16,
1020 _depth
1021 )?;
1022 Ok(())
1023 }
1024 }
1025}