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::NullableHandle {
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
487 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
488 self.inner.shutdown_with_epitaph(status)
489 }
490
491 fn is_closed(&self) -> bool {
492 self.inner.channel().is_closed()
493 }
494 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
495 self.inner.channel().on_closed()
496 }
497
498 #[cfg(target_os = "fuchsia")]
499 fn signal_peer(
500 &self,
501 clear_mask: zx::Signals,
502 set_mask: zx::Signals,
503 ) -> Result<(), zx_status::Status> {
504 use fidl::Peered;
505 self.inner.channel().signal_peer(clear_mask, set_mask)
506 }
507}
508
509impl DeviceIdentificationControlHandle {}
510
511#[must_use = "FIDL methods require a response to be sent"]
512#[derive(Debug)]
513pub struct DeviceIdentificationSetDeviceIdentificationResponder {
514 control_handle: std::mem::ManuallyDrop<DeviceIdentificationControlHandle>,
515 tx_id: u32,
516}
517
518impl std::ops::Drop for DeviceIdentificationSetDeviceIdentificationResponder {
522 fn drop(&mut self) {
523 self.control_handle.shutdown();
524 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
526 }
527}
528
529impl fidl::endpoints::Responder for DeviceIdentificationSetDeviceIdentificationResponder {
530 type ControlHandle = DeviceIdentificationControlHandle;
531
532 fn control_handle(&self) -> &DeviceIdentificationControlHandle {
533 &self.control_handle
534 }
535
536 fn drop_without_shutdown(mut self) {
537 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
539 std::mem::forget(self);
541 }
542}
543
544impl DeviceIdentificationSetDeviceIdentificationResponder {
545 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
549 let _result = self.send_raw(result);
550 if _result.is_err() {
551 self.control_handle.shutdown();
552 }
553 self.drop_without_shutdown();
554 _result
555 }
556
557 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
559 let _result = self.send_raw(result);
560 self.drop_without_shutdown();
561 _result
562 }
563
564 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
565 self.control_handle
566 .inner
567 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
568 result,
569 self.tx_id,
570 0x12ada3cb3fbcbd0a,
571 fidl::encoding::DynamicFlags::empty(),
572 )
573 }
574}
575
576#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
577pub struct DeviceIdentificationHandleMarker;
578
579impl fidl::endpoints::ProtocolMarker for DeviceIdentificationHandleMarker {
580 type Proxy = DeviceIdentificationHandleProxy;
581 type RequestStream = DeviceIdentificationHandleRequestStream;
582 #[cfg(target_os = "fuchsia")]
583 type SynchronousProxy = DeviceIdentificationHandleSynchronousProxy;
584
585 const DEBUG_NAME: &'static str = "(anonymous) DeviceIdentificationHandle";
586}
587
588pub trait DeviceIdentificationHandleProxyInterface: Send + Sync {}
589#[derive(Debug)]
590#[cfg(target_os = "fuchsia")]
591pub struct DeviceIdentificationHandleSynchronousProxy {
592 client: fidl::client::sync::Client,
593}
594
595#[cfg(target_os = "fuchsia")]
596impl fidl::endpoints::SynchronousProxy for DeviceIdentificationHandleSynchronousProxy {
597 type Proxy = DeviceIdentificationHandleProxy;
598 type Protocol = DeviceIdentificationHandleMarker;
599
600 fn from_channel(inner: fidl::Channel) -> Self {
601 Self::new(inner)
602 }
603
604 fn into_channel(self) -> fidl::Channel {
605 self.client.into_channel()
606 }
607
608 fn as_channel(&self) -> &fidl::Channel {
609 self.client.as_channel()
610 }
611}
612
613#[cfg(target_os = "fuchsia")]
614impl DeviceIdentificationHandleSynchronousProxy {
615 pub fn new(channel: fidl::Channel) -> Self {
616 let protocol_name =
617 <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
618 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
619 }
620
621 pub fn into_channel(self) -> fidl::Channel {
622 self.client.into_channel()
623 }
624
625 pub fn wait_for_event(
628 &self,
629 deadline: zx::MonotonicInstant,
630 ) -> Result<DeviceIdentificationHandleEvent, fidl::Error> {
631 DeviceIdentificationHandleEvent::decode(self.client.wait_for_event(deadline)?)
632 }
633}
634
635#[cfg(target_os = "fuchsia")]
636impl From<DeviceIdentificationHandleSynchronousProxy> for zx::NullableHandle {
637 fn from(value: DeviceIdentificationHandleSynchronousProxy) -> Self {
638 value.into_channel().into()
639 }
640}
641
642#[cfg(target_os = "fuchsia")]
643impl From<fidl::Channel> for DeviceIdentificationHandleSynchronousProxy {
644 fn from(value: fidl::Channel) -> Self {
645 Self::new(value)
646 }
647}
648
649#[cfg(target_os = "fuchsia")]
650impl fidl::endpoints::FromClient for DeviceIdentificationHandleSynchronousProxy {
651 type Protocol = DeviceIdentificationHandleMarker;
652
653 fn from_client(value: fidl::endpoints::ClientEnd<DeviceIdentificationHandleMarker>) -> Self {
654 Self::new(value.into_channel())
655 }
656}
657
658#[derive(Debug, Clone)]
659pub struct DeviceIdentificationHandleProxy {
660 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
661}
662
663impl fidl::endpoints::Proxy for DeviceIdentificationHandleProxy {
664 type Protocol = DeviceIdentificationHandleMarker;
665
666 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
667 Self::new(inner)
668 }
669
670 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
671 self.client.into_channel().map_err(|client| Self { client })
672 }
673
674 fn as_channel(&self) -> &::fidl::AsyncChannel {
675 self.client.as_channel()
676 }
677}
678
679impl DeviceIdentificationHandleProxy {
680 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
682 let protocol_name =
683 <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
684 Self { client: fidl::client::Client::new(channel, protocol_name) }
685 }
686
687 pub fn take_event_stream(&self) -> DeviceIdentificationHandleEventStream {
693 DeviceIdentificationHandleEventStream { event_receiver: self.client.take_event_receiver() }
694 }
695}
696
697impl DeviceIdentificationHandleProxyInterface for DeviceIdentificationHandleProxy {}
698
699pub struct DeviceIdentificationHandleEventStream {
700 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
701}
702
703impl std::marker::Unpin for DeviceIdentificationHandleEventStream {}
704
705impl futures::stream::FusedStream for DeviceIdentificationHandleEventStream {
706 fn is_terminated(&self) -> bool {
707 self.event_receiver.is_terminated()
708 }
709}
710
711impl futures::Stream for DeviceIdentificationHandleEventStream {
712 type Item = Result<DeviceIdentificationHandleEvent, fidl::Error>;
713
714 fn poll_next(
715 mut self: std::pin::Pin<&mut Self>,
716 cx: &mut std::task::Context<'_>,
717 ) -> std::task::Poll<Option<Self::Item>> {
718 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
719 &mut self.event_receiver,
720 cx
721 )?) {
722 Some(buf) => std::task::Poll::Ready(Some(DeviceIdentificationHandleEvent::decode(buf))),
723 None => std::task::Poll::Ready(None),
724 }
725 }
726}
727
728#[derive(Debug)]
729pub enum DeviceIdentificationHandleEvent {}
730
731impl DeviceIdentificationHandleEvent {
732 fn decode(
734 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
735 ) -> Result<DeviceIdentificationHandleEvent, fidl::Error> {
736 let (bytes, _handles) = buf.split_mut();
737 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
738 debug_assert_eq!(tx_header.tx_id, 0);
739 match tx_header.ordinal {
740 _ => Err(fidl::Error::UnknownOrdinal {
741 ordinal: tx_header.ordinal,
742 protocol_name: <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
743 })
744 }
745 }
746}
747
748pub struct DeviceIdentificationHandleRequestStream {
750 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
751 is_terminated: bool,
752}
753
754impl std::marker::Unpin for DeviceIdentificationHandleRequestStream {}
755
756impl futures::stream::FusedStream for DeviceIdentificationHandleRequestStream {
757 fn is_terminated(&self) -> bool {
758 self.is_terminated
759 }
760}
761
762impl fidl::endpoints::RequestStream for DeviceIdentificationHandleRequestStream {
763 type Protocol = DeviceIdentificationHandleMarker;
764 type ControlHandle = DeviceIdentificationHandleControlHandle;
765
766 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
767 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
768 }
769
770 fn control_handle(&self) -> Self::ControlHandle {
771 DeviceIdentificationHandleControlHandle { inner: self.inner.clone() }
772 }
773
774 fn into_inner(
775 self,
776 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
777 {
778 (self.inner, self.is_terminated)
779 }
780
781 fn from_inner(
782 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
783 is_terminated: bool,
784 ) -> Self {
785 Self { inner, is_terminated }
786 }
787}
788
789impl futures::Stream for DeviceIdentificationHandleRequestStream {
790 type Item = Result<DeviceIdentificationHandleRequest, fidl::Error>;
791
792 fn poll_next(
793 mut self: std::pin::Pin<&mut Self>,
794 cx: &mut std::task::Context<'_>,
795 ) -> std::task::Poll<Option<Self::Item>> {
796 let this = &mut *self;
797 if this.inner.check_shutdown(cx) {
798 this.is_terminated = true;
799 return std::task::Poll::Ready(None);
800 }
801 if this.is_terminated {
802 panic!("polled DeviceIdentificationHandleRequestStream after completion");
803 }
804 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
805 |bytes, handles| {
806 match this.inner.channel().read_etc(cx, bytes, handles) {
807 std::task::Poll::Ready(Ok(())) => {}
808 std::task::Poll::Pending => return std::task::Poll::Pending,
809 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
810 this.is_terminated = true;
811 return std::task::Poll::Ready(None);
812 }
813 std::task::Poll::Ready(Err(e)) => {
814 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
815 e.into(),
816 ))));
817 }
818 }
819
820 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
822
823 std::task::Poll::Ready(Some(match header.ordinal {
824 _ => Err(fidl::Error::UnknownOrdinal {
825 ordinal: header.ordinal,
826 protocol_name: <DeviceIdentificationHandleMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
827 }),
828 }))
829 },
830 )
831 }
832}
833
834#[derive(Debug)]
837pub enum DeviceIdentificationHandleRequest {}
838
839impl DeviceIdentificationHandleRequest {
840 pub fn method_name(&self) -> &'static str {
842 match *self {}
843 }
844}
845
846#[derive(Debug, Clone)]
847pub struct DeviceIdentificationHandleControlHandle {
848 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
849}
850
851impl fidl::endpoints::ControlHandle for DeviceIdentificationHandleControlHandle {
852 fn shutdown(&self) {
853 self.inner.shutdown()
854 }
855
856 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
857 self.inner.shutdown_with_epitaph(status)
858 }
859
860 fn is_closed(&self) -> bool {
861 self.inner.channel().is_closed()
862 }
863 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
864 self.inner.channel().on_closed()
865 }
866
867 #[cfg(target_os = "fuchsia")]
868 fn signal_peer(
869 &self,
870 clear_mask: zx::Signals,
871 set_mask: zx::Signals,
872 ) -> Result<(), zx_status::Status> {
873 use fidl::Peered;
874 self.inner.channel().signal_peer(clear_mask, set_mask)
875 }
876}
877
878impl DeviceIdentificationHandleControlHandle {}
879
880mod internal {
881 use super::*;
882
883 impl fidl::encoding::ResourceTypeMarker for DeviceIdentificationSetDeviceIdentificationRequest {
884 type Borrowed<'a> = &'a mut Self;
885 fn take_or_borrow<'a>(
886 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
887 ) -> Self::Borrowed<'a> {
888 value
889 }
890 }
891
892 unsafe impl fidl::encoding::TypeMarker for DeviceIdentificationSetDeviceIdentificationRequest {
893 type Owned = Self;
894
895 #[inline(always)]
896 fn inline_align(_context: fidl::encoding::Context) -> usize {
897 8
898 }
899
900 #[inline(always)]
901 fn inline_size(_context: fidl::encoding::Context) -> usize {
902 24
903 }
904 }
905
906 unsafe impl
907 fidl::encoding::Encode<
908 DeviceIdentificationSetDeviceIdentificationRequest,
909 fidl::encoding::DefaultFuchsiaResourceDialect,
910 > for &mut DeviceIdentificationSetDeviceIdentificationRequest
911 {
912 #[inline]
913 unsafe fn encode(
914 self,
915 encoder: &mut fidl::encoding::Encoder<
916 '_,
917 fidl::encoding::DefaultFuchsiaResourceDialect,
918 >,
919 offset: usize,
920 _depth: fidl::encoding::Depth,
921 ) -> fidl::Result<()> {
922 encoder
923 .debug_check_bounds::<DeviceIdentificationSetDeviceIdentificationRequest>(offset);
924 fidl::encoding::Encode::<DeviceIdentificationSetDeviceIdentificationRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
926 (
927 <fidl::encoding::Vector<DeviceIdentificationRecord, 3> as fidl::encoding::ValueTypeMarker>::borrow(&self.records),
928 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.token),
929 ),
930 encoder, offset, _depth
931 )
932 }
933 }
934 unsafe impl<
935 T0: fidl::encoding::Encode<
936 fidl::encoding::Vector<DeviceIdentificationRecord, 3>,
937 fidl::encoding::DefaultFuchsiaResourceDialect,
938 >,
939 T1: fidl::encoding::Encode<
940 fidl::encoding::Endpoint<
941 fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
942 >,
943 fidl::encoding::DefaultFuchsiaResourceDialect,
944 >,
945 >
946 fidl::encoding::Encode<
947 DeviceIdentificationSetDeviceIdentificationRequest,
948 fidl::encoding::DefaultFuchsiaResourceDialect,
949 > for (T0, T1)
950 {
951 #[inline]
952 unsafe fn encode(
953 self,
954 encoder: &mut fidl::encoding::Encoder<
955 '_,
956 fidl::encoding::DefaultFuchsiaResourceDialect,
957 >,
958 offset: usize,
959 depth: fidl::encoding::Depth,
960 ) -> fidl::Result<()> {
961 encoder
962 .debug_check_bounds::<DeviceIdentificationSetDeviceIdentificationRequest>(offset);
963 unsafe {
966 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
967 (ptr as *mut u64).write_unaligned(0);
968 }
969 self.0.encode(encoder, offset + 0, depth)?;
971 self.1.encode(encoder, offset + 16, depth)?;
972 Ok(())
973 }
974 }
975
976 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
977 for DeviceIdentificationSetDeviceIdentificationRequest
978 {
979 #[inline(always)]
980 fn new_empty() -> Self {
981 Self {
982 records: fidl::new_empty!(fidl::encoding::Vector<DeviceIdentificationRecord, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
983 token: fidl::new_empty!(
984 fidl::encoding::Endpoint<
985 fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
986 >,
987 fidl::encoding::DefaultFuchsiaResourceDialect
988 ),
989 }
990 }
991
992 #[inline]
993 unsafe fn decode(
994 &mut self,
995 decoder: &mut fidl::encoding::Decoder<
996 '_,
997 fidl::encoding::DefaultFuchsiaResourceDialect,
998 >,
999 offset: usize,
1000 _depth: fidl::encoding::Depth,
1001 ) -> fidl::Result<()> {
1002 decoder.debug_check_bounds::<Self>(offset);
1003 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1005 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1006 let mask = 0xffffffff00000000u64;
1007 let maskedval = padval & mask;
1008 if maskedval != 0 {
1009 return Err(fidl::Error::NonZeroPadding {
1010 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1011 });
1012 }
1013 fidl::decode!(fidl::encoding::Vector<DeviceIdentificationRecord, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.records, decoder, offset + 0, _depth)?;
1014 fidl::decode!(
1015 fidl::encoding::Endpoint<
1016 fidl::endpoints::ServerEnd<DeviceIdentificationHandleMarker>,
1017 >,
1018 fidl::encoding::DefaultFuchsiaResourceDialect,
1019 &mut self.token,
1020 decoder,
1021 offset + 16,
1022 _depth
1023 )?;
1024 Ok(())
1025 }
1026 }
1027}