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#[cfg(target_os = "fuchsia")]
135impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
136 type Protocol = DeviceMarker;
137
138 fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
139 Self::new(value.into_channel())
140 }
141}
142
143#[derive(Debug, Clone)]
144pub struct DeviceProxy {
145 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
146}
147
148impl fidl::endpoints::Proxy for DeviceProxy {
149 type Protocol = DeviceMarker;
150
151 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
152 Self::new(inner)
153 }
154
155 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
156 self.client.into_channel().map_err(|client| Self { client })
157 }
158
159 fn as_channel(&self) -> &::fidl::AsyncChannel {
160 self.client.as_channel()
161 }
162}
163
164impl DeviceProxy {
165 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
167 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
168 Self { client: fidl::client::Client::new(channel, protocol_name) }
169 }
170
171 pub fn take_event_stream(&self) -> DeviceEventStream {
177 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
178 }
179
180 pub fn r#start_vibration(
183 &self,
184 ) -> fidl::client::QueryResponseFut<
185 DeviceStartVibrationResult,
186 fidl::encoding::DefaultFuchsiaResourceDialect,
187 > {
188 DeviceProxyInterface::r#start_vibration(self)
189 }
190
191 pub fn r#stop_vibration(
194 &self,
195 ) -> fidl::client::QueryResponseFut<
196 DeviceStopVibrationResult,
197 fidl::encoding::DefaultFuchsiaResourceDialect,
198 > {
199 DeviceProxyInterface::r#stop_vibration(self)
200 }
201}
202
203impl DeviceProxyInterface for DeviceProxy {
204 type StartVibrationResponseFut = fidl::client::QueryResponseFut<
205 DeviceStartVibrationResult,
206 fidl::encoding::DefaultFuchsiaResourceDialect,
207 >;
208 fn r#start_vibration(&self) -> Self::StartVibrationResponseFut {
209 fn _decode(
210 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
211 ) -> Result<DeviceStartVibrationResult, fidl::Error> {
212 let _response = fidl::client::decode_transaction_body::<
213 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
214 fidl::encoding::DefaultFuchsiaResourceDialect,
215 0x439dad11bbcca662,
216 >(_buf?)?
217 .into_result::<DeviceMarker>("start_vibration")?;
218 Ok(_response.map(|x| x))
219 }
220 self.client
221 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceStartVibrationResult>(
222 (),
223 0x439dad11bbcca662,
224 fidl::encoding::DynamicFlags::FLEXIBLE,
225 _decode,
226 )
227 }
228
229 type StopVibrationResponseFut = fidl::client::QueryResponseFut<
230 DeviceStopVibrationResult,
231 fidl::encoding::DefaultFuchsiaResourceDialect,
232 >;
233 fn r#stop_vibration(&self) -> Self::StopVibrationResponseFut {
234 fn _decode(
235 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
236 ) -> Result<DeviceStopVibrationResult, fidl::Error> {
237 let _response = fidl::client::decode_transaction_body::<
238 fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
239 fidl::encoding::DefaultFuchsiaResourceDialect,
240 0x5861752ab352f513,
241 >(_buf?)?
242 .into_result::<DeviceMarker>("stop_vibration")?;
243 Ok(_response.map(|x| x))
244 }
245 self.client
246 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceStopVibrationResult>(
247 (),
248 0x5861752ab352f513,
249 fidl::encoding::DynamicFlags::FLEXIBLE,
250 _decode,
251 )
252 }
253}
254
255pub struct DeviceEventStream {
256 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
257}
258
259impl std::marker::Unpin for DeviceEventStream {}
260
261impl futures::stream::FusedStream for DeviceEventStream {
262 fn is_terminated(&self) -> bool {
263 self.event_receiver.is_terminated()
264 }
265}
266
267impl futures::Stream for DeviceEventStream {
268 type Item = Result<DeviceEvent, fidl::Error>;
269
270 fn poll_next(
271 mut self: std::pin::Pin<&mut Self>,
272 cx: &mut std::task::Context<'_>,
273 ) -> std::task::Poll<Option<Self::Item>> {
274 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
275 &mut self.event_receiver,
276 cx
277 )?) {
278 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
279 None => std::task::Poll::Ready(None),
280 }
281 }
282}
283
284#[derive(Debug)]
285pub enum DeviceEvent {
286 #[non_exhaustive]
287 _UnknownEvent {
288 ordinal: u64,
290 },
291}
292
293impl DeviceEvent {
294 fn decode(
296 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
297 ) -> Result<DeviceEvent, fidl::Error> {
298 let (bytes, _handles) = buf.split_mut();
299 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
300 debug_assert_eq!(tx_header.tx_id, 0);
301 match tx_header.ordinal {
302 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
303 Ok(DeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
304 }
305 _ => Err(fidl::Error::UnknownOrdinal {
306 ordinal: tx_header.ordinal,
307 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
308 }),
309 }
310 }
311}
312
313pub struct DeviceRequestStream {
315 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
316 is_terminated: bool,
317}
318
319impl std::marker::Unpin for DeviceRequestStream {}
320
321impl futures::stream::FusedStream for DeviceRequestStream {
322 fn is_terminated(&self) -> bool {
323 self.is_terminated
324 }
325}
326
327impl fidl::endpoints::RequestStream for DeviceRequestStream {
328 type Protocol = DeviceMarker;
329 type ControlHandle = DeviceControlHandle;
330
331 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
332 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
333 }
334
335 fn control_handle(&self) -> Self::ControlHandle {
336 DeviceControlHandle { inner: self.inner.clone() }
337 }
338
339 fn into_inner(
340 self,
341 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
342 {
343 (self.inner, self.is_terminated)
344 }
345
346 fn from_inner(
347 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
348 is_terminated: bool,
349 ) -> Self {
350 Self { inner, is_terminated }
351 }
352}
353
354impl futures::Stream for DeviceRequestStream {
355 type Item = Result<DeviceRequest, fidl::Error>;
356
357 fn poll_next(
358 mut self: std::pin::Pin<&mut Self>,
359 cx: &mut std::task::Context<'_>,
360 ) -> std::task::Poll<Option<Self::Item>> {
361 let this = &mut *self;
362 if this.inner.check_shutdown(cx) {
363 this.is_terminated = true;
364 return std::task::Poll::Ready(None);
365 }
366 if this.is_terminated {
367 panic!("polled DeviceRequestStream after completion");
368 }
369 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
370 |bytes, handles| {
371 match this.inner.channel().read_etc(cx, bytes, handles) {
372 std::task::Poll::Ready(Ok(())) => {}
373 std::task::Poll::Pending => return std::task::Poll::Pending,
374 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
375 this.is_terminated = true;
376 return std::task::Poll::Ready(None);
377 }
378 std::task::Poll::Ready(Err(e)) => {
379 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
380 e.into(),
381 ))))
382 }
383 }
384
385 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
387
388 std::task::Poll::Ready(Some(match header.ordinal {
389 0x439dad11bbcca662 => {
390 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
391 let mut req = fidl::new_empty!(
392 fidl::encoding::EmptyPayload,
393 fidl::encoding::DefaultFuchsiaResourceDialect
394 );
395 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
396 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
397 Ok(DeviceRequest::StartVibration {
398 responder: DeviceStartVibrationResponder {
399 control_handle: std::mem::ManuallyDrop::new(control_handle),
400 tx_id: header.tx_id,
401 },
402 })
403 }
404 0x5861752ab352f513 => {
405 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
406 let mut req = fidl::new_empty!(
407 fidl::encoding::EmptyPayload,
408 fidl::encoding::DefaultFuchsiaResourceDialect
409 );
410 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
411 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
412 Ok(DeviceRequest::StopVibration {
413 responder: DeviceStopVibrationResponder {
414 control_handle: std::mem::ManuallyDrop::new(control_handle),
415 tx_id: header.tx_id,
416 },
417 })
418 }
419 _ if header.tx_id == 0
420 && header
421 .dynamic_flags()
422 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
423 {
424 Ok(DeviceRequest::_UnknownMethod {
425 ordinal: header.ordinal,
426 control_handle: DeviceControlHandle { inner: this.inner.clone() },
427 method_type: fidl::MethodType::OneWay,
428 })
429 }
430 _ if header
431 .dynamic_flags()
432 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
433 {
434 this.inner.send_framework_err(
435 fidl::encoding::FrameworkErr::UnknownMethod,
436 header.tx_id,
437 header.ordinal,
438 header.dynamic_flags(),
439 (bytes, handles),
440 )?;
441 Ok(DeviceRequest::_UnknownMethod {
442 ordinal: header.ordinal,
443 control_handle: DeviceControlHandle { inner: this.inner.clone() },
444 method_type: fidl::MethodType::TwoWay,
445 })
446 }
447 _ => Err(fidl::Error::UnknownOrdinal {
448 ordinal: header.ordinal,
449 protocol_name:
450 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
451 }),
452 }))
453 },
454 )
455 }
456}
457
458#[derive(Debug)]
459pub enum DeviceRequest {
460 StartVibration { responder: DeviceStartVibrationResponder },
463 StopVibration { responder: DeviceStopVibrationResponder },
466 #[non_exhaustive]
468 _UnknownMethod {
469 ordinal: u64,
471 control_handle: DeviceControlHandle,
472 method_type: fidl::MethodType,
473 },
474}
475
476impl DeviceRequest {
477 #[allow(irrefutable_let_patterns)]
478 pub fn into_start_vibration(self) -> Option<(DeviceStartVibrationResponder)> {
479 if let DeviceRequest::StartVibration { responder } = self {
480 Some((responder))
481 } else {
482 None
483 }
484 }
485
486 #[allow(irrefutable_let_patterns)]
487 pub fn into_stop_vibration(self) -> Option<(DeviceStopVibrationResponder)> {
488 if let DeviceRequest::StopVibration { responder } = self {
489 Some((responder))
490 } else {
491 None
492 }
493 }
494
495 pub fn method_name(&self) -> &'static str {
497 match *self {
498 DeviceRequest::StartVibration { .. } => "start_vibration",
499 DeviceRequest::StopVibration { .. } => "stop_vibration",
500 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
501 "unknown one-way method"
502 }
503 DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
504 "unknown two-way method"
505 }
506 }
507 }
508}
509
510#[derive(Debug, Clone)]
511pub struct DeviceControlHandle {
512 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
513}
514
515impl fidl::endpoints::ControlHandle for DeviceControlHandle {
516 fn shutdown(&self) {
517 self.inner.shutdown()
518 }
519 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
520 self.inner.shutdown_with_epitaph(status)
521 }
522
523 fn is_closed(&self) -> bool {
524 self.inner.channel().is_closed()
525 }
526 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
527 self.inner.channel().on_closed()
528 }
529
530 #[cfg(target_os = "fuchsia")]
531 fn signal_peer(
532 &self,
533 clear_mask: zx::Signals,
534 set_mask: zx::Signals,
535 ) -> Result<(), zx_status::Status> {
536 use fidl::Peered;
537 self.inner.channel().signal_peer(clear_mask, set_mask)
538 }
539}
540
541impl DeviceControlHandle {}
542
543#[must_use = "FIDL methods require a response to be sent"]
544#[derive(Debug)]
545pub struct DeviceStartVibrationResponder {
546 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
547 tx_id: u32,
548}
549
550impl std::ops::Drop for DeviceStartVibrationResponder {
554 fn drop(&mut self) {
555 self.control_handle.shutdown();
556 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
558 }
559}
560
561impl fidl::endpoints::Responder for DeviceStartVibrationResponder {
562 type ControlHandle = DeviceControlHandle;
563
564 fn control_handle(&self) -> &DeviceControlHandle {
565 &self.control_handle
566 }
567
568 fn drop_without_shutdown(mut self) {
569 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
571 std::mem::forget(self);
573 }
574}
575
576impl DeviceStartVibrationResponder {
577 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
581 let _result = self.send_raw(result);
582 if _result.is_err() {
583 self.control_handle.shutdown();
584 }
585 self.drop_without_shutdown();
586 _result
587 }
588
589 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
591 let _result = self.send_raw(result);
592 self.drop_without_shutdown();
593 _result
594 }
595
596 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
597 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
598 fidl::encoding::EmptyStruct,
599 i32,
600 >>(
601 fidl::encoding::FlexibleResult::new(result),
602 self.tx_id,
603 0x439dad11bbcca662,
604 fidl::encoding::DynamicFlags::FLEXIBLE,
605 )
606 }
607}
608
609#[must_use = "FIDL methods require a response to be sent"]
610#[derive(Debug)]
611pub struct DeviceStopVibrationResponder {
612 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
613 tx_id: u32,
614}
615
616impl std::ops::Drop for DeviceStopVibrationResponder {
620 fn drop(&mut self) {
621 self.control_handle.shutdown();
622 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
624 }
625}
626
627impl fidl::endpoints::Responder for DeviceStopVibrationResponder {
628 type ControlHandle = DeviceControlHandle;
629
630 fn control_handle(&self) -> &DeviceControlHandle {
631 &self.control_handle
632 }
633
634 fn drop_without_shutdown(mut self) {
635 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
637 std::mem::forget(self);
639 }
640}
641
642impl DeviceStopVibrationResponder {
643 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
647 let _result = self.send_raw(result);
648 if _result.is_err() {
649 self.control_handle.shutdown();
650 }
651 self.drop_without_shutdown();
652 _result
653 }
654
655 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
657 let _result = self.send_raw(result);
658 self.drop_without_shutdown();
659 _result
660 }
661
662 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
663 self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
664 fidl::encoding::EmptyStruct,
665 i32,
666 >>(
667 fidl::encoding::FlexibleResult::new(result),
668 self.tx_id,
669 0x5861752ab352f513,
670 fidl::encoding::DynamicFlags::FLEXIBLE,
671 )
672 }
673}
674
675#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
676pub struct ServiceMarker;
677
678#[cfg(target_os = "fuchsia")]
679impl fidl::endpoints::ServiceMarker for ServiceMarker {
680 type Proxy = ServiceProxy;
681 type Request = ServiceRequest;
682 const SERVICE_NAME: &'static str = "fuchsia.hardware.haptics.Service";
683}
684
685#[cfg(target_os = "fuchsia")]
688pub enum ServiceRequest {
689 Device(DeviceRequestStream),
690}
691
692#[cfg(target_os = "fuchsia")]
693impl fidl::endpoints::ServiceRequest for ServiceRequest {
694 type Service = ServiceMarker;
695
696 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
697 match name {
698 "device" => Self::Device(
699 <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
700 ),
701 _ => panic!("no such member protocol name for service Service"),
702 }
703 }
704
705 fn member_names() -> &'static [&'static str] {
706 &["device"]
707 }
708}
709#[cfg(target_os = "fuchsia")]
710pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
711
712#[cfg(target_os = "fuchsia")]
713impl fidl::endpoints::ServiceProxy for ServiceProxy {
714 type Service = ServiceMarker;
715
716 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
717 Self(opener)
718 }
719}
720
721#[cfg(target_os = "fuchsia")]
722impl ServiceProxy {
723 pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
724 let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
725 self.connect_channel_to_device(server_end)?;
726 Ok(proxy)
727 }
728
729 pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
732 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
733 self.connect_channel_to_device(server_end)?;
734 Ok(proxy)
735 }
736
737 pub fn connect_channel_to_device(
740 &self,
741 server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
742 ) -> Result<(), fidl::Error> {
743 self.0.open_member("device", server_end.into_channel())
744 }
745
746 pub fn instance_name(&self) -> &str {
747 self.0.instance_name()
748 }
749}
750
751mod internal {
752 use super::*;
753}