Skip to main content

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