Skip to main content

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