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