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