fidl_fuchsia_hardware_temperature/
fidl_fuchsia_hardware_temperature.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_temperature__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 = "(anonymous) Device";
24}
25
26pub trait DeviceProxyInterface: Send + Sync {
27    type GetTemperatureCelsiusResponseFut: std::future::Future<Output = Result<(i32, f32), fidl::Error>>
28        + Send;
29    fn r#get_temperature_celsius(&self) -> Self::GetTemperatureCelsiusResponseFut;
30    type GetSensorNameResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
31    fn r#get_sensor_name(&self) -> Self::GetSensorNameResponseFut;
32}
33#[derive(Debug)]
34#[cfg(target_os = "fuchsia")]
35pub struct DeviceSynchronousProxy {
36    client: fidl::client::sync::Client,
37}
38
39#[cfg(target_os = "fuchsia")]
40impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
41    type Proxy = DeviceProxy;
42    type Protocol = DeviceMarker;
43
44    fn from_channel(inner: fidl::Channel) -> Self {
45        Self::new(inner)
46    }
47
48    fn into_channel(self) -> fidl::Channel {
49        self.client.into_channel()
50    }
51
52    fn as_channel(&self) -> &fidl::Channel {
53        self.client.as_channel()
54    }
55}
56
57#[cfg(target_os = "fuchsia")]
58impl DeviceSynchronousProxy {
59    pub fn new(channel: fidl::Channel) -> Self {
60        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
61        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
62    }
63
64    pub fn into_channel(self) -> fidl::Channel {
65        self.client.into_channel()
66    }
67
68    /// Waits until an event arrives and returns it. It is safe for other
69    /// threads to make concurrent requests while waiting for an event.
70    pub fn wait_for_event(
71        &self,
72        deadline: zx::MonotonicInstant,
73    ) -> Result<DeviceEvent, fidl::Error> {
74        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
75    }
76
77    /// Get the current temperature in degrees Celsius.
78    pub fn r#get_temperature_celsius(
79        &self,
80        ___deadline: zx::MonotonicInstant,
81    ) -> Result<(i32, f32), fidl::Error> {
82        let _response = self
83            .client
84            .send_query::<fidl::encoding::EmptyPayload, DeviceGetTemperatureCelsiusResponse>(
85                (),
86                0x755e08b84736133c,
87                fidl::encoding::DynamicFlags::empty(),
88                ___deadline,
89            )?;
90        Ok((_response.status, _response.temp))
91    }
92
93    pub fn r#get_sensor_name(
94        &self,
95        ___deadline: zx::MonotonicInstant,
96    ) -> Result<String, fidl::Error> {
97        let _response =
98            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetSensorNameResponse>(
99                (),
100                0x4cbd7abaeafc02c1,
101                fidl::encoding::DynamicFlags::empty(),
102                ___deadline,
103            )?;
104        Ok(_response.name)
105    }
106}
107
108#[cfg(target_os = "fuchsia")]
109impl From<DeviceSynchronousProxy> for zx::Handle {
110    fn from(value: DeviceSynchronousProxy) -> Self {
111        value.into_channel().into()
112    }
113}
114
115#[cfg(target_os = "fuchsia")]
116impl From<fidl::Channel> for DeviceSynchronousProxy {
117    fn from(value: fidl::Channel) -> Self {
118        Self::new(value)
119    }
120}
121
122#[cfg(target_os = "fuchsia")]
123impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
124    type Protocol = DeviceMarker;
125
126    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
127        Self::new(value.into_channel())
128    }
129}
130
131#[derive(Debug, Clone)]
132pub struct DeviceProxy {
133    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
134}
135
136impl fidl::endpoints::Proxy for DeviceProxy {
137    type Protocol = DeviceMarker;
138
139    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
140        Self::new(inner)
141    }
142
143    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
144        self.client.into_channel().map_err(|client| Self { client })
145    }
146
147    fn as_channel(&self) -> &::fidl::AsyncChannel {
148        self.client.as_channel()
149    }
150}
151
152impl DeviceProxy {
153    /// Create a new Proxy for fuchsia.hardware.temperature/Device.
154    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
155        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156        Self { client: fidl::client::Client::new(channel, protocol_name) }
157    }
158
159    /// Get a Stream of events from the remote end of the protocol.
160    ///
161    /// # Panics
162    ///
163    /// Panics if the event stream was already taken.
164    pub fn take_event_stream(&self) -> DeviceEventStream {
165        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
166    }
167
168    /// Get the current temperature in degrees Celsius.
169    pub fn r#get_temperature_celsius(
170        &self,
171    ) -> fidl::client::QueryResponseFut<(i32, f32), fidl::encoding::DefaultFuchsiaResourceDialect>
172    {
173        DeviceProxyInterface::r#get_temperature_celsius(self)
174    }
175
176    pub fn r#get_sensor_name(
177        &self,
178    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
179        DeviceProxyInterface::r#get_sensor_name(self)
180    }
181}
182
183impl DeviceProxyInterface for DeviceProxy {
184    type GetTemperatureCelsiusResponseFut =
185        fidl::client::QueryResponseFut<(i32, f32), fidl::encoding::DefaultFuchsiaResourceDialect>;
186    fn r#get_temperature_celsius(&self) -> Self::GetTemperatureCelsiusResponseFut {
187        fn _decode(
188            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
189        ) -> Result<(i32, f32), fidl::Error> {
190            let _response = fidl::client::decode_transaction_body::<
191                DeviceGetTemperatureCelsiusResponse,
192                fidl::encoding::DefaultFuchsiaResourceDialect,
193                0x755e08b84736133c,
194            >(_buf?)?;
195            Ok((_response.status, _response.temp))
196        }
197        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (i32, f32)>(
198            (),
199            0x755e08b84736133c,
200            fidl::encoding::DynamicFlags::empty(),
201            _decode,
202        )
203    }
204
205    type GetSensorNameResponseFut =
206        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
207    fn r#get_sensor_name(&self) -> Self::GetSensorNameResponseFut {
208        fn _decode(
209            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
210        ) -> Result<String, fidl::Error> {
211            let _response = fidl::client::decode_transaction_body::<
212                DeviceGetSensorNameResponse,
213                fidl::encoding::DefaultFuchsiaResourceDialect,
214                0x4cbd7abaeafc02c1,
215            >(_buf?)?;
216            Ok(_response.name)
217        }
218        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
219            (),
220            0x4cbd7abaeafc02c1,
221            fidl::encoding::DynamicFlags::empty(),
222            _decode,
223        )
224    }
225}
226
227pub struct DeviceEventStream {
228    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
229}
230
231impl std::marker::Unpin for DeviceEventStream {}
232
233impl futures::stream::FusedStream for DeviceEventStream {
234    fn is_terminated(&self) -> bool {
235        self.event_receiver.is_terminated()
236    }
237}
238
239impl futures::Stream for DeviceEventStream {
240    type Item = Result<DeviceEvent, fidl::Error>;
241
242    fn poll_next(
243        mut self: std::pin::Pin<&mut Self>,
244        cx: &mut std::task::Context<'_>,
245    ) -> std::task::Poll<Option<Self::Item>> {
246        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
247            &mut self.event_receiver,
248            cx
249        )?) {
250            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
251            None => std::task::Poll::Ready(None),
252        }
253    }
254}
255
256#[derive(Debug)]
257pub enum DeviceEvent {}
258
259impl DeviceEvent {
260    /// Decodes a message buffer as a [`DeviceEvent`].
261    fn decode(
262        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
263    ) -> Result<DeviceEvent, fidl::Error> {
264        let (bytes, _handles) = buf.split_mut();
265        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
266        debug_assert_eq!(tx_header.tx_id, 0);
267        match tx_header.ordinal {
268            _ => Err(fidl::Error::UnknownOrdinal {
269                ordinal: tx_header.ordinal,
270                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
271            }),
272        }
273    }
274}
275
276/// A Stream of incoming requests for fuchsia.hardware.temperature/Device.
277pub struct DeviceRequestStream {
278    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
279    is_terminated: bool,
280}
281
282impl std::marker::Unpin for DeviceRequestStream {}
283
284impl futures::stream::FusedStream for DeviceRequestStream {
285    fn is_terminated(&self) -> bool {
286        self.is_terminated
287    }
288}
289
290impl fidl::endpoints::RequestStream for DeviceRequestStream {
291    type Protocol = DeviceMarker;
292    type ControlHandle = DeviceControlHandle;
293
294    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
295        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
296    }
297
298    fn control_handle(&self) -> Self::ControlHandle {
299        DeviceControlHandle { inner: self.inner.clone() }
300    }
301
302    fn into_inner(
303        self,
304    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
305    {
306        (self.inner, self.is_terminated)
307    }
308
309    fn from_inner(
310        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
311        is_terminated: bool,
312    ) -> Self {
313        Self { inner, is_terminated }
314    }
315}
316
317impl futures::Stream for DeviceRequestStream {
318    type Item = Result<DeviceRequest, fidl::Error>;
319
320    fn poll_next(
321        mut self: std::pin::Pin<&mut Self>,
322        cx: &mut std::task::Context<'_>,
323    ) -> std::task::Poll<Option<Self::Item>> {
324        let this = &mut *self;
325        if this.inner.check_shutdown(cx) {
326            this.is_terminated = true;
327            return std::task::Poll::Ready(None);
328        }
329        if this.is_terminated {
330            panic!("polled DeviceRequestStream after completion");
331        }
332        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
333            |bytes, handles| {
334                match this.inner.channel().read_etc(cx, bytes, handles) {
335                    std::task::Poll::Ready(Ok(())) => {}
336                    std::task::Poll::Pending => return std::task::Poll::Pending,
337                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
338                        this.is_terminated = true;
339                        return std::task::Poll::Ready(None);
340                    }
341                    std::task::Poll::Ready(Err(e)) => {
342                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
343                            e.into(),
344                        ))))
345                    }
346                }
347
348                // A message has been received from the channel
349                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
350
351                std::task::Poll::Ready(Some(match header.ordinal {
352                    0x755e08b84736133c => {
353                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
354                        let mut req = fidl::new_empty!(
355                            fidl::encoding::EmptyPayload,
356                            fidl::encoding::DefaultFuchsiaResourceDialect
357                        );
358                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
359                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
360                        Ok(DeviceRequest::GetTemperatureCelsius {
361                            responder: DeviceGetTemperatureCelsiusResponder {
362                                control_handle: std::mem::ManuallyDrop::new(control_handle),
363                                tx_id: header.tx_id,
364                            },
365                        })
366                    }
367                    0x4cbd7abaeafc02c1 => {
368                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
369                        let mut req = fidl::new_empty!(
370                            fidl::encoding::EmptyPayload,
371                            fidl::encoding::DefaultFuchsiaResourceDialect
372                        );
373                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
374                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
375                        Ok(DeviceRequest::GetSensorName {
376                            responder: DeviceGetSensorNameResponder {
377                                control_handle: std::mem::ManuallyDrop::new(control_handle),
378                                tx_id: header.tx_id,
379                            },
380                        })
381                    }
382                    _ => Err(fidl::Error::UnknownOrdinal {
383                        ordinal: header.ordinal,
384                        protocol_name:
385                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
386                    }),
387                }))
388            },
389        )
390    }
391}
392
393#[derive(Debug)]
394pub enum DeviceRequest {
395    /// Get the current temperature in degrees Celsius.
396    GetTemperatureCelsius {
397        responder: DeviceGetTemperatureCelsiusResponder,
398    },
399    GetSensorName {
400        responder: DeviceGetSensorNameResponder,
401    },
402}
403
404impl DeviceRequest {
405    #[allow(irrefutable_let_patterns)]
406    pub fn into_get_temperature_celsius(self) -> Option<(DeviceGetTemperatureCelsiusResponder)> {
407        if let DeviceRequest::GetTemperatureCelsius { responder } = self {
408            Some((responder))
409        } else {
410            None
411        }
412    }
413
414    #[allow(irrefutable_let_patterns)]
415    pub fn into_get_sensor_name(self) -> Option<(DeviceGetSensorNameResponder)> {
416        if let DeviceRequest::GetSensorName { responder } = self {
417            Some((responder))
418        } else {
419            None
420        }
421    }
422
423    /// Name of the method defined in FIDL
424    pub fn method_name(&self) -> &'static str {
425        match *self {
426            DeviceRequest::GetTemperatureCelsius { .. } => "get_temperature_celsius",
427            DeviceRequest::GetSensorName { .. } => "get_sensor_name",
428        }
429    }
430}
431
432#[derive(Debug, Clone)]
433pub struct DeviceControlHandle {
434    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
435}
436
437impl fidl::endpoints::ControlHandle for DeviceControlHandle {
438    fn shutdown(&self) {
439        self.inner.shutdown()
440    }
441    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
442        self.inner.shutdown_with_epitaph(status)
443    }
444
445    fn is_closed(&self) -> bool {
446        self.inner.channel().is_closed()
447    }
448    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
449        self.inner.channel().on_closed()
450    }
451
452    #[cfg(target_os = "fuchsia")]
453    fn signal_peer(
454        &self,
455        clear_mask: zx::Signals,
456        set_mask: zx::Signals,
457    ) -> Result<(), zx_status::Status> {
458        use fidl::Peered;
459        self.inner.channel().signal_peer(clear_mask, set_mask)
460    }
461}
462
463impl DeviceControlHandle {}
464
465#[must_use = "FIDL methods require a response to be sent"]
466#[derive(Debug)]
467pub struct DeviceGetTemperatureCelsiusResponder {
468    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
469    tx_id: u32,
470}
471
472/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
473/// if the responder is dropped without sending a response, so that the client
474/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
475impl std::ops::Drop for DeviceGetTemperatureCelsiusResponder {
476    fn drop(&mut self) {
477        self.control_handle.shutdown();
478        // Safety: drops once, never accessed again
479        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
480    }
481}
482
483impl fidl::endpoints::Responder for DeviceGetTemperatureCelsiusResponder {
484    type ControlHandle = DeviceControlHandle;
485
486    fn control_handle(&self) -> &DeviceControlHandle {
487        &self.control_handle
488    }
489
490    fn drop_without_shutdown(mut self) {
491        // Safety: drops once, never accessed again due to mem::forget
492        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
493        // Prevent Drop from running (which would shut down the channel)
494        std::mem::forget(self);
495    }
496}
497
498impl DeviceGetTemperatureCelsiusResponder {
499    /// Sends a response to the FIDL transaction.
500    ///
501    /// Sets the channel to shutdown if an error occurs.
502    pub fn send(self, mut status: i32, mut temp: f32) -> Result<(), fidl::Error> {
503        let _result = self.send_raw(status, temp);
504        if _result.is_err() {
505            self.control_handle.shutdown();
506        }
507        self.drop_without_shutdown();
508        _result
509    }
510
511    /// Similar to "send" but does not shutdown the channel if an error occurs.
512    pub fn send_no_shutdown_on_err(
513        self,
514        mut status: i32,
515        mut temp: f32,
516    ) -> Result<(), fidl::Error> {
517        let _result = self.send_raw(status, temp);
518        self.drop_without_shutdown();
519        _result
520    }
521
522    fn send_raw(&self, mut status: i32, mut temp: f32) -> Result<(), fidl::Error> {
523        self.control_handle.inner.send::<DeviceGetTemperatureCelsiusResponse>(
524            (status, temp),
525            self.tx_id,
526            0x755e08b84736133c,
527            fidl::encoding::DynamicFlags::empty(),
528        )
529    }
530}
531
532#[must_use = "FIDL methods require a response to be sent"]
533#[derive(Debug)]
534pub struct DeviceGetSensorNameResponder {
535    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
536    tx_id: u32,
537}
538
539/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
540/// if the responder is dropped without sending a response, so that the client
541/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
542impl std::ops::Drop for DeviceGetSensorNameResponder {
543    fn drop(&mut self) {
544        self.control_handle.shutdown();
545        // Safety: drops once, never accessed again
546        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
547    }
548}
549
550impl fidl::endpoints::Responder for DeviceGetSensorNameResponder {
551    type ControlHandle = DeviceControlHandle;
552
553    fn control_handle(&self) -> &DeviceControlHandle {
554        &self.control_handle
555    }
556
557    fn drop_without_shutdown(mut self) {
558        // Safety: drops once, never accessed again due to mem::forget
559        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
560        // Prevent Drop from running (which would shut down the channel)
561        std::mem::forget(self);
562    }
563}
564
565impl DeviceGetSensorNameResponder {
566    /// Sends a response to the FIDL transaction.
567    ///
568    /// Sets the channel to shutdown if an error occurs.
569    pub fn send(self, mut name: &str) -> Result<(), fidl::Error> {
570        let _result = self.send_raw(name);
571        if _result.is_err() {
572            self.control_handle.shutdown();
573        }
574        self.drop_without_shutdown();
575        _result
576    }
577
578    /// Similar to "send" but does not shutdown the channel if an error occurs.
579    pub fn send_no_shutdown_on_err(self, mut name: &str) -> Result<(), fidl::Error> {
580        let _result = self.send_raw(name);
581        self.drop_without_shutdown();
582        _result
583    }
584
585    fn send_raw(&self, mut name: &str) -> Result<(), fidl::Error> {
586        self.control_handle.inner.send::<DeviceGetSensorNameResponse>(
587            (name,),
588            self.tx_id,
589            0x4cbd7abaeafc02c1,
590            fidl::encoding::DynamicFlags::empty(),
591        )
592    }
593}
594
595#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
596pub struct ServiceMarker;
597
598#[cfg(target_os = "fuchsia")]
599impl fidl::endpoints::ServiceMarker for ServiceMarker {
600    type Proxy = ServiceProxy;
601    type Request = ServiceRequest;
602    const SERVICE_NAME: &'static str = "fuchsia.hardware.temperature.Service";
603}
604
605/// A request for one of the member protocols of Service.
606///
607#[cfg(target_os = "fuchsia")]
608pub enum ServiceRequest {
609    Device(DeviceRequestStream),
610}
611
612#[cfg(target_os = "fuchsia")]
613impl fidl::endpoints::ServiceRequest for ServiceRequest {
614    type Service = ServiceMarker;
615
616    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
617        match name {
618            "device" => Self::Device(
619                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
620            ),
621            _ => panic!("no such member protocol name for service Service"),
622        }
623    }
624
625    fn member_names() -> &'static [&'static str] {
626        &["device"]
627    }
628}
629#[cfg(target_os = "fuchsia")]
630pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
631
632#[cfg(target_os = "fuchsia")]
633impl fidl::endpoints::ServiceProxy for ServiceProxy {
634    type Service = ServiceMarker;
635
636    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
637        Self(opener)
638    }
639}
640
641#[cfg(target_os = "fuchsia")]
642impl ServiceProxy {
643    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
644        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
645        self.connect_channel_to_device(server_end)?;
646        Ok(proxy)
647    }
648
649    /// Like `connect_to_device`, but returns a sync proxy.
650    /// See [`Self::connect_to_device`] for more details.
651    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
652        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
653        self.connect_channel_to_device(server_end)?;
654        Ok(proxy)
655    }
656
657    /// Like `connect_to_device`, but accepts a server end.
658    /// See [`Self::connect_to_device`] for more details.
659    pub fn connect_channel_to_device(
660        &self,
661        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
662    ) -> Result<(), fidl::Error> {
663        self.0.open_member("device", server_end.into_channel())
664    }
665
666    pub fn instance_name(&self) -> &str {
667        self.0.instance_name()
668    }
669}
670
671mod internal {
672    use super::*;
673}