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_gatt2_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ClientConnectToServiceRequest {
16 pub handle: ServiceHandle,
17 pub service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ClientConnectToServiceRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct LocalServiceOnIndicateValueRequest {
27 pub update: ValueChangedParameters,
28 pub confirmation: fidl::EventPair,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for LocalServiceOnIndicateValueRequest
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct RemoteServiceRegisterCharacteristicNotifierRequest {
38 pub handle: Handle,
39 pub notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43 for RemoteServiceRegisterCharacteristicNotifierRequest
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct ServerPublishServiceRequest {
49 pub info: ServiceInfo,
50 pub service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54 for ServerPublishServiceRequest
55{
56}
57
58#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
59pub struct CharacteristicNotifierMarker;
60
61impl fidl::endpoints::ProtocolMarker for CharacteristicNotifierMarker {
62 type Proxy = CharacteristicNotifierProxy;
63 type RequestStream = CharacteristicNotifierRequestStream;
64 #[cfg(target_os = "fuchsia")]
65 type SynchronousProxy = CharacteristicNotifierSynchronousProxy;
66
67 const DEBUG_NAME: &'static str = "(anonymous) CharacteristicNotifier";
68}
69
70pub trait CharacteristicNotifierProxyInterface: Send + Sync {
71 type OnNotificationResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
72 fn r#on_notification(&self, value: &ReadValue) -> Self::OnNotificationResponseFut;
73}
74#[derive(Debug)]
75#[cfg(target_os = "fuchsia")]
76pub struct CharacteristicNotifierSynchronousProxy {
77 client: fidl::client::sync::Client,
78}
79
80#[cfg(target_os = "fuchsia")]
81impl fidl::endpoints::SynchronousProxy for CharacteristicNotifierSynchronousProxy {
82 type Proxy = CharacteristicNotifierProxy;
83 type Protocol = CharacteristicNotifierMarker;
84
85 fn from_channel(inner: fidl::Channel) -> Self {
86 Self::new(inner)
87 }
88
89 fn into_channel(self) -> fidl::Channel {
90 self.client.into_channel()
91 }
92
93 fn as_channel(&self) -> &fidl::Channel {
94 self.client.as_channel()
95 }
96}
97
98#[cfg(target_os = "fuchsia")]
99impl CharacteristicNotifierSynchronousProxy {
100 pub fn new(channel: fidl::Channel) -> Self {
101 let protocol_name =
102 <CharacteristicNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
103 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
104 }
105
106 pub fn into_channel(self) -> fidl::Channel {
107 self.client.into_channel()
108 }
109
110 pub fn wait_for_event(
113 &self,
114 deadline: zx::MonotonicInstant,
115 ) -> Result<CharacteristicNotifierEvent, fidl::Error> {
116 CharacteristicNotifierEvent::decode(self.client.wait_for_event(deadline)?)
117 }
118
119 pub fn r#on_notification(
126 &self,
127 mut value: &ReadValue,
128 ___deadline: zx::MonotonicInstant,
129 ) -> Result<(), fidl::Error> {
130 let _response = self.client.send_query::<
131 CharacteristicNotifierOnNotificationRequest,
132 fidl::encoding::EmptyPayload,
133 >(
134 (value,),
135 0x8edda1bd01f3c0a,
136 fidl::encoding::DynamicFlags::empty(),
137 ___deadline,
138 )?;
139 Ok(_response)
140 }
141}
142
143#[cfg(target_os = "fuchsia")]
144impl From<CharacteristicNotifierSynchronousProxy> for zx::Handle {
145 fn from(value: CharacteristicNotifierSynchronousProxy) -> Self {
146 value.into_channel().into()
147 }
148}
149
150#[cfg(target_os = "fuchsia")]
151impl From<fidl::Channel> for CharacteristicNotifierSynchronousProxy {
152 fn from(value: fidl::Channel) -> Self {
153 Self::new(value)
154 }
155}
156
157#[derive(Debug, Clone)]
158pub struct CharacteristicNotifierProxy {
159 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
160}
161
162impl fidl::endpoints::Proxy for CharacteristicNotifierProxy {
163 type Protocol = CharacteristicNotifierMarker;
164
165 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
166 Self::new(inner)
167 }
168
169 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
170 self.client.into_channel().map_err(|client| Self { client })
171 }
172
173 fn as_channel(&self) -> &::fidl::AsyncChannel {
174 self.client.as_channel()
175 }
176}
177
178impl CharacteristicNotifierProxy {
179 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
181 let protocol_name =
182 <CharacteristicNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
183 Self { client: fidl::client::Client::new(channel, protocol_name) }
184 }
185
186 pub fn take_event_stream(&self) -> CharacteristicNotifierEventStream {
192 CharacteristicNotifierEventStream { event_receiver: self.client.take_event_receiver() }
193 }
194
195 pub fn r#on_notification(
202 &self,
203 mut value: &ReadValue,
204 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
205 CharacteristicNotifierProxyInterface::r#on_notification(self, value)
206 }
207}
208
209impl CharacteristicNotifierProxyInterface for CharacteristicNotifierProxy {
210 type OnNotificationResponseFut =
211 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
212 fn r#on_notification(&self, mut value: &ReadValue) -> Self::OnNotificationResponseFut {
213 fn _decode(
214 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
215 ) -> Result<(), fidl::Error> {
216 let _response = fidl::client::decode_transaction_body::<
217 fidl::encoding::EmptyPayload,
218 fidl::encoding::DefaultFuchsiaResourceDialect,
219 0x8edda1bd01f3c0a,
220 >(_buf?)?;
221 Ok(_response)
222 }
223 self.client.send_query_and_decode::<CharacteristicNotifierOnNotificationRequest, ()>(
224 (value,),
225 0x8edda1bd01f3c0a,
226 fidl::encoding::DynamicFlags::empty(),
227 _decode,
228 )
229 }
230}
231
232pub struct CharacteristicNotifierEventStream {
233 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
234}
235
236impl std::marker::Unpin for CharacteristicNotifierEventStream {}
237
238impl futures::stream::FusedStream for CharacteristicNotifierEventStream {
239 fn is_terminated(&self) -> bool {
240 self.event_receiver.is_terminated()
241 }
242}
243
244impl futures::Stream for CharacteristicNotifierEventStream {
245 type Item = Result<CharacteristicNotifierEvent, fidl::Error>;
246
247 fn poll_next(
248 mut self: std::pin::Pin<&mut Self>,
249 cx: &mut std::task::Context<'_>,
250 ) -> std::task::Poll<Option<Self::Item>> {
251 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
252 &mut self.event_receiver,
253 cx
254 )?) {
255 Some(buf) => std::task::Poll::Ready(Some(CharacteristicNotifierEvent::decode(buf))),
256 None => std::task::Poll::Ready(None),
257 }
258 }
259}
260
261#[derive(Debug)]
262pub enum CharacteristicNotifierEvent {}
263
264impl CharacteristicNotifierEvent {
265 fn decode(
267 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
268 ) -> Result<CharacteristicNotifierEvent, fidl::Error> {
269 let (bytes, _handles) = buf.split_mut();
270 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
271 debug_assert_eq!(tx_header.tx_id, 0);
272 match tx_header.ordinal {
273 _ => Err(fidl::Error::UnknownOrdinal {
274 ordinal: tx_header.ordinal,
275 protocol_name:
276 <CharacteristicNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
277 }),
278 }
279 }
280}
281
282pub struct CharacteristicNotifierRequestStream {
284 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
285 is_terminated: bool,
286}
287
288impl std::marker::Unpin for CharacteristicNotifierRequestStream {}
289
290impl futures::stream::FusedStream for CharacteristicNotifierRequestStream {
291 fn is_terminated(&self) -> bool {
292 self.is_terminated
293 }
294}
295
296impl fidl::endpoints::RequestStream for CharacteristicNotifierRequestStream {
297 type Protocol = CharacteristicNotifierMarker;
298 type ControlHandle = CharacteristicNotifierControlHandle;
299
300 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
301 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
302 }
303
304 fn control_handle(&self) -> Self::ControlHandle {
305 CharacteristicNotifierControlHandle { inner: self.inner.clone() }
306 }
307
308 fn into_inner(
309 self,
310 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
311 {
312 (self.inner, self.is_terminated)
313 }
314
315 fn from_inner(
316 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
317 is_terminated: bool,
318 ) -> Self {
319 Self { inner, is_terminated }
320 }
321}
322
323impl futures::Stream for CharacteristicNotifierRequestStream {
324 type Item = Result<CharacteristicNotifierRequest, fidl::Error>;
325
326 fn poll_next(
327 mut self: std::pin::Pin<&mut Self>,
328 cx: &mut std::task::Context<'_>,
329 ) -> std::task::Poll<Option<Self::Item>> {
330 let this = &mut *self;
331 if this.inner.check_shutdown(cx) {
332 this.is_terminated = true;
333 return std::task::Poll::Ready(None);
334 }
335 if this.is_terminated {
336 panic!("polled CharacteristicNotifierRequestStream after completion");
337 }
338 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
339 |bytes, handles| {
340 match this.inner.channel().read_etc(cx, bytes, handles) {
341 std::task::Poll::Ready(Ok(())) => {}
342 std::task::Poll::Pending => return std::task::Poll::Pending,
343 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
344 this.is_terminated = true;
345 return std::task::Poll::Ready(None);
346 }
347 std::task::Poll::Ready(Err(e)) => {
348 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
349 e.into(),
350 ))))
351 }
352 }
353
354 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
356
357 std::task::Poll::Ready(Some(match header.ordinal {
358 0x8edda1bd01f3c0a => {
359 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
360 let mut req = fidl::new_empty!(CharacteristicNotifierOnNotificationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
361 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CharacteristicNotifierOnNotificationRequest>(&header, _body_bytes, handles, &mut req)?;
362 let control_handle = CharacteristicNotifierControlHandle {
363 inner: this.inner.clone(),
364 };
365 Ok(CharacteristicNotifierRequest::OnNotification {value: req.value,
366
367 responder: CharacteristicNotifierOnNotificationResponder {
368 control_handle: std::mem::ManuallyDrop::new(control_handle),
369 tx_id: header.tx_id,
370 },
371 })
372 }
373 _ => Err(fidl::Error::UnknownOrdinal {
374 ordinal: header.ordinal,
375 protocol_name: <CharacteristicNotifierMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
376 }),
377 }))
378 },
379 )
380 }
381}
382
383#[derive(Debug)]
385pub enum CharacteristicNotifierRequest {
386 OnNotification { value: ReadValue, responder: CharacteristicNotifierOnNotificationResponder },
393}
394
395impl CharacteristicNotifierRequest {
396 #[allow(irrefutable_let_patterns)]
397 pub fn into_on_notification(
398 self,
399 ) -> Option<(ReadValue, CharacteristicNotifierOnNotificationResponder)> {
400 if let CharacteristicNotifierRequest::OnNotification { value, responder } = self {
401 Some((value, responder))
402 } else {
403 None
404 }
405 }
406
407 pub fn method_name(&self) -> &'static str {
409 match *self {
410 CharacteristicNotifierRequest::OnNotification { .. } => "on_notification",
411 }
412 }
413}
414
415#[derive(Debug, Clone)]
416pub struct CharacteristicNotifierControlHandle {
417 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
418}
419
420impl fidl::endpoints::ControlHandle for CharacteristicNotifierControlHandle {
421 fn shutdown(&self) {
422 self.inner.shutdown()
423 }
424 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
425 self.inner.shutdown_with_epitaph(status)
426 }
427
428 fn is_closed(&self) -> bool {
429 self.inner.channel().is_closed()
430 }
431 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
432 self.inner.channel().on_closed()
433 }
434
435 #[cfg(target_os = "fuchsia")]
436 fn signal_peer(
437 &self,
438 clear_mask: zx::Signals,
439 set_mask: zx::Signals,
440 ) -> Result<(), zx_status::Status> {
441 use fidl::Peered;
442 self.inner.channel().signal_peer(clear_mask, set_mask)
443 }
444}
445
446impl CharacteristicNotifierControlHandle {}
447
448#[must_use = "FIDL methods require a response to be sent"]
449#[derive(Debug)]
450pub struct CharacteristicNotifierOnNotificationResponder {
451 control_handle: std::mem::ManuallyDrop<CharacteristicNotifierControlHandle>,
452 tx_id: u32,
453}
454
455impl std::ops::Drop for CharacteristicNotifierOnNotificationResponder {
459 fn drop(&mut self) {
460 self.control_handle.shutdown();
461 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
463 }
464}
465
466impl fidl::endpoints::Responder for CharacteristicNotifierOnNotificationResponder {
467 type ControlHandle = CharacteristicNotifierControlHandle;
468
469 fn control_handle(&self) -> &CharacteristicNotifierControlHandle {
470 &self.control_handle
471 }
472
473 fn drop_without_shutdown(mut self) {
474 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
476 std::mem::forget(self);
478 }
479}
480
481impl CharacteristicNotifierOnNotificationResponder {
482 pub fn send(self) -> Result<(), fidl::Error> {
486 let _result = self.send_raw();
487 if _result.is_err() {
488 self.control_handle.shutdown();
489 }
490 self.drop_without_shutdown();
491 _result
492 }
493
494 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
496 let _result = self.send_raw();
497 self.drop_without_shutdown();
498 _result
499 }
500
501 fn send_raw(&self) -> Result<(), fidl::Error> {
502 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
503 (),
504 self.tx_id,
505 0x8edda1bd01f3c0a,
506 fidl::encoding::DynamicFlags::empty(),
507 )
508 }
509}
510
511#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
512pub struct ClientMarker;
513
514impl fidl::endpoints::ProtocolMarker for ClientMarker {
515 type Proxy = ClientProxy;
516 type RequestStream = ClientRequestStream;
517 #[cfg(target_os = "fuchsia")]
518 type SynchronousProxy = ClientSynchronousProxy;
519
520 const DEBUG_NAME: &'static str = "(anonymous) Client";
521}
522
523pub trait ClientProxyInterface: Send + Sync {
524 type WatchServicesResponseFut: std::future::Future<Output = Result<(Vec<ServiceInfo>, Vec<Handle>), fidl::Error>>
525 + Send;
526 fn r#watch_services(
527 &self,
528 uuids: &[fidl_fuchsia_bluetooth::Uuid],
529 ) -> Self::WatchServicesResponseFut;
530 fn r#connect_to_service(
531 &self,
532 handle: &ServiceHandle,
533 service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
534 ) -> Result<(), fidl::Error>;
535}
536#[derive(Debug)]
537#[cfg(target_os = "fuchsia")]
538pub struct ClientSynchronousProxy {
539 client: fidl::client::sync::Client,
540}
541
542#[cfg(target_os = "fuchsia")]
543impl fidl::endpoints::SynchronousProxy for ClientSynchronousProxy {
544 type Proxy = ClientProxy;
545 type Protocol = ClientMarker;
546
547 fn from_channel(inner: fidl::Channel) -> Self {
548 Self::new(inner)
549 }
550
551 fn into_channel(self) -> fidl::Channel {
552 self.client.into_channel()
553 }
554
555 fn as_channel(&self) -> &fidl::Channel {
556 self.client.as_channel()
557 }
558}
559
560#[cfg(target_os = "fuchsia")]
561impl ClientSynchronousProxy {
562 pub fn new(channel: fidl::Channel) -> Self {
563 let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
564 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
565 }
566
567 pub fn into_channel(self) -> fidl::Channel {
568 self.client.into_channel()
569 }
570
571 pub fn wait_for_event(
574 &self,
575 deadline: zx::MonotonicInstant,
576 ) -> Result<ClientEvent, fidl::Error> {
577 ClientEvent::decode(self.client.wait_for_event(deadline)?)
578 }
579
580 pub fn r#watch_services(
610 &self,
611 mut uuids: &[fidl_fuchsia_bluetooth::Uuid],
612 ___deadline: zx::MonotonicInstant,
613 ) -> Result<(Vec<ServiceInfo>, Vec<Handle>), fidl::Error> {
614 let _response =
615 self.client.send_query::<ClientWatchServicesRequest, ClientWatchServicesResponse>(
616 (uuids,),
617 0x23243a22d6f08640,
618 fidl::encoding::DynamicFlags::empty(),
619 ___deadline,
620 )?;
621 Ok((_response.updated, _response.removed))
622 }
623
624 pub fn r#connect_to_service(
635 &self,
636 mut handle: &ServiceHandle,
637 mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
638 ) -> Result<(), fidl::Error> {
639 self.client.send::<ClientConnectToServiceRequest>(
640 (handle, service),
641 0x61b59f2b6d075ff8,
642 fidl::encoding::DynamicFlags::empty(),
643 )
644 }
645}
646
647#[cfg(target_os = "fuchsia")]
648impl From<ClientSynchronousProxy> for zx::Handle {
649 fn from(value: ClientSynchronousProxy) -> Self {
650 value.into_channel().into()
651 }
652}
653
654#[cfg(target_os = "fuchsia")]
655impl From<fidl::Channel> for ClientSynchronousProxy {
656 fn from(value: fidl::Channel) -> Self {
657 Self::new(value)
658 }
659}
660
661#[derive(Debug, Clone)]
662pub struct ClientProxy {
663 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
664}
665
666impl fidl::endpoints::Proxy for ClientProxy {
667 type Protocol = ClientMarker;
668
669 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
670 Self::new(inner)
671 }
672
673 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
674 self.client.into_channel().map_err(|client| Self { client })
675 }
676
677 fn as_channel(&self) -> &::fidl::AsyncChannel {
678 self.client.as_channel()
679 }
680}
681
682impl ClientProxy {
683 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
685 let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
686 Self { client: fidl::client::Client::new(channel, protocol_name) }
687 }
688
689 pub fn take_event_stream(&self) -> ClientEventStream {
695 ClientEventStream { event_receiver: self.client.take_event_receiver() }
696 }
697
698 pub fn r#watch_services(
728 &self,
729 mut uuids: &[fidl_fuchsia_bluetooth::Uuid],
730 ) -> fidl::client::QueryResponseFut<
731 (Vec<ServiceInfo>, Vec<Handle>),
732 fidl::encoding::DefaultFuchsiaResourceDialect,
733 > {
734 ClientProxyInterface::r#watch_services(self, uuids)
735 }
736
737 pub fn r#connect_to_service(
748 &self,
749 mut handle: &ServiceHandle,
750 mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
751 ) -> Result<(), fidl::Error> {
752 ClientProxyInterface::r#connect_to_service(self, handle, service)
753 }
754}
755
756impl ClientProxyInterface for ClientProxy {
757 type WatchServicesResponseFut = fidl::client::QueryResponseFut<
758 (Vec<ServiceInfo>, Vec<Handle>),
759 fidl::encoding::DefaultFuchsiaResourceDialect,
760 >;
761 fn r#watch_services(
762 &self,
763 mut uuids: &[fidl_fuchsia_bluetooth::Uuid],
764 ) -> Self::WatchServicesResponseFut {
765 fn _decode(
766 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
767 ) -> Result<(Vec<ServiceInfo>, Vec<Handle>), fidl::Error> {
768 let _response = fidl::client::decode_transaction_body::<
769 ClientWatchServicesResponse,
770 fidl::encoding::DefaultFuchsiaResourceDialect,
771 0x23243a22d6f08640,
772 >(_buf?)?;
773 Ok((_response.updated, _response.removed))
774 }
775 self.client
776 .send_query_and_decode::<ClientWatchServicesRequest, (Vec<ServiceInfo>, Vec<Handle>)>(
777 (uuids,),
778 0x23243a22d6f08640,
779 fidl::encoding::DynamicFlags::empty(),
780 _decode,
781 )
782 }
783
784 fn r#connect_to_service(
785 &self,
786 mut handle: &ServiceHandle,
787 mut service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
788 ) -> Result<(), fidl::Error> {
789 self.client.send::<ClientConnectToServiceRequest>(
790 (handle, service),
791 0x61b59f2b6d075ff8,
792 fidl::encoding::DynamicFlags::empty(),
793 )
794 }
795}
796
797pub struct ClientEventStream {
798 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
799}
800
801impl std::marker::Unpin for ClientEventStream {}
802
803impl futures::stream::FusedStream for ClientEventStream {
804 fn is_terminated(&self) -> bool {
805 self.event_receiver.is_terminated()
806 }
807}
808
809impl futures::Stream for ClientEventStream {
810 type Item = Result<ClientEvent, fidl::Error>;
811
812 fn poll_next(
813 mut self: std::pin::Pin<&mut Self>,
814 cx: &mut std::task::Context<'_>,
815 ) -> std::task::Poll<Option<Self::Item>> {
816 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
817 &mut self.event_receiver,
818 cx
819 )?) {
820 Some(buf) => std::task::Poll::Ready(Some(ClientEvent::decode(buf))),
821 None => std::task::Poll::Ready(None),
822 }
823 }
824}
825
826#[derive(Debug)]
827pub enum ClientEvent {}
828
829impl ClientEvent {
830 fn decode(
832 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
833 ) -> Result<ClientEvent, fidl::Error> {
834 let (bytes, _handles) = buf.split_mut();
835 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
836 debug_assert_eq!(tx_header.tx_id, 0);
837 match tx_header.ordinal {
838 _ => Err(fidl::Error::UnknownOrdinal {
839 ordinal: tx_header.ordinal,
840 protocol_name: <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
841 }),
842 }
843 }
844}
845
846pub struct ClientRequestStream {
848 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
849 is_terminated: bool,
850}
851
852impl std::marker::Unpin for ClientRequestStream {}
853
854impl futures::stream::FusedStream for ClientRequestStream {
855 fn is_terminated(&self) -> bool {
856 self.is_terminated
857 }
858}
859
860impl fidl::endpoints::RequestStream for ClientRequestStream {
861 type Protocol = ClientMarker;
862 type ControlHandle = ClientControlHandle;
863
864 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
865 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
866 }
867
868 fn control_handle(&self) -> Self::ControlHandle {
869 ClientControlHandle { inner: self.inner.clone() }
870 }
871
872 fn into_inner(
873 self,
874 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
875 {
876 (self.inner, self.is_terminated)
877 }
878
879 fn from_inner(
880 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
881 is_terminated: bool,
882 ) -> Self {
883 Self { inner, is_terminated }
884 }
885}
886
887impl futures::Stream for ClientRequestStream {
888 type Item = Result<ClientRequest, fidl::Error>;
889
890 fn poll_next(
891 mut self: std::pin::Pin<&mut Self>,
892 cx: &mut std::task::Context<'_>,
893 ) -> std::task::Poll<Option<Self::Item>> {
894 let this = &mut *self;
895 if this.inner.check_shutdown(cx) {
896 this.is_terminated = true;
897 return std::task::Poll::Ready(None);
898 }
899 if this.is_terminated {
900 panic!("polled ClientRequestStream after completion");
901 }
902 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
903 |bytes, handles| {
904 match this.inner.channel().read_etc(cx, bytes, handles) {
905 std::task::Poll::Ready(Ok(())) => {}
906 std::task::Poll::Pending => return std::task::Poll::Pending,
907 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
908 this.is_terminated = true;
909 return std::task::Poll::Ready(None);
910 }
911 std::task::Poll::Ready(Err(e)) => {
912 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
913 e.into(),
914 ))))
915 }
916 }
917
918 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
920
921 std::task::Poll::Ready(Some(match header.ordinal {
922 0x23243a22d6f08640 => {
923 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
924 let mut req = fidl::new_empty!(
925 ClientWatchServicesRequest,
926 fidl::encoding::DefaultFuchsiaResourceDialect
927 );
928 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientWatchServicesRequest>(&header, _body_bytes, handles, &mut req)?;
929 let control_handle = ClientControlHandle { inner: this.inner.clone() };
930 Ok(ClientRequest::WatchServices {
931 uuids: req.uuids,
932
933 responder: ClientWatchServicesResponder {
934 control_handle: std::mem::ManuallyDrop::new(control_handle),
935 tx_id: header.tx_id,
936 },
937 })
938 }
939 0x61b59f2b6d075ff8 => {
940 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
941 let mut req = fidl::new_empty!(
942 ClientConnectToServiceRequest,
943 fidl::encoding::DefaultFuchsiaResourceDialect
944 );
945 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientConnectToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
946 let control_handle = ClientControlHandle { inner: this.inner.clone() };
947 Ok(ClientRequest::ConnectToService {
948 handle: req.handle,
949 service: req.service,
950
951 control_handle,
952 })
953 }
954 _ => Err(fidl::Error::UnknownOrdinal {
955 ordinal: header.ordinal,
956 protocol_name:
957 <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
958 }),
959 }))
960 },
961 )
962 }
963}
964
965#[derive(Debug)]
966pub enum ClientRequest {
967 WatchServices {
997 uuids: Vec<fidl_fuchsia_bluetooth::Uuid>,
998 responder: ClientWatchServicesResponder,
999 },
1000 ConnectToService {
1011 handle: ServiceHandle,
1012 service: fidl::endpoints::ServerEnd<RemoteServiceMarker>,
1013 control_handle: ClientControlHandle,
1014 },
1015}
1016
1017impl ClientRequest {
1018 #[allow(irrefutable_let_patterns)]
1019 pub fn into_watch_services(
1020 self,
1021 ) -> Option<(Vec<fidl_fuchsia_bluetooth::Uuid>, ClientWatchServicesResponder)> {
1022 if let ClientRequest::WatchServices { uuids, responder } = self {
1023 Some((uuids, responder))
1024 } else {
1025 None
1026 }
1027 }
1028
1029 #[allow(irrefutable_let_patterns)]
1030 pub fn into_connect_to_service(
1031 self,
1032 ) -> Option<(ServiceHandle, fidl::endpoints::ServerEnd<RemoteServiceMarker>, ClientControlHandle)>
1033 {
1034 if let ClientRequest::ConnectToService { handle, service, control_handle } = self {
1035 Some((handle, service, control_handle))
1036 } else {
1037 None
1038 }
1039 }
1040
1041 pub fn method_name(&self) -> &'static str {
1043 match *self {
1044 ClientRequest::WatchServices { .. } => "watch_services",
1045 ClientRequest::ConnectToService { .. } => "connect_to_service",
1046 }
1047 }
1048}
1049
1050#[derive(Debug, Clone)]
1051pub struct ClientControlHandle {
1052 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1053}
1054
1055impl fidl::endpoints::ControlHandle for ClientControlHandle {
1056 fn shutdown(&self) {
1057 self.inner.shutdown()
1058 }
1059 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1060 self.inner.shutdown_with_epitaph(status)
1061 }
1062
1063 fn is_closed(&self) -> bool {
1064 self.inner.channel().is_closed()
1065 }
1066 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1067 self.inner.channel().on_closed()
1068 }
1069
1070 #[cfg(target_os = "fuchsia")]
1071 fn signal_peer(
1072 &self,
1073 clear_mask: zx::Signals,
1074 set_mask: zx::Signals,
1075 ) -> Result<(), zx_status::Status> {
1076 use fidl::Peered;
1077 self.inner.channel().signal_peer(clear_mask, set_mask)
1078 }
1079}
1080
1081impl ClientControlHandle {}
1082
1083#[must_use = "FIDL methods require a response to be sent"]
1084#[derive(Debug)]
1085pub struct ClientWatchServicesResponder {
1086 control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
1087 tx_id: u32,
1088}
1089
1090impl std::ops::Drop for ClientWatchServicesResponder {
1094 fn drop(&mut self) {
1095 self.control_handle.shutdown();
1096 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1098 }
1099}
1100
1101impl fidl::endpoints::Responder for ClientWatchServicesResponder {
1102 type ControlHandle = ClientControlHandle;
1103
1104 fn control_handle(&self) -> &ClientControlHandle {
1105 &self.control_handle
1106 }
1107
1108 fn drop_without_shutdown(mut self) {
1109 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1111 std::mem::forget(self);
1113 }
1114}
1115
1116impl ClientWatchServicesResponder {
1117 pub fn send(
1121 self,
1122 mut updated: &[ServiceInfo],
1123 mut removed: &[Handle],
1124 ) -> Result<(), fidl::Error> {
1125 let _result = self.send_raw(updated, removed);
1126 if _result.is_err() {
1127 self.control_handle.shutdown();
1128 }
1129 self.drop_without_shutdown();
1130 _result
1131 }
1132
1133 pub fn send_no_shutdown_on_err(
1135 self,
1136 mut updated: &[ServiceInfo],
1137 mut removed: &[Handle],
1138 ) -> Result<(), fidl::Error> {
1139 let _result = self.send_raw(updated, removed);
1140 self.drop_without_shutdown();
1141 _result
1142 }
1143
1144 fn send_raw(
1145 &self,
1146 mut updated: &[ServiceInfo],
1147 mut removed: &[Handle],
1148 ) -> Result<(), fidl::Error> {
1149 self.control_handle.inner.send::<ClientWatchServicesResponse>(
1150 (updated, removed),
1151 self.tx_id,
1152 0x23243a22d6f08640,
1153 fidl::encoding::DynamicFlags::empty(),
1154 )
1155 }
1156}
1157
1158#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1159pub struct LocalServiceMarker;
1160
1161impl fidl::endpoints::ProtocolMarker for LocalServiceMarker {
1162 type Proxy = LocalServiceProxy;
1163 type RequestStream = LocalServiceRequestStream;
1164 #[cfg(target_os = "fuchsia")]
1165 type SynchronousProxy = LocalServiceSynchronousProxy;
1166
1167 const DEBUG_NAME: &'static str = "(anonymous) LocalService";
1168}
1169pub type LocalServiceReadValueResult = Result<Vec<u8>, Error>;
1170pub type LocalServiceWriteValueResult = Result<(), Error>;
1171
1172pub trait LocalServiceProxyInterface: Send + Sync {
1173 type CharacteristicConfigurationResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1174 + Send;
1175 fn r#characteristic_configuration(
1176 &self,
1177 peer_id: &fidl_fuchsia_bluetooth::PeerId,
1178 handle: &Handle,
1179 notify: bool,
1180 indicate: bool,
1181 ) -> Self::CharacteristicConfigurationResponseFut;
1182 type ReadValueResponseFut: std::future::Future<Output = Result<LocalServiceReadValueResult, fidl::Error>>
1183 + Send;
1184 fn r#read_value(
1185 &self,
1186 peer_id: &fidl_fuchsia_bluetooth::PeerId,
1187 handle: &Handle,
1188 offset: i32,
1189 ) -> Self::ReadValueResponseFut;
1190 type WriteValueResponseFut: std::future::Future<Output = Result<LocalServiceWriteValueResult, fidl::Error>>
1191 + Send;
1192 fn r#write_value(&self, payload: &LocalServiceWriteValueRequest)
1193 -> Self::WriteValueResponseFut;
1194 type PeerUpdateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1195 fn r#peer_update(&self, payload: &LocalServicePeerUpdateRequest)
1196 -> Self::PeerUpdateResponseFut;
1197 fn r#value_changed_credit(&self, additional_credit: u8) -> Result<(), fidl::Error>;
1198}
1199#[derive(Debug)]
1200#[cfg(target_os = "fuchsia")]
1201pub struct LocalServiceSynchronousProxy {
1202 client: fidl::client::sync::Client,
1203}
1204
1205#[cfg(target_os = "fuchsia")]
1206impl fidl::endpoints::SynchronousProxy for LocalServiceSynchronousProxy {
1207 type Proxy = LocalServiceProxy;
1208 type Protocol = LocalServiceMarker;
1209
1210 fn from_channel(inner: fidl::Channel) -> Self {
1211 Self::new(inner)
1212 }
1213
1214 fn into_channel(self) -> fidl::Channel {
1215 self.client.into_channel()
1216 }
1217
1218 fn as_channel(&self) -> &fidl::Channel {
1219 self.client.as_channel()
1220 }
1221}
1222
1223#[cfg(target_os = "fuchsia")]
1224impl LocalServiceSynchronousProxy {
1225 pub fn new(channel: fidl::Channel) -> Self {
1226 let protocol_name = <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1227 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1228 }
1229
1230 pub fn into_channel(self) -> fidl::Channel {
1231 self.client.into_channel()
1232 }
1233
1234 pub fn wait_for_event(
1237 &self,
1238 deadline: zx::MonotonicInstant,
1239 ) -> Result<LocalServiceEvent, fidl::Error> {
1240 LocalServiceEvent::decode(self.client.wait_for_event(deadline)?)
1241 }
1242
1243 pub fn r#characteristic_configuration(
1258 &self,
1259 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1260 mut handle: &Handle,
1261 mut notify: bool,
1262 mut indicate: bool,
1263 ___deadline: zx::MonotonicInstant,
1264 ) -> Result<(), fidl::Error> {
1265 let _response = self.client.send_query::<
1266 LocalServiceCharacteristicConfigurationRequest,
1267 fidl::encoding::EmptyPayload,
1268 >(
1269 (peer_id, handle, notify, indicate,),
1270 0x431101fcd8d9ef15,
1271 fidl::encoding::DynamicFlags::empty(),
1272 ___deadline,
1273 )?;
1274 Ok(_response)
1275 }
1276
1277 pub fn r#read_value(
1286 &self,
1287 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1288 mut handle: &Handle,
1289 mut offset: i32,
1290 ___deadline: zx::MonotonicInstant,
1291 ) -> Result<LocalServiceReadValueResult, fidl::Error> {
1292 let _response = self.client.send_query::<
1293 LocalServiceReadValueRequest,
1294 fidl::encoding::ResultType<LocalServiceReadValueResponse, Error>,
1295 >(
1296 (peer_id, handle, offset,),
1297 0x49e11d396625d104,
1298 fidl::encoding::DynamicFlags::empty(),
1299 ___deadline,
1300 )?;
1301 Ok(_response.map(|x| x.value))
1302 }
1303
1304 pub fn r#write_value(
1318 &self,
1319 mut payload: &LocalServiceWriteValueRequest,
1320 ___deadline: zx::MonotonicInstant,
1321 ) -> Result<LocalServiceWriteValueResult, fidl::Error> {
1322 let _response = self.client.send_query::<
1323 LocalServiceWriteValueRequest,
1324 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1325 >(
1326 payload,
1327 0x7d6ae631baf18260,
1328 fidl::encoding::DynamicFlags::empty(),
1329 ___deadline,
1330 )?;
1331 Ok(_response.map(|x| x))
1332 }
1333
1334 pub fn r#peer_update(
1351 &self,
1352 mut payload: &LocalServicePeerUpdateRequest,
1353 ___deadline: zx::MonotonicInstant,
1354 ) -> Result<(), fidl::Error> {
1355 let _response =
1356 self.client.send_query::<LocalServicePeerUpdateRequest, fidl::encoding::EmptyPayload>(
1357 payload,
1358 0x7e362177a04108b8,
1359 fidl::encoding::DynamicFlags::empty(),
1360 ___deadline,
1361 )?;
1362 Ok(_response)
1363 }
1364
1365 pub fn r#value_changed_credit(&self, mut additional_credit: u8) -> Result<(), fidl::Error> {
1371 self.client.send::<LocalServiceValueChangedCreditRequest>(
1372 (additional_credit,),
1373 0x7cf0931548318566,
1374 fidl::encoding::DynamicFlags::empty(),
1375 )
1376 }
1377}
1378
1379#[cfg(target_os = "fuchsia")]
1380impl From<LocalServiceSynchronousProxy> for zx::Handle {
1381 fn from(value: LocalServiceSynchronousProxy) -> Self {
1382 value.into_channel().into()
1383 }
1384}
1385
1386#[cfg(target_os = "fuchsia")]
1387impl From<fidl::Channel> for LocalServiceSynchronousProxy {
1388 fn from(value: fidl::Channel) -> Self {
1389 Self::new(value)
1390 }
1391}
1392
1393#[derive(Debug, Clone)]
1394pub struct LocalServiceProxy {
1395 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1396}
1397
1398impl fidl::endpoints::Proxy for LocalServiceProxy {
1399 type Protocol = LocalServiceMarker;
1400
1401 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1402 Self::new(inner)
1403 }
1404
1405 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1406 self.client.into_channel().map_err(|client| Self { client })
1407 }
1408
1409 fn as_channel(&self) -> &::fidl::AsyncChannel {
1410 self.client.as_channel()
1411 }
1412}
1413
1414impl LocalServiceProxy {
1415 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1417 let protocol_name = <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1418 Self { client: fidl::client::Client::new(channel, protocol_name) }
1419 }
1420
1421 pub fn take_event_stream(&self) -> LocalServiceEventStream {
1427 LocalServiceEventStream { event_receiver: self.client.take_event_receiver() }
1428 }
1429
1430 pub fn r#characteristic_configuration(
1445 &self,
1446 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1447 mut handle: &Handle,
1448 mut notify: bool,
1449 mut indicate: bool,
1450 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1451 LocalServiceProxyInterface::r#characteristic_configuration(
1452 self, peer_id, handle, notify, indicate,
1453 )
1454 }
1455
1456 pub fn r#read_value(
1465 &self,
1466 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1467 mut handle: &Handle,
1468 mut offset: i32,
1469 ) -> fidl::client::QueryResponseFut<
1470 LocalServiceReadValueResult,
1471 fidl::encoding::DefaultFuchsiaResourceDialect,
1472 > {
1473 LocalServiceProxyInterface::r#read_value(self, peer_id, handle, offset)
1474 }
1475
1476 pub fn r#write_value(
1490 &self,
1491 mut payload: &LocalServiceWriteValueRequest,
1492 ) -> fidl::client::QueryResponseFut<
1493 LocalServiceWriteValueResult,
1494 fidl::encoding::DefaultFuchsiaResourceDialect,
1495 > {
1496 LocalServiceProxyInterface::r#write_value(self, payload)
1497 }
1498
1499 pub fn r#peer_update(
1516 &self,
1517 mut payload: &LocalServicePeerUpdateRequest,
1518 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1519 LocalServiceProxyInterface::r#peer_update(self, payload)
1520 }
1521
1522 pub fn r#value_changed_credit(&self, mut additional_credit: u8) -> Result<(), fidl::Error> {
1528 LocalServiceProxyInterface::r#value_changed_credit(self, additional_credit)
1529 }
1530}
1531
1532impl LocalServiceProxyInterface for LocalServiceProxy {
1533 type CharacteristicConfigurationResponseFut =
1534 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1535 fn r#characteristic_configuration(
1536 &self,
1537 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1538 mut handle: &Handle,
1539 mut notify: bool,
1540 mut indicate: bool,
1541 ) -> Self::CharacteristicConfigurationResponseFut {
1542 fn _decode(
1543 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1544 ) -> Result<(), fidl::Error> {
1545 let _response = fidl::client::decode_transaction_body::<
1546 fidl::encoding::EmptyPayload,
1547 fidl::encoding::DefaultFuchsiaResourceDialect,
1548 0x431101fcd8d9ef15,
1549 >(_buf?)?;
1550 Ok(_response)
1551 }
1552 self.client.send_query_and_decode::<LocalServiceCharacteristicConfigurationRequest, ()>(
1553 (peer_id, handle, notify, indicate),
1554 0x431101fcd8d9ef15,
1555 fidl::encoding::DynamicFlags::empty(),
1556 _decode,
1557 )
1558 }
1559
1560 type ReadValueResponseFut = fidl::client::QueryResponseFut<
1561 LocalServiceReadValueResult,
1562 fidl::encoding::DefaultFuchsiaResourceDialect,
1563 >;
1564 fn r#read_value(
1565 &self,
1566 mut peer_id: &fidl_fuchsia_bluetooth::PeerId,
1567 mut handle: &Handle,
1568 mut offset: i32,
1569 ) -> Self::ReadValueResponseFut {
1570 fn _decode(
1571 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1572 ) -> Result<LocalServiceReadValueResult, fidl::Error> {
1573 let _response = fidl::client::decode_transaction_body::<
1574 fidl::encoding::ResultType<LocalServiceReadValueResponse, Error>,
1575 fidl::encoding::DefaultFuchsiaResourceDialect,
1576 0x49e11d396625d104,
1577 >(_buf?)?;
1578 Ok(_response.map(|x| x.value))
1579 }
1580 self.client
1581 .send_query_and_decode::<LocalServiceReadValueRequest, LocalServiceReadValueResult>(
1582 (peer_id, handle, offset),
1583 0x49e11d396625d104,
1584 fidl::encoding::DynamicFlags::empty(),
1585 _decode,
1586 )
1587 }
1588
1589 type WriteValueResponseFut = fidl::client::QueryResponseFut<
1590 LocalServiceWriteValueResult,
1591 fidl::encoding::DefaultFuchsiaResourceDialect,
1592 >;
1593 fn r#write_value(
1594 &self,
1595 mut payload: &LocalServiceWriteValueRequest,
1596 ) -> Self::WriteValueResponseFut {
1597 fn _decode(
1598 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1599 ) -> Result<LocalServiceWriteValueResult, fidl::Error> {
1600 let _response = fidl::client::decode_transaction_body::<
1601 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1602 fidl::encoding::DefaultFuchsiaResourceDialect,
1603 0x7d6ae631baf18260,
1604 >(_buf?)?;
1605 Ok(_response.map(|x| x))
1606 }
1607 self.client
1608 .send_query_and_decode::<LocalServiceWriteValueRequest, LocalServiceWriteValueResult>(
1609 payload,
1610 0x7d6ae631baf18260,
1611 fidl::encoding::DynamicFlags::empty(),
1612 _decode,
1613 )
1614 }
1615
1616 type PeerUpdateResponseFut =
1617 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1618 fn r#peer_update(
1619 &self,
1620 mut payload: &LocalServicePeerUpdateRequest,
1621 ) -> Self::PeerUpdateResponseFut {
1622 fn _decode(
1623 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1624 ) -> Result<(), fidl::Error> {
1625 let _response = fidl::client::decode_transaction_body::<
1626 fidl::encoding::EmptyPayload,
1627 fidl::encoding::DefaultFuchsiaResourceDialect,
1628 0x7e362177a04108b8,
1629 >(_buf?)?;
1630 Ok(_response)
1631 }
1632 self.client.send_query_and_decode::<LocalServicePeerUpdateRequest, ()>(
1633 payload,
1634 0x7e362177a04108b8,
1635 fidl::encoding::DynamicFlags::empty(),
1636 _decode,
1637 )
1638 }
1639
1640 fn r#value_changed_credit(&self, mut additional_credit: u8) -> Result<(), fidl::Error> {
1641 self.client.send::<LocalServiceValueChangedCreditRequest>(
1642 (additional_credit,),
1643 0x7cf0931548318566,
1644 fidl::encoding::DynamicFlags::empty(),
1645 )
1646 }
1647}
1648
1649pub struct LocalServiceEventStream {
1650 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1651}
1652
1653impl std::marker::Unpin for LocalServiceEventStream {}
1654
1655impl futures::stream::FusedStream for LocalServiceEventStream {
1656 fn is_terminated(&self) -> bool {
1657 self.event_receiver.is_terminated()
1658 }
1659}
1660
1661impl futures::Stream for LocalServiceEventStream {
1662 type Item = Result<LocalServiceEvent, fidl::Error>;
1663
1664 fn poll_next(
1665 mut self: std::pin::Pin<&mut Self>,
1666 cx: &mut std::task::Context<'_>,
1667 ) -> std::task::Poll<Option<Self::Item>> {
1668 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1669 &mut self.event_receiver,
1670 cx
1671 )?) {
1672 Some(buf) => std::task::Poll::Ready(Some(LocalServiceEvent::decode(buf))),
1673 None => std::task::Poll::Ready(None),
1674 }
1675 }
1676}
1677
1678#[derive(Debug)]
1679pub enum LocalServiceEvent {
1680 OnSuppressDiscovery {},
1681 OnNotifyValue { payload: ValueChangedParameters },
1682 OnIndicateValue { update: ValueChangedParameters, confirmation: fidl::EventPair },
1683}
1684
1685impl LocalServiceEvent {
1686 #[allow(irrefutable_let_patterns)]
1687 pub fn into_on_suppress_discovery(self) -> Option<()> {
1688 if let LocalServiceEvent::OnSuppressDiscovery {} = self {
1689 Some(())
1690 } else {
1691 None
1692 }
1693 }
1694 #[allow(irrefutable_let_patterns)]
1695 pub fn into_on_notify_value(self) -> Option<ValueChangedParameters> {
1696 if let LocalServiceEvent::OnNotifyValue { payload } = self {
1697 Some((payload))
1698 } else {
1699 None
1700 }
1701 }
1702 #[allow(irrefutable_let_patterns)]
1703 pub fn into_on_indicate_value(self) -> Option<(ValueChangedParameters, fidl::EventPair)> {
1704 if let LocalServiceEvent::OnIndicateValue { update, confirmation } = self {
1705 Some((update, confirmation))
1706 } else {
1707 None
1708 }
1709 }
1710
1711 fn decode(
1713 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1714 ) -> Result<LocalServiceEvent, fidl::Error> {
1715 let (bytes, _handles) = buf.split_mut();
1716 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1717 debug_assert_eq!(tx_header.tx_id, 0);
1718 match tx_header.ordinal {
1719 0x106d36281c3cfb66 => {
1720 let mut out = fidl::new_empty!(
1721 fidl::encoding::EmptyPayload,
1722 fidl::encoding::DefaultFuchsiaResourceDialect
1723 );
1724 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1725 Ok((LocalServiceEvent::OnSuppressDiscovery {}))
1726 }
1727 0x190c1c528bfd0068 => {
1728 let mut out = fidl::new_empty!(
1729 ValueChangedParameters,
1730 fidl::encoding::DefaultFuchsiaResourceDialect
1731 );
1732 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ValueChangedParameters>(&tx_header, _body_bytes, _handles, &mut out)?;
1733 Ok((LocalServiceEvent::OnNotifyValue { payload: out }))
1734 }
1735 0x59431c3653ac531f => {
1736 let mut out = fidl::new_empty!(
1737 LocalServiceOnIndicateValueRequest,
1738 fidl::encoding::DefaultFuchsiaResourceDialect
1739 );
1740 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceOnIndicateValueRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1741 Ok((LocalServiceEvent::OnIndicateValue {
1742 update: out.update,
1743 confirmation: out.confirmation,
1744 }))
1745 }
1746 _ => Err(fidl::Error::UnknownOrdinal {
1747 ordinal: tx_header.ordinal,
1748 protocol_name: <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1749 }),
1750 }
1751 }
1752}
1753
1754pub struct LocalServiceRequestStream {
1756 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1757 is_terminated: bool,
1758}
1759
1760impl std::marker::Unpin for LocalServiceRequestStream {}
1761
1762impl futures::stream::FusedStream for LocalServiceRequestStream {
1763 fn is_terminated(&self) -> bool {
1764 self.is_terminated
1765 }
1766}
1767
1768impl fidl::endpoints::RequestStream for LocalServiceRequestStream {
1769 type Protocol = LocalServiceMarker;
1770 type ControlHandle = LocalServiceControlHandle;
1771
1772 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1773 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1774 }
1775
1776 fn control_handle(&self) -> Self::ControlHandle {
1777 LocalServiceControlHandle { inner: self.inner.clone() }
1778 }
1779
1780 fn into_inner(
1781 self,
1782 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1783 {
1784 (self.inner, self.is_terminated)
1785 }
1786
1787 fn from_inner(
1788 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1789 is_terminated: bool,
1790 ) -> Self {
1791 Self { inner, is_terminated }
1792 }
1793}
1794
1795impl futures::Stream for LocalServiceRequestStream {
1796 type Item = Result<LocalServiceRequest, fidl::Error>;
1797
1798 fn poll_next(
1799 mut self: std::pin::Pin<&mut Self>,
1800 cx: &mut std::task::Context<'_>,
1801 ) -> std::task::Poll<Option<Self::Item>> {
1802 let this = &mut *self;
1803 if this.inner.check_shutdown(cx) {
1804 this.is_terminated = true;
1805 return std::task::Poll::Ready(None);
1806 }
1807 if this.is_terminated {
1808 panic!("polled LocalServiceRequestStream after completion");
1809 }
1810 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1811 |bytes, handles| {
1812 match this.inner.channel().read_etc(cx, bytes, handles) {
1813 std::task::Poll::Ready(Ok(())) => {}
1814 std::task::Poll::Pending => return std::task::Poll::Pending,
1815 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1816 this.is_terminated = true;
1817 return std::task::Poll::Ready(None);
1818 }
1819 std::task::Poll::Ready(Err(e)) => {
1820 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1821 e.into(),
1822 ))))
1823 }
1824 }
1825
1826 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1828
1829 std::task::Poll::Ready(Some(match header.ordinal {
1830 0x431101fcd8d9ef15 => {
1831 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1832 let mut req = fidl::new_empty!(
1833 LocalServiceCharacteristicConfigurationRequest,
1834 fidl::encoding::DefaultFuchsiaResourceDialect
1835 );
1836 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceCharacteristicConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
1837 let control_handle =
1838 LocalServiceControlHandle { inner: this.inner.clone() };
1839 Ok(LocalServiceRequest::CharacteristicConfiguration {
1840 peer_id: req.peer_id,
1841 handle: req.handle,
1842 notify: req.notify,
1843 indicate: req.indicate,
1844
1845 responder: LocalServiceCharacteristicConfigurationResponder {
1846 control_handle: std::mem::ManuallyDrop::new(control_handle),
1847 tx_id: header.tx_id,
1848 },
1849 })
1850 }
1851 0x49e11d396625d104 => {
1852 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1853 let mut req = fidl::new_empty!(
1854 LocalServiceReadValueRequest,
1855 fidl::encoding::DefaultFuchsiaResourceDialect
1856 );
1857 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceReadValueRequest>(&header, _body_bytes, handles, &mut req)?;
1858 let control_handle =
1859 LocalServiceControlHandle { inner: this.inner.clone() };
1860 Ok(LocalServiceRequest::ReadValue {
1861 peer_id: req.peer_id,
1862 handle: req.handle,
1863 offset: req.offset,
1864
1865 responder: LocalServiceReadValueResponder {
1866 control_handle: std::mem::ManuallyDrop::new(control_handle),
1867 tx_id: header.tx_id,
1868 },
1869 })
1870 }
1871 0x7d6ae631baf18260 => {
1872 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1873 let mut req = fidl::new_empty!(
1874 LocalServiceWriteValueRequest,
1875 fidl::encoding::DefaultFuchsiaResourceDialect
1876 );
1877 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceWriteValueRequest>(&header, _body_bytes, handles, &mut req)?;
1878 let control_handle =
1879 LocalServiceControlHandle { inner: this.inner.clone() };
1880 Ok(LocalServiceRequest::WriteValue {
1881 payload: req,
1882 responder: LocalServiceWriteValueResponder {
1883 control_handle: std::mem::ManuallyDrop::new(control_handle),
1884 tx_id: header.tx_id,
1885 },
1886 })
1887 }
1888 0x7e362177a04108b8 => {
1889 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1890 let mut req = fidl::new_empty!(
1891 LocalServicePeerUpdateRequest,
1892 fidl::encoding::DefaultFuchsiaResourceDialect
1893 );
1894 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServicePeerUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
1895 let control_handle =
1896 LocalServiceControlHandle { inner: this.inner.clone() };
1897 Ok(LocalServiceRequest::PeerUpdate {
1898 payload: req,
1899 responder: LocalServicePeerUpdateResponder {
1900 control_handle: std::mem::ManuallyDrop::new(control_handle),
1901 tx_id: header.tx_id,
1902 },
1903 })
1904 }
1905 0x7cf0931548318566 => {
1906 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1907 let mut req = fidl::new_empty!(
1908 LocalServiceValueChangedCreditRequest,
1909 fidl::encoding::DefaultFuchsiaResourceDialect
1910 );
1911 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalServiceValueChangedCreditRequest>(&header, _body_bytes, handles, &mut req)?;
1912 let control_handle =
1913 LocalServiceControlHandle { inner: this.inner.clone() };
1914 Ok(LocalServiceRequest::ValueChangedCredit {
1915 additional_credit: req.additional_credit,
1916
1917 control_handle,
1918 })
1919 }
1920 _ => Err(fidl::Error::UnknownOrdinal {
1921 ordinal: header.ordinal,
1922 protocol_name:
1923 <LocalServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1924 }),
1925 }))
1926 },
1927 )
1928 }
1929}
1930
1931#[derive(Debug)]
1935pub enum LocalServiceRequest {
1936 CharacteristicConfiguration {
1951 peer_id: fidl_fuchsia_bluetooth::PeerId,
1952 handle: Handle,
1953 notify: bool,
1954 indicate: bool,
1955 responder: LocalServiceCharacteristicConfigurationResponder,
1956 },
1957 ReadValue {
1966 peer_id: fidl_fuchsia_bluetooth::PeerId,
1967 handle: Handle,
1968 offset: i32,
1969 responder: LocalServiceReadValueResponder,
1970 },
1971 WriteValue {
1985 payload: LocalServiceWriteValueRequest,
1986 responder: LocalServiceWriteValueResponder,
1987 },
1988 PeerUpdate {
2005 payload: LocalServicePeerUpdateRequest,
2006 responder: LocalServicePeerUpdateResponder,
2007 },
2008 ValueChangedCredit { additional_credit: u8, control_handle: LocalServiceControlHandle },
2014}
2015
2016impl LocalServiceRequest {
2017 #[allow(irrefutable_let_patterns)]
2018 pub fn into_characteristic_configuration(
2019 self,
2020 ) -> Option<(
2021 fidl_fuchsia_bluetooth::PeerId,
2022 Handle,
2023 bool,
2024 bool,
2025 LocalServiceCharacteristicConfigurationResponder,
2026 )> {
2027 if let LocalServiceRequest::CharacteristicConfiguration {
2028 peer_id,
2029 handle,
2030 notify,
2031 indicate,
2032 responder,
2033 } = self
2034 {
2035 Some((peer_id, handle, notify, indicate, responder))
2036 } else {
2037 None
2038 }
2039 }
2040
2041 #[allow(irrefutable_let_patterns)]
2042 pub fn into_read_value(
2043 self,
2044 ) -> Option<(fidl_fuchsia_bluetooth::PeerId, Handle, i32, LocalServiceReadValueResponder)> {
2045 if let LocalServiceRequest::ReadValue { peer_id, handle, offset, responder } = self {
2046 Some((peer_id, handle, offset, responder))
2047 } else {
2048 None
2049 }
2050 }
2051
2052 #[allow(irrefutable_let_patterns)]
2053 pub fn into_write_value(
2054 self,
2055 ) -> Option<(LocalServiceWriteValueRequest, LocalServiceWriteValueResponder)> {
2056 if let LocalServiceRequest::WriteValue { payload, responder } = self {
2057 Some((payload, responder))
2058 } else {
2059 None
2060 }
2061 }
2062
2063 #[allow(irrefutable_let_patterns)]
2064 pub fn into_peer_update(
2065 self,
2066 ) -> Option<(LocalServicePeerUpdateRequest, LocalServicePeerUpdateResponder)> {
2067 if let LocalServiceRequest::PeerUpdate { payload, responder } = self {
2068 Some((payload, responder))
2069 } else {
2070 None
2071 }
2072 }
2073
2074 #[allow(irrefutable_let_patterns)]
2075 pub fn into_value_changed_credit(self) -> Option<(u8, LocalServiceControlHandle)> {
2076 if let LocalServiceRequest::ValueChangedCredit { additional_credit, control_handle } = self
2077 {
2078 Some((additional_credit, control_handle))
2079 } else {
2080 None
2081 }
2082 }
2083
2084 pub fn method_name(&self) -> &'static str {
2086 match *self {
2087 LocalServiceRequest::CharacteristicConfiguration { .. } => {
2088 "characteristic_configuration"
2089 }
2090 LocalServiceRequest::ReadValue { .. } => "read_value",
2091 LocalServiceRequest::WriteValue { .. } => "write_value",
2092 LocalServiceRequest::PeerUpdate { .. } => "peer_update",
2093 LocalServiceRequest::ValueChangedCredit { .. } => "value_changed_credit",
2094 }
2095 }
2096}
2097
2098#[derive(Debug, Clone)]
2099pub struct LocalServiceControlHandle {
2100 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2101}
2102
2103impl fidl::endpoints::ControlHandle for LocalServiceControlHandle {
2104 fn shutdown(&self) {
2105 self.inner.shutdown()
2106 }
2107 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2108 self.inner.shutdown_with_epitaph(status)
2109 }
2110
2111 fn is_closed(&self) -> bool {
2112 self.inner.channel().is_closed()
2113 }
2114 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2115 self.inner.channel().on_closed()
2116 }
2117
2118 #[cfg(target_os = "fuchsia")]
2119 fn signal_peer(
2120 &self,
2121 clear_mask: zx::Signals,
2122 set_mask: zx::Signals,
2123 ) -> Result<(), zx_status::Status> {
2124 use fidl::Peered;
2125 self.inner.channel().signal_peer(clear_mask, set_mask)
2126 }
2127}
2128
2129impl LocalServiceControlHandle {
2130 pub fn send_on_suppress_discovery(&self) -> Result<(), fidl::Error> {
2131 self.inner.send::<fidl::encoding::EmptyPayload>(
2132 (),
2133 0,
2134 0x106d36281c3cfb66,
2135 fidl::encoding::DynamicFlags::empty(),
2136 )
2137 }
2138
2139 pub fn send_on_notify_value(
2140 &self,
2141 mut payload: &ValueChangedParameters,
2142 ) -> Result<(), fidl::Error> {
2143 self.inner.send::<ValueChangedParameters>(
2144 payload,
2145 0,
2146 0x190c1c528bfd0068,
2147 fidl::encoding::DynamicFlags::empty(),
2148 )
2149 }
2150
2151 pub fn send_on_indicate_value(
2152 &self,
2153 mut update: &ValueChangedParameters,
2154 mut confirmation: fidl::EventPair,
2155 ) -> Result<(), fidl::Error> {
2156 self.inner.send::<LocalServiceOnIndicateValueRequest>(
2157 (update, confirmation),
2158 0,
2159 0x59431c3653ac531f,
2160 fidl::encoding::DynamicFlags::empty(),
2161 )
2162 }
2163}
2164
2165#[must_use = "FIDL methods require a response to be sent"]
2166#[derive(Debug)]
2167pub struct LocalServiceCharacteristicConfigurationResponder {
2168 control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
2169 tx_id: u32,
2170}
2171
2172impl std::ops::Drop for LocalServiceCharacteristicConfigurationResponder {
2176 fn drop(&mut self) {
2177 self.control_handle.shutdown();
2178 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2180 }
2181}
2182
2183impl fidl::endpoints::Responder for LocalServiceCharacteristicConfigurationResponder {
2184 type ControlHandle = LocalServiceControlHandle;
2185
2186 fn control_handle(&self) -> &LocalServiceControlHandle {
2187 &self.control_handle
2188 }
2189
2190 fn drop_without_shutdown(mut self) {
2191 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2193 std::mem::forget(self);
2195 }
2196}
2197
2198impl LocalServiceCharacteristicConfigurationResponder {
2199 pub fn send(self) -> Result<(), fidl::Error> {
2203 let _result = self.send_raw();
2204 if _result.is_err() {
2205 self.control_handle.shutdown();
2206 }
2207 self.drop_without_shutdown();
2208 _result
2209 }
2210
2211 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2213 let _result = self.send_raw();
2214 self.drop_without_shutdown();
2215 _result
2216 }
2217
2218 fn send_raw(&self) -> Result<(), fidl::Error> {
2219 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2220 (),
2221 self.tx_id,
2222 0x431101fcd8d9ef15,
2223 fidl::encoding::DynamicFlags::empty(),
2224 )
2225 }
2226}
2227
2228#[must_use = "FIDL methods require a response to be sent"]
2229#[derive(Debug)]
2230pub struct LocalServiceReadValueResponder {
2231 control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
2232 tx_id: u32,
2233}
2234
2235impl std::ops::Drop for LocalServiceReadValueResponder {
2239 fn drop(&mut self) {
2240 self.control_handle.shutdown();
2241 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2243 }
2244}
2245
2246impl fidl::endpoints::Responder for LocalServiceReadValueResponder {
2247 type ControlHandle = LocalServiceControlHandle;
2248
2249 fn control_handle(&self) -> &LocalServiceControlHandle {
2250 &self.control_handle
2251 }
2252
2253 fn drop_without_shutdown(mut self) {
2254 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2256 std::mem::forget(self);
2258 }
2259}
2260
2261impl LocalServiceReadValueResponder {
2262 pub fn send(self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
2266 let _result = self.send_raw(result);
2267 if _result.is_err() {
2268 self.control_handle.shutdown();
2269 }
2270 self.drop_without_shutdown();
2271 _result
2272 }
2273
2274 pub fn send_no_shutdown_on_err(
2276 self,
2277 mut result: Result<&[u8], Error>,
2278 ) -> Result<(), fidl::Error> {
2279 let _result = self.send_raw(result);
2280 self.drop_without_shutdown();
2281 _result
2282 }
2283
2284 fn send_raw(&self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
2285 self.control_handle
2286 .inner
2287 .send::<fidl::encoding::ResultType<LocalServiceReadValueResponse, Error>>(
2288 result.map(|value| (value,)),
2289 self.tx_id,
2290 0x49e11d396625d104,
2291 fidl::encoding::DynamicFlags::empty(),
2292 )
2293 }
2294}
2295
2296#[must_use = "FIDL methods require a response to be sent"]
2297#[derive(Debug)]
2298pub struct LocalServiceWriteValueResponder {
2299 control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
2300 tx_id: u32,
2301}
2302
2303impl std::ops::Drop for LocalServiceWriteValueResponder {
2307 fn drop(&mut self) {
2308 self.control_handle.shutdown();
2309 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2311 }
2312}
2313
2314impl fidl::endpoints::Responder for LocalServiceWriteValueResponder {
2315 type ControlHandle = LocalServiceControlHandle;
2316
2317 fn control_handle(&self) -> &LocalServiceControlHandle {
2318 &self.control_handle
2319 }
2320
2321 fn drop_without_shutdown(mut self) {
2322 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2324 std::mem::forget(self);
2326 }
2327}
2328
2329impl LocalServiceWriteValueResponder {
2330 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2334 let _result = self.send_raw(result);
2335 if _result.is_err() {
2336 self.control_handle.shutdown();
2337 }
2338 self.drop_without_shutdown();
2339 _result
2340 }
2341
2342 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2344 let _result = self.send_raw(result);
2345 self.drop_without_shutdown();
2346 _result
2347 }
2348
2349 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2350 self.control_handle
2351 .inner
2352 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2353 result,
2354 self.tx_id,
2355 0x7d6ae631baf18260,
2356 fidl::encoding::DynamicFlags::empty(),
2357 )
2358 }
2359}
2360
2361#[must_use = "FIDL methods require a response to be sent"]
2362#[derive(Debug)]
2363pub struct LocalServicePeerUpdateResponder {
2364 control_handle: std::mem::ManuallyDrop<LocalServiceControlHandle>,
2365 tx_id: u32,
2366}
2367
2368impl std::ops::Drop for LocalServicePeerUpdateResponder {
2372 fn drop(&mut self) {
2373 self.control_handle.shutdown();
2374 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2376 }
2377}
2378
2379impl fidl::endpoints::Responder for LocalServicePeerUpdateResponder {
2380 type ControlHandle = LocalServiceControlHandle;
2381
2382 fn control_handle(&self) -> &LocalServiceControlHandle {
2383 &self.control_handle
2384 }
2385
2386 fn drop_without_shutdown(mut self) {
2387 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2389 std::mem::forget(self);
2391 }
2392}
2393
2394impl LocalServicePeerUpdateResponder {
2395 pub fn send(self) -> Result<(), fidl::Error> {
2399 let _result = self.send_raw();
2400 if _result.is_err() {
2401 self.control_handle.shutdown();
2402 }
2403 self.drop_without_shutdown();
2404 _result
2405 }
2406
2407 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2409 let _result = self.send_raw();
2410 self.drop_without_shutdown();
2411 _result
2412 }
2413
2414 fn send_raw(&self) -> Result<(), fidl::Error> {
2415 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2416 (),
2417 self.tx_id,
2418 0x7e362177a04108b8,
2419 fidl::encoding::DynamicFlags::empty(),
2420 )
2421 }
2422}
2423
2424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2425pub struct RemoteServiceMarker;
2426
2427impl fidl::endpoints::ProtocolMarker for RemoteServiceMarker {
2428 type Proxy = RemoteServiceProxy;
2429 type RequestStream = RemoteServiceRequestStream;
2430 #[cfg(target_os = "fuchsia")]
2431 type SynchronousProxy = RemoteServiceSynchronousProxy;
2432
2433 const DEBUG_NAME: &'static str = "(anonymous) RemoteService";
2434}
2435pub type RemoteServiceReadByTypeResult = Result<Vec<ReadByTypeResult>, Error>;
2436pub type RemoteServiceReadCharacteristicResult = Result<ReadValue, Error>;
2437pub type RemoteServiceWriteCharacteristicResult = Result<(), Error>;
2438pub type RemoteServiceReadDescriptorResult = Result<ReadValue, Error>;
2439pub type RemoteServiceWriteDescriptorResult = Result<(), Error>;
2440pub type RemoteServiceRegisterCharacteristicNotifierResult = Result<(), Error>;
2441
2442pub trait RemoteServiceProxyInterface: Send + Sync {
2443 type DiscoverCharacteristicsResponseFut: std::future::Future<Output = Result<Vec<Characteristic>, fidl::Error>>
2444 + Send;
2445 fn r#discover_characteristics(&self) -> Self::DiscoverCharacteristicsResponseFut;
2446 type ReadByTypeResponseFut: std::future::Future<Output = Result<RemoteServiceReadByTypeResult, fidl::Error>>
2447 + Send;
2448 fn r#read_by_type(&self, uuid: &fidl_fuchsia_bluetooth::Uuid) -> Self::ReadByTypeResponseFut;
2449 type ReadCharacteristicResponseFut: std::future::Future<Output = Result<RemoteServiceReadCharacteristicResult, fidl::Error>>
2450 + Send;
2451 fn r#read_characteristic(
2452 &self,
2453 handle: &Handle,
2454 options: &ReadOptions,
2455 ) -> Self::ReadCharacteristicResponseFut;
2456 type WriteCharacteristicResponseFut: std::future::Future<Output = Result<RemoteServiceWriteCharacteristicResult, fidl::Error>>
2457 + Send;
2458 fn r#write_characteristic(
2459 &self,
2460 handle: &Handle,
2461 value: &[u8],
2462 options: &WriteOptions,
2463 ) -> Self::WriteCharacteristicResponseFut;
2464 type ReadDescriptorResponseFut: std::future::Future<Output = Result<RemoteServiceReadDescriptorResult, fidl::Error>>
2465 + Send;
2466 fn r#read_descriptor(
2467 &self,
2468 handle: &Handle,
2469 options: &ReadOptions,
2470 ) -> Self::ReadDescriptorResponseFut;
2471 type WriteDescriptorResponseFut: std::future::Future<Output = Result<RemoteServiceWriteDescriptorResult, fidl::Error>>
2472 + Send;
2473 fn r#write_descriptor(
2474 &self,
2475 handle: &Handle,
2476 value: &[u8],
2477 options: &WriteOptions,
2478 ) -> Self::WriteDescriptorResponseFut;
2479 type RegisterCharacteristicNotifierResponseFut: std::future::Future<
2480 Output = Result<RemoteServiceRegisterCharacteristicNotifierResult, fidl::Error>,
2481 > + Send;
2482 fn r#register_characteristic_notifier(
2483 &self,
2484 handle: &Handle,
2485 notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
2486 ) -> Self::RegisterCharacteristicNotifierResponseFut;
2487}
2488#[derive(Debug)]
2489#[cfg(target_os = "fuchsia")]
2490pub struct RemoteServiceSynchronousProxy {
2491 client: fidl::client::sync::Client,
2492}
2493
2494#[cfg(target_os = "fuchsia")]
2495impl fidl::endpoints::SynchronousProxy for RemoteServiceSynchronousProxy {
2496 type Proxy = RemoteServiceProxy;
2497 type Protocol = RemoteServiceMarker;
2498
2499 fn from_channel(inner: fidl::Channel) -> Self {
2500 Self::new(inner)
2501 }
2502
2503 fn into_channel(self) -> fidl::Channel {
2504 self.client.into_channel()
2505 }
2506
2507 fn as_channel(&self) -> &fidl::Channel {
2508 self.client.as_channel()
2509 }
2510}
2511
2512#[cfg(target_os = "fuchsia")]
2513impl RemoteServiceSynchronousProxy {
2514 pub fn new(channel: fidl::Channel) -> Self {
2515 let protocol_name = <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2516 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2517 }
2518
2519 pub fn into_channel(self) -> fidl::Channel {
2520 self.client.into_channel()
2521 }
2522
2523 pub fn wait_for_event(
2526 &self,
2527 deadline: zx::MonotonicInstant,
2528 ) -> Result<RemoteServiceEvent, fidl::Error> {
2529 RemoteServiceEvent::decode(self.client.wait_for_event(deadline)?)
2530 }
2531
2532 pub fn r#discover_characteristics(
2535 &self,
2536 ___deadline: zx::MonotonicInstant,
2537 ) -> Result<Vec<Characteristic>, fidl::Error> {
2538 let _response = self.client.send_query::<
2539 fidl::encoding::EmptyPayload,
2540 RemoteServiceDiscoverCharacteristicsResponse,
2541 >(
2542 (),
2543 0x6cd730f12e402543,
2544 fidl::encoding::DynamicFlags::empty(),
2545 ___deadline,
2546 )?;
2547 Ok(_response.characteristics)
2548 }
2549
2550 pub fn r#read_by_type(
2568 &self,
2569 mut uuid: &fidl_fuchsia_bluetooth::Uuid,
2570 ___deadline: zx::MonotonicInstant,
2571 ) -> Result<RemoteServiceReadByTypeResult, fidl::Error> {
2572 let _response = self.client.send_query::<
2573 RemoteServiceReadByTypeRequest,
2574 fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>,
2575 >(
2576 (uuid,),
2577 0x739bb1e313162bbc,
2578 fidl::encoding::DynamicFlags::empty(),
2579 ___deadline,
2580 )?;
2581 Ok(_response.map(|x| x.results))
2582 }
2583
2584 pub fn r#read_characteristic(
2595 &self,
2596 mut handle: &Handle,
2597 mut options: &ReadOptions,
2598 ___deadline: zx::MonotonicInstant,
2599 ) -> Result<RemoteServiceReadCharacteristicResult, fidl::Error> {
2600 let _response = self.client.send_query::<
2601 RemoteServiceReadCharacteristicRequest,
2602 fidl::encoding::ResultType<RemoteServiceReadCharacteristicResponse, Error>,
2603 >(
2604 (handle, options,),
2605 0x4d41757ed69a96cb,
2606 fidl::encoding::DynamicFlags::empty(),
2607 ___deadline,
2608 )?;
2609 Ok(_response.map(|x| x.value))
2610 }
2611
2612 pub fn r#write_characteristic(
2630 &self,
2631 mut handle: &Handle,
2632 mut value: &[u8],
2633 mut options: &WriteOptions,
2634 ___deadline: zx::MonotonicInstant,
2635 ) -> Result<RemoteServiceWriteCharacteristicResult, fidl::Error> {
2636 let _response = self.client.send_query::<
2637 RemoteServiceWriteCharacteristicRequest,
2638 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2639 >(
2640 (handle, value, options,),
2641 0x7fc7511adecde8c,
2642 fidl::encoding::DynamicFlags::empty(),
2643 ___deadline,
2644 )?;
2645 Ok(_response.map(|x| x))
2646 }
2647
2648 pub fn r#read_descriptor(
2660 &self,
2661 mut handle: &Handle,
2662 mut options: &ReadOptions,
2663 ___deadline: zx::MonotonicInstant,
2664 ) -> Result<RemoteServiceReadDescriptorResult, fidl::Error> {
2665 let _response = self.client.send_query::<
2666 RemoteServiceReadDescriptorRequest,
2667 fidl::encoding::ResultType<RemoteServiceReadDescriptorResponse, Error>,
2668 >(
2669 (handle, options,),
2670 0x7ed7ce00457dcec1,
2671 fidl::encoding::DynamicFlags::empty(),
2672 ___deadline,
2673 )?;
2674 Ok(_response.map(|x| x.value))
2675 }
2676
2677 pub fn r#write_descriptor(
2695 &self,
2696 mut handle: &Handle,
2697 mut value: &[u8],
2698 mut options: &WriteOptions,
2699 ___deadline: zx::MonotonicInstant,
2700 ) -> Result<RemoteServiceWriteDescriptorResult, fidl::Error> {
2701 let _response = self.client.send_query::<
2702 RemoteServiceWriteDescriptorRequest,
2703 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2704 >(
2705 (handle, value, options,),
2706 0x21d9106bfd6b7351,
2707 fidl::encoding::DynamicFlags::empty(),
2708 ___deadline,
2709 )?;
2710 Ok(_response.map(|x| x))
2711 }
2712
2713 pub fn r#register_characteristic_notifier(
2741 &self,
2742 mut handle: &Handle,
2743 mut notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
2744 ___deadline: zx::MonotonicInstant,
2745 ) -> Result<RemoteServiceRegisterCharacteristicNotifierResult, fidl::Error> {
2746 let _response = self.client.send_query::<
2747 RemoteServiceRegisterCharacteristicNotifierRequest,
2748 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2749 >(
2750 (handle, notifier,),
2751 0x35007a85245f5cc6,
2752 fidl::encoding::DynamicFlags::empty(),
2753 ___deadline,
2754 )?;
2755 Ok(_response.map(|x| x))
2756 }
2757}
2758
2759#[cfg(target_os = "fuchsia")]
2760impl From<RemoteServiceSynchronousProxy> for zx::Handle {
2761 fn from(value: RemoteServiceSynchronousProxy) -> Self {
2762 value.into_channel().into()
2763 }
2764}
2765
2766#[cfg(target_os = "fuchsia")]
2767impl From<fidl::Channel> for RemoteServiceSynchronousProxy {
2768 fn from(value: fidl::Channel) -> Self {
2769 Self::new(value)
2770 }
2771}
2772
2773#[derive(Debug, Clone)]
2774pub struct RemoteServiceProxy {
2775 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2776}
2777
2778impl fidl::endpoints::Proxy for RemoteServiceProxy {
2779 type Protocol = RemoteServiceMarker;
2780
2781 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2782 Self::new(inner)
2783 }
2784
2785 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2786 self.client.into_channel().map_err(|client| Self { client })
2787 }
2788
2789 fn as_channel(&self) -> &::fidl::AsyncChannel {
2790 self.client.as_channel()
2791 }
2792}
2793
2794impl RemoteServiceProxy {
2795 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2797 let protocol_name = <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2798 Self { client: fidl::client::Client::new(channel, protocol_name) }
2799 }
2800
2801 pub fn take_event_stream(&self) -> RemoteServiceEventStream {
2807 RemoteServiceEventStream { event_receiver: self.client.take_event_receiver() }
2808 }
2809
2810 pub fn r#discover_characteristics(
2813 &self,
2814 ) -> fidl::client::QueryResponseFut<
2815 Vec<Characteristic>,
2816 fidl::encoding::DefaultFuchsiaResourceDialect,
2817 > {
2818 RemoteServiceProxyInterface::r#discover_characteristics(self)
2819 }
2820
2821 pub fn r#read_by_type(
2839 &self,
2840 mut uuid: &fidl_fuchsia_bluetooth::Uuid,
2841 ) -> fidl::client::QueryResponseFut<
2842 RemoteServiceReadByTypeResult,
2843 fidl::encoding::DefaultFuchsiaResourceDialect,
2844 > {
2845 RemoteServiceProxyInterface::r#read_by_type(self, uuid)
2846 }
2847
2848 pub fn r#read_characteristic(
2859 &self,
2860 mut handle: &Handle,
2861 mut options: &ReadOptions,
2862 ) -> fidl::client::QueryResponseFut<
2863 RemoteServiceReadCharacteristicResult,
2864 fidl::encoding::DefaultFuchsiaResourceDialect,
2865 > {
2866 RemoteServiceProxyInterface::r#read_characteristic(self, handle, options)
2867 }
2868
2869 pub fn r#write_characteristic(
2887 &self,
2888 mut handle: &Handle,
2889 mut value: &[u8],
2890 mut options: &WriteOptions,
2891 ) -> fidl::client::QueryResponseFut<
2892 RemoteServiceWriteCharacteristicResult,
2893 fidl::encoding::DefaultFuchsiaResourceDialect,
2894 > {
2895 RemoteServiceProxyInterface::r#write_characteristic(self, handle, value, options)
2896 }
2897
2898 pub fn r#read_descriptor(
2910 &self,
2911 mut handle: &Handle,
2912 mut options: &ReadOptions,
2913 ) -> fidl::client::QueryResponseFut<
2914 RemoteServiceReadDescriptorResult,
2915 fidl::encoding::DefaultFuchsiaResourceDialect,
2916 > {
2917 RemoteServiceProxyInterface::r#read_descriptor(self, handle, options)
2918 }
2919
2920 pub fn r#write_descriptor(
2938 &self,
2939 mut handle: &Handle,
2940 mut value: &[u8],
2941 mut options: &WriteOptions,
2942 ) -> fidl::client::QueryResponseFut<
2943 RemoteServiceWriteDescriptorResult,
2944 fidl::encoding::DefaultFuchsiaResourceDialect,
2945 > {
2946 RemoteServiceProxyInterface::r#write_descriptor(self, handle, value, options)
2947 }
2948
2949 pub fn r#register_characteristic_notifier(
2977 &self,
2978 mut handle: &Handle,
2979 mut notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
2980 ) -> fidl::client::QueryResponseFut<
2981 RemoteServiceRegisterCharacteristicNotifierResult,
2982 fidl::encoding::DefaultFuchsiaResourceDialect,
2983 > {
2984 RemoteServiceProxyInterface::r#register_characteristic_notifier(self, handle, notifier)
2985 }
2986}
2987
2988impl RemoteServiceProxyInterface for RemoteServiceProxy {
2989 type DiscoverCharacteristicsResponseFut = fidl::client::QueryResponseFut<
2990 Vec<Characteristic>,
2991 fidl::encoding::DefaultFuchsiaResourceDialect,
2992 >;
2993 fn r#discover_characteristics(&self) -> Self::DiscoverCharacteristicsResponseFut {
2994 fn _decode(
2995 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2996 ) -> Result<Vec<Characteristic>, fidl::Error> {
2997 let _response = fidl::client::decode_transaction_body::<
2998 RemoteServiceDiscoverCharacteristicsResponse,
2999 fidl::encoding::DefaultFuchsiaResourceDialect,
3000 0x6cd730f12e402543,
3001 >(_buf?)?;
3002 Ok(_response.characteristics)
3003 }
3004 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Characteristic>>(
3005 (),
3006 0x6cd730f12e402543,
3007 fidl::encoding::DynamicFlags::empty(),
3008 _decode,
3009 )
3010 }
3011
3012 type ReadByTypeResponseFut = fidl::client::QueryResponseFut<
3013 RemoteServiceReadByTypeResult,
3014 fidl::encoding::DefaultFuchsiaResourceDialect,
3015 >;
3016 fn r#read_by_type(
3017 &self,
3018 mut uuid: &fidl_fuchsia_bluetooth::Uuid,
3019 ) -> Self::ReadByTypeResponseFut {
3020 fn _decode(
3021 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3022 ) -> Result<RemoteServiceReadByTypeResult, fidl::Error> {
3023 let _response = fidl::client::decode_transaction_body::<
3024 fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>,
3025 fidl::encoding::DefaultFuchsiaResourceDialect,
3026 0x739bb1e313162bbc,
3027 >(_buf?)?;
3028 Ok(_response.map(|x| x.results))
3029 }
3030 self.client
3031 .send_query_and_decode::<RemoteServiceReadByTypeRequest, RemoteServiceReadByTypeResult>(
3032 (uuid,),
3033 0x739bb1e313162bbc,
3034 fidl::encoding::DynamicFlags::empty(),
3035 _decode,
3036 )
3037 }
3038
3039 type ReadCharacteristicResponseFut = fidl::client::QueryResponseFut<
3040 RemoteServiceReadCharacteristicResult,
3041 fidl::encoding::DefaultFuchsiaResourceDialect,
3042 >;
3043 fn r#read_characteristic(
3044 &self,
3045 mut handle: &Handle,
3046 mut options: &ReadOptions,
3047 ) -> Self::ReadCharacteristicResponseFut {
3048 fn _decode(
3049 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3050 ) -> Result<RemoteServiceReadCharacteristicResult, fidl::Error> {
3051 let _response = fidl::client::decode_transaction_body::<
3052 fidl::encoding::ResultType<RemoteServiceReadCharacteristicResponse, Error>,
3053 fidl::encoding::DefaultFuchsiaResourceDialect,
3054 0x4d41757ed69a96cb,
3055 >(_buf?)?;
3056 Ok(_response.map(|x| x.value))
3057 }
3058 self.client.send_query_and_decode::<
3059 RemoteServiceReadCharacteristicRequest,
3060 RemoteServiceReadCharacteristicResult,
3061 >(
3062 (handle, options,),
3063 0x4d41757ed69a96cb,
3064 fidl::encoding::DynamicFlags::empty(),
3065 _decode,
3066 )
3067 }
3068
3069 type WriteCharacteristicResponseFut = fidl::client::QueryResponseFut<
3070 RemoteServiceWriteCharacteristicResult,
3071 fidl::encoding::DefaultFuchsiaResourceDialect,
3072 >;
3073 fn r#write_characteristic(
3074 &self,
3075 mut handle: &Handle,
3076 mut value: &[u8],
3077 mut options: &WriteOptions,
3078 ) -> Self::WriteCharacteristicResponseFut {
3079 fn _decode(
3080 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3081 ) -> Result<RemoteServiceWriteCharacteristicResult, fidl::Error> {
3082 let _response = fidl::client::decode_transaction_body::<
3083 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
3084 fidl::encoding::DefaultFuchsiaResourceDialect,
3085 0x7fc7511adecde8c,
3086 >(_buf?)?;
3087 Ok(_response.map(|x| x))
3088 }
3089 self.client.send_query_and_decode::<
3090 RemoteServiceWriteCharacteristicRequest,
3091 RemoteServiceWriteCharacteristicResult,
3092 >(
3093 (handle, value, options,),
3094 0x7fc7511adecde8c,
3095 fidl::encoding::DynamicFlags::empty(),
3096 _decode,
3097 )
3098 }
3099
3100 type ReadDescriptorResponseFut = fidl::client::QueryResponseFut<
3101 RemoteServiceReadDescriptorResult,
3102 fidl::encoding::DefaultFuchsiaResourceDialect,
3103 >;
3104 fn r#read_descriptor(
3105 &self,
3106 mut handle: &Handle,
3107 mut options: &ReadOptions,
3108 ) -> Self::ReadDescriptorResponseFut {
3109 fn _decode(
3110 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3111 ) -> Result<RemoteServiceReadDescriptorResult, fidl::Error> {
3112 let _response = fidl::client::decode_transaction_body::<
3113 fidl::encoding::ResultType<RemoteServiceReadDescriptorResponse, Error>,
3114 fidl::encoding::DefaultFuchsiaResourceDialect,
3115 0x7ed7ce00457dcec1,
3116 >(_buf?)?;
3117 Ok(_response.map(|x| x.value))
3118 }
3119 self.client.send_query_and_decode::<
3120 RemoteServiceReadDescriptorRequest,
3121 RemoteServiceReadDescriptorResult,
3122 >(
3123 (handle, options,),
3124 0x7ed7ce00457dcec1,
3125 fidl::encoding::DynamicFlags::empty(),
3126 _decode,
3127 )
3128 }
3129
3130 type WriteDescriptorResponseFut = fidl::client::QueryResponseFut<
3131 RemoteServiceWriteDescriptorResult,
3132 fidl::encoding::DefaultFuchsiaResourceDialect,
3133 >;
3134 fn r#write_descriptor(
3135 &self,
3136 mut handle: &Handle,
3137 mut value: &[u8],
3138 mut options: &WriteOptions,
3139 ) -> Self::WriteDescriptorResponseFut {
3140 fn _decode(
3141 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3142 ) -> Result<RemoteServiceWriteDescriptorResult, fidl::Error> {
3143 let _response = fidl::client::decode_transaction_body::<
3144 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
3145 fidl::encoding::DefaultFuchsiaResourceDialect,
3146 0x21d9106bfd6b7351,
3147 >(_buf?)?;
3148 Ok(_response.map(|x| x))
3149 }
3150 self.client.send_query_and_decode::<
3151 RemoteServiceWriteDescriptorRequest,
3152 RemoteServiceWriteDescriptorResult,
3153 >(
3154 (handle, value, options,),
3155 0x21d9106bfd6b7351,
3156 fidl::encoding::DynamicFlags::empty(),
3157 _decode,
3158 )
3159 }
3160
3161 type RegisterCharacteristicNotifierResponseFut = fidl::client::QueryResponseFut<
3162 RemoteServiceRegisterCharacteristicNotifierResult,
3163 fidl::encoding::DefaultFuchsiaResourceDialect,
3164 >;
3165 fn r#register_characteristic_notifier(
3166 &self,
3167 mut handle: &Handle,
3168 mut notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
3169 ) -> Self::RegisterCharacteristicNotifierResponseFut {
3170 fn _decode(
3171 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3172 ) -> Result<RemoteServiceRegisterCharacteristicNotifierResult, fidl::Error> {
3173 let _response = fidl::client::decode_transaction_body::<
3174 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
3175 fidl::encoding::DefaultFuchsiaResourceDialect,
3176 0x35007a85245f5cc6,
3177 >(_buf?)?;
3178 Ok(_response.map(|x| x))
3179 }
3180 self.client.send_query_and_decode::<
3181 RemoteServiceRegisterCharacteristicNotifierRequest,
3182 RemoteServiceRegisterCharacteristicNotifierResult,
3183 >(
3184 (handle, notifier,),
3185 0x35007a85245f5cc6,
3186 fidl::encoding::DynamicFlags::empty(),
3187 _decode,
3188 )
3189 }
3190}
3191
3192pub struct RemoteServiceEventStream {
3193 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3194}
3195
3196impl std::marker::Unpin for RemoteServiceEventStream {}
3197
3198impl futures::stream::FusedStream for RemoteServiceEventStream {
3199 fn is_terminated(&self) -> bool {
3200 self.event_receiver.is_terminated()
3201 }
3202}
3203
3204impl futures::Stream for RemoteServiceEventStream {
3205 type Item = Result<RemoteServiceEvent, fidl::Error>;
3206
3207 fn poll_next(
3208 mut self: std::pin::Pin<&mut Self>,
3209 cx: &mut std::task::Context<'_>,
3210 ) -> std::task::Poll<Option<Self::Item>> {
3211 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3212 &mut self.event_receiver,
3213 cx
3214 )?) {
3215 Some(buf) => std::task::Poll::Ready(Some(RemoteServiceEvent::decode(buf))),
3216 None => std::task::Poll::Ready(None),
3217 }
3218 }
3219}
3220
3221#[derive(Debug)]
3222pub enum RemoteServiceEvent {}
3223
3224impl RemoteServiceEvent {
3225 fn decode(
3227 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3228 ) -> Result<RemoteServiceEvent, fidl::Error> {
3229 let (bytes, _handles) = buf.split_mut();
3230 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3231 debug_assert_eq!(tx_header.tx_id, 0);
3232 match tx_header.ordinal {
3233 _ => Err(fidl::Error::UnknownOrdinal {
3234 ordinal: tx_header.ordinal,
3235 protocol_name: <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3236 }),
3237 }
3238 }
3239}
3240
3241pub struct RemoteServiceRequestStream {
3243 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3244 is_terminated: bool,
3245}
3246
3247impl std::marker::Unpin for RemoteServiceRequestStream {}
3248
3249impl futures::stream::FusedStream for RemoteServiceRequestStream {
3250 fn is_terminated(&self) -> bool {
3251 self.is_terminated
3252 }
3253}
3254
3255impl fidl::endpoints::RequestStream for RemoteServiceRequestStream {
3256 type Protocol = RemoteServiceMarker;
3257 type ControlHandle = RemoteServiceControlHandle;
3258
3259 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3260 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3261 }
3262
3263 fn control_handle(&self) -> Self::ControlHandle {
3264 RemoteServiceControlHandle { inner: self.inner.clone() }
3265 }
3266
3267 fn into_inner(
3268 self,
3269 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3270 {
3271 (self.inner, self.is_terminated)
3272 }
3273
3274 fn from_inner(
3275 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3276 is_terminated: bool,
3277 ) -> Self {
3278 Self { inner, is_terminated }
3279 }
3280}
3281
3282impl futures::Stream for RemoteServiceRequestStream {
3283 type Item = Result<RemoteServiceRequest, fidl::Error>;
3284
3285 fn poll_next(
3286 mut self: std::pin::Pin<&mut Self>,
3287 cx: &mut std::task::Context<'_>,
3288 ) -> std::task::Poll<Option<Self::Item>> {
3289 let this = &mut *self;
3290 if this.inner.check_shutdown(cx) {
3291 this.is_terminated = true;
3292 return std::task::Poll::Ready(None);
3293 }
3294 if this.is_terminated {
3295 panic!("polled RemoteServiceRequestStream after completion");
3296 }
3297 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3298 |bytes, handles| {
3299 match this.inner.channel().read_etc(cx, bytes, handles) {
3300 std::task::Poll::Ready(Ok(())) => {}
3301 std::task::Poll::Pending => return std::task::Poll::Pending,
3302 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3303 this.is_terminated = true;
3304 return std::task::Poll::Ready(None);
3305 }
3306 std::task::Poll::Ready(Err(e)) => {
3307 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3308 e.into(),
3309 ))))
3310 }
3311 }
3312
3313 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3315
3316 std::task::Poll::Ready(Some(match header.ordinal {
3317 0x6cd730f12e402543 => {
3318 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3319 let mut req = fidl::new_empty!(
3320 fidl::encoding::EmptyPayload,
3321 fidl::encoding::DefaultFuchsiaResourceDialect
3322 );
3323 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3324 let control_handle =
3325 RemoteServiceControlHandle { inner: this.inner.clone() };
3326 Ok(RemoteServiceRequest::DiscoverCharacteristics {
3327 responder: RemoteServiceDiscoverCharacteristicsResponder {
3328 control_handle: std::mem::ManuallyDrop::new(control_handle),
3329 tx_id: header.tx_id,
3330 },
3331 })
3332 }
3333 0x739bb1e313162bbc => {
3334 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3335 let mut req = fidl::new_empty!(
3336 RemoteServiceReadByTypeRequest,
3337 fidl::encoding::DefaultFuchsiaResourceDialect
3338 );
3339 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadByTypeRequest>(&header, _body_bytes, handles, &mut req)?;
3340 let control_handle =
3341 RemoteServiceControlHandle { inner: this.inner.clone() };
3342 Ok(RemoteServiceRequest::ReadByType {
3343 uuid: req.uuid,
3344
3345 responder: RemoteServiceReadByTypeResponder {
3346 control_handle: std::mem::ManuallyDrop::new(control_handle),
3347 tx_id: header.tx_id,
3348 },
3349 })
3350 }
3351 0x4d41757ed69a96cb => {
3352 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3353 let mut req = fidl::new_empty!(
3354 RemoteServiceReadCharacteristicRequest,
3355 fidl::encoding::DefaultFuchsiaResourceDialect
3356 );
3357 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
3358 let control_handle =
3359 RemoteServiceControlHandle { inner: this.inner.clone() };
3360 Ok(RemoteServiceRequest::ReadCharacteristic {
3361 handle: req.handle,
3362 options: req.options,
3363
3364 responder: RemoteServiceReadCharacteristicResponder {
3365 control_handle: std::mem::ManuallyDrop::new(control_handle),
3366 tx_id: header.tx_id,
3367 },
3368 })
3369 }
3370 0x7fc7511adecde8c => {
3371 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3372 let mut req = fidl::new_empty!(
3373 RemoteServiceWriteCharacteristicRequest,
3374 fidl::encoding::DefaultFuchsiaResourceDialect
3375 );
3376 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteCharacteristicRequest>(&header, _body_bytes, handles, &mut req)?;
3377 let control_handle =
3378 RemoteServiceControlHandle { inner: this.inner.clone() };
3379 Ok(RemoteServiceRequest::WriteCharacteristic {
3380 handle: req.handle,
3381 value: req.value,
3382 options: req.options,
3383
3384 responder: RemoteServiceWriteCharacteristicResponder {
3385 control_handle: std::mem::ManuallyDrop::new(control_handle),
3386 tx_id: header.tx_id,
3387 },
3388 })
3389 }
3390 0x7ed7ce00457dcec1 => {
3391 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3392 let mut req = fidl::new_empty!(
3393 RemoteServiceReadDescriptorRequest,
3394 fidl::encoding::DefaultFuchsiaResourceDialect
3395 );
3396 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceReadDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
3397 let control_handle =
3398 RemoteServiceControlHandle { inner: this.inner.clone() };
3399 Ok(RemoteServiceRequest::ReadDescriptor {
3400 handle: req.handle,
3401 options: req.options,
3402
3403 responder: RemoteServiceReadDescriptorResponder {
3404 control_handle: std::mem::ManuallyDrop::new(control_handle),
3405 tx_id: header.tx_id,
3406 },
3407 })
3408 }
3409 0x21d9106bfd6b7351 => {
3410 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3411 let mut req = fidl::new_empty!(
3412 RemoteServiceWriteDescriptorRequest,
3413 fidl::encoding::DefaultFuchsiaResourceDialect
3414 );
3415 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceWriteDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
3416 let control_handle =
3417 RemoteServiceControlHandle { inner: this.inner.clone() };
3418 Ok(RemoteServiceRequest::WriteDescriptor {
3419 handle: req.handle,
3420 value: req.value,
3421 options: req.options,
3422
3423 responder: RemoteServiceWriteDescriptorResponder {
3424 control_handle: std::mem::ManuallyDrop::new(control_handle),
3425 tx_id: header.tx_id,
3426 },
3427 })
3428 }
3429 0x35007a85245f5cc6 => {
3430 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3431 let mut req = fidl::new_empty!(
3432 RemoteServiceRegisterCharacteristicNotifierRequest,
3433 fidl::encoding::DefaultFuchsiaResourceDialect
3434 );
3435 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteServiceRegisterCharacteristicNotifierRequest>(&header, _body_bytes, handles, &mut req)?;
3436 let control_handle =
3437 RemoteServiceControlHandle { inner: this.inner.clone() };
3438 Ok(RemoteServiceRequest::RegisterCharacteristicNotifier {
3439 handle: req.handle,
3440 notifier: req.notifier,
3441
3442 responder: RemoteServiceRegisterCharacteristicNotifierResponder {
3443 control_handle: std::mem::ManuallyDrop::new(control_handle),
3444 tx_id: header.tx_id,
3445 },
3446 })
3447 }
3448 _ => Err(fidl::Error::UnknownOrdinal {
3449 ordinal: header.ordinal,
3450 protocol_name:
3451 <RemoteServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3452 }),
3453 }))
3454 },
3455 )
3456 }
3457}
3458
3459#[derive(Debug)]
3460pub enum RemoteServiceRequest {
3461 DiscoverCharacteristics { responder: RemoteServiceDiscoverCharacteristicsResponder },
3464 ReadByType { uuid: fidl_fuchsia_bluetooth::Uuid, responder: RemoteServiceReadByTypeResponder },
3482 ReadCharacteristic {
3493 handle: Handle,
3494 options: ReadOptions,
3495 responder: RemoteServiceReadCharacteristicResponder,
3496 },
3497 WriteCharacteristic {
3515 handle: Handle,
3516 value: Vec<u8>,
3517 options: WriteOptions,
3518 responder: RemoteServiceWriteCharacteristicResponder,
3519 },
3520 ReadDescriptor {
3532 handle: Handle,
3533 options: ReadOptions,
3534 responder: RemoteServiceReadDescriptorResponder,
3535 },
3536 WriteDescriptor {
3554 handle: Handle,
3555 value: Vec<u8>,
3556 options: WriteOptions,
3557 responder: RemoteServiceWriteDescriptorResponder,
3558 },
3559 RegisterCharacteristicNotifier {
3587 handle: Handle,
3588 notifier: fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
3589 responder: RemoteServiceRegisterCharacteristicNotifierResponder,
3590 },
3591}
3592
3593impl RemoteServiceRequest {
3594 #[allow(irrefutable_let_patterns)]
3595 pub fn into_discover_characteristics(
3596 self,
3597 ) -> Option<(RemoteServiceDiscoverCharacteristicsResponder)> {
3598 if let RemoteServiceRequest::DiscoverCharacteristics { responder } = self {
3599 Some((responder))
3600 } else {
3601 None
3602 }
3603 }
3604
3605 #[allow(irrefutable_let_patterns)]
3606 pub fn into_read_by_type(
3607 self,
3608 ) -> Option<(fidl_fuchsia_bluetooth::Uuid, RemoteServiceReadByTypeResponder)> {
3609 if let RemoteServiceRequest::ReadByType { uuid, responder } = self {
3610 Some((uuid, responder))
3611 } else {
3612 None
3613 }
3614 }
3615
3616 #[allow(irrefutable_let_patterns)]
3617 pub fn into_read_characteristic(
3618 self,
3619 ) -> Option<(Handle, ReadOptions, RemoteServiceReadCharacteristicResponder)> {
3620 if let RemoteServiceRequest::ReadCharacteristic { handle, options, responder } = self {
3621 Some((handle, options, responder))
3622 } else {
3623 None
3624 }
3625 }
3626
3627 #[allow(irrefutable_let_patterns)]
3628 pub fn into_write_characteristic(
3629 self,
3630 ) -> Option<(Handle, Vec<u8>, WriteOptions, RemoteServiceWriteCharacteristicResponder)> {
3631 if let RemoteServiceRequest::WriteCharacteristic { handle, value, options, responder } =
3632 self
3633 {
3634 Some((handle, value, options, responder))
3635 } else {
3636 None
3637 }
3638 }
3639
3640 #[allow(irrefutable_let_patterns)]
3641 pub fn into_read_descriptor(
3642 self,
3643 ) -> Option<(Handle, ReadOptions, RemoteServiceReadDescriptorResponder)> {
3644 if let RemoteServiceRequest::ReadDescriptor { handle, options, responder } = self {
3645 Some((handle, options, responder))
3646 } else {
3647 None
3648 }
3649 }
3650
3651 #[allow(irrefutable_let_patterns)]
3652 pub fn into_write_descriptor(
3653 self,
3654 ) -> Option<(Handle, Vec<u8>, WriteOptions, RemoteServiceWriteDescriptorResponder)> {
3655 if let RemoteServiceRequest::WriteDescriptor { handle, value, options, responder } = self {
3656 Some((handle, value, options, responder))
3657 } else {
3658 None
3659 }
3660 }
3661
3662 #[allow(irrefutable_let_patterns)]
3663 pub fn into_register_characteristic_notifier(
3664 self,
3665 ) -> Option<(
3666 Handle,
3667 fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
3668 RemoteServiceRegisterCharacteristicNotifierResponder,
3669 )> {
3670 if let RemoteServiceRequest::RegisterCharacteristicNotifier {
3671 handle,
3672 notifier,
3673 responder,
3674 } = self
3675 {
3676 Some((handle, notifier, responder))
3677 } else {
3678 None
3679 }
3680 }
3681
3682 pub fn method_name(&self) -> &'static str {
3684 match *self {
3685 RemoteServiceRequest::DiscoverCharacteristics { .. } => "discover_characteristics",
3686 RemoteServiceRequest::ReadByType { .. } => "read_by_type",
3687 RemoteServiceRequest::ReadCharacteristic { .. } => "read_characteristic",
3688 RemoteServiceRequest::WriteCharacteristic { .. } => "write_characteristic",
3689 RemoteServiceRequest::ReadDescriptor { .. } => "read_descriptor",
3690 RemoteServiceRequest::WriteDescriptor { .. } => "write_descriptor",
3691 RemoteServiceRequest::RegisterCharacteristicNotifier { .. } => {
3692 "register_characteristic_notifier"
3693 }
3694 }
3695 }
3696}
3697
3698#[derive(Debug, Clone)]
3699pub struct RemoteServiceControlHandle {
3700 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3701}
3702
3703impl fidl::endpoints::ControlHandle for RemoteServiceControlHandle {
3704 fn shutdown(&self) {
3705 self.inner.shutdown()
3706 }
3707 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3708 self.inner.shutdown_with_epitaph(status)
3709 }
3710
3711 fn is_closed(&self) -> bool {
3712 self.inner.channel().is_closed()
3713 }
3714 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3715 self.inner.channel().on_closed()
3716 }
3717
3718 #[cfg(target_os = "fuchsia")]
3719 fn signal_peer(
3720 &self,
3721 clear_mask: zx::Signals,
3722 set_mask: zx::Signals,
3723 ) -> Result<(), zx_status::Status> {
3724 use fidl::Peered;
3725 self.inner.channel().signal_peer(clear_mask, set_mask)
3726 }
3727}
3728
3729impl RemoteServiceControlHandle {}
3730
3731#[must_use = "FIDL methods require a response to be sent"]
3732#[derive(Debug)]
3733pub struct RemoteServiceDiscoverCharacteristicsResponder {
3734 control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3735 tx_id: u32,
3736}
3737
3738impl std::ops::Drop for RemoteServiceDiscoverCharacteristicsResponder {
3742 fn drop(&mut self) {
3743 self.control_handle.shutdown();
3744 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3746 }
3747}
3748
3749impl fidl::endpoints::Responder for RemoteServiceDiscoverCharacteristicsResponder {
3750 type ControlHandle = RemoteServiceControlHandle;
3751
3752 fn control_handle(&self) -> &RemoteServiceControlHandle {
3753 &self.control_handle
3754 }
3755
3756 fn drop_without_shutdown(mut self) {
3757 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3759 std::mem::forget(self);
3761 }
3762}
3763
3764impl RemoteServiceDiscoverCharacteristicsResponder {
3765 pub fn send(self, mut characteristics: &[Characteristic]) -> Result<(), fidl::Error> {
3769 let _result = self.send_raw(characteristics);
3770 if _result.is_err() {
3771 self.control_handle.shutdown();
3772 }
3773 self.drop_without_shutdown();
3774 _result
3775 }
3776
3777 pub fn send_no_shutdown_on_err(
3779 self,
3780 mut characteristics: &[Characteristic],
3781 ) -> Result<(), fidl::Error> {
3782 let _result = self.send_raw(characteristics);
3783 self.drop_without_shutdown();
3784 _result
3785 }
3786
3787 fn send_raw(&self, mut characteristics: &[Characteristic]) -> Result<(), fidl::Error> {
3788 self.control_handle.inner.send::<RemoteServiceDiscoverCharacteristicsResponse>(
3789 (characteristics,),
3790 self.tx_id,
3791 0x6cd730f12e402543,
3792 fidl::encoding::DynamicFlags::empty(),
3793 )
3794 }
3795}
3796
3797#[must_use = "FIDL methods require a response to be sent"]
3798#[derive(Debug)]
3799pub struct RemoteServiceReadByTypeResponder {
3800 control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3801 tx_id: u32,
3802}
3803
3804impl std::ops::Drop for RemoteServiceReadByTypeResponder {
3808 fn drop(&mut self) {
3809 self.control_handle.shutdown();
3810 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3812 }
3813}
3814
3815impl fidl::endpoints::Responder for RemoteServiceReadByTypeResponder {
3816 type ControlHandle = RemoteServiceControlHandle;
3817
3818 fn control_handle(&self) -> &RemoteServiceControlHandle {
3819 &self.control_handle
3820 }
3821
3822 fn drop_without_shutdown(mut self) {
3823 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3825 std::mem::forget(self);
3827 }
3828}
3829
3830impl RemoteServiceReadByTypeResponder {
3831 pub fn send(self, mut result: Result<&[ReadByTypeResult], Error>) -> Result<(), fidl::Error> {
3835 let _result = self.send_raw(result);
3836 if _result.is_err() {
3837 self.control_handle.shutdown();
3838 }
3839 self.drop_without_shutdown();
3840 _result
3841 }
3842
3843 pub fn send_no_shutdown_on_err(
3845 self,
3846 mut result: Result<&[ReadByTypeResult], Error>,
3847 ) -> Result<(), fidl::Error> {
3848 let _result = self.send_raw(result);
3849 self.drop_without_shutdown();
3850 _result
3851 }
3852
3853 fn send_raw(&self, mut result: Result<&[ReadByTypeResult], Error>) -> Result<(), fidl::Error> {
3854 self.control_handle
3855 .inner
3856 .send::<fidl::encoding::ResultType<RemoteServiceReadByTypeResponse, Error>>(
3857 result.map(|results| (results,)),
3858 self.tx_id,
3859 0x739bb1e313162bbc,
3860 fidl::encoding::DynamicFlags::empty(),
3861 )
3862 }
3863}
3864
3865#[must_use = "FIDL methods require a response to be sent"]
3866#[derive(Debug)]
3867pub struct RemoteServiceReadCharacteristicResponder {
3868 control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3869 tx_id: u32,
3870}
3871
3872impl std::ops::Drop for RemoteServiceReadCharacteristicResponder {
3876 fn drop(&mut self) {
3877 self.control_handle.shutdown();
3878 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3880 }
3881}
3882
3883impl fidl::endpoints::Responder for RemoteServiceReadCharacteristicResponder {
3884 type ControlHandle = RemoteServiceControlHandle;
3885
3886 fn control_handle(&self) -> &RemoteServiceControlHandle {
3887 &self.control_handle
3888 }
3889
3890 fn drop_without_shutdown(mut self) {
3891 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3893 std::mem::forget(self);
3895 }
3896}
3897
3898impl RemoteServiceReadCharacteristicResponder {
3899 pub fn send(self, mut result: Result<&ReadValue, Error>) -> Result<(), fidl::Error> {
3903 let _result = self.send_raw(result);
3904 if _result.is_err() {
3905 self.control_handle.shutdown();
3906 }
3907 self.drop_without_shutdown();
3908 _result
3909 }
3910
3911 pub fn send_no_shutdown_on_err(
3913 self,
3914 mut result: Result<&ReadValue, Error>,
3915 ) -> Result<(), fidl::Error> {
3916 let _result = self.send_raw(result);
3917 self.drop_without_shutdown();
3918 _result
3919 }
3920
3921 fn send_raw(&self, mut result: Result<&ReadValue, Error>) -> Result<(), fidl::Error> {
3922 self.control_handle.inner.send::<fidl::encoding::ResultType<
3923 RemoteServiceReadCharacteristicResponse,
3924 Error,
3925 >>(
3926 result.map(|value| (value,)),
3927 self.tx_id,
3928 0x4d41757ed69a96cb,
3929 fidl::encoding::DynamicFlags::empty(),
3930 )
3931 }
3932}
3933
3934#[must_use = "FIDL methods require a response to be sent"]
3935#[derive(Debug)]
3936pub struct RemoteServiceWriteCharacteristicResponder {
3937 control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
3938 tx_id: u32,
3939}
3940
3941impl std::ops::Drop for RemoteServiceWriteCharacteristicResponder {
3945 fn drop(&mut self) {
3946 self.control_handle.shutdown();
3947 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3949 }
3950}
3951
3952impl fidl::endpoints::Responder for RemoteServiceWriteCharacteristicResponder {
3953 type ControlHandle = RemoteServiceControlHandle;
3954
3955 fn control_handle(&self) -> &RemoteServiceControlHandle {
3956 &self.control_handle
3957 }
3958
3959 fn drop_without_shutdown(mut self) {
3960 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3962 std::mem::forget(self);
3964 }
3965}
3966
3967impl RemoteServiceWriteCharacteristicResponder {
3968 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3972 let _result = self.send_raw(result);
3973 if _result.is_err() {
3974 self.control_handle.shutdown();
3975 }
3976 self.drop_without_shutdown();
3977 _result
3978 }
3979
3980 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3982 let _result = self.send_raw(result);
3983 self.drop_without_shutdown();
3984 _result
3985 }
3986
3987 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3988 self.control_handle
3989 .inner
3990 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3991 result,
3992 self.tx_id,
3993 0x7fc7511adecde8c,
3994 fidl::encoding::DynamicFlags::empty(),
3995 )
3996 }
3997}
3998
3999#[must_use = "FIDL methods require a response to be sent"]
4000#[derive(Debug)]
4001pub struct RemoteServiceReadDescriptorResponder {
4002 control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4003 tx_id: u32,
4004}
4005
4006impl std::ops::Drop for RemoteServiceReadDescriptorResponder {
4010 fn drop(&mut self) {
4011 self.control_handle.shutdown();
4012 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4014 }
4015}
4016
4017impl fidl::endpoints::Responder for RemoteServiceReadDescriptorResponder {
4018 type ControlHandle = RemoteServiceControlHandle;
4019
4020 fn control_handle(&self) -> &RemoteServiceControlHandle {
4021 &self.control_handle
4022 }
4023
4024 fn drop_without_shutdown(mut self) {
4025 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4027 std::mem::forget(self);
4029 }
4030}
4031
4032impl RemoteServiceReadDescriptorResponder {
4033 pub fn send(self, mut result: Result<&ReadValue, Error>) -> Result<(), fidl::Error> {
4037 let _result = self.send_raw(result);
4038 if _result.is_err() {
4039 self.control_handle.shutdown();
4040 }
4041 self.drop_without_shutdown();
4042 _result
4043 }
4044
4045 pub fn send_no_shutdown_on_err(
4047 self,
4048 mut result: Result<&ReadValue, Error>,
4049 ) -> Result<(), fidl::Error> {
4050 let _result = self.send_raw(result);
4051 self.drop_without_shutdown();
4052 _result
4053 }
4054
4055 fn send_raw(&self, mut result: Result<&ReadValue, Error>) -> Result<(), fidl::Error> {
4056 self.control_handle.inner.send::<fidl::encoding::ResultType<
4057 RemoteServiceReadDescriptorResponse,
4058 Error,
4059 >>(
4060 result.map(|value| (value,)),
4061 self.tx_id,
4062 0x7ed7ce00457dcec1,
4063 fidl::encoding::DynamicFlags::empty(),
4064 )
4065 }
4066}
4067
4068#[must_use = "FIDL methods require a response to be sent"]
4069#[derive(Debug)]
4070pub struct RemoteServiceWriteDescriptorResponder {
4071 control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4072 tx_id: u32,
4073}
4074
4075impl std::ops::Drop for RemoteServiceWriteDescriptorResponder {
4079 fn drop(&mut self) {
4080 self.control_handle.shutdown();
4081 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4083 }
4084}
4085
4086impl fidl::endpoints::Responder for RemoteServiceWriteDescriptorResponder {
4087 type ControlHandle = RemoteServiceControlHandle;
4088
4089 fn control_handle(&self) -> &RemoteServiceControlHandle {
4090 &self.control_handle
4091 }
4092
4093 fn drop_without_shutdown(mut self) {
4094 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4096 std::mem::forget(self);
4098 }
4099}
4100
4101impl RemoteServiceWriteDescriptorResponder {
4102 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4106 let _result = self.send_raw(result);
4107 if _result.is_err() {
4108 self.control_handle.shutdown();
4109 }
4110 self.drop_without_shutdown();
4111 _result
4112 }
4113
4114 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4116 let _result = self.send_raw(result);
4117 self.drop_without_shutdown();
4118 _result
4119 }
4120
4121 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4122 self.control_handle
4123 .inner
4124 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
4125 result,
4126 self.tx_id,
4127 0x21d9106bfd6b7351,
4128 fidl::encoding::DynamicFlags::empty(),
4129 )
4130 }
4131}
4132
4133#[must_use = "FIDL methods require a response to be sent"]
4134#[derive(Debug)]
4135pub struct RemoteServiceRegisterCharacteristicNotifierResponder {
4136 control_handle: std::mem::ManuallyDrop<RemoteServiceControlHandle>,
4137 tx_id: u32,
4138}
4139
4140impl std::ops::Drop for RemoteServiceRegisterCharacteristicNotifierResponder {
4144 fn drop(&mut self) {
4145 self.control_handle.shutdown();
4146 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4148 }
4149}
4150
4151impl fidl::endpoints::Responder for RemoteServiceRegisterCharacteristicNotifierResponder {
4152 type ControlHandle = RemoteServiceControlHandle;
4153
4154 fn control_handle(&self) -> &RemoteServiceControlHandle {
4155 &self.control_handle
4156 }
4157
4158 fn drop_without_shutdown(mut self) {
4159 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4161 std::mem::forget(self);
4163 }
4164}
4165
4166impl RemoteServiceRegisterCharacteristicNotifierResponder {
4167 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4171 let _result = self.send_raw(result);
4172 if _result.is_err() {
4173 self.control_handle.shutdown();
4174 }
4175 self.drop_without_shutdown();
4176 _result
4177 }
4178
4179 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4181 let _result = self.send_raw(result);
4182 self.drop_without_shutdown();
4183 _result
4184 }
4185
4186 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
4187 self.control_handle
4188 .inner
4189 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
4190 result,
4191 self.tx_id,
4192 0x35007a85245f5cc6,
4193 fidl::encoding::DynamicFlags::empty(),
4194 )
4195 }
4196}
4197
4198#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4199pub struct Server_Marker;
4200
4201impl fidl::endpoints::ProtocolMarker for Server_Marker {
4202 type Proxy = Server_Proxy;
4203 type RequestStream = Server_RequestStream;
4204 #[cfg(target_os = "fuchsia")]
4205 type SynchronousProxy = Server_SynchronousProxy;
4206
4207 const DEBUG_NAME: &'static str = "fuchsia.bluetooth.gatt2.Server";
4208}
4209impl fidl::endpoints::DiscoverableProtocolMarker for Server_Marker {}
4210pub type ServerPublishServiceResult = Result<(), PublishServiceError>;
4211
4212pub trait Server_ProxyInterface: Send + Sync {
4213 type PublishServiceResponseFut: std::future::Future<Output = Result<ServerPublishServiceResult, fidl::Error>>
4214 + Send;
4215 fn r#publish_service(
4216 &self,
4217 info: &ServiceInfo,
4218 service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
4219 ) -> Self::PublishServiceResponseFut;
4220}
4221#[derive(Debug)]
4222#[cfg(target_os = "fuchsia")]
4223pub struct Server_SynchronousProxy {
4224 client: fidl::client::sync::Client,
4225}
4226
4227#[cfg(target_os = "fuchsia")]
4228impl fidl::endpoints::SynchronousProxy for Server_SynchronousProxy {
4229 type Proxy = Server_Proxy;
4230 type Protocol = Server_Marker;
4231
4232 fn from_channel(inner: fidl::Channel) -> Self {
4233 Self::new(inner)
4234 }
4235
4236 fn into_channel(self) -> fidl::Channel {
4237 self.client.into_channel()
4238 }
4239
4240 fn as_channel(&self) -> &fidl::Channel {
4241 self.client.as_channel()
4242 }
4243}
4244
4245#[cfg(target_os = "fuchsia")]
4246impl Server_SynchronousProxy {
4247 pub fn new(channel: fidl::Channel) -> Self {
4248 let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4249 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4250 }
4251
4252 pub fn into_channel(self) -> fidl::Channel {
4253 self.client.into_channel()
4254 }
4255
4256 pub fn wait_for_event(
4259 &self,
4260 deadline: zx::MonotonicInstant,
4261 ) -> Result<Server_Event, fidl::Error> {
4262 Server_Event::decode(self.client.wait_for_event(deadline)?)
4263 }
4264
4265 pub fn r#publish_service(
4280 &self,
4281 mut info: &ServiceInfo,
4282 mut service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
4283 ___deadline: zx::MonotonicInstant,
4284 ) -> Result<ServerPublishServiceResult, fidl::Error> {
4285 let _response =
4286 self.client.send_query::<ServerPublishServiceRequest, fidl::encoding::ResultType<
4287 fidl::encoding::EmptyStruct,
4288 PublishServiceError,
4289 >>(
4290 (info, service),
4291 0x3110442f2077bfe2,
4292 fidl::encoding::DynamicFlags::empty(),
4293 ___deadline,
4294 )?;
4295 Ok(_response.map(|x| x))
4296 }
4297}
4298
4299#[cfg(target_os = "fuchsia")]
4300impl From<Server_SynchronousProxy> for zx::Handle {
4301 fn from(value: Server_SynchronousProxy) -> Self {
4302 value.into_channel().into()
4303 }
4304}
4305
4306#[cfg(target_os = "fuchsia")]
4307impl From<fidl::Channel> for Server_SynchronousProxy {
4308 fn from(value: fidl::Channel) -> Self {
4309 Self::new(value)
4310 }
4311}
4312
4313#[derive(Debug, Clone)]
4314pub struct Server_Proxy {
4315 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4316}
4317
4318impl fidl::endpoints::Proxy for Server_Proxy {
4319 type Protocol = Server_Marker;
4320
4321 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4322 Self::new(inner)
4323 }
4324
4325 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4326 self.client.into_channel().map_err(|client| Self { client })
4327 }
4328
4329 fn as_channel(&self) -> &::fidl::AsyncChannel {
4330 self.client.as_channel()
4331 }
4332}
4333
4334impl Server_Proxy {
4335 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4337 let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4338 Self { client: fidl::client::Client::new(channel, protocol_name) }
4339 }
4340
4341 pub fn take_event_stream(&self) -> Server_EventStream {
4347 Server_EventStream { event_receiver: self.client.take_event_receiver() }
4348 }
4349
4350 pub fn r#publish_service(
4365 &self,
4366 mut info: &ServiceInfo,
4367 mut service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
4368 ) -> fidl::client::QueryResponseFut<
4369 ServerPublishServiceResult,
4370 fidl::encoding::DefaultFuchsiaResourceDialect,
4371 > {
4372 Server_ProxyInterface::r#publish_service(self, info, service)
4373 }
4374}
4375
4376impl Server_ProxyInterface for Server_Proxy {
4377 type PublishServiceResponseFut = fidl::client::QueryResponseFut<
4378 ServerPublishServiceResult,
4379 fidl::encoding::DefaultFuchsiaResourceDialect,
4380 >;
4381 fn r#publish_service(
4382 &self,
4383 mut info: &ServiceInfo,
4384 mut service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
4385 ) -> Self::PublishServiceResponseFut {
4386 fn _decode(
4387 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4388 ) -> Result<ServerPublishServiceResult, fidl::Error> {
4389 let _response = fidl::client::decode_transaction_body::<
4390 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishServiceError>,
4391 fidl::encoding::DefaultFuchsiaResourceDialect,
4392 0x3110442f2077bfe2,
4393 >(_buf?)?;
4394 Ok(_response.map(|x| x))
4395 }
4396 self.client
4397 .send_query_and_decode::<ServerPublishServiceRequest, ServerPublishServiceResult>(
4398 (info, service),
4399 0x3110442f2077bfe2,
4400 fidl::encoding::DynamicFlags::empty(),
4401 _decode,
4402 )
4403 }
4404}
4405
4406pub struct Server_EventStream {
4407 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4408}
4409
4410impl std::marker::Unpin for Server_EventStream {}
4411
4412impl futures::stream::FusedStream for Server_EventStream {
4413 fn is_terminated(&self) -> bool {
4414 self.event_receiver.is_terminated()
4415 }
4416}
4417
4418impl futures::Stream for Server_EventStream {
4419 type Item = Result<Server_Event, fidl::Error>;
4420
4421 fn poll_next(
4422 mut self: std::pin::Pin<&mut Self>,
4423 cx: &mut std::task::Context<'_>,
4424 ) -> std::task::Poll<Option<Self::Item>> {
4425 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4426 &mut self.event_receiver,
4427 cx
4428 )?) {
4429 Some(buf) => std::task::Poll::Ready(Some(Server_Event::decode(buf))),
4430 None => std::task::Poll::Ready(None),
4431 }
4432 }
4433}
4434
4435#[derive(Debug)]
4436pub enum Server_Event {}
4437
4438impl Server_Event {
4439 fn decode(
4441 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4442 ) -> Result<Server_Event, fidl::Error> {
4443 let (bytes, _handles) = buf.split_mut();
4444 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4445 debug_assert_eq!(tx_header.tx_id, 0);
4446 match tx_header.ordinal {
4447 _ => Err(fidl::Error::UnknownOrdinal {
4448 ordinal: tx_header.ordinal,
4449 protocol_name: <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4450 }),
4451 }
4452 }
4453}
4454
4455pub struct Server_RequestStream {
4457 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4458 is_terminated: bool,
4459}
4460
4461impl std::marker::Unpin for Server_RequestStream {}
4462
4463impl futures::stream::FusedStream for Server_RequestStream {
4464 fn is_terminated(&self) -> bool {
4465 self.is_terminated
4466 }
4467}
4468
4469impl fidl::endpoints::RequestStream for Server_RequestStream {
4470 type Protocol = Server_Marker;
4471 type ControlHandle = Server_ControlHandle;
4472
4473 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4474 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4475 }
4476
4477 fn control_handle(&self) -> Self::ControlHandle {
4478 Server_ControlHandle { inner: self.inner.clone() }
4479 }
4480
4481 fn into_inner(
4482 self,
4483 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4484 {
4485 (self.inner, self.is_terminated)
4486 }
4487
4488 fn from_inner(
4489 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4490 is_terminated: bool,
4491 ) -> Self {
4492 Self { inner, is_terminated }
4493 }
4494}
4495
4496impl futures::Stream for Server_RequestStream {
4497 type Item = Result<Server_Request, fidl::Error>;
4498
4499 fn poll_next(
4500 mut self: std::pin::Pin<&mut Self>,
4501 cx: &mut std::task::Context<'_>,
4502 ) -> std::task::Poll<Option<Self::Item>> {
4503 let this = &mut *self;
4504 if this.inner.check_shutdown(cx) {
4505 this.is_terminated = true;
4506 return std::task::Poll::Ready(None);
4507 }
4508 if this.is_terminated {
4509 panic!("polled Server_RequestStream after completion");
4510 }
4511 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4512 |bytes, handles| {
4513 match this.inner.channel().read_etc(cx, bytes, handles) {
4514 std::task::Poll::Ready(Ok(())) => {}
4515 std::task::Poll::Pending => return std::task::Poll::Pending,
4516 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4517 this.is_terminated = true;
4518 return std::task::Poll::Ready(None);
4519 }
4520 std::task::Poll::Ready(Err(e)) => {
4521 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4522 e.into(),
4523 ))))
4524 }
4525 }
4526
4527 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4529
4530 std::task::Poll::Ready(Some(match header.ordinal {
4531 0x3110442f2077bfe2 => {
4532 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4533 let mut req = fidl::new_empty!(
4534 ServerPublishServiceRequest,
4535 fidl::encoding::DefaultFuchsiaResourceDialect
4536 );
4537 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerPublishServiceRequest>(&header, _body_bytes, handles, &mut req)?;
4538 let control_handle = Server_ControlHandle { inner: this.inner.clone() };
4539 Ok(Server_Request::PublishService {
4540 info: req.info,
4541 service: req.service,
4542
4543 responder: Server_PublishServiceResponder {
4544 control_handle: std::mem::ManuallyDrop::new(control_handle),
4545 tx_id: header.tx_id,
4546 },
4547 })
4548 }
4549 _ => Err(fidl::Error::UnknownOrdinal {
4550 ordinal: header.ordinal,
4551 protocol_name:
4552 <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4553 }),
4554 }))
4555 },
4556 )
4557 }
4558}
4559
4560#[derive(Debug)]
4561pub enum Server_Request {
4562 PublishService {
4577 info: ServiceInfo,
4578 service: fidl::endpoints::ClientEnd<LocalServiceMarker>,
4579 responder: Server_PublishServiceResponder,
4580 },
4581}
4582
4583impl Server_Request {
4584 #[allow(irrefutable_let_patterns)]
4585 pub fn into_publish_service(
4586 self,
4587 ) -> Option<(
4588 ServiceInfo,
4589 fidl::endpoints::ClientEnd<LocalServiceMarker>,
4590 Server_PublishServiceResponder,
4591 )> {
4592 if let Server_Request::PublishService { info, service, responder } = self {
4593 Some((info, service, responder))
4594 } else {
4595 None
4596 }
4597 }
4598
4599 pub fn method_name(&self) -> &'static str {
4601 match *self {
4602 Server_Request::PublishService { .. } => "publish_service",
4603 }
4604 }
4605}
4606
4607#[derive(Debug, Clone)]
4608pub struct Server_ControlHandle {
4609 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4610}
4611
4612impl fidl::endpoints::ControlHandle for Server_ControlHandle {
4613 fn shutdown(&self) {
4614 self.inner.shutdown()
4615 }
4616 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4617 self.inner.shutdown_with_epitaph(status)
4618 }
4619
4620 fn is_closed(&self) -> bool {
4621 self.inner.channel().is_closed()
4622 }
4623 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4624 self.inner.channel().on_closed()
4625 }
4626
4627 #[cfg(target_os = "fuchsia")]
4628 fn signal_peer(
4629 &self,
4630 clear_mask: zx::Signals,
4631 set_mask: zx::Signals,
4632 ) -> Result<(), zx_status::Status> {
4633 use fidl::Peered;
4634 self.inner.channel().signal_peer(clear_mask, set_mask)
4635 }
4636}
4637
4638impl Server_ControlHandle {}
4639
4640#[must_use = "FIDL methods require a response to be sent"]
4641#[derive(Debug)]
4642pub struct Server_PublishServiceResponder {
4643 control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
4644 tx_id: u32,
4645}
4646
4647impl std::ops::Drop for Server_PublishServiceResponder {
4651 fn drop(&mut self) {
4652 self.control_handle.shutdown();
4653 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4655 }
4656}
4657
4658impl fidl::endpoints::Responder for Server_PublishServiceResponder {
4659 type ControlHandle = Server_ControlHandle;
4660
4661 fn control_handle(&self) -> &Server_ControlHandle {
4662 &self.control_handle
4663 }
4664
4665 fn drop_without_shutdown(mut self) {
4666 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4668 std::mem::forget(self);
4670 }
4671}
4672
4673impl Server_PublishServiceResponder {
4674 pub fn send(self, mut result: Result<(), PublishServiceError>) -> Result<(), fidl::Error> {
4678 let _result = self.send_raw(result);
4679 if _result.is_err() {
4680 self.control_handle.shutdown();
4681 }
4682 self.drop_without_shutdown();
4683 _result
4684 }
4685
4686 pub fn send_no_shutdown_on_err(
4688 self,
4689 mut result: Result<(), PublishServiceError>,
4690 ) -> Result<(), fidl::Error> {
4691 let _result = self.send_raw(result);
4692 self.drop_without_shutdown();
4693 _result
4694 }
4695
4696 fn send_raw(&self, mut result: Result<(), PublishServiceError>) -> Result<(), fidl::Error> {
4697 self.control_handle.inner.send::<fidl::encoding::ResultType<
4698 fidl::encoding::EmptyStruct,
4699 PublishServiceError,
4700 >>(
4701 result,
4702 self.tx_id,
4703 0x3110442f2077bfe2,
4704 fidl::encoding::DynamicFlags::empty(),
4705 )
4706 }
4707}
4708
4709mod internal {
4710 use super::*;
4711
4712 impl fidl::encoding::ResourceTypeMarker for ClientConnectToServiceRequest {
4713 type Borrowed<'a> = &'a mut Self;
4714 fn take_or_borrow<'a>(
4715 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4716 ) -> Self::Borrowed<'a> {
4717 value
4718 }
4719 }
4720
4721 unsafe impl fidl::encoding::TypeMarker for ClientConnectToServiceRequest {
4722 type Owned = Self;
4723
4724 #[inline(always)]
4725 fn inline_align(_context: fidl::encoding::Context) -> usize {
4726 8
4727 }
4728
4729 #[inline(always)]
4730 fn inline_size(_context: fidl::encoding::Context) -> usize {
4731 16
4732 }
4733 }
4734
4735 unsafe impl
4736 fidl::encoding::Encode<
4737 ClientConnectToServiceRequest,
4738 fidl::encoding::DefaultFuchsiaResourceDialect,
4739 > for &mut ClientConnectToServiceRequest
4740 {
4741 #[inline]
4742 unsafe fn encode(
4743 self,
4744 encoder: &mut fidl::encoding::Encoder<
4745 '_,
4746 fidl::encoding::DefaultFuchsiaResourceDialect,
4747 >,
4748 offset: usize,
4749 _depth: fidl::encoding::Depth,
4750 ) -> fidl::Result<()> {
4751 encoder.debug_check_bounds::<ClientConnectToServiceRequest>(offset);
4752 fidl::encoding::Encode::<ClientConnectToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4754 (
4755 <ServiceHandle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
4756 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service),
4757 ),
4758 encoder, offset, _depth
4759 )
4760 }
4761 }
4762 unsafe impl<
4763 T0: fidl::encoding::Encode<ServiceHandle, fidl::encoding::DefaultFuchsiaResourceDialect>,
4764 T1: fidl::encoding::Encode<
4765 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
4766 fidl::encoding::DefaultFuchsiaResourceDialect,
4767 >,
4768 >
4769 fidl::encoding::Encode<
4770 ClientConnectToServiceRequest,
4771 fidl::encoding::DefaultFuchsiaResourceDialect,
4772 > for (T0, T1)
4773 {
4774 #[inline]
4775 unsafe fn encode(
4776 self,
4777 encoder: &mut fidl::encoding::Encoder<
4778 '_,
4779 fidl::encoding::DefaultFuchsiaResourceDialect,
4780 >,
4781 offset: usize,
4782 depth: fidl::encoding::Depth,
4783 ) -> fidl::Result<()> {
4784 encoder.debug_check_bounds::<ClientConnectToServiceRequest>(offset);
4785 unsafe {
4788 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4789 (ptr as *mut u64).write_unaligned(0);
4790 }
4791 self.0.encode(encoder, offset + 0, depth)?;
4793 self.1.encode(encoder, offset + 8, depth)?;
4794 Ok(())
4795 }
4796 }
4797
4798 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4799 for ClientConnectToServiceRequest
4800 {
4801 #[inline(always)]
4802 fn new_empty() -> Self {
4803 Self {
4804 handle: fidl::new_empty!(
4805 ServiceHandle,
4806 fidl::encoding::DefaultFuchsiaResourceDialect
4807 ),
4808 service: fidl::new_empty!(
4809 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
4810 fidl::encoding::DefaultFuchsiaResourceDialect
4811 ),
4812 }
4813 }
4814
4815 #[inline]
4816 unsafe fn decode(
4817 &mut self,
4818 decoder: &mut fidl::encoding::Decoder<
4819 '_,
4820 fidl::encoding::DefaultFuchsiaResourceDialect,
4821 >,
4822 offset: usize,
4823 _depth: fidl::encoding::Depth,
4824 ) -> fidl::Result<()> {
4825 decoder.debug_check_bounds::<Self>(offset);
4826 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4828 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4829 let mask = 0xffffffff00000000u64;
4830 let maskedval = padval & mask;
4831 if maskedval != 0 {
4832 return Err(fidl::Error::NonZeroPadding {
4833 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4834 });
4835 }
4836 fidl::decode!(
4837 ServiceHandle,
4838 fidl::encoding::DefaultFuchsiaResourceDialect,
4839 &mut self.handle,
4840 decoder,
4841 offset + 0,
4842 _depth
4843 )?;
4844 fidl::decode!(
4845 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RemoteServiceMarker>>,
4846 fidl::encoding::DefaultFuchsiaResourceDialect,
4847 &mut self.service,
4848 decoder,
4849 offset + 8,
4850 _depth
4851 )?;
4852 Ok(())
4853 }
4854 }
4855
4856 impl fidl::encoding::ResourceTypeMarker for LocalServiceOnIndicateValueRequest {
4857 type Borrowed<'a> = &'a mut Self;
4858 fn take_or_borrow<'a>(
4859 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4860 ) -> Self::Borrowed<'a> {
4861 value
4862 }
4863 }
4864
4865 unsafe impl fidl::encoding::TypeMarker for LocalServiceOnIndicateValueRequest {
4866 type Owned = Self;
4867
4868 #[inline(always)]
4869 fn inline_align(_context: fidl::encoding::Context) -> usize {
4870 8
4871 }
4872
4873 #[inline(always)]
4874 fn inline_size(_context: fidl::encoding::Context) -> usize {
4875 24
4876 }
4877 }
4878
4879 unsafe impl
4880 fidl::encoding::Encode<
4881 LocalServiceOnIndicateValueRequest,
4882 fidl::encoding::DefaultFuchsiaResourceDialect,
4883 > for &mut LocalServiceOnIndicateValueRequest
4884 {
4885 #[inline]
4886 unsafe fn encode(
4887 self,
4888 encoder: &mut fidl::encoding::Encoder<
4889 '_,
4890 fidl::encoding::DefaultFuchsiaResourceDialect,
4891 >,
4892 offset: usize,
4893 _depth: fidl::encoding::Depth,
4894 ) -> fidl::Result<()> {
4895 encoder.debug_check_bounds::<LocalServiceOnIndicateValueRequest>(offset);
4896 fidl::encoding::Encode::<
4898 LocalServiceOnIndicateValueRequest,
4899 fidl::encoding::DefaultFuchsiaResourceDialect,
4900 >::encode(
4901 (
4902 <ValueChangedParameters as fidl::encoding::ValueTypeMarker>::borrow(
4903 &self.update,
4904 ),
4905 <fidl::encoding::HandleType<
4906 fidl::EventPair,
4907 { fidl::ObjectType::EVENTPAIR.into_raw() },
4908 2147483648,
4909 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4910 &mut self.confirmation,
4911 ),
4912 ),
4913 encoder,
4914 offset,
4915 _depth,
4916 )
4917 }
4918 }
4919 unsafe impl<
4920 T0: fidl::encoding::Encode<
4921 ValueChangedParameters,
4922 fidl::encoding::DefaultFuchsiaResourceDialect,
4923 >,
4924 T1: fidl::encoding::Encode<
4925 fidl::encoding::HandleType<
4926 fidl::EventPair,
4927 { fidl::ObjectType::EVENTPAIR.into_raw() },
4928 2147483648,
4929 >,
4930 fidl::encoding::DefaultFuchsiaResourceDialect,
4931 >,
4932 >
4933 fidl::encoding::Encode<
4934 LocalServiceOnIndicateValueRequest,
4935 fidl::encoding::DefaultFuchsiaResourceDialect,
4936 > for (T0, T1)
4937 {
4938 #[inline]
4939 unsafe fn encode(
4940 self,
4941 encoder: &mut fidl::encoding::Encoder<
4942 '_,
4943 fidl::encoding::DefaultFuchsiaResourceDialect,
4944 >,
4945 offset: usize,
4946 depth: fidl::encoding::Depth,
4947 ) -> fidl::Result<()> {
4948 encoder.debug_check_bounds::<LocalServiceOnIndicateValueRequest>(offset);
4949 unsafe {
4952 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4953 (ptr as *mut u64).write_unaligned(0);
4954 }
4955 self.0.encode(encoder, offset + 0, depth)?;
4957 self.1.encode(encoder, offset + 16, depth)?;
4958 Ok(())
4959 }
4960 }
4961
4962 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4963 for LocalServiceOnIndicateValueRequest
4964 {
4965 #[inline(always)]
4966 fn new_empty() -> Self {
4967 Self {
4968 update: fidl::new_empty!(
4969 ValueChangedParameters,
4970 fidl::encoding::DefaultFuchsiaResourceDialect
4971 ),
4972 confirmation: fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
4973 }
4974 }
4975
4976 #[inline]
4977 unsafe fn decode(
4978 &mut self,
4979 decoder: &mut fidl::encoding::Decoder<
4980 '_,
4981 fidl::encoding::DefaultFuchsiaResourceDialect,
4982 >,
4983 offset: usize,
4984 _depth: fidl::encoding::Depth,
4985 ) -> fidl::Result<()> {
4986 decoder.debug_check_bounds::<Self>(offset);
4987 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4989 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4990 let mask = 0xffffffff00000000u64;
4991 let maskedval = padval & mask;
4992 if maskedval != 0 {
4993 return Err(fidl::Error::NonZeroPadding {
4994 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4995 });
4996 }
4997 fidl::decode!(
4998 ValueChangedParameters,
4999 fidl::encoding::DefaultFuchsiaResourceDialect,
5000 &mut self.update,
5001 decoder,
5002 offset + 0,
5003 _depth
5004 )?;
5005 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.confirmation, decoder, offset + 16, _depth)?;
5006 Ok(())
5007 }
5008 }
5009
5010 impl fidl::encoding::ResourceTypeMarker for RemoteServiceRegisterCharacteristicNotifierRequest {
5011 type Borrowed<'a> = &'a mut Self;
5012 fn take_or_borrow<'a>(
5013 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5014 ) -> Self::Borrowed<'a> {
5015 value
5016 }
5017 }
5018
5019 unsafe impl fidl::encoding::TypeMarker for RemoteServiceRegisterCharacteristicNotifierRequest {
5020 type Owned = Self;
5021
5022 #[inline(always)]
5023 fn inline_align(_context: fidl::encoding::Context) -> usize {
5024 8
5025 }
5026
5027 #[inline(always)]
5028 fn inline_size(_context: fidl::encoding::Context) -> usize {
5029 16
5030 }
5031 }
5032
5033 unsafe impl
5034 fidl::encoding::Encode<
5035 RemoteServiceRegisterCharacteristicNotifierRequest,
5036 fidl::encoding::DefaultFuchsiaResourceDialect,
5037 > for &mut RemoteServiceRegisterCharacteristicNotifierRequest
5038 {
5039 #[inline]
5040 unsafe fn encode(
5041 self,
5042 encoder: &mut fidl::encoding::Encoder<
5043 '_,
5044 fidl::encoding::DefaultFuchsiaResourceDialect,
5045 >,
5046 offset: usize,
5047 _depth: fidl::encoding::Depth,
5048 ) -> fidl::Result<()> {
5049 encoder
5050 .debug_check_bounds::<RemoteServiceRegisterCharacteristicNotifierRequest>(offset);
5051 fidl::encoding::Encode::<
5053 RemoteServiceRegisterCharacteristicNotifierRequest,
5054 fidl::encoding::DefaultFuchsiaResourceDialect,
5055 >::encode(
5056 (
5057 <Handle as fidl::encoding::ValueTypeMarker>::borrow(&self.handle),
5058 <fidl::encoding::Endpoint<
5059 fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
5060 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5061 &mut self.notifier
5062 ),
5063 ),
5064 encoder,
5065 offset,
5066 _depth,
5067 )
5068 }
5069 }
5070 unsafe impl<
5071 T0: fidl::encoding::Encode<Handle, fidl::encoding::DefaultFuchsiaResourceDialect>,
5072 T1: fidl::encoding::Encode<
5073 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>>,
5074 fidl::encoding::DefaultFuchsiaResourceDialect,
5075 >,
5076 >
5077 fidl::encoding::Encode<
5078 RemoteServiceRegisterCharacteristicNotifierRequest,
5079 fidl::encoding::DefaultFuchsiaResourceDialect,
5080 > for (T0, T1)
5081 {
5082 #[inline]
5083 unsafe fn encode(
5084 self,
5085 encoder: &mut fidl::encoding::Encoder<
5086 '_,
5087 fidl::encoding::DefaultFuchsiaResourceDialect,
5088 >,
5089 offset: usize,
5090 depth: fidl::encoding::Depth,
5091 ) -> fidl::Result<()> {
5092 encoder
5093 .debug_check_bounds::<RemoteServiceRegisterCharacteristicNotifierRequest>(offset);
5094 unsafe {
5097 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
5098 (ptr as *mut u64).write_unaligned(0);
5099 }
5100 self.0.encode(encoder, offset + 0, depth)?;
5102 self.1.encode(encoder, offset + 8, depth)?;
5103 Ok(())
5104 }
5105 }
5106
5107 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5108 for RemoteServiceRegisterCharacteristicNotifierRequest
5109 {
5110 #[inline(always)]
5111 fn new_empty() -> Self {
5112 Self {
5113 handle: fidl::new_empty!(Handle, fidl::encoding::DefaultFuchsiaResourceDialect),
5114 notifier: fidl::new_empty!(
5115 fidl::encoding::Endpoint<
5116 fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>,
5117 >,
5118 fidl::encoding::DefaultFuchsiaResourceDialect
5119 ),
5120 }
5121 }
5122
5123 #[inline]
5124 unsafe fn decode(
5125 &mut self,
5126 decoder: &mut fidl::encoding::Decoder<
5127 '_,
5128 fidl::encoding::DefaultFuchsiaResourceDialect,
5129 >,
5130 offset: usize,
5131 _depth: fidl::encoding::Depth,
5132 ) -> fidl::Result<()> {
5133 decoder.debug_check_bounds::<Self>(offset);
5134 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
5136 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5137 let mask = 0xffffffff00000000u64;
5138 let maskedval = padval & mask;
5139 if maskedval != 0 {
5140 return Err(fidl::Error::NonZeroPadding {
5141 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
5142 });
5143 }
5144 fidl::decode!(
5145 Handle,
5146 fidl::encoding::DefaultFuchsiaResourceDialect,
5147 &mut self.handle,
5148 decoder,
5149 offset + 0,
5150 _depth
5151 )?;
5152 fidl::decode!(
5153 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<CharacteristicNotifierMarker>>,
5154 fidl::encoding::DefaultFuchsiaResourceDialect,
5155 &mut self.notifier,
5156 decoder,
5157 offset + 8,
5158 _depth
5159 )?;
5160 Ok(())
5161 }
5162 }
5163
5164 impl fidl::encoding::ResourceTypeMarker for ServerPublishServiceRequest {
5165 type Borrowed<'a> = &'a mut Self;
5166 fn take_or_borrow<'a>(
5167 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5168 ) -> Self::Borrowed<'a> {
5169 value
5170 }
5171 }
5172
5173 unsafe impl fidl::encoding::TypeMarker for ServerPublishServiceRequest {
5174 type Owned = Self;
5175
5176 #[inline(always)]
5177 fn inline_align(_context: fidl::encoding::Context) -> usize {
5178 8
5179 }
5180
5181 #[inline(always)]
5182 fn inline_size(_context: fidl::encoding::Context) -> usize {
5183 24
5184 }
5185 }
5186
5187 unsafe impl
5188 fidl::encoding::Encode<
5189 ServerPublishServiceRequest,
5190 fidl::encoding::DefaultFuchsiaResourceDialect,
5191 > for &mut ServerPublishServiceRequest
5192 {
5193 #[inline]
5194 unsafe fn encode(
5195 self,
5196 encoder: &mut fidl::encoding::Encoder<
5197 '_,
5198 fidl::encoding::DefaultFuchsiaResourceDialect,
5199 >,
5200 offset: usize,
5201 _depth: fidl::encoding::Depth,
5202 ) -> fidl::Result<()> {
5203 encoder.debug_check_bounds::<ServerPublishServiceRequest>(offset);
5204 fidl::encoding::Encode::<ServerPublishServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5206 (
5207 <ServiceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
5208 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service),
5209 ),
5210 encoder, offset, _depth
5211 )
5212 }
5213 }
5214 unsafe impl<
5215 T0: fidl::encoding::Encode<ServiceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>,
5216 T1: fidl::encoding::Encode<
5217 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>>,
5218 fidl::encoding::DefaultFuchsiaResourceDialect,
5219 >,
5220 >
5221 fidl::encoding::Encode<
5222 ServerPublishServiceRequest,
5223 fidl::encoding::DefaultFuchsiaResourceDialect,
5224 > for (T0, T1)
5225 {
5226 #[inline]
5227 unsafe fn encode(
5228 self,
5229 encoder: &mut fidl::encoding::Encoder<
5230 '_,
5231 fidl::encoding::DefaultFuchsiaResourceDialect,
5232 >,
5233 offset: usize,
5234 depth: fidl::encoding::Depth,
5235 ) -> fidl::Result<()> {
5236 encoder.debug_check_bounds::<ServerPublishServiceRequest>(offset);
5237 unsafe {
5240 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5241 (ptr as *mut u64).write_unaligned(0);
5242 }
5243 self.0.encode(encoder, offset + 0, depth)?;
5245 self.1.encode(encoder, offset + 16, depth)?;
5246 Ok(())
5247 }
5248 }
5249
5250 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5251 for ServerPublishServiceRequest
5252 {
5253 #[inline(always)]
5254 fn new_empty() -> Self {
5255 Self {
5256 info: fidl::new_empty!(ServiceInfo, fidl::encoding::DefaultFuchsiaResourceDialect),
5257 service: fidl::new_empty!(
5258 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>>,
5259 fidl::encoding::DefaultFuchsiaResourceDialect
5260 ),
5261 }
5262 }
5263
5264 #[inline]
5265 unsafe fn decode(
5266 &mut self,
5267 decoder: &mut fidl::encoding::Decoder<
5268 '_,
5269 fidl::encoding::DefaultFuchsiaResourceDialect,
5270 >,
5271 offset: usize,
5272 _depth: fidl::encoding::Depth,
5273 ) -> fidl::Result<()> {
5274 decoder.debug_check_bounds::<Self>(offset);
5275 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5277 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5278 let mask = 0xffffffff00000000u64;
5279 let maskedval = padval & mask;
5280 if maskedval != 0 {
5281 return Err(fidl::Error::NonZeroPadding {
5282 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5283 });
5284 }
5285 fidl::decode!(
5286 ServiceInfo,
5287 fidl::encoding::DefaultFuchsiaResourceDialect,
5288 &mut self.info,
5289 decoder,
5290 offset + 0,
5291 _depth
5292 )?;
5293 fidl::decode!(
5294 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<LocalServiceMarker>>,
5295 fidl::encoding::DefaultFuchsiaResourceDialect,
5296 &mut self.service,
5297 decoder,
5298 offset + 16,
5299 _depth
5300 )?;
5301 Ok(())
5302 }
5303 }
5304}