Skip to main content

fidl_fuchsia_test_syscalls/
fidl_fuchsia_test_syscalls.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_test_syscalls__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ControlMarker;
16
17impl fidl::endpoints::ProtocolMarker for ControlMarker {
18    type Proxy = ControlProxy;
19    type RequestStream = ControlRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = ControlSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "(anonymous) Control";
24}
25
26pub trait ControlProxyInterface: Send + Sync {
27    type SetSuspendEnterResultResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
28        + Send;
29    fn r#set_suspend_enter_result(&self, status: i32) -> Self::SetSuspendEnterResultResponseFut;
30    type GetStateResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
31    fn r#get_state(&self) -> Self::GetStateResponseFut;
32}
33#[derive(Debug)]
34#[cfg(target_os = "fuchsia")]
35pub struct ControlSynchronousProxy {
36    client: fidl::client::sync::Client,
37}
38
39#[cfg(target_os = "fuchsia")]
40impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
41    type Proxy = ControlProxy;
42    type Protocol = ControlMarker;
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 ControlSynchronousProxy {
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<ControlEvent, fidl::Error> {
73        ControlEvent::decode(self.client.wait_for_event::<ControlMarker>(deadline)?)
74    }
75
76    /// Set the status that the fixture returns on a return from
77    /// zx_system_suspend_enter.
78    pub fn r#set_suspend_enter_result(
79        &self,
80        mut status: i32,
81        ___deadline: zx::MonotonicInstant,
82    ) -> Result<(), fidl::Error> {
83        let _response = self.client.send_query::<
84            ControlSetSuspendEnterResultRequest,
85            fidl::encoding::EmptyPayload,
86            ControlMarker,
87        >(
88            (status,),
89            0x138f77664d2dcd4,
90            fidl::encoding::DynamicFlags::empty(),
91            ___deadline,
92        )?;
93        Ok(_response)
94    }
95
96    /// Gets the internal state of the instrumented driver.
97    pub fn r#get_state(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
98        let _response =
99            self.client.send_query::<fidl::encoding::EmptyPayload, State, ControlMarker>(
100                (),
101                0x759e8e871c4a33d1,
102                fidl::encoding::DynamicFlags::empty(),
103                ___deadline,
104            )?;
105        Ok(_response.zx_system_suspend_enter_calls_count)
106    }
107}
108
109#[cfg(target_os = "fuchsia")]
110impl From<ControlSynchronousProxy> for zx::NullableHandle {
111    fn from(value: ControlSynchronousProxy) -> Self {
112        value.into_channel().into()
113    }
114}
115
116#[cfg(target_os = "fuchsia")]
117impl From<fidl::Channel> for ControlSynchronousProxy {
118    fn from(value: fidl::Channel) -> Self {
119        Self::new(value)
120    }
121}
122
123#[cfg(target_os = "fuchsia")]
124impl fidl::endpoints::FromClient for ControlSynchronousProxy {
125    type Protocol = ControlMarker;
126
127    fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
128        Self::new(value.into_channel())
129    }
130}
131
132#[derive(Debug, Clone)]
133pub struct ControlProxy {
134    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
135}
136
137impl fidl::endpoints::Proxy for ControlProxy {
138    type Protocol = ControlMarker;
139
140    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
141        Self::new(inner)
142    }
143
144    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
145        self.client.into_channel().map_err(|client| Self { client })
146    }
147
148    fn as_channel(&self) -> &::fidl::AsyncChannel {
149        self.client.as_channel()
150    }
151}
152
153impl ControlProxy {
154    /// Create a new Proxy for fuchsia.test.syscalls/Control.
155    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
156        let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
157        Self { client: fidl::client::Client::new(channel, protocol_name) }
158    }
159
160    /// Get a Stream of events from the remote end of the protocol.
161    ///
162    /// # Panics
163    ///
164    /// Panics if the event stream was already taken.
165    pub fn take_event_stream(&self) -> ControlEventStream {
166        ControlEventStream { event_receiver: self.client.take_event_receiver() }
167    }
168
169    /// Set the status that the fixture returns on a return from
170    /// zx_system_suspend_enter.
171    pub fn r#set_suspend_enter_result(
172        &self,
173        mut status: i32,
174    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
175        ControlProxyInterface::r#set_suspend_enter_result(self, status)
176    }
177
178    /// Gets the internal state of the instrumented driver.
179    pub fn r#get_state(
180        &self,
181    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
182        ControlProxyInterface::r#get_state(self)
183    }
184}
185
186impl ControlProxyInterface for ControlProxy {
187    type SetSuspendEnterResultResponseFut =
188        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
189    fn r#set_suspend_enter_result(
190        &self,
191        mut status: i32,
192    ) -> Self::SetSuspendEnterResultResponseFut {
193        fn _decode(
194            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
195        ) -> Result<(), fidl::Error> {
196            let _response = fidl::client::decode_transaction_body::<
197                fidl::encoding::EmptyPayload,
198                fidl::encoding::DefaultFuchsiaResourceDialect,
199                0x138f77664d2dcd4,
200            >(_buf?)?;
201            Ok(_response)
202        }
203        self.client.send_query_and_decode::<ControlSetSuspendEnterResultRequest, ()>(
204            (status,),
205            0x138f77664d2dcd4,
206            fidl::encoding::DynamicFlags::empty(),
207            _decode,
208        )
209    }
210
211    type GetStateResponseFut =
212        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
213    fn r#get_state(&self) -> Self::GetStateResponseFut {
214        fn _decode(
215            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
216        ) -> Result<u32, fidl::Error> {
217            let _response = fidl::client::decode_transaction_body::<
218                State,
219                fidl::encoding::DefaultFuchsiaResourceDialect,
220                0x759e8e871c4a33d1,
221            >(_buf?)?;
222            Ok(_response.zx_system_suspend_enter_calls_count)
223        }
224        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
225            (),
226            0x759e8e871c4a33d1,
227            fidl::encoding::DynamicFlags::empty(),
228            _decode,
229        )
230    }
231}
232
233pub struct ControlEventStream {
234    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
235}
236
237impl std::marker::Unpin for ControlEventStream {}
238
239impl futures::stream::FusedStream for ControlEventStream {
240    fn is_terminated(&self) -> bool {
241        self.event_receiver.is_terminated()
242    }
243}
244
245impl futures::Stream for ControlEventStream {
246    type Item = Result<ControlEvent, fidl::Error>;
247
248    fn poll_next(
249        mut self: std::pin::Pin<&mut Self>,
250        cx: &mut std::task::Context<'_>,
251    ) -> std::task::Poll<Option<Self::Item>> {
252        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
253            &mut self.event_receiver,
254            cx
255        )?) {
256            Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
257            None => std::task::Poll::Ready(None),
258        }
259    }
260}
261
262#[derive(Debug)]
263pub enum ControlEvent {}
264
265impl ControlEvent {
266    /// Decodes a message buffer as a [`ControlEvent`].
267    fn decode(
268        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
269    ) -> Result<ControlEvent, fidl::Error> {
270        let (bytes, _handles) = buf.split_mut();
271        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
272        debug_assert_eq!(tx_header.tx_id, 0);
273        match tx_header.ordinal {
274            _ => Err(fidl::Error::UnknownOrdinal {
275                ordinal: tx_header.ordinal,
276                protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
277            }),
278        }
279    }
280}
281
282/// A Stream of incoming requests for fuchsia.test.syscalls/Control.
283pub struct ControlRequestStream {
284    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
285    is_terminated: bool,
286}
287
288impl std::marker::Unpin for ControlRequestStream {}
289
290impl futures::stream::FusedStream for ControlRequestStream {
291    fn is_terminated(&self) -> bool {
292        self.is_terminated
293    }
294}
295
296impl fidl::endpoints::RequestStream for ControlRequestStream {
297    type Protocol = ControlMarker;
298    type ControlHandle = ControlControlHandle;
299
300    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
301        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
302    }
303
304    fn control_handle(&self) -> Self::ControlHandle {
305        ControlControlHandle { inner: self.inner.clone() }
306    }
307
308    fn into_inner(
309        self,
310    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
311    {
312        (self.inner, self.is_terminated)
313    }
314
315    fn from_inner(
316        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
317        is_terminated: bool,
318    ) -> Self {
319        Self { inner, is_terminated }
320    }
321}
322
323impl futures::Stream for ControlRequestStream {
324    type Item = Result<ControlRequest, fidl::Error>;
325
326    fn poll_next(
327        mut self: std::pin::Pin<&mut Self>,
328        cx: &mut std::task::Context<'_>,
329    ) -> std::task::Poll<Option<Self::Item>> {
330        let this = &mut *self;
331        if this.inner.check_shutdown(cx) {
332            this.is_terminated = true;
333            return std::task::Poll::Ready(None);
334        }
335        if this.is_terminated {
336            panic!("polled ControlRequestStream after completion");
337        }
338        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
339            |bytes, handles| {
340                match this.inner.channel().read_etc(cx, bytes, handles) {
341                    std::task::Poll::Ready(Ok(())) => {}
342                    std::task::Poll::Pending => return std::task::Poll::Pending,
343                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
344                        this.is_terminated = true;
345                        return std::task::Poll::Ready(None);
346                    }
347                    std::task::Poll::Ready(Err(e)) => {
348                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
349                            e.into(),
350                        ))));
351                    }
352                }
353
354                // A message has been received from the channel
355                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
356
357                std::task::Poll::Ready(Some(match header.ordinal {
358                    0x138f77664d2dcd4 => {
359                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
360                        let mut req = fidl::new_empty!(
361                            ControlSetSuspendEnterResultRequest,
362                            fidl::encoding::DefaultFuchsiaResourceDialect
363                        );
364                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetSuspendEnterResultRequest>(&header, _body_bytes, handles, &mut req)?;
365                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
366                        Ok(ControlRequest::SetSuspendEnterResult {
367                            status: req.status,
368
369                            responder: ControlSetSuspendEnterResultResponder {
370                                control_handle: std::mem::ManuallyDrop::new(control_handle),
371                                tx_id: header.tx_id,
372                            },
373                        })
374                    }
375                    0x759e8e871c4a33d1 => {
376                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
377                        let mut req = fidl::new_empty!(
378                            fidl::encoding::EmptyPayload,
379                            fidl::encoding::DefaultFuchsiaResourceDialect
380                        );
381                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
382                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
383                        Ok(ControlRequest::GetState {
384                            responder: ControlGetStateResponder {
385                                control_handle: std::mem::ManuallyDrop::new(control_handle),
386                                tx_id: header.tx_id,
387                            },
388                        })
389                    }
390                    _ => Err(fidl::Error::UnknownOrdinal {
391                        ordinal: header.ordinal,
392                        protocol_name:
393                            <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394                    }),
395                }))
396            },
397        )
398    }
399}
400
401#[derive(Debug)]
402pub enum ControlRequest {
403    /// Set the status that the fixture returns on a return from
404    /// zx_system_suspend_enter.
405    SetSuspendEnterResult { status: i32, responder: ControlSetSuspendEnterResultResponder },
406    /// Gets the internal state of the instrumented driver.
407    GetState { responder: ControlGetStateResponder },
408}
409
410impl ControlRequest {
411    #[allow(irrefutable_let_patterns)]
412    pub fn into_set_suspend_enter_result(
413        self,
414    ) -> Option<(i32, ControlSetSuspendEnterResultResponder)> {
415        if let ControlRequest::SetSuspendEnterResult { status, responder } = self {
416            Some((status, responder))
417        } else {
418            None
419        }
420    }
421
422    #[allow(irrefutable_let_patterns)]
423    pub fn into_get_state(self) -> Option<(ControlGetStateResponder)> {
424        if let ControlRequest::GetState { responder } = self { Some((responder)) } else { None }
425    }
426
427    /// Name of the method defined in FIDL
428    pub fn method_name(&self) -> &'static str {
429        match *self {
430            ControlRequest::SetSuspendEnterResult { .. } => "set_suspend_enter_result",
431            ControlRequest::GetState { .. } => "get_state",
432        }
433    }
434}
435
436#[derive(Debug, Clone)]
437pub struct ControlControlHandle {
438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
439}
440
441impl fidl::endpoints::ControlHandle for ControlControlHandle {
442    fn shutdown(&self) {
443        self.inner.shutdown()
444    }
445
446    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
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 ControlControlHandle {}
469
470#[must_use = "FIDL methods require a response to be sent"]
471#[derive(Debug)]
472pub struct ControlSetSuspendEnterResultResponder {
473    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
474    tx_id: u32,
475}
476
477/// Set the the channel to be shutdown (see [`ControlControlHandle::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 ControlSetSuspendEnterResultResponder {
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 ControlSetSuspendEnterResultResponder {
489    type ControlHandle = ControlControlHandle;
490
491    fn control_handle(&self) -> &ControlControlHandle {
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 ControlSetSuspendEnterResultResponder {
504    /// Sends a response to the FIDL transaction.
505    ///
506    /// Sets the channel to shutdown if an error occurs.
507    pub fn send(self) -> Result<(), fidl::Error> {
508        let _result = self.send_raw();
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(self) -> Result<(), fidl::Error> {
518        let _result = self.send_raw();
519        self.drop_without_shutdown();
520        _result
521    }
522
523    fn send_raw(&self) -> Result<(), fidl::Error> {
524        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
525            (),
526            self.tx_id,
527            0x138f77664d2dcd4,
528            fidl::encoding::DynamicFlags::empty(),
529        )
530    }
531}
532
533#[must_use = "FIDL methods require a response to be sent"]
534#[derive(Debug)]
535pub struct ControlGetStateResponder {
536    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
537    tx_id: u32,
538}
539
540/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
541/// if the responder is dropped without sending a response, so that the client
542/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
543impl std::ops::Drop for ControlGetStateResponder {
544    fn drop(&mut self) {
545        self.control_handle.shutdown();
546        // Safety: drops once, never accessed again
547        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
548    }
549}
550
551impl fidl::endpoints::Responder for ControlGetStateResponder {
552    type ControlHandle = ControlControlHandle;
553
554    fn control_handle(&self) -> &ControlControlHandle {
555        &self.control_handle
556    }
557
558    fn drop_without_shutdown(mut self) {
559        // Safety: drops once, never accessed again due to mem::forget
560        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
561        // Prevent Drop from running (which would shut down the channel)
562        std::mem::forget(self);
563    }
564}
565
566impl ControlGetStateResponder {
567    /// Sends a response to the FIDL transaction.
568    ///
569    /// Sets the channel to shutdown if an error occurs.
570    pub fn send(self, mut zx_system_suspend_enter_calls_count: u32) -> Result<(), fidl::Error> {
571        let _result = self.send_raw(zx_system_suspend_enter_calls_count);
572        if _result.is_err() {
573            self.control_handle.shutdown();
574        }
575        self.drop_without_shutdown();
576        _result
577    }
578
579    /// Similar to "send" but does not shutdown the channel if an error occurs.
580    pub fn send_no_shutdown_on_err(
581        self,
582        mut zx_system_suspend_enter_calls_count: u32,
583    ) -> Result<(), fidl::Error> {
584        let _result = self.send_raw(zx_system_suspend_enter_calls_count);
585        self.drop_without_shutdown();
586        _result
587    }
588
589    fn send_raw(&self, mut zx_system_suspend_enter_calls_count: u32) -> Result<(), fidl::Error> {
590        self.control_handle.inner.send::<State>(
591            (zx_system_suspend_enter_calls_count,),
592            self.tx_id,
593            0x759e8e871c4a33d1,
594            fidl::encoding::DynamicFlags::empty(),
595        )
596    }
597}
598
599#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
600pub struct ControlServiceMarker;
601
602#[cfg(target_os = "fuchsia")]
603impl fidl::endpoints::ServiceMarker for ControlServiceMarker {
604    type Proxy = ControlServiceProxy;
605    type Request = ControlServiceRequest;
606    const SERVICE_NAME: &'static str = "fuchsia.test.syscalls.ControlService";
607}
608
609/// A request for one of the member protocols of ControlService.
610///
611/// Serves the Control protocol as a service. Only needed due to
612/// driver test realm implementation detail.
613#[cfg(target_os = "fuchsia")]
614pub enum ControlServiceRequest {
615    Control(ControlRequestStream),
616}
617
618#[cfg(target_os = "fuchsia")]
619impl fidl::endpoints::ServiceRequest for ControlServiceRequest {
620    type Service = ControlServiceMarker;
621
622    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
623        match name {
624            "control" => Self::Control(
625                <ControlRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
626            ),
627            _ => panic!("no such member protocol name for service ControlService"),
628        }
629    }
630
631    fn member_names() -> &'static [&'static str] {
632        &["control"]
633    }
634}
635/// Serves the Control protocol as a service. Only needed due to
636/// driver test realm implementation detail.
637#[cfg(target_os = "fuchsia")]
638pub struct ControlServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
639
640#[cfg(target_os = "fuchsia")]
641impl fidl::endpoints::ServiceProxy for ControlServiceProxy {
642    type Service = ControlServiceMarker;
643
644    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
645        Self(opener)
646    }
647}
648
649#[cfg(target_os = "fuchsia")]
650impl ControlServiceProxy {
651    pub fn connect_to_control(&self) -> Result<ControlProxy, fidl::Error> {
652        let (proxy, server_end) = fidl::endpoints::create_proxy::<ControlMarker>();
653        self.connect_channel_to_control(server_end)?;
654        Ok(proxy)
655    }
656
657    /// Like `connect_to_control`, but returns a sync proxy.
658    /// See [`Self::connect_to_control`] for more details.
659    pub fn connect_to_control_sync(&self) -> Result<ControlSynchronousProxy, fidl::Error> {
660        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControlMarker>();
661        self.connect_channel_to_control(server_end)?;
662        Ok(proxy)
663    }
664
665    /// Like `connect_to_control`, but accepts a server end.
666    /// See [`Self::connect_to_control`] for more details.
667    pub fn connect_channel_to_control(
668        &self,
669        server_end: fidl::endpoints::ServerEnd<ControlMarker>,
670    ) -> Result<(), fidl::Error> {
671        self.0.open_member("control", server_end.into_channel())
672    }
673
674    pub fn instance_name(&self) -> &str {
675        self.0.instance_name()
676    }
677}
678
679mod internal {
680    use super::*;
681}