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