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 RemoteControlControlHandle {
946    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
947        self.inner.shutdown_with_epitaph(status.into())
948    }
949}
950
951impl fidl::endpoints::ControlHandle for RemoteControlControlHandle {
952    fn shutdown(&self) {
953        self.inner.shutdown()
954    }
955
956    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
957        self.inner.shutdown_with_epitaph(status)
958    }
959
960    fn is_closed(&self) -> bool {
961        self.inner.channel().is_closed()
962    }
963    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
964        self.inner.channel().on_closed()
965    }
966
967    #[cfg(target_os = "fuchsia")]
968    fn signal_peer(
969        &self,
970        clear_mask: zx::Signals,
971        set_mask: zx::Signals,
972    ) -> Result<(), zx_status::Status> {
973        use fidl::Peered;
974        self.inner.channel().signal_peer(clear_mask, set_mask)
975    }
976}
977
978impl RemoteControlControlHandle {}
979
980#[must_use = "FIDL methods require a response to be sent"]
981#[derive(Debug)]
982pub struct RemoteControlEchoStringResponder {
983    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
984    tx_id: u32,
985}
986
987/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
988/// if the responder is dropped without sending a response, so that the client
989/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
990impl std::ops::Drop for RemoteControlEchoStringResponder {
991    fn drop(&mut self) {
992        self.control_handle.shutdown();
993        // Safety: drops once, never accessed again
994        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
995    }
996}
997
998impl fidl::endpoints::Responder for RemoteControlEchoStringResponder {
999    type ControlHandle = RemoteControlControlHandle;
1000
1001    fn control_handle(&self) -> &RemoteControlControlHandle {
1002        &self.control_handle
1003    }
1004
1005    fn drop_without_shutdown(mut self) {
1006        // Safety: drops once, never accessed again due to mem::forget
1007        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1008        // Prevent Drop from running (which would shut down the channel)
1009        std::mem::forget(self);
1010    }
1011}
1012
1013impl RemoteControlEchoStringResponder {
1014    /// Sends a response to the FIDL transaction.
1015    ///
1016    /// Sets the channel to shutdown if an error occurs.
1017    pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
1018        let _result = self.send_raw(response);
1019        if _result.is_err() {
1020            self.control_handle.shutdown();
1021        }
1022        self.drop_without_shutdown();
1023        _result
1024    }
1025
1026    /// Similar to "send" but does not shutdown the channel if an error occurs.
1027    pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
1028        let _result = self.send_raw(response);
1029        self.drop_without_shutdown();
1030        _result
1031    }
1032
1033    fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
1034        self.control_handle.inner.send::<RemoteControlEchoStringResponse>(
1035            (response,),
1036            self.tx_id,
1037            0x2bbec7ca8a72e82b,
1038            fidl::encoding::DynamicFlags::empty(),
1039        )
1040    }
1041}
1042
1043#[must_use = "FIDL methods require a response to be sent"]
1044#[derive(Debug)]
1045pub struct RemoteControlLogMessageResponder {
1046    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1047    tx_id: u32,
1048}
1049
1050/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1051/// if the responder is dropped without sending a response, so that the client
1052/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1053impl std::ops::Drop for RemoteControlLogMessageResponder {
1054    fn drop(&mut self) {
1055        self.control_handle.shutdown();
1056        // Safety: drops once, never accessed again
1057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1058    }
1059}
1060
1061impl fidl::endpoints::Responder for RemoteControlLogMessageResponder {
1062    type ControlHandle = RemoteControlControlHandle;
1063
1064    fn control_handle(&self) -> &RemoteControlControlHandle {
1065        &self.control_handle
1066    }
1067
1068    fn drop_without_shutdown(mut self) {
1069        // Safety: drops once, never accessed again due to mem::forget
1070        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1071        // Prevent Drop from running (which would shut down the channel)
1072        std::mem::forget(self);
1073    }
1074}
1075
1076impl RemoteControlLogMessageResponder {
1077    /// Sends a response to the FIDL transaction.
1078    ///
1079    /// Sets the channel to shutdown if an error occurs.
1080    pub fn send(self) -> Result<(), fidl::Error> {
1081        let _result = self.send_raw();
1082        if _result.is_err() {
1083            self.control_handle.shutdown();
1084        }
1085        self.drop_without_shutdown();
1086        _result
1087    }
1088
1089    /// Similar to "send" but does not shutdown the channel if an error occurs.
1090    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1091        let _result = self.send_raw();
1092        self.drop_without_shutdown();
1093        _result
1094    }
1095
1096    fn send_raw(&self) -> Result<(), fidl::Error> {
1097        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1098            (),
1099            self.tx_id,
1100            0x3da84acd5bbf3926,
1101            fidl::encoding::DynamicFlags::empty(),
1102        )
1103    }
1104}
1105
1106#[must_use = "FIDL methods require a response to be sent"]
1107#[derive(Debug)]
1108pub struct RemoteControlIdentifyHostResponder {
1109    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1110    tx_id: u32,
1111}
1112
1113/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1114/// if the responder is dropped without sending a response, so that the client
1115/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1116impl std::ops::Drop for RemoteControlIdentifyHostResponder {
1117    fn drop(&mut self) {
1118        self.control_handle.shutdown();
1119        // Safety: drops once, never accessed again
1120        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1121    }
1122}
1123
1124impl fidl::endpoints::Responder for RemoteControlIdentifyHostResponder {
1125    type ControlHandle = RemoteControlControlHandle;
1126
1127    fn control_handle(&self) -> &RemoteControlControlHandle {
1128        &self.control_handle
1129    }
1130
1131    fn drop_without_shutdown(mut self) {
1132        // Safety: drops once, never accessed again due to mem::forget
1133        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1134        // Prevent Drop from running (which would shut down the channel)
1135        std::mem::forget(self);
1136    }
1137}
1138
1139impl RemoteControlIdentifyHostResponder {
1140    /// Sends a response to the FIDL transaction.
1141    ///
1142    /// Sets the channel to shutdown if an error occurs.
1143    pub fn send(
1144        self,
1145        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
1146    ) -> Result<(), fidl::Error> {
1147        let _result = self.send_raw(result);
1148        if _result.is_err() {
1149            self.control_handle.shutdown();
1150        }
1151        self.drop_without_shutdown();
1152        _result
1153    }
1154
1155    /// Similar to "send" but does not shutdown the channel if an error occurs.
1156    pub fn send_no_shutdown_on_err(
1157        self,
1158        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
1159    ) -> Result<(), fidl::Error> {
1160        let _result = self.send_raw(result);
1161        self.drop_without_shutdown();
1162        _result
1163    }
1164
1165    fn send_raw(
1166        &self,
1167        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
1168    ) -> Result<(), fidl::Error> {
1169        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1170            RemoteControlIdentifyHostResponse,
1171            IdentifyHostError,
1172        >>(
1173            fidl::encoding::FlexibleResult::new(result.map(|response| (response,))),
1174            self.tx_id,
1175            0x6035e1ab368deee1,
1176            fidl::encoding::DynamicFlags::FLEXIBLE,
1177        )
1178    }
1179}
1180
1181#[must_use = "FIDL methods require a response to be sent"]
1182#[derive(Debug)]
1183pub struct RemoteControlConnectCapabilityResponder {
1184    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1185    tx_id: u32,
1186}
1187
1188/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1189/// if the responder is dropped without sending a response, so that the client
1190/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1191impl std::ops::Drop for RemoteControlConnectCapabilityResponder {
1192    fn drop(&mut self) {
1193        self.control_handle.shutdown();
1194        // Safety: drops once, never accessed again
1195        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1196    }
1197}
1198
1199impl fidl::endpoints::Responder for RemoteControlConnectCapabilityResponder {
1200    type ControlHandle = RemoteControlControlHandle;
1201
1202    fn control_handle(&self) -> &RemoteControlControlHandle {
1203        &self.control_handle
1204    }
1205
1206    fn drop_without_shutdown(mut self) {
1207        // Safety: drops once, never accessed again due to mem::forget
1208        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1209        // Prevent Drop from running (which would shut down the channel)
1210        std::mem::forget(self);
1211    }
1212}
1213
1214impl RemoteControlConnectCapabilityResponder {
1215    /// Sends a response to the FIDL transaction.
1216    ///
1217    /// Sets the channel to shutdown if an error occurs.
1218    pub fn send(self, mut result: Result<(), ConnectCapabilityError>) -> Result<(), fidl::Error> {
1219        let _result = self.send_raw(result);
1220        if _result.is_err() {
1221            self.control_handle.shutdown();
1222        }
1223        self.drop_without_shutdown();
1224        _result
1225    }
1226
1227    /// Similar to "send" but does not shutdown the channel if an error occurs.
1228    pub fn send_no_shutdown_on_err(
1229        self,
1230        mut result: Result<(), ConnectCapabilityError>,
1231    ) -> Result<(), fidl::Error> {
1232        let _result = self.send_raw(result);
1233        self.drop_without_shutdown();
1234        _result
1235    }
1236
1237    fn send_raw(&self, mut result: Result<(), ConnectCapabilityError>) -> Result<(), fidl::Error> {
1238        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1239            fidl::encoding::EmptyStruct,
1240            ConnectCapabilityError,
1241        >>(
1242            fidl::encoding::FlexibleResult::new(result),
1243            self.tx_id,
1244            0x3ae7a7c874dceceb,
1245            fidl::encoding::DynamicFlags::FLEXIBLE,
1246        )
1247    }
1248}
1249
1250#[must_use = "FIDL methods require a response to be sent"]
1251#[derive(Debug)]
1252pub struct RemoteControlGetTimeResponder {
1253    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1254    tx_id: u32,
1255}
1256
1257/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1258/// if the responder is dropped without sending a response, so that the client
1259/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1260impl std::ops::Drop for RemoteControlGetTimeResponder {
1261    fn drop(&mut self) {
1262        self.control_handle.shutdown();
1263        // Safety: drops once, never accessed again
1264        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1265    }
1266}
1267
1268impl fidl::endpoints::Responder for RemoteControlGetTimeResponder {
1269    type ControlHandle = RemoteControlControlHandle;
1270
1271    fn control_handle(&self) -> &RemoteControlControlHandle {
1272        &self.control_handle
1273    }
1274
1275    fn drop_without_shutdown(mut self) {
1276        // Safety: drops once, never accessed again due to mem::forget
1277        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1278        // Prevent Drop from running (which would shut down the channel)
1279        std::mem::forget(self);
1280    }
1281}
1282
1283impl RemoteControlGetTimeResponder {
1284    /// Sends a response to the FIDL transaction.
1285    ///
1286    /// Sets the channel to shutdown if an error occurs.
1287    pub fn send(self, mut time: fidl::MonotonicInstant) -> Result<(), fidl::Error> {
1288        let _result = self.send_raw(time);
1289        if _result.is_err() {
1290            self.control_handle.shutdown();
1291        }
1292        self.drop_without_shutdown();
1293        _result
1294    }
1295
1296    /// Similar to "send" but does not shutdown the channel if an error occurs.
1297    pub fn send_no_shutdown_on_err(
1298        self,
1299        mut time: fidl::MonotonicInstant,
1300    ) -> Result<(), fidl::Error> {
1301        let _result = self.send_raw(time);
1302        self.drop_without_shutdown();
1303        _result
1304    }
1305
1306    fn send_raw(&self, mut time: fidl::MonotonicInstant) -> Result<(), fidl::Error> {
1307        self.control_handle.inner.send::<RemoteControlGetTimeResponse>(
1308            (time,),
1309            self.tx_id,
1310            0x3588f31e9067748d,
1311            fidl::encoding::DynamicFlags::empty(),
1312        )
1313    }
1314}
1315
1316#[must_use = "FIDL methods require a response to be sent"]
1317#[derive(Debug)]
1318pub struct RemoteControlGetBootTimeResponder {
1319    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1320    tx_id: u32,
1321}
1322
1323/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1324/// if the responder is dropped without sending a response, so that the client
1325/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1326impl std::ops::Drop for RemoteControlGetBootTimeResponder {
1327    fn drop(&mut self) {
1328        self.control_handle.shutdown();
1329        // Safety: drops once, never accessed again
1330        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1331    }
1332}
1333
1334impl fidl::endpoints::Responder for RemoteControlGetBootTimeResponder {
1335    type ControlHandle = RemoteControlControlHandle;
1336
1337    fn control_handle(&self) -> &RemoteControlControlHandle {
1338        &self.control_handle
1339    }
1340
1341    fn drop_without_shutdown(mut self) {
1342        // Safety: drops once, never accessed again due to mem::forget
1343        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1344        // Prevent Drop from running (which would shut down the channel)
1345        std::mem::forget(self);
1346    }
1347}
1348
1349impl RemoteControlGetBootTimeResponder {
1350    /// Sends a response to the FIDL transaction.
1351    ///
1352    /// Sets the channel to shutdown if an error occurs.
1353    pub fn send(self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1354        let _result = self.send_raw(time);
1355        if _result.is_err() {
1356            self.control_handle.shutdown();
1357        }
1358        self.drop_without_shutdown();
1359        _result
1360    }
1361
1362    /// Similar to "send" but does not shutdown the channel if an error occurs.
1363    pub fn send_no_shutdown_on_err(self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1364        let _result = self.send_raw(time);
1365        self.drop_without_shutdown();
1366        _result
1367    }
1368
1369    fn send_raw(&self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1370        self.control_handle.inner.send::<RemoteControlGetBootTimeResponse>(
1371            (time,),
1372            self.tx_id,
1373            0x55706f013cd79ebd,
1374            fidl::encoding::DynamicFlags::empty(),
1375        )
1376    }
1377}
1378
1379mod internal {
1380    use super::*;
1381
1382    impl fidl::encoding::ResourceTypeMarker for RemoteControlConnectCapabilityRequest {
1383        type Borrowed<'a> = &'a mut Self;
1384        fn take_or_borrow<'a>(
1385            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1386        ) -> Self::Borrowed<'a> {
1387            value
1388        }
1389    }
1390
1391    unsafe impl fidl::encoding::TypeMarker for RemoteControlConnectCapabilityRequest {
1392        type Owned = Self;
1393
1394        #[inline(always)]
1395        fn inline_align(_context: fidl::encoding::Context) -> usize {
1396            8
1397        }
1398
1399        #[inline(always)]
1400        fn inline_size(_context: fidl::encoding::Context) -> usize {
1401            48
1402        }
1403    }
1404
1405    unsafe impl
1406        fidl::encoding::Encode<
1407            RemoteControlConnectCapabilityRequest,
1408            fidl::encoding::DefaultFuchsiaResourceDialect,
1409        > for &mut RemoteControlConnectCapabilityRequest
1410    {
1411        #[inline]
1412        unsafe fn encode(
1413            self,
1414            encoder: &mut fidl::encoding::Encoder<
1415                '_,
1416                fidl::encoding::DefaultFuchsiaResourceDialect,
1417            >,
1418            offset: usize,
1419            _depth: fidl::encoding::Depth,
1420        ) -> fidl::Result<()> {
1421            encoder.debug_check_bounds::<RemoteControlConnectCapabilityRequest>(offset);
1422            // Delegate to tuple encoding.
1423            fidl::encoding::Encode::<RemoteControlConnectCapabilityRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1424                (
1425                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
1426                    <fidl_fuchsia_sys2::OpenDirType as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_set),
1427                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_name),
1428                    <fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_channel),
1429                ),
1430                encoder, offset, _depth
1431            )
1432        }
1433    }
1434    unsafe impl<
1435        T0: fidl::encoding::Encode<
1436                fidl::encoding::BoundedString<4096>,
1437                fidl::encoding::DefaultFuchsiaResourceDialect,
1438            >,
1439        T1: fidl::encoding::Encode<
1440                fidl_fuchsia_sys2::OpenDirType,
1441                fidl::encoding::DefaultFuchsiaResourceDialect,
1442            >,
1443        T2: fidl::encoding::Encode<
1444                fidl::encoding::BoundedString<255>,
1445                fidl::encoding::DefaultFuchsiaResourceDialect,
1446            >,
1447        T3: fidl::encoding::Encode<
1448                fidl::encoding::HandleType<
1449                    fidl::Channel,
1450                    { fidl::ObjectType::CHANNEL.into_raw() },
1451                    2147483648,
1452                >,
1453                fidl::encoding::DefaultFuchsiaResourceDialect,
1454            >,
1455    >
1456        fidl::encoding::Encode<
1457            RemoteControlConnectCapabilityRequest,
1458            fidl::encoding::DefaultFuchsiaResourceDialect,
1459        > for (T0, T1, T2, T3)
1460    {
1461        #[inline]
1462        unsafe fn encode(
1463            self,
1464            encoder: &mut fidl::encoding::Encoder<
1465                '_,
1466                fidl::encoding::DefaultFuchsiaResourceDialect,
1467            >,
1468            offset: usize,
1469            depth: fidl::encoding::Depth,
1470        ) -> fidl::Result<()> {
1471            encoder.debug_check_bounds::<RemoteControlConnectCapabilityRequest>(offset);
1472            // Zero out padding regions. There's no need to apply masks
1473            // because the unmasked parts will be overwritten by fields.
1474            unsafe {
1475                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1476                (ptr as *mut u64).write_unaligned(0);
1477            }
1478            unsafe {
1479                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1480                (ptr as *mut u64).write_unaligned(0);
1481            }
1482            // Write the fields.
1483            self.0.encode(encoder, offset + 0, depth)?;
1484            self.1.encode(encoder, offset + 16, depth)?;
1485            self.2.encode(encoder, offset + 24, depth)?;
1486            self.3.encode(encoder, offset + 40, depth)?;
1487            Ok(())
1488        }
1489    }
1490
1491    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1492        for RemoteControlConnectCapabilityRequest
1493    {
1494        #[inline(always)]
1495        fn new_empty() -> Self {
1496            Self {
1497                moniker: fidl::new_empty!(
1498                    fidl::encoding::BoundedString<4096>,
1499                    fidl::encoding::DefaultFuchsiaResourceDialect
1500                ),
1501                capability_set: fidl::new_empty!(
1502                    fidl_fuchsia_sys2::OpenDirType,
1503                    fidl::encoding::DefaultFuchsiaResourceDialect
1504                ),
1505                capability_name: fidl::new_empty!(
1506                    fidl::encoding::BoundedString<255>,
1507                    fidl::encoding::DefaultFuchsiaResourceDialect
1508                ),
1509                server_channel: fidl::new_empty!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
1510            }
1511        }
1512
1513        #[inline]
1514        unsafe fn decode(
1515            &mut self,
1516            decoder: &mut fidl::encoding::Decoder<
1517                '_,
1518                fidl::encoding::DefaultFuchsiaResourceDialect,
1519            >,
1520            offset: usize,
1521            _depth: fidl::encoding::Depth,
1522        ) -> fidl::Result<()> {
1523            decoder.debug_check_bounds::<Self>(offset);
1524            // Verify that padding bytes are zero.
1525            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1526            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1527            let mask = 0xffffffff00000000u64;
1528            let maskedval = padval & mask;
1529            if maskedval != 0 {
1530                return Err(fidl::Error::NonZeroPadding {
1531                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1532                });
1533            }
1534            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1535            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1536            let mask = 0xffffffff00000000u64;
1537            let maskedval = padval & mask;
1538            if maskedval != 0 {
1539                return Err(fidl::Error::NonZeroPadding {
1540                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1541                });
1542            }
1543            fidl::decode!(
1544                fidl::encoding::BoundedString<4096>,
1545                fidl::encoding::DefaultFuchsiaResourceDialect,
1546                &mut self.moniker,
1547                decoder,
1548                offset + 0,
1549                _depth
1550            )?;
1551            fidl::decode!(
1552                fidl_fuchsia_sys2::OpenDirType,
1553                fidl::encoding::DefaultFuchsiaResourceDialect,
1554                &mut self.capability_set,
1555                decoder,
1556                offset + 16,
1557                _depth
1558            )?;
1559            fidl::decode!(
1560                fidl::encoding::BoundedString<255>,
1561                fidl::encoding::DefaultFuchsiaResourceDialect,
1562                &mut self.capability_name,
1563                decoder,
1564                offset + 24,
1565                _depth
1566            )?;
1567            fidl::decode!(fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.server_channel, decoder, offset + 40, _depth)?;
1568            Ok(())
1569        }
1570    }
1571}