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_hardware_haptics__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeviceMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeviceMarker {
18 type Proxy = DeviceProxy;
19 type RequestStream = DeviceRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeviceSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.hardware.haptics.Device";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
26pub type DeviceStartVibrationResult = Result<(), i32>;
27pub type DeviceStopVibrationResult = Result<(), i32>;
28
29pub trait DeviceProxyInterface: Send + Sync {
30 type StartVibrationResponseFut: std::future::Future<Output = Result<DeviceStartVibrationResult, fidl::Error>>
31 + Send;
32 fn r#start_vibration(&self) -> Self::StartVibrationResponseFut;
33 type StopVibrationResponseFut: std::future::Future<Output = Result<DeviceStopVibrationResult, fidl::Error>>
34 + Send;
35 fn r#stop_vibration(&self) -> Self::StopVibrationResponseFut;
36}
37#[derive(Debug)]
38#[cfg(target_os = "fuchsia")]
39pub struct DeviceSynchronousProxy {
40 client: fidl::client::sync::Client,
41}
42
43#[cfg(target_os = "fuchsia")]
44impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
45 type Proxy = DeviceProxy;
46 type Protocol = DeviceMarker;
47
48 fn from_channel(inner: fidl::Channel) -> Self {
49 Self::new(inner)
50 }
51
52 fn into_channel(self) -> fidl::Channel {
53 self.client.into_channel()
54 }
55
56 fn as_channel(&self) -> &fidl::Channel {
57 self.client.as_channel()
58 }
59}
60
61#[cfg(target_os = "fuchsia")]
62impl DeviceSynchronousProxy {
63 pub fn new(channel: fidl::Channel) -> Self {
64 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
65 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
66 }
67
68 pub fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 pub fn wait_for_event(
75 &self,
76 deadline: zx::MonotonicInstant,
77 ) -> Result<DeviceEvent, fidl::Error> {
78 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
79 }
80
81 pub fn r#start_vibration(
84 &self,
85 ___deadline: zx::MonotonicInstant,
86 ) -> Result<DeviceStartVibrationResult, fidl::Error> {
87 let _response = self.client.send_query::<
88 fidl::encoding::EmptyPayload,
89 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
90 >(
91 (),
92 0x439dad11bbcca662,
93 fidl::encoding::DynamicFlags::FLEXIBLE,
94 ___deadline,
95 )?
96 .into_result::<DeviceMarker>("start_vibration")?;
97 Ok(_response.map(|x| x))
98 }
99
100 pub fn r#stop_vibration(
103 &self,
104 ___deadline: zx::MonotonicInstant,
105 ) -> Result<DeviceStopVibrationResult, fidl::Error> {
106 let _response = self.client.send_query::<
107 fidl::encoding::EmptyPayload,
108 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
109 >(
110 (),
111 0x5861752ab352f513,
112 fidl::encoding::DynamicFlags::FLEXIBLE,
113 ___deadline,
114 )?
115 .into_result::<DeviceMarker>("stop_vibration")?;
116 Ok(_response.map(|x| x))
117 }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl From<DeviceSynchronousProxy> for zx::Handle {
122 fn from(value: DeviceSynchronousProxy) -> Self {
123 value.into_channel().into()
124 }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl From<fidl::Channel> for DeviceSynchronousProxy {
129 fn from(value: fidl::Channel) -> Self {
130 Self::new(value)
131 }
132}
133
134#[derive(Debug, Clone)]
135pub struct DeviceProxy {
136 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl fidl::endpoints::Proxy for DeviceProxy {
140 type Protocol = DeviceMarker;
141
142 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
143 Self::new(inner)
144 }
145
146 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
147 self.client.into_channel().map_err(|client| Self { client })
148 }
149
150 fn as_channel(&self) -> &::fidl::AsyncChannel {
151 self.client.as_channel()
152 }
153}
154
155impl DeviceProxy {
156 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
158 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
159 Self { client: fidl::client::Client::new(channel, protocol_name) }
160 }
161
162 pub fn take_event_stream(&self) -> DeviceEventStream {
168 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
169 }
170
171 pub fn r#start_vibration(
174 &self,
175 ) -> fidl::client::QueryResponseFut<
176 DeviceStartVibrationResult,
177 fidl::encoding::DefaultFuchsiaResourceDialect,
178 > {
179 DeviceProxyInterface::r#start_vibration(self)
180 }
181
182 pub fn r#stop_vibration(
185 &self,
186 ) -> fidl::client::QueryResponseFut<
187 DeviceStopVibrationResult,
188 fidl::encoding::DefaultFuchsiaResourceDialect,
189 > {
190 DeviceProxyInterface::r#stop_vibration(self)
191 }
192}
193
194impl DeviceProxyInterface for DeviceProxy {
195 type StartVibrationResponseFut = fidl::client::QueryResponseFut<
196 DeviceStartVibrationResult,
197 fidl::encoding::DefaultFuchsiaResourceDialect,
198 >;
199 fn r#start_vibration(&self) -> Self::StartVibrationResponseFut {
200 fn _decode(
201 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
202 ) -> Result<DeviceStartVibrationResult, fidl::Error> {
203 let _response = fidl::client::decode_transaction_body::<
204 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
205 fidl::encoding::DefaultFuchsiaResourceDialect,
206 0x439dad11bbcca662,
207 >(_buf?)?
208 .into_result::<DeviceMarker>("start_vibration")?;
209 Ok(_response.map(|x| x))
210 }
211 self.client
212 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceStartVibrationResult>(
213 (),
214 0x439dad11bbcca662,
215 fidl::encoding::DynamicFlags::FLEXIBLE,
216 _decode,
217 )
218 }
219
220 type StopVibrationResponseFut = fidl::client::QueryResponseFut<
221 DeviceStopVibrationResult,
222 fidl::encoding::DefaultFuchsiaResourceDialect,
223 >;
224 fn r#stop_vibration(&self) -> Self::StopVibrationResponseFut {
225 fn _decode(
226 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
227 ) -> Result<DeviceStopVibrationResult, fidl::Error> {
228 let _response = fidl::client::decode_transaction_body::<
229 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
230 fidl::encoding::DefaultFuchsiaResourceDialect,
231 0x5861752ab352f513,
232 >(_buf?)?
233 .into_result::<DeviceMarker>("stop_vibration")?;
234 Ok(_response.map(|x| x))
235 }
236 self.client
237 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceStopVibrationResult>(
238 (),
239 0x5861752ab352f513,
240 fidl::encoding::DynamicFlags::FLEXIBLE,
241 _decode,
242 )
243 }
244}
245
246pub struct DeviceEventStream {
247 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
248}
249
250impl std::marker::Unpin for DeviceEventStream {}
251
252impl futures::stream::FusedStream for DeviceEventStream {
253 fn is_terminated(&self) -> bool {
254 self.event_receiver.is_terminated()
255 }
256}
257
258impl futures::Stream for DeviceEventStream {
259 type Item = Result<DeviceEvent, fidl::Error>;
260
261 fn poll_next(
262 mut self: std::pin::Pin<&mut Self>,
263 cx: &mut std::task::Context<'_>,
264 ) -> std::task::Poll<Option<Self::Item>> {
265 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
266 &mut self.event_receiver,
267 cx
268 )?) {
269 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
270 None => std::task::Poll::Ready(None),
271 }
272 }
273}
274
275#[derive(Debug)]
276pub enum DeviceEvent {
277 #[non_exhaustive]
278 _UnknownEvent {
279 ordinal: u64,
281 },
282}
283
284impl DeviceEvent {
285 fn decode(
287 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
288 ) -> Result<DeviceEvent, fidl::Error> {
289 let (bytes, _handles) = buf.split_mut();
290 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
291 debug_assert_eq!(tx_header.tx_id, 0);
292 match tx_header.ordinal {
293 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
294 Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
295 }
296 _ => Err(fidl::Error::UnknownOrdinal {
297 ordinal: tx_header.ordinal,
298 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
299 }),
300 }
301 }
302}
303
304pub struct DeviceRequestStream {
306 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
307 is_terminated: bool,
308}
309
310impl std::marker::Unpin for DeviceRequestStream {}
311
312impl futures::stream::FusedStream for DeviceRequestStream {
313 fn is_terminated(&self) -> bool {
314 self.is_terminated
315 }
316}
317
318impl fidl::endpoints::RequestStream for DeviceRequestStream {
319 type Protocol = DeviceMarker;
320 type ControlHandle = DeviceControlHandle;
321
322 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
323 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
324 }
325
326 fn control_handle(&self) -> Self::ControlHandle {
327 DeviceControlHandle { inner: self.inner.clone() }
328 }
329
330 fn into_inner(
331 self,
332 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
333 {
334 (self.inner, self.is_terminated)
335 }
336
337 fn from_inner(
338 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
339 is_terminated: bool,
340 ) -> Self {
341 Self { inner, is_terminated }
342 }
343}
344
345impl futures::Stream for DeviceRequestStream {
346 type Item = Result<DeviceRequest, fidl::Error>;
347
348 fn poll_next(
349 mut self: std::pin::Pin<&mut Self>,
350 cx: &mut std::task::Context<'_>,
351 ) -> std::task::Poll<Option<Self::Item>> {
352 let this = &mut *self;
353 if this.inner.check_shutdown(cx) {
354 this.is_terminated = true;
355 return std::task::Poll::Ready(None);
356 }
357 if this.is_terminated {
358 panic!("polled DeviceRequestStream after completion");
359 }
360 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
361 |bytes, handles| {
362 match this.inner.channel().read_etc(cx, bytes, handles) {
363 std::task::Poll::Ready(Ok(())) => {}
364 std::task::Poll::Pending => return std::task::Poll::Pending,
365 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
366 this.is_terminated = true;
367 return std::task::Poll::Ready(None);
368 }
369 std::task::Poll::Ready(Err(e)) => {
370 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
371 e.into(),
372 ))))
373 }
374 }
375
376 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
378
379 std::task::Poll::Ready(Some(match header.ordinal {
380 0x439dad11bbcca662 => {
381 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
382 let mut req = fidl::new_empty!(
383 fidl::encoding::EmptyPayload,
384 fidl::encoding::DefaultFuchsiaResourceDialect
385 );
386 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
387 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
388 Ok(DeviceRequest::StartVibration {
389 responder: DeviceStartVibrationResponder {
390 control_handle: std::mem::ManuallyDrop::new(control_handle),
391 tx_id: header.tx_id,
392 },
393 })
394 }
395 0x5861752ab352f513 => {
396 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
397 let mut req = fidl::new_empty!(
398 fidl::encoding::EmptyPayload,
399 fidl::encoding::DefaultFuchsiaResourceDialect
400 );
401 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
402 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
403 Ok(DeviceRequest::StopVibration {
404 responder: DeviceStopVibrationResponder {
405 control_handle: std::mem::ManuallyDrop::new(control_handle),
406 tx_id: header.tx_id,
407 },
408 })
409 }
410 _ if header.tx_id == 0
411 && header
412 .dynamic_flags()
413 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
414 {
415 Ok(DeviceRequest::_UnknownMethod {
416 ordinal: header.ordinal,
417 control_handle: DeviceControlHandle { inner: this.inner.clone() },
418 method_type: fidl::MethodType::OneWay,
419 })
420 }
421 _ if header
422 .dynamic_flags()
423 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
424 {
425 this.inner.send_framework_err(
426 fidl::encoding::FrameworkErr::UnknownMethod,
427 header.tx_id,
428 header.ordinal,
429 header.dynamic_flags(),
430 (bytes, handles),
431 )?;
432 Ok(DeviceRequest::_UnknownMethod {
433 ordinal: header.ordinal,
434 control_handle: DeviceControlHandle { inner: this.inner.clone() },
435 method_type: fidl::MethodType::TwoWay,
436 })
437 }
438 _ => Err(fidl::Error::UnknownOrdinal {
439 ordinal: header.ordinal,
440 protocol_name:
441 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
442 }),
443 }))
444 },
445 )
446 }
447}
448
449#[derive(Debug)]
450pub enum DeviceRequest {
451 StartVibration { responder: DeviceStartVibrationResponder },
454 StopVibration { responder: DeviceStopVibrationResponder },
457 #[non_exhaustive]
459 _UnknownMethod {
460 ordinal: u64,
462 control_handle: DeviceControlHandle,
463 method_type: fidl::MethodType,
464 },
465}
466
467impl DeviceRequest {
468 #[allow(irrefutable_let_patterns)]
469 pub fn into_start_vibration(self) -> Option<(DeviceStartVibrationResponder)> {
470 if let DeviceRequest::StartVibration { responder } = self {
471 Some((responder))
472 } else {
473 None
474 }
475 }
476
477 #[allow(irrefutable_let_patterns)]
478 pub fn into_stop_vibration(self) -> Option<(DeviceStopVibrationResponder)> {
479 if let DeviceRequest::StopVibration { responder } = self {
480 Some((responder))
481 } else {
482 None
483 }
484 }
485
486 pub fn method_name(&self) -> &'static str {
488 match *self {
489 DeviceRequest::StartVibration { .. } => "start_vibration",
490 DeviceRequest::StopVibration { .. } => "stop_vibration",
491 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
492 "unknown one-way method"
493 }
494 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
495 "unknown two-way method"
496 }
497 }
498 }
499}
500
501#[derive(Debug, Clone)]
502pub struct DeviceControlHandle {
503 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
504}
505
506impl fidl::endpoints::ControlHandle for DeviceControlHandle {
507 fn shutdown(&self) {
508 self.inner.shutdown()
509 }
510 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
511 self.inner.shutdown_with_epitaph(status)
512 }
513
514 fn is_closed(&self) -> bool {
515 self.inner.channel().is_closed()
516 }
517 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
518 self.inner.channel().on_closed()
519 }
520
521 #[cfg(target_os = "fuchsia")]
522 fn signal_peer(
523 &self,
524 clear_mask: zx::Signals,
525 set_mask: zx::Signals,
526 ) -> Result<(), zx_status::Status> {
527 use fidl::Peered;
528 self.inner.channel().signal_peer(clear_mask, set_mask)
529 }
530}
531
532impl DeviceControlHandle {}
533
534#[must_use = "FIDL methods require a response to be sent"]
535#[derive(Debug)]
536pub struct DeviceStartVibrationResponder {
537 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
538 tx_id: u32,
539}
540
541impl std::ops::Drop for DeviceStartVibrationResponder {
545 fn drop(&mut self) {
546 self.control_handle.shutdown();
547 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
549 }
550}
551
552impl fidl::endpoints::Responder for DeviceStartVibrationResponder {
553 type ControlHandle = DeviceControlHandle;
554
555 fn control_handle(&self) -> &DeviceControlHandle {
556 &self.control_handle
557 }
558
559 fn drop_without_shutdown(mut self) {
560 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
562 std::mem::forget(self);
564 }
565}
566
567impl DeviceStartVibrationResponder {
568 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
572 let _result = self.send_raw(result);
573 if _result.is_err() {
574 self.control_handle.shutdown();
575 }
576 self.drop_without_shutdown();
577 _result
578 }
579
580 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
582 let _result = self.send_raw(result);
583 self.drop_without_shutdown();
584 _result
585 }
586
587 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
588 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
589 fidl::encoding::EmptyStruct,
590 i32,
591 >>(
592 fidl::encoding::FlexibleResult::new(result),
593 self.tx_id,
594 0x439dad11bbcca662,
595 fidl::encoding::DynamicFlags::FLEXIBLE,
596 )
597 }
598}
599
600#[must_use = "FIDL methods require a response to be sent"]
601#[derive(Debug)]
602pub struct DeviceStopVibrationResponder {
603 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
604 tx_id: u32,
605}
606
607impl std::ops::Drop for DeviceStopVibrationResponder {
611 fn drop(&mut self) {
612 self.control_handle.shutdown();
613 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
615 }
616}
617
618impl fidl::endpoints::Responder for DeviceStopVibrationResponder {
619 type ControlHandle = DeviceControlHandle;
620
621 fn control_handle(&self) -> &DeviceControlHandle {
622 &self.control_handle
623 }
624
625 fn drop_without_shutdown(mut self) {
626 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
628 std::mem::forget(self);
630 }
631}
632
633impl DeviceStopVibrationResponder {
634 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
638 let _result = self.send_raw(result);
639 if _result.is_err() {
640 self.control_handle.shutdown();
641 }
642 self.drop_without_shutdown();
643 _result
644 }
645
646 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
648 let _result = self.send_raw(result);
649 self.drop_without_shutdown();
650 _result
651 }
652
653 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
654 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
655 fidl::encoding::EmptyStruct,
656 i32,
657 >>(
658 fidl::encoding::FlexibleResult::new(result),
659 self.tx_id,
660 0x5861752ab352f513,
661 fidl::encoding::DynamicFlags::FLEXIBLE,
662 )
663 }
664}
665
666#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
667pub struct ServiceMarker;
668
669#[cfg(target_os = "fuchsia")]
670impl fidl::endpoints::ServiceMarker for ServiceMarker {
671 type Proxy = ServiceProxy;
672 type Request = ServiceRequest;
673 const SERVICE_NAME: &'static str = "fuchsia.hardware.haptics.Service";
674}
675
676#[cfg(target_os = "fuchsia")]
679pub enum ServiceRequest {
680 Device(DeviceRequestStream),
681}
682
683#[cfg(target_os = "fuchsia")]
684impl fidl::endpoints::ServiceRequest for ServiceRequest {
685 type Service = ServiceMarker;
686
687 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
688 match name {
689 "device" => Self::Device(
690 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
691 ),
692 _ => panic!("no such member protocol name for service Service"),
693 }
694 }
695
696 fn member_names() -> &'static [&'static str] {
697 &["device"]
698 }
699}
700#[cfg(target_os = "fuchsia")]
701pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
702
703#[cfg(target_os = "fuchsia")]
704impl fidl::endpoints::ServiceProxy for ServiceProxy {
705 type Service = ServiceMarker;
706
707 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
708 Self(opener)
709 }
710}
711
712#[cfg(target_os = "fuchsia")]
713impl ServiceProxy {
714 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
715 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
716 self.connect_channel_to_device(server_end)?;
717 Ok(proxy)
718 }
719
720 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
723 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
724 self.connect_channel_to_device(server_end)?;
725 Ok(proxy)
726 }
727
728 pub fn connect_channel_to_device(
731 &self,
732 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
733 ) -> Result<(), fidl::Error> {
734 self.0.open_member("device", server_end.into_channel())
735 }
736
737 pub fn instance_name(&self) -> &str {
738 self.0.instance_name()
739 }
740}
741
742mod internal {
743 use super::*;
744}