Skip to main content

fidl_fuchsia_developer_remotecontrol/
fidl_fuchsia_developer_remotecontrol.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_developer_remotecontrol__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct RemoteControlConnectCapabilityRequest {
16    pub moniker: String,
17    pub capability_set: fidl_fuchsia_sys2::OpenDirType,
18    pub capability_name: String,
19    pub server_channel: fidl::Channel,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
23    for RemoteControlConnectCapabilityRequest
24{
25}
26
27#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
28pub struct RemoteControlMarker;
29
30impl fidl::endpoints::ProtocolMarker for RemoteControlMarker {
31    type Proxy = RemoteControlProxy;
32    type RequestStream = RemoteControlRequestStream;
33    #[cfg(target_os = "fuchsia")]
34    type SynchronousProxy = RemoteControlSynchronousProxy;
35
36    const DEBUG_NAME: &'static str = "fuchsia.developer.remotecontrol.RemoteControl";
37}
38impl fidl::endpoints::DiscoverableProtocolMarker for RemoteControlMarker {}
39pub type RemoteControlIdentifyHostResult = Result<IdentifyHostResponse, IdentifyHostError>;
40pub type RemoteControlConnectCapabilityResult = Result<(), ConnectCapabilityError>;
41
42pub trait RemoteControlProxyInterface: Send + Sync {
43    type EchoStringResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
44    fn r#echo_string(&self, value: &str) -> Self::EchoStringResponseFut;
45    type LogMessageResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
46    fn r#log_message(
47        &self,
48        tag: &str,
49        message: &str,
50        severity: fidl_fuchsia_diagnostics_types::Severity,
51    ) -> Self::LogMessageResponseFut;
52    type IdentifyHostResponseFut: std::future::Future<Output = Result<RemoteControlIdentifyHostResult, fidl::Error>>
53        + Send;
54    fn r#identify_host(&self) -> Self::IdentifyHostResponseFut;
55    type ConnectCapabilityResponseFut: std::future::Future<Output = Result<RemoteControlConnectCapabilityResult, fidl::Error>>
56        + Send;
57    fn r#connect_capability(
58        &self,
59        moniker: &str,
60        capability_set: fidl_fuchsia_sys2::OpenDirType,
61        capability_name: &str,
62        server_channel: fidl::Channel,
63    ) -> Self::ConnectCapabilityResponseFut;
64    type GetTimeResponseFut: std::future::Future<Output = Result<fidl::MonotonicInstant, fidl::Error>>
65        + Send;
66    fn r#get_time(&self) -> Self::GetTimeResponseFut;
67    type GetBootTimeResponseFut: std::future::Future<Output = Result<fidl::BootInstant, fidl::Error>>
68        + Send;
69    fn r#get_boot_time(&self) -> Self::GetBootTimeResponseFut;
70}
71#[derive(Debug)]
72#[cfg(target_os = "fuchsia")]
73pub struct RemoteControlSynchronousProxy {
74    client: fidl::client::sync::Client,
75}
76
77#[cfg(target_os = "fuchsia")]
78impl fidl::endpoints::SynchronousProxy for RemoteControlSynchronousProxy {
79    type Proxy = RemoteControlProxy;
80    type Protocol = RemoteControlMarker;
81
82    fn from_channel(inner: fidl::Channel) -> Self {
83        Self::new(inner)
84    }
85
86    fn into_channel(self) -> fidl::Channel {
87        self.client.into_channel()
88    }
89
90    fn as_channel(&self) -> &fidl::Channel {
91        self.client.as_channel()
92    }
93}
94
95#[cfg(target_os = "fuchsia")]
96impl RemoteControlSynchronousProxy {
97    pub fn new(channel: fidl::Channel) -> Self {
98        Self { client: fidl::client::sync::Client::new(channel) }
99    }
100
101    pub fn into_channel(self) -> fidl::Channel {
102        self.client.into_channel()
103    }
104
105    /// Waits until an event arrives and returns it. It is safe for other
106    /// threads to make concurrent requests while waiting for an event.
107    pub fn wait_for_event(
108        &self,
109        deadline: zx::MonotonicInstant,
110    ) -> Result<RemoteControlEvent, fidl::Error> {
111        RemoteControlEvent::decode(self.client.wait_for_event::<RemoteControlMarker>(deadline)?)
112    }
113
114    /// Returns the input.
115    pub fn r#echo_string(
116        &self,
117        mut value: &str,
118        ___deadline: zx::MonotonicInstant,
119    ) -> Result<String, fidl::Error> {
120        let _response = self.client.send_query::<
121            RemoteControlEchoStringRequest,
122            RemoteControlEchoStringResponse,
123            RemoteControlMarker,
124        >(
125            (value,),
126            0x2bbec7ca8a72e82b,
127            fidl::encoding::DynamicFlags::empty(),
128            ___deadline,
129        )?;
130        Ok(_response.response)
131    }
132
133    /// Writes a string to the syslog on the device.
134    pub fn r#log_message(
135        &self,
136        mut tag: &str,
137        mut message: &str,
138        mut severity: fidl_fuchsia_diagnostics_types::Severity,
139        ___deadline: zx::MonotonicInstant,
140    ) -> Result<(), fidl::Error> {
141        let _response = self.client.send_query::<
142            RemoteControlLogMessageRequest,
143            fidl::encoding::EmptyPayload,
144            RemoteControlMarker,
145        >(
146            (tag, message, severity,),
147            0x3da84acd5bbf3926,
148            fidl::encoding::DynamicFlags::empty(),
149            ___deadline,
150        )?;
151        Ok(_response)
152    }
153
154    pub fn r#identify_host(
155        &self,
156        ___deadline: zx::MonotonicInstant,
157    ) -> Result<RemoteControlIdentifyHostResult, fidl::Error> {
158        let _response = self
159            .client
160            .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
161                RemoteControlIdentifyHostResponse,
162                IdentifyHostError,
163            >, RemoteControlMarker>(
164                (),
165                0x6035e1ab368deee1,
166                fidl::encoding::DynamicFlags::FLEXIBLE,
167                ___deadline,
168            )?
169            .into_result::<RemoteControlMarker>("identify_host")?;
170        Ok(_response.map(|x| x.response))
171    }
172
173    /// Connects a channel to a service, given a moniker and a channel iff the component identified
174    /// by the given moniker exposes a capability of the requested name.
175    pub fn r#connect_capability(
176        &self,
177        mut moniker: &str,
178        mut capability_set: fidl_fuchsia_sys2::OpenDirType,
179        mut capability_name: &str,
180        mut server_channel: fidl::Channel,
181        ___deadline: zx::MonotonicInstant,
182    ) -> Result<RemoteControlConnectCapabilityResult, fidl::Error> {
183        let _response = self.client.send_query::<
184            RemoteControlConnectCapabilityRequest,
185            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, ConnectCapabilityError>,
186            RemoteControlMarker,
187        >(
188            (moniker, capability_set, capability_name, server_channel,),
189            0x3ae7a7c874dceceb,
190            fidl::encoding::DynamicFlags::FLEXIBLE,
191            ___deadline,
192        )?
193        .into_result::<RemoteControlMarker>("connect_capability")?;
194        Ok(_response.map(|x| x))
195    }
196
197    pub fn r#get_time(
198        &self,
199        ___deadline: zx::MonotonicInstant,
200    ) -> Result<fidl::MonotonicInstant, fidl::Error> {
201        let _response = self.client.send_query::<
202            fidl::encoding::EmptyPayload,
203            RemoteControlGetTimeResponse,
204            RemoteControlMarker,
205        >(
206            (),
207            0x3588f31e9067748d,
208            fidl::encoding::DynamicFlags::empty(),
209            ___deadline,
210        )?;
211        Ok(_response.time)
212    }
213
214    pub fn r#get_boot_time(
215        &self,
216        ___deadline: zx::MonotonicInstant,
217    ) -> Result<fidl::BootInstant, fidl::Error> {
218        let _response = self.client.send_query::<
219            fidl::encoding::EmptyPayload,
220            RemoteControlGetBootTimeResponse,
221            RemoteControlMarker,
222        >(
223            (),
224            0x55706f013cd79ebd,
225            fidl::encoding::DynamicFlags::empty(),
226            ___deadline,
227        )?;
228        Ok(_response.time)
229    }
230}
231
232#[cfg(target_os = "fuchsia")]
233impl From<RemoteControlSynchronousProxy> for zx::NullableHandle {
234    fn from(value: RemoteControlSynchronousProxy) -> Self {
235        value.into_channel().into()
236    }
237}
238
239#[cfg(target_os = "fuchsia")]
240impl From<fidl::Channel> for RemoteControlSynchronousProxy {
241    fn from(value: fidl::Channel) -> Self {
242        Self::new(value)
243    }
244}
245
246#[cfg(target_os = "fuchsia")]
247impl fidl::endpoints::FromClient for RemoteControlSynchronousProxy {
248    type Protocol = RemoteControlMarker;
249
250    fn from_client(value: fidl::endpoints::ClientEnd<RemoteControlMarker>) -> Self {
251        Self::new(value.into_channel())
252    }
253}
254
255#[derive(Debug, Clone)]
256pub struct RemoteControlProxy {
257    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
258}
259
260impl fidl::endpoints::Proxy for RemoteControlProxy {
261    type Protocol = RemoteControlMarker;
262
263    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
264        Self::new(inner)
265    }
266
267    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
268        self.client.into_channel().map_err(|client| Self { client })
269    }
270
271    fn as_channel(&self) -> &::fidl::AsyncChannel {
272        self.client.as_channel()
273    }
274}
275
276impl RemoteControlProxy {
277    /// Create a new Proxy for fuchsia.developer.remotecontrol/RemoteControl.
278    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
279        let protocol_name = <RemoteControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
280        Self { client: fidl::client::Client::new(channel, protocol_name) }
281    }
282
283    /// Get a Stream of events from the remote end of the protocol.
284    ///
285    /// # Panics
286    ///
287    /// Panics if the event stream was already taken.
288    pub fn take_event_stream(&self) -> RemoteControlEventStream {
289        RemoteControlEventStream { event_receiver: self.client.take_event_receiver() }
290    }
291
292    /// Returns the input.
293    pub fn r#echo_string(
294        &self,
295        mut value: &str,
296    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
297        RemoteControlProxyInterface::r#echo_string(self, value)
298    }
299
300    /// Writes a string to the syslog on the device.
301    pub fn r#log_message(
302        &self,
303        mut tag: &str,
304        mut message: &str,
305        mut severity: fidl_fuchsia_diagnostics_types::Severity,
306    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
307        RemoteControlProxyInterface::r#log_message(self, tag, message, severity)
308    }
309
310    pub fn r#identify_host(
311        &self,
312    ) -> fidl::client::QueryResponseFut<
313        RemoteControlIdentifyHostResult,
314        fidl::encoding::DefaultFuchsiaResourceDialect,
315    > {
316        RemoteControlProxyInterface::r#identify_host(self)
317    }
318
319    /// Connects a channel to a service, given a moniker and a channel iff the component identified
320    /// by the given moniker exposes a capability of the requested name.
321    pub fn r#connect_capability(
322        &self,
323        mut moniker: &str,
324        mut capability_set: fidl_fuchsia_sys2::OpenDirType,
325        mut capability_name: &str,
326        mut server_channel: fidl::Channel,
327    ) -> fidl::client::QueryResponseFut<
328        RemoteControlConnectCapabilityResult,
329        fidl::encoding::DefaultFuchsiaResourceDialect,
330    > {
331        RemoteControlProxyInterface::r#connect_capability(
332            self,
333            moniker,
334            capability_set,
335            capability_name,
336            server_channel,
337        )
338    }
339
340    pub fn r#get_time(
341        &self,
342    ) -> fidl::client::QueryResponseFut<
343        fidl::MonotonicInstant,
344        fidl::encoding::DefaultFuchsiaResourceDialect,
345    > {
346        RemoteControlProxyInterface::r#get_time(self)
347    }
348
349    pub fn r#get_boot_time(
350        &self,
351    ) -> fidl::client::QueryResponseFut<
352        fidl::BootInstant,
353        fidl::encoding::DefaultFuchsiaResourceDialect,
354    > {
355        RemoteControlProxyInterface::r#get_boot_time(self)
356    }
357}
358
359impl RemoteControlProxyInterface for RemoteControlProxy {
360    type EchoStringResponseFut =
361        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
362    fn r#echo_string(&self, mut value: &str) -> Self::EchoStringResponseFut {
363        fn _decode(
364            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
365        ) -> Result<String, fidl::Error> {
366            let _response = fidl::client::decode_transaction_body::<
367                RemoteControlEchoStringResponse,
368                fidl::encoding::DefaultFuchsiaResourceDialect,
369                0x2bbec7ca8a72e82b,
370            >(_buf?)?;
371            Ok(_response.response)
372        }
373        self.client.send_query_and_decode::<RemoteControlEchoStringRequest, String>(
374            (value,),
375            0x2bbec7ca8a72e82b,
376            fidl::encoding::DynamicFlags::empty(),
377            _decode,
378        )
379    }
380
381    type LogMessageResponseFut =
382        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
383    fn r#log_message(
384        &self,
385        mut tag: &str,
386        mut message: &str,
387        mut severity: fidl_fuchsia_diagnostics_types::Severity,
388    ) -> Self::LogMessageResponseFut {
389        fn _decode(
390            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
391        ) -> Result<(), fidl::Error> {
392            let _response = fidl::client::decode_transaction_body::<
393                fidl::encoding::EmptyPayload,
394                fidl::encoding::DefaultFuchsiaResourceDialect,
395                0x3da84acd5bbf3926,
396            >(_buf?)?;
397            Ok(_response)
398        }
399        self.client.send_query_and_decode::<RemoteControlLogMessageRequest, ()>(
400            (tag, message, severity),
401            0x3da84acd5bbf3926,
402            fidl::encoding::DynamicFlags::empty(),
403            _decode,
404        )
405    }
406
407    type IdentifyHostResponseFut = fidl::client::QueryResponseFut<
408        RemoteControlIdentifyHostResult,
409        fidl::encoding::DefaultFuchsiaResourceDialect,
410    >;
411    fn r#identify_host(&self) -> Self::IdentifyHostResponseFut {
412        fn _decode(
413            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
414        ) -> Result<RemoteControlIdentifyHostResult, fidl::Error> {
415            let _response = fidl::client::decode_transaction_body::<
416                fidl::encoding::FlexibleResultType<
417                    RemoteControlIdentifyHostResponse,
418                    IdentifyHostError,
419                >,
420                fidl::encoding::DefaultFuchsiaResourceDialect,
421                0x6035e1ab368deee1,
422            >(_buf?)?
423            .into_result::<RemoteControlMarker>("identify_host")?;
424            Ok(_response.map(|x| x.response))
425        }
426        self.client
427            .send_query_and_decode::<fidl::encoding::EmptyPayload, RemoteControlIdentifyHostResult>(
428                (),
429                0x6035e1ab368deee1,
430                fidl::encoding::DynamicFlags::FLEXIBLE,
431                _decode,
432            )
433    }
434
435    type ConnectCapabilityResponseFut = fidl::client::QueryResponseFut<
436        RemoteControlConnectCapabilityResult,
437        fidl::encoding::DefaultFuchsiaResourceDialect,
438    >;
439    fn r#connect_capability(
440        &self,
441        mut moniker: &str,
442        mut capability_set: fidl_fuchsia_sys2::OpenDirType,
443        mut capability_name: &str,
444        mut server_channel: fidl::Channel,
445    ) -> Self::ConnectCapabilityResponseFut {
446        fn _decode(
447            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
448        ) -> Result<RemoteControlConnectCapabilityResult, fidl::Error> {
449            let _response = fidl::client::decode_transaction_body::<
450                fidl::encoding::FlexibleResultType<
451                    fidl::encoding::EmptyStruct,
452                    ConnectCapabilityError,
453                >,
454                fidl::encoding::DefaultFuchsiaResourceDialect,
455                0x3ae7a7c874dceceb,
456            >(_buf?)?
457            .into_result::<RemoteControlMarker>("connect_capability")?;
458            Ok(_response.map(|x| x))
459        }
460        self.client.send_query_and_decode::<
461            RemoteControlConnectCapabilityRequest,
462            RemoteControlConnectCapabilityResult,
463        >(
464            (moniker, capability_set, capability_name, server_channel,),
465            0x3ae7a7c874dceceb,
466            fidl::encoding::DynamicFlags::FLEXIBLE,
467            _decode,
468        )
469    }
470
471    type GetTimeResponseFut = fidl::client::QueryResponseFut<
472        fidl::MonotonicInstant,
473        fidl::encoding::DefaultFuchsiaResourceDialect,
474    >;
475    fn r#get_time(&self) -> Self::GetTimeResponseFut {
476        fn _decode(
477            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
478        ) -> Result<fidl::MonotonicInstant, fidl::Error> {
479            let _response = fidl::client::decode_transaction_body::<
480                RemoteControlGetTimeResponse,
481                fidl::encoding::DefaultFuchsiaResourceDialect,
482                0x3588f31e9067748d,
483            >(_buf?)?;
484            Ok(_response.time)
485        }
486        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::MonotonicInstant>(
487            (),
488            0x3588f31e9067748d,
489            fidl::encoding::DynamicFlags::empty(),
490            _decode,
491        )
492    }
493
494    type GetBootTimeResponseFut = fidl::client::QueryResponseFut<
495        fidl::BootInstant,
496        fidl::encoding::DefaultFuchsiaResourceDialect,
497    >;
498    fn r#get_boot_time(&self) -> Self::GetBootTimeResponseFut {
499        fn _decode(
500            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
501        ) -> Result<fidl::BootInstant, fidl::Error> {
502            let _response = fidl::client::decode_transaction_body::<
503                RemoteControlGetBootTimeResponse,
504                fidl::encoding::DefaultFuchsiaResourceDialect,
505                0x55706f013cd79ebd,
506            >(_buf?)?;
507            Ok(_response.time)
508        }
509        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, fidl::BootInstant>(
510            (),
511            0x55706f013cd79ebd,
512            fidl::encoding::DynamicFlags::empty(),
513            _decode,
514        )
515    }
516}
517
518pub struct RemoteControlEventStream {
519    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
520}
521
522impl std::marker::Unpin for RemoteControlEventStream {}
523
524impl futures::stream::FusedStream for RemoteControlEventStream {
525    fn is_terminated(&self) -> bool {
526        self.event_receiver.is_terminated()
527    }
528}
529
530impl futures::Stream for RemoteControlEventStream {
531    type Item = Result<RemoteControlEvent, fidl::Error>;
532
533    fn poll_next(
534        mut self: std::pin::Pin<&mut Self>,
535        cx: &mut std::task::Context<'_>,
536    ) -> std::task::Poll<Option<Self::Item>> {
537        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
538            &mut self.event_receiver,
539            cx
540        )?) {
541            Some(buf) => std::task::Poll::Ready(Some(RemoteControlEvent::decode(buf))),
542            None => std::task::Poll::Ready(None),
543        }
544    }
545}
546
547#[derive(Debug)]
548pub enum RemoteControlEvent {
549    #[non_exhaustive]
550    _UnknownEvent {
551        /// Ordinal of the event that was sent.
552        ordinal: u64,
553    },
554}
555
556impl RemoteControlEvent {
557    /// Decodes a message buffer as a [`RemoteControlEvent`].
558    fn decode(
559        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
560    ) -> Result<RemoteControlEvent, fidl::Error> {
561        let (bytes, _handles) = buf.split_mut();
562        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
563        debug_assert_eq!(tx_header.tx_id, 0);
564        match tx_header.ordinal {
565            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
566                Ok(RemoteControlEvent::_UnknownEvent { ordinal: tx_header.ordinal })
567            }
568            _ => Err(fidl::Error::UnknownOrdinal {
569                ordinal: tx_header.ordinal,
570                protocol_name: <RemoteControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
571            }),
572        }
573    }
574}
575
576/// A Stream of incoming requests for fuchsia.developer.remotecontrol/RemoteControl.
577pub struct RemoteControlRequestStream {
578    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
579    is_terminated: bool,
580}
581
582impl std::marker::Unpin for RemoteControlRequestStream {}
583
584impl futures::stream::FusedStream for RemoteControlRequestStream {
585    fn is_terminated(&self) -> bool {
586        self.is_terminated
587    }
588}
589
590impl fidl::endpoints::RequestStream for RemoteControlRequestStream {
591    type Protocol = RemoteControlMarker;
592    type ControlHandle = RemoteControlControlHandle;
593
594    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
595        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
596    }
597
598    fn control_handle(&self) -> Self::ControlHandle {
599        RemoteControlControlHandle { inner: self.inner.clone() }
600    }
601
602    fn into_inner(
603        self,
604    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
605    {
606        (self.inner, self.is_terminated)
607    }
608
609    fn from_inner(
610        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
611        is_terminated: bool,
612    ) -> Self {
613        Self { inner, is_terminated }
614    }
615}
616
617impl futures::Stream for RemoteControlRequestStream {
618    type Item = Result<RemoteControlRequest, fidl::Error>;
619
620    fn poll_next(
621        mut self: std::pin::Pin<&mut Self>,
622        cx: &mut std::task::Context<'_>,
623    ) -> std::task::Poll<Option<Self::Item>> {
624        let this = &mut *self;
625        if this.inner.check_shutdown(cx) {
626            this.is_terminated = true;
627            return std::task::Poll::Ready(None);
628        }
629        if this.is_terminated {
630            panic!("polled RemoteControlRequestStream after completion");
631        }
632        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
633            |bytes, handles| {
634                match this.inner.channel().read_etc(cx, bytes, handles) {
635                    std::task::Poll::Ready(Ok(())) => {}
636                    std::task::Poll::Pending => return std::task::Poll::Pending,
637                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
638                        this.is_terminated = true;
639                        return std::task::Poll::Ready(None);
640                    }
641                    std::task::Poll::Ready(Err(e)) => {
642                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
643                            e.into(),
644                        ))));
645                    }
646                }
647
648                // A message has been received from the channel
649                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
650
651                std::task::Poll::Ready(Some(match header.ordinal {
652                    0x2bbec7ca8a72e82b => {
653                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
654                        let mut req = fidl::new_empty!(
655                            RemoteControlEchoStringRequest,
656                            fidl::encoding::DefaultFuchsiaResourceDialect
657                        );
658                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteControlEchoStringRequest>(&header, _body_bytes, handles, &mut req)?;
659                        let control_handle =
660                            RemoteControlControlHandle { inner: this.inner.clone() };
661                        Ok(RemoteControlRequest::EchoString {
662                            value: req.value,
663
664                            responder: RemoteControlEchoStringResponder {
665                                control_handle: std::mem::ManuallyDrop::new(control_handle),
666                                tx_id: header.tx_id,
667                            },
668                        })
669                    }
670                    0x3da84acd5bbf3926 => {
671                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
672                        let mut req = fidl::new_empty!(
673                            RemoteControlLogMessageRequest,
674                            fidl::encoding::DefaultFuchsiaResourceDialect
675                        );
676                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteControlLogMessageRequest>(&header, _body_bytes, handles, &mut req)?;
677                        let control_handle =
678                            RemoteControlControlHandle { inner: this.inner.clone() };
679                        Ok(RemoteControlRequest::LogMessage {
680                            tag: req.tag,
681                            message: req.message,
682                            severity: req.severity,
683
684                            responder: RemoteControlLogMessageResponder {
685                                control_handle: std::mem::ManuallyDrop::new(control_handle),
686                                tx_id: header.tx_id,
687                            },
688                        })
689                    }
690                    0x6035e1ab368deee1 => {
691                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
692                        let mut req = fidl::new_empty!(
693                            fidl::encoding::EmptyPayload,
694                            fidl::encoding::DefaultFuchsiaResourceDialect
695                        );
696                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
697                        let control_handle =
698                            RemoteControlControlHandle { inner: this.inner.clone() };
699                        Ok(RemoteControlRequest::IdentifyHost {
700                            responder: RemoteControlIdentifyHostResponder {
701                                control_handle: std::mem::ManuallyDrop::new(control_handle),
702                                tx_id: header.tx_id,
703                            },
704                        })
705                    }
706                    0x3ae7a7c874dceceb => {
707                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
708                        let mut req = fidl::new_empty!(
709                            RemoteControlConnectCapabilityRequest,
710                            fidl::encoding::DefaultFuchsiaResourceDialect
711                        );
712                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RemoteControlConnectCapabilityRequest>(&header, _body_bytes, handles, &mut req)?;
713                        let control_handle =
714                            RemoteControlControlHandle { inner: this.inner.clone() };
715                        Ok(RemoteControlRequest::ConnectCapability {
716                            moniker: req.moniker,
717                            capability_set: req.capability_set,
718                            capability_name: req.capability_name,
719                            server_channel: req.server_channel,
720
721                            responder: RemoteControlConnectCapabilityResponder {
722                                control_handle: std::mem::ManuallyDrop::new(control_handle),
723                                tx_id: header.tx_id,
724                            },
725                        })
726                    }
727                    0x3588f31e9067748d => {
728                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
729                        let mut req = fidl::new_empty!(
730                            fidl::encoding::EmptyPayload,
731                            fidl::encoding::DefaultFuchsiaResourceDialect
732                        );
733                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
734                        let control_handle =
735                            RemoteControlControlHandle { inner: this.inner.clone() };
736                        Ok(RemoteControlRequest::GetTime {
737                            responder: RemoteControlGetTimeResponder {
738                                control_handle: std::mem::ManuallyDrop::new(control_handle),
739                                tx_id: header.tx_id,
740                            },
741                        })
742                    }
743                    0x55706f013cd79ebd => {
744                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
745                        let mut req = fidl::new_empty!(
746                            fidl::encoding::EmptyPayload,
747                            fidl::encoding::DefaultFuchsiaResourceDialect
748                        );
749                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
750                        let control_handle =
751                            RemoteControlControlHandle { inner: this.inner.clone() };
752                        Ok(RemoteControlRequest::GetBootTime {
753                            responder: RemoteControlGetBootTimeResponder {
754                                control_handle: std::mem::ManuallyDrop::new(control_handle),
755                                tx_id: header.tx_id,
756                            },
757                        })
758                    }
759                    _ if header.tx_id == 0
760                        && header
761                            .dynamic_flags()
762                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
763                    {
764                        Ok(RemoteControlRequest::_UnknownMethod {
765                            ordinal: header.ordinal,
766                            control_handle: RemoteControlControlHandle {
767                                inner: this.inner.clone(),
768                            },
769                            method_type: fidl::MethodType::OneWay,
770                        })
771                    }
772                    _ if header
773                        .dynamic_flags()
774                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
775                    {
776                        this.inner.send_framework_err(
777                            fidl::encoding::FrameworkErr::UnknownMethod,
778                            header.tx_id,
779                            header.ordinal,
780                            header.dynamic_flags(),
781                            (bytes, handles),
782                        )?;
783                        Ok(RemoteControlRequest::_UnknownMethod {
784                            ordinal: header.ordinal,
785                            control_handle: RemoteControlControlHandle {
786                                inner: this.inner.clone(),
787                            },
788                            method_type: fidl::MethodType::TwoWay,
789                        })
790                    }
791                    _ => Err(fidl::Error::UnknownOrdinal {
792                        ordinal: header.ordinal,
793                        protocol_name:
794                            <RemoteControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
795                    }),
796                }))
797            },
798        )
799    }
800}
801
802#[derive(Debug)]
803pub enum RemoteControlRequest {
804    /// Returns the input.
805    EchoString {
806        value: String,
807        responder: RemoteControlEchoStringResponder,
808    },
809    /// Writes a string to the syslog on the device.
810    LogMessage {
811        tag: String,
812        message: String,
813        severity: fidl_fuchsia_diagnostics_types::Severity,
814        responder: RemoteControlLogMessageResponder,
815    },
816    IdentifyHost {
817        responder: RemoteControlIdentifyHostResponder,
818    },
819    /// Connects a channel to a service, given a moniker and a channel iff the component identified
820    /// by the given moniker exposes a capability of the requested name.
821    ConnectCapability {
822        moniker: String,
823        capability_set: fidl_fuchsia_sys2::OpenDirType,
824        capability_name: String,
825        server_channel: fidl::Channel,
826        responder: RemoteControlConnectCapabilityResponder,
827    },
828    GetTime {
829        responder: RemoteControlGetTimeResponder,
830    },
831    GetBootTime {
832        responder: RemoteControlGetBootTimeResponder,
833    },
834    /// An interaction was received which does not match any known method.
835    #[non_exhaustive]
836    _UnknownMethod {
837        /// Ordinal of the method that was called.
838        ordinal: u64,
839        control_handle: RemoteControlControlHandle,
840        method_type: fidl::MethodType,
841    },
842}
843
844impl RemoteControlRequest {
845    #[allow(irrefutable_let_patterns)]
846    pub fn into_echo_string(self) -> Option<(String, RemoteControlEchoStringResponder)> {
847        if let RemoteControlRequest::EchoString { value, responder } = self {
848            Some((value, responder))
849        } else {
850            None
851        }
852    }
853
854    #[allow(irrefutable_let_patterns)]
855    pub fn into_log_message(
856        self,
857    ) -> Option<(
858        String,
859        String,
860        fidl_fuchsia_diagnostics_types::Severity,
861        RemoteControlLogMessageResponder,
862    )> {
863        if let RemoteControlRequest::LogMessage { tag, message, severity, responder } = self {
864            Some((tag, message, severity, responder))
865        } else {
866            None
867        }
868    }
869
870    #[allow(irrefutable_let_patterns)]
871    pub fn into_identify_host(self) -> Option<(RemoteControlIdentifyHostResponder)> {
872        if let RemoteControlRequest::IdentifyHost { responder } = self {
873            Some((responder))
874        } else {
875            None
876        }
877    }
878
879    #[allow(irrefutable_let_patterns)]
880    pub fn into_connect_capability(
881        self,
882    ) -> Option<(
883        String,
884        fidl_fuchsia_sys2::OpenDirType,
885        String,
886        fidl::Channel,
887        RemoteControlConnectCapabilityResponder,
888    )> {
889        if let RemoteControlRequest::ConnectCapability {
890            moniker,
891            capability_set,
892            capability_name,
893            server_channel,
894            responder,
895        } = self
896        {
897            Some((moniker, capability_set, capability_name, server_channel, responder))
898        } else {
899            None
900        }
901    }
902
903    #[allow(irrefutable_let_patterns)]
904    pub fn into_get_time(self) -> Option<(RemoteControlGetTimeResponder)> {
905        if let RemoteControlRequest::GetTime { responder } = self {
906            Some((responder))
907        } else {
908            None
909        }
910    }
911
912    #[allow(irrefutable_let_patterns)]
913    pub fn into_get_boot_time(self) -> Option<(RemoteControlGetBootTimeResponder)> {
914        if let RemoteControlRequest::GetBootTime { responder } = self {
915            Some((responder))
916        } else {
917            None
918        }
919    }
920
921    /// Name of the method defined in FIDL
922    pub fn method_name(&self) -> &'static str {
923        match *self {
924            RemoteControlRequest::EchoString { .. } => "echo_string",
925            RemoteControlRequest::LogMessage { .. } => "log_message",
926            RemoteControlRequest::IdentifyHost { .. } => "identify_host",
927            RemoteControlRequest::ConnectCapability { .. } => "connect_capability",
928            RemoteControlRequest::GetTime { .. } => "get_time",
929            RemoteControlRequest::GetBootTime { .. } => "get_boot_time",
930            RemoteControlRequest::_UnknownMethod {
931                method_type: fidl::MethodType::OneWay, ..
932            } => "unknown one-way method",
933            RemoteControlRequest::_UnknownMethod {
934                method_type: fidl::MethodType::TwoWay, ..
935            } => "unknown two-way method",
936        }
937    }
938}
939
940#[derive(Debug, Clone)]
941pub struct RemoteControlControlHandle {
942    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
943}
944
945impl fidl::endpoints::ControlHandle for RemoteControlControlHandle {
946    fn shutdown(&self) {
947        self.inner.shutdown()
948    }
949
950    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
951        self.inner.shutdown_with_epitaph(status)
952    }
953
954    fn is_closed(&self) -> bool {
955        self.inner.channel().is_closed()
956    }
957    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
958        self.inner.channel().on_closed()
959    }
960
961    #[cfg(target_os = "fuchsia")]
962    fn signal_peer(
963        &self,
964        clear_mask: zx::Signals,
965        set_mask: zx::Signals,
966    ) -> Result<(), zx_status::Status> {
967        use fidl::Peered;
968        self.inner.channel().signal_peer(clear_mask, set_mask)
969    }
970}
971
972impl RemoteControlControlHandle {}
973
974#[must_use = "FIDL methods require a response to be sent"]
975#[derive(Debug)]
976pub struct RemoteControlEchoStringResponder {
977    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
978    tx_id: u32,
979}
980
981/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
982/// if the responder is dropped without sending a response, so that the client
983/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
984impl std::ops::Drop for RemoteControlEchoStringResponder {
985    fn drop(&mut self) {
986        self.control_handle.shutdown();
987        // Safety: drops once, never accessed again
988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
989    }
990}
991
992impl fidl::endpoints::Responder for RemoteControlEchoStringResponder {
993    type ControlHandle = RemoteControlControlHandle;
994
995    fn control_handle(&self) -> &RemoteControlControlHandle {
996        &self.control_handle
997    }
998
999    fn drop_without_shutdown(mut self) {
1000        // Safety: drops once, never accessed again due to mem::forget
1001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1002        // Prevent Drop from running (which would shut down the channel)
1003        std::mem::forget(self);
1004    }
1005}
1006
1007impl RemoteControlEchoStringResponder {
1008    /// Sends a response to the FIDL transaction.
1009    ///
1010    /// Sets the channel to shutdown if an error occurs.
1011    pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
1012        let _result = self.send_raw(response);
1013        if _result.is_err() {
1014            self.control_handle.shutdown();
1015        }
1016        self.drop_without_shutdown();
1017        _result
1018    }
1019
1020    /// Similar to "send" but does not shutdown the channel if an error occurs.
1021    pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
1022        let _result = self.send_raw(response);
1023        self.drop_without_shutdown();
1024        _result
1025    }
1026
1027    fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
1028        self.control_handle.inner.send::<RemoteControlEchoStringResponse>(
1029            (response,),
1030            self.tx_id,
1031            0x2bbec7ca8a72e82b,
1032            fidl::encoding::DynamicFlags::empty(),
1033        )
1034    }
1035}
1036
1037#[must_use = "FIDL methods require a response to be sent"]
1038#[derive(Debug)]
1039pub struct RemoteControlLogMessageResponder {
1040    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1041    tx_id: u32,
1042}
1043
1044/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1045/// if the responder is dropped without sending a response, so that the client
1046/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1047impl std::ops::Drop for RemoteControlLogMessageResponder {
1048    fn drop(&mut self) {
1049        self.control_handle.shutdown();
1050        // Safety: drops once, never accessed again
1051        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1052    }
1053}
1054
1055impl fidl::endpoints::Responder for RemoteControlLogMessageResponder {
1056    type ControlHandle = RemoteControlControlHandle;
1057
1058    fn control_handle(&self) -> &RemoteControlControlHandle {
1059        &self.control_handle
1060    }
1061
1062    fn drop_without_shutdown(mut self) {
1063        // Safety: drops once, never accessed again due to mem::forget
1064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1065        // Prevent Drop from running (which would shut down the channel)
1066        std::mem::forget(self);
1067    }
1068}
1069
1070impl RemoteControlLogMessageResponder {
1071    /// Sends a response to the FIDL transaction.
1072    ///
1073    /// Sets the channel to shutdown if an error occurs.
1074    pub fn send(self) -> Result<(), fidl::Error> {
1075        let _result = self.send_raw();
1076        if _result.is_err() {
1077            self.control_handle.shutdown();
1078        }
1079        self.drop_without_shutdown();
1080        _result
1081    }
1082
1083    /// Similar to "send" but does not shutdown the channel if an error occurs.
1084    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1085        let _result = self.send_raw();
1086        self.drop_without_shutdown();
1087        _result
1088    }
1089
1090    fn send_raw(&self) -> Result<(), fidl::Error> {
1091        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1092            (),
1093            self.tx_id,
1094            0x3da84acd5bbf3926,
1095            fidl::encoding::DynamicFlags::empty(),
1096        )
1097    }
1098}
1099
1100#[must_use = "FIDL methods require a response to be sent"]
1101#[derive(Debug)]
1102pub struct RemoteControlIdentifyHostResponder {
1103    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1104    tx_id: u32,
1105}
1106
1107/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1108/// if the responder is dropped without sending a response, so that the client
1109/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1110impl std::ops::Drop for RemoteControlIdentifyHostResponder {
1111    fn drop(&mut self) {
1112        self.control_handle.shutdown();
1113        // Safety: drops once, never accessed again
1114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1115    }
1116}
1117
1118impl fidl::endpoints::Responder for RemoteControlIdentifyHostResponder {
1119    type ControlHandle = RemoteControlControlHandle;
1120
1121    fn control_handle(&self) -> &RemoteControlControlHandle {
1122        &self.control_handle
1123    }
1124
1125    fn drop_without_shutdown(mut self) {
1126        // Safety: drops once, never accessed again due to mem::forget
1127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1128        // Prevent Drop from running (which would shut down the channel)
1129        std::mem::forget(self);
1130    }
1131}
1132
1133impl RemoteControlIdentifyHostResponder {
1134    /// Sends a response to the FIDL transaction.
1135    ///
1136    /// Sets the channel to shutdown if an error occurs.
1137    pub fn send(
1138        self,
1139        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
1140    ) -> Result<(), fidl::Error> {
1141        let _result = self.send_raw(result);
1142        if _result.is_err() {
1143            self.control_handle.shutdown();
1144        }
1145        self.drop_without_shutdown();
1146        _result
1147    }
1148
1149    /// Similar to "send" but does not shutdown the channel if an error occurs.
1150    pub fn send_no_shutdown_on_err(
1151        self,
1152        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
1153    ) -> Result<(), fidl::Error> {
1154        let _result = self.send_raw(result);
1155        self.drop_without_shutdown();
1156        _result
1157    }
1158
1159    fn send_raw(
1160        &self,
1161        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
1162    ) -> Result<(), fidl::Error> {
1163        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1164            RemoteControlIdentifyHostResponse,
1165            IdentifyHostError,
1166        >>(
1167            fidl::encoding::FlexibleResult::new(result.map(|response| (response,))),
1168            self.tx_id,
1169            0x6035e1ab368deee1,
1170            fidl::encoding::DynamicFlags::FLEXIBLE,
1171        )
1172    }
1173}
1174
1175#[must_use = "FIDL methods require a response to be sent"]
1176#[derive(Debug)]
1177pub struct RemoteControlConnectCapabilityResponder {
1178    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1179    tx_id: u32,
1180}
1181
1182/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1183/// if the responder is dropped without sending a response, so that the client
1184/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1185impl std::ops::Drop for RemoteControlConnectCapabilityResponder {
1186    fn drop(&mut self) {
1187        self.control_handle.shutdown();
1188        // Safety: drops once, never accessed again
1189        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1190    }
1191}
1192
1193impl fidl::endpoints::Responder for RemoteControlConnectCapabilityResponder {
1194    type ControlHandle = RemoteControlControlHandle;
1195
1196    fn control_handle(&self) -> &RemoteControlControlHandle {
1197        &self.control_handle
1198    }
1199
1200    fn drop_without_shutdown(mut self) {
1201        // Safety: drops once, never accessed again due to mem::forget
1202        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1203        // Prevent Drop from running (which would shut down the channel)
1204        std::mem::forget(self);
1205    }
1206}
1207
1208impl RemoteControlConnectCapabilityResponder {
1209    /// Sends a response to the FIDL transaction.
1210    ///
1211    /// Sets the channel to shutdown if an error occurs.
1212    pub fn send(self, mut result: Result<(), ConnectCapabilityError>) -> Result<(), fidl::Error> {
1213        let _result = self.send_raw(result);
1214        if _result.is_err() {
1215            self.control_handle.shutdown();
1216        }
1217        self.drop_without_shutdown();
1218        _result
1219    }
1220
1221    /// Similar to "send" but does not shutdown the channel if an error occurs.
1222    pub fn send_no_shutdown_on_err(
1223        self,
1224        mut result: Result<(), ConnectCapabilityError>,
1225    ) -> Result<(), fidl::Error> {
1226        let _result = self.send_raw(result);
1227        self.drop_without_shutdown();
1228        _result
1229    }
1230
1231    fn send_raw(&self, mut result: Result<(), ConnectCapabilityError>) -> Result<(), fidl::Error> {
1232        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1233            fidl::encoding::EmptyStruct,
1234            ConnectCapabilityError,
1235        >>(
1236            fidl::encoding::FlexibleResult::new(result),
1237            self.tx_id,
1238            0x3ae7a7c874dceceb,
1239            fidl::encoding::DynamicFlags::FLEXIBLE,
1240        )
1241    }
1242}
1243
1244#[must_use = "FIDL methods require a response to be sent"]
1245#[derive(Debug)]
1246pub struct RemoteControlGetTimeResponder {
1247    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1248    tx_id: u32,
1249}
1250
1251/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1252/// if the responder is dropped without sending a response, so that the client
1253/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1254impl std::ops::Drop for RemoteControlGetTimeResponder {
1255    fn drop(&mut self) {
1256        self.control_handle.shutdown();
1257        // Safety: drops once, never accessed again
1258        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1259    }
1260}
1261
1262impl fidl::endpoints::Responder for RemoteControlGetTimeResponder {
1263    type ControlHandle = RemoteControlControlHandle;
1264
1265    fn control_handle(&self) -> &RemoteControlControlHandle {
1266        &self.control_handle
1267    }
1268
1269    fn drop_without_shutdown(mut self) {
1270        // Safety: drops once, never accessed again due to mem::forget
1271        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1272        // Prevent Drop from running (which would shut down the channel)
1273        std::mem::forget(self);
1274    }
1275}
1276
1277impl RemoteControlGetTimeResponder {
1278    /// Sends a response to the FIDL transaction.
1279    ///
1280    /// Sets the channel to shutdown if an error occurs.
1281    pub fn send(self, mut time: fidl::MonotonicInstant) -> Result<(), fidl::Error> {
1282        let _result = self.send_raw(time);
1283        if _result.is_err() {
1284            self.control_handle.shutdown();
1285        }
1286        self.drop_without_shutdown();
1287        _result
1288    }
1289
1290    /// Similar to "send" but does not shutdown the channel if an error occurs.
1291    pub fn send_no_shutdown_on_err(
1292        self,
1293        mut time: fidl::MonotonicInstant,
1294    ) -> Result<(), fidl::Error> {
1295        let _result = self.send_raw(time);
1296        self.drop_without_shutdown();
1297        _result
1298    }
1299
1300    fn send_raw(&self, mut time: fidl::MonotonicInstant) -> Result<(), fidl::Error> {
1301        self.control_handle.inner.send::<RemoteControlGetTimeResponse>(
1302            (time,),
1303            self.tx_id,
1304            0x3588f31e9067748d,
1305            fidl::encoding::DynamicFlags::empty(),
1306        )
1307    }
1308}
1309
1310#[must_use = "FIDL methods require a response to be sent"]
1311#[derive(Debug)]
1312pub struct RemoteControlGetBootTimeResponder {
1313    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1314    tx_id: u32,
1315}
1316
1317/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1318/// if the responder is dropped without sending a response, so that the client
1319/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1320impl std::ops::Drop for RemoteControlGetBootTimeResponder {
1321    fn drop(&mut self) {
1322        self.control_handle.shutdown();
1323        // Safety: drops once, never accessed again
1324        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1325    }
1326}
1327
1328impl fidl::endpoints::Responder for RemoteControlGetBootTimeResponder {
1329    type ControlHandle = RemoteControlControlHandle;
1330
1331    fn control_handle(&self) -> &RemoteControlControlHandle {
1332        &self.control_handle
1333    }
1334
1335    fn drop_without_shutdown(mut self) {
1336        // Safety: drops once, never accessed again due to mem::forget
1337        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1338        // Prevent Drop from running (which would shut down the channel)
1339        std::mem::forget(self);
1340    }
1341}
1342
1343impl RemoteControlGetBootTimeResponder {
1344    /// Sends a response to the FIDL transaction.
1345    ///
1346    /// Sets the channel to shutdown if an error occurs.
1347    pub fn send(self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1348        let _result = self.send_raw(time);
1349        if _result.is_err() {
1350            self.control_handle.shutdown();
1351        }
1352        self.drop_without_shutdown();
1353        _result
1354    }
1355
1356    /// Similar to "send" but does not shutdown the channel if an error occurs.
1357    pub fn send_no_shutdown_on_err(self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1358        let _result = self.send_raw(time);
1359        self.drop_without_shutdown();
1360        _result
1361    }
1362
1363    fn send_raw(&self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1364        self.control_handle.inner.send::<RemoteControlGetBootTimeResponse>(
1365            (time,),
1366            self.tx_id,
1367            0x55706f013cd79ebd,
1368            fidl::encoding::DynamicFlags::empty(),
1369        )
1370    }
1371}
1372
1373mod internal {
1374    use super::*;
1375
1376    impl fidl::encoding::ResourceTypeMarker for RemoteControlConnectCapabilityRequest {
1377        type Borrowed<'a> = &'a mut Self;
1378        fn take_or_borrow<'a>(
1379            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1380        ) -> Self::Borrowed<'a> {
1381            value
1382        }
1383    }
1384
1385    unsafe impl fidl::encoding::TypeMarker for RemoteControlConnectCapabilityRequest {
1386        type Owned = Self;
1387
1388        #[inline(always)]
1389        fn inline_align(_context: fidl::encoding::Context) -> usize {
1390            8
1391        }
1392
1393        #[inline(always)]
1394        fn inline_size(_context: fidl::encoding::Context) -> usize {
1395            48
1396        }
1397    }
1398
1399    unsafe impl
1400        fidl::encoding::Encode<
1401            RemoteControlConnectCapabilityRequest,
1402            fidl::encoding::DefaultFuchsiaResourceDialect,
1403        > for &mut RemoteControlConnectCapabilityRequest
1404    {
1405        #[inline]
1406        unsafe fn encode(
1407            self,
1408            encoder: &mut fidl::encoding::Encoder<
1409                '_,
1410                fidl::encoding::DefaultFuchsiaResourceDialect,
1411            >,
1412            offset: usize,
1413            _depth: fidl::encoding::Depth,
1414        ) -> fidl::Result<()> {
1415            encoder.debug_check_bounds::<RemoteControlConnectCapabilityRequest>(offset);
1416            // Delegate to tuple encoding.
1417            fidl::encoding::Encode::<RemoteControlConnectCapabilityRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1418                (
1419                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
1420                    <fidl_fuchsia_sys2::OpenDirType as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_set),
1421                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_name),
1422                    <fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_channel),
1423                ),
1424                encoder, offset, _depth
1425            )
1426        }
1427    }
1428    unsafe impl<
1429        T0: fidl::encoding::Encode<
1430                fidl::encoding::BoundedString<4096>,
1431                fidl::encoding::DefaultFuchsiaResourceDialect,
1432            >,
1433        T1: fidl::encoding::Encode<
1434                fidl_fuchsia_sys2::OpenDirType,
1435                fidl::encoding::DefaultFuchsiaResourceDialect,
1436            >,
1437        T2: fidl::encoding::Encode<
1438                fidl::encoding::BoundedString<255>,
1439                fidl::encoding::DefaultFuchsiaResourceDialect,
1440            >,
1441        T3: fidl::encoding::Encode<
1442                fidl::encoding::HandleType<
1443                    fidl::Channel,
1444                    { fidl::ObjectType::CHANNEL.into_raw() },
1445                    2147483648,
1446                >,
1447                fidl::encoding::DefaultFuchsiaResourceDialect,
1448            >,
1449    >
1450        fidl::encoding::Encode<
1451            RemoteControlConnectCapabilityRequest,
1452            fidl::encoding::DefaultFuchsiaResourceDialect,
1453        > for (T0, T1, T2, T3)
1454    {
1455        #[inline]
1456        unsafe fn encode(
1457            self,
1458            encoder: &mut fidl::encoding::Encoder<
1459                '_,
1460                fidl::encoding::DefaultFuchsiaResourceDialect,
1461            >,
1462            offset: usize,
1463            depth: fidl::encoding::Depth,
1464        ) -> fidl::Result<()> {
1465            encoder.debug_check_bounds::<RemoteControlConnectCapabilityRequest>(offset);
1466            // Zero out padding regions. There's no need to apply masks
1467            // because the unmasked parts will be overwritten by fields.
1468            unsafe {
1469                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1470                (ptr as *mut u64).write_unaligned(0);
1471            }
1472            unsafe {
1473                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1474                (ptr as *mut u64).write_unaligned(0);
1475            }
1476            // Write the fields.
1477            self.0.encode(encoder, offset + 0, depth)?;
1478            self.1.encode(encoder, offset + 16, depth)?;
1479            self.2.encode(encoder, offset + 24, depth)?;
1480            self.3.encode(encoder, offset + 40, depth)?;
1481            Ok(())
1482        }
1483    }
1484
1485    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1486        for RemoteControlConnectCapabilityRequest
1487    {
1488        #[inline(always)]
1489        fn new_empty() -> Self {
1490            Self {
1491                moniker: fidl::new_empty!(
1492                    fidl::encoding::BoundedString<4096>,
1493                    fidl::encoding::DefaultFuchsiaResourceDialect
1494                ),
1495                capability_set: fidl::new_empty!(
1496                    fidl_fuchsia_sys2::OpenDirType,
1497                    fidl::encoding::DefaultFuchsiaResourceDialect
1498                ),
1499                capability_name: fidl::new_empty!(
1500                    fidl::encoding::BoundedString<255>,
1501                    fidl::encoding::DefaultFuchsiaResourceDialect
1502                ),
1503                server_channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1504            }
1505        }
1506
1507        #[inline]
1508        unsafe fn decode(
1509            &mut self,
1510            decoder: &mut fidl::encoding::Decoder<
1511                '_,
1512                fidl::encoding::DefaultFuchsiaResourceDialect,
1513            >,
1514            offset: usize,
1515            _depth: fidl::encoding::Depth,
1516        ) -> fidl::Result<()> {
1517            decoder.debug_check_bounds::<Self>(offset);
1518            // Verify that padding bytes are zero.
1519            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1520            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1521            let mask = 0xffffffff00000000u64;
1522            let maskedval = padval & mask;
1523            if maskedval != 0 {
1524                return Err(fidl::Error::NonZeroPadding {
1525                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1526                });
1527            }
1528            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1529            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1530            let mask = 0xffffffff00000000u64;
1531            let maskedval = padval & mask;
1532            if maskedval != 0 {
1533                return Err(fidl::Error::NonZeroPadding {
1534                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1535                });
1536            }
1537            fidl::decode!(
1538                fidl::encoding::BoundedString<4096>,
1539                fidl::encoding::DefaultFuchsiaResourceDialect,
1540                &mut self.moniker,
1541                decoder,
1542                offset + 0,
1543                _depth
1544            )?;
1545            fidl::decode!(
1546                fidl_fuchsia_sys2::OpenDirType,
1547                fidl::encoding::DefaultFuchsiaResourceDialect,
1548                &mut self.capability_set,
1549                decoder,
1550                offset + 16,
1551                _depth
1552            )?;
1553            fidl::decode!(
1554                fidl::encoding::BoundedString<255>,
1555                fidl::encoding::DefaultFuchsiaResourceDialect,
1556                &mut self.capability_name,
1557                decoder,
1558                offset + 24,
1559                _depth
1560            )?;
1561            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_channel, decoder, offset + 40, _depth)?;
1562            Ok(())
1563        }
1564    }
1565}