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 fdomain_client::fidl::ControlHandle for RemoteControlControlHandle {
735    fn shutdown(&self) {
736        self.inner.shutdown()
737    }
738
739    fn is_closed(&self) -> bool {
740        self.inner.channel().is_closed()
741    }
742    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
743        self.inner.channel().on_closed()
744    }
745}
746
747impl RemoteControlControlHandle {}
748
749#[must_use = "FIDL methods require a response to be sent"]
750#[derive(Debug)]
751pub struct RemoteControlEchoStringResponder {
752    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
753    tx_id: u32,
754}
755
756/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
757/// if the responder is dropped without sending a response, so that the client
758/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
759impl std::ops::Drop for RemoteControlEchoStringResponder {
760    fn drop(&mut self) {
761        self.control_handle.shutdown();
762        // Safety: drops once, never accessed again
763        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
764    }
765}
766
767impl fdomain_client::fidl::Responder for RemoteControlEchoStringResponder {
768    type ControlHandle = RemoteControlControlHandle;
769
770    fn control_handle(&self) -> &RemoteControlControlHandle {
771        &self.control_handle
772    }
773
774    fn drop_without_shutdown(mut self) {
775        // Safety: drops once, never accessed again due to mem::forget
776        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
777        // Prevent Drop from running (which would shut down the channel)
778        std::mem::forget(self);
779    }
780}
781
782impl RemoteControlEchoStringResponder {
783    /// Sends a response to the FIDL transaction.
784    ///
785    /// Sets the channel to shutdown if an error occurs.
786    pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
787        let _result = self.send_raw(response);
788        if _result.is_err() {
789            self.control_handle.shutdown();
790        }
791        self.drop_without_shutdown();
792        _result
793    }
794
795    /// Similar to "send" but does not shutdown the channel if an error occurs.
796    pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
797        let _result = self.send_raw(response);
798        self.drop_without_shutdown();
799        _result
800    }
801
802    fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
803        self.control_handle.inner.send::<RemoteControlEchoStringResponse>(
804            (response,),
805            self.tx_id,
806            0x2bbec7ca8a72e82b,
807            fidl::encoding::DynamicFlags::empty(),
808        )
809    }
810}
811
812#[must_use = "FIDL methods require a response to be sent"]
813#[derive(Debug)]
814pub struct RemoteControlLogMessageResponder {
815    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
816    tx_id: u32,
817}
818
819/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
820/// if the responder is dropped without sending a response, so that the client
821/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
822impl std::ops::Drop for RemoteControlLogMessageResponder {
823    fn drop(&mut self) {
824        self.control_handle.shutdown();
825        // Safety: drops once, never accessed again
826        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
827    }
828}
829
830impl fdomain_client::fidl::Responder for RemoteControlLogMessageResponder {
831    type ControlHandle = RemoteControlControlHandle;
832
833    fn control_handle(&self) -> &RemoteControlControlHandle {
834        &self.control_handle
835    }
836
837    fn drop_without_shutdown(mut self) {
838        // Safety: drops once, never accessed again due to mem::forget
839        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
840        // Prevent Drop from running (which would shut down the channel)
841        std::mem::forget(self);
842    }
843}
844
845impl RemoteControlLogMessageResponder {
846    /// Sends a response to the FIDL transaction.
847    ///
848    /// Sets the channel to shutdown if an error occurs.
849    pub fn send(self) -> Result<(), fidl::Error> {
850        let _result = self.send_raw();
851        if _result.is_err() {
852            self.control_handle.shutdown();
853        }
854        self.drop_without_shutdown();
855        _result
856    }
857
858    /// Similar to "send" but does not shutdown the channel if an error occurs.
859    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
860        let _result = self.send_raw();
861        self.drop_without_shutdown();
862        _result
863    }
864
865    fn send_raw(&self) -> Result<(), fidl::Error> {
866        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
867            (),
868            self.tx_id,
869            0x3da84acd5bbf3926,
870            fidl::encoding::DynamicFlags::empty(),
871        )
872    }
873}
874
875#[must_use = "FIDL methods require a response to be sent"]
876#[derive(Debug)]
877pub struct RemoteControlIdentifyHostResponder {
878    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
879    tx_id: u32,
880}
881
882/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
883/// if the responder is dropped without sending a response, so that the client
884/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
885impl std::ops::Drop for RemoteControlIdentifyHostResponder {
886    fn drop(&mut self) {
887        self.control_handle.shutdown();
888        // Safety: drops once, never accessed again
889        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
890    }
891}
892
893impl fdomain_client::fidl::Responder for RemoteControlIdentifyHostResponder {
894    type ControlHandle = RemoteControlControlHandle;
895
896    fn control_handle(&self) -> &RemoteControlControlHandle {
897        &self.control_handle
898    }
899
900    fn drop_without_shutdown(mut self) {
901        // Safety: drops once, never accessed again due to mem::forget
902        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
903        // Prevent Drop from running (which would shut down the channel)
904        std::mem::forget(self);
905    }
906}
907
908impl RemoteControlIdentifyHostResponder {
909    /// Sends a response to the FIDL transaction.
910    ///
911    /// Sets the channel to shutdown if an error occurs.
912    pub fn send(
913        self,
914        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
915    ) -> Result<(), fidl::Error> {
916        let _result = self.send_raw(result);
917        if _result.is_err() {
918            self.control_handle.shutdown();
919        }
920        self.drop_without_shutdown();
921        _result
922    }
923
924    /// Similar to "send" but does not shutdown the channel if an error occurs.
925    pub fn send_no_shutdown_on_err(
926        self,
927        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
928    ) -> Result<(), fidl::Error> {
929        let _result = self.send_raw(result);
930        self.drop_without_shutdown();
931        _result
932    }
933
934    fn send_raw(
935        &self,
936        mut result: Result<&IdentifyHostResponse, IdentifyHostError>,
937    ) -> Result<(), fidl::Error> {
938        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
939            RemoteControlIdentifyHostResponse,
940            IdentifyHostError,
941        >>(
942            fidl::encoding::FlexibleResult::new(result.map(|response| (response,))),
943            self.tx_id,
944            0x6035e1ab368deee1,
945            fidl::encoding::DynamicFlags::FLEXIBLE,
946        )
947    }
948}
949
950#[must_use = "FIDL methods require a response to be sent"]
951#[derive(Debug)]
952pub struct RemoteControlConnectCapabilityResponder {
953    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
954    tx_id: u32,
955}
956
957/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
958/// if the responder is dropped without sending a response, so that the client
959/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
960impl std::ops::Drop for RemoteControlConnectCapabilityResponder {
961    fn drop(&mut self) {
962        self.control_handle.shutdown();
963        // Safety: drops once, never accessed again
964        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
965    }
966}
967
968impl fdomain_client::fidl::Responder for RemoteControlConnectCapabilityResponder {
969    type ControlHandle = RemoteControlControlHandle;
970
971    fn control_handle(&self) -> &RemoteControlControlHandle {
972        &self.control_handle
973    }
974
975    fn drop_without_shutdown(mut self) {
976        // Safety: drops once, never accessed again due to mem::forget
977        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
978        // Prevent Drop from running (which would shut down the channel)
979        std::mem::forget(self);
980    }
981}
982
983impl RemoteControlConnectCapabilityResponder {
984    /// Sends a response to the FIDL transaction.
985    ///
986    /// Sets the channel to shutdown if an error occurs.
987    pub fn send(self, mut result: Result<(), ConnectCapabilityError>) -> Result<(), fidl::Error> {
988        let _result = self.send_raw(result);
989        if _result.is_err() {
990            self.control_handle.shutdown();
991        }
992        self.drop_without_shutdown();
993        _result
994    }
995
996    /// Similar to "send" but does not shutdown the channel if an error occurs.
997    pub fn send_no_shutdown_on_err(
998        self,
999        mut result: Result<(), ConnectCapabilityError>,
1000    ) -> Result<(), fidl::Error> {
1001        let _result = self.send_raw(result);
1002        self.drop_without_shutdown();
1003        _result
1004    }
1005
1006    fn send_raw(&self, mut result: Result<(), ConnectCapabilityError>) -> Result<(), fidl::Error> {
1007        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
1008            fidl::encoding::EmptyStruct,
1009            ConnectCapabilityError,
1010        >>(
1011            fidl::encoding::FlexibleResult::new(result),
1012            self.tx_id,
1013            0x3ae7a7c874dceceb,
1014            fidl::encoding::DynamicFlags::FLEXIBLE,
1015        )
1016    }
1017}
1018
1019#[must_use = "FIDL methods require a response to be sent"]
1020#[derive(Debug)]
1021pub struct RemoteControlGetTimeResponder {
1022    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1023    tx_id: u32,
1024}
1025
1026/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1027/// if the responder is dropped without sending a response, so that the client
1028/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1029impl std::ops::Drop for RemoteControlGetTimeResponder {
1030    fn drop(&mut self) {
1031        self.control_handle.shutdown();
1032        // Safety: drops once, never accessed again
1033        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1034    }
1035}
1036
1037impl fdomain_client::fidl::Responder for RemoteControlGetTimeResponder {
1038    type ControlHandle = RemoteControlControlHandle;
1039
1040    fn control_handle(&self) -> &RemoteControlControlHandle {
1041        &self.control_handle
1042    }
1043
1044    fn drop_without_shutdown(mut self) {
1045        // Safety: drops once, never accessed again due to mem::forget
1046        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1047        // Prevent Drop from running (which would shut down the channel)
1048        std::mem::forget(self);
1049    }
1050}
1051
1052impl RemoteControlGetTimeResponder {
1053    /// Sends a response to the FIDL transaction.
1054    ///
1055    /// Sets the channel to shutdown if an error occurs.
1056    pub fn send(self, mut time: fidl::MonotonicInstant) -> Result<(), fidl::Error> {
1057        let _result = self.send_raw(time);
1058        if _result.is_err() {
1059            self.control_handle.shutdown();
1060        }
1061        self.drop_without_shutdown();
1062        _result
1063    }
1064
1065    /// Similar to "send" but does not shutdown the channel if an error occurs.
1066    pub fn send_no_shutdown_on_err(
1067        self,
1068        mut time: fidl::MonotonicInstant,
1069    ) -> Result<(), fidl::Error> {
1070        let _result = self.send_raw(time);
1071        self.drop_without_shutdown();
1072        _result
1073    }
1074
1075    fn send_raw(&self, mut time: fidl::MonotonicInstant) -> Result<(), fidl::Error> {
1076        self.control_handle.inner.send::<RemoteControlGetTimeResponse>(
1077            (time,),
1078            self.tx_id,
1079            0x3588f31e9067748d,
1080            fidl::encoding::DynamicFlags::empty(),
1081        )
1082    }
1083}
1084
1085#[must_use = "FIDL methods require a response to be sent"]
1086#[derive(Debug)]
1087pub struct RemoteControlGetBootTimeResponder {
1088    control_handle: std::mem::ManuallyDrop<RemoteControlControlHandle>,
1089    tx_id: u32,
1090}
1091
1092/// Set the the channel to be shutdown (see [`RemoteControlControlHandle::shutdown`])
1093/// if the responder is dropped without sending a response, so that the client
1094/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1095impl std::ops::Drop for RemoteControlGetBootTimeResponder {
1096    fn drop(&mut self) {
1097        self.control_handle.shutdown();
1098        // Safety: drops once, never accessed again
1099        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1100    }
1101}
1102
1103impl fdomain_client::fidl::Responder for RemoteControlGetBootTimeResponder {
1104    type ControlHandle = RemoteControlControlHandle;
1105
1106    fn control_handle(&self) -> &RemoteControlControlHandle {
1107        &self.control_handle
1108    }
1109
1110    fn drop_without_shutdown(mut self) {
1111        // Safety: drops once, never accessed again due to mem::forget
1112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1113        // Prevent Drop from running (which would shut down the channel)
1114        std::mem::forget(self);
1115    }
1116}
1117
1118impl RemoteControlGetBootTimeResponder {
1119    /// Sends a response to the FIDL transaction.
1120    ///
1121    /// Sets the channel to shutdown if an error occurs.
1122    pub fn send(self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1123        let _result = self.send_raw(time);
1124        if _result.is_err() {
1125            self.control_handle.shutdown();
1126        }
1127        self.drop_without_shutdown();
1128        _result
1129    }
1130
1131    /// Similar to "send" but does not shutdown the channel if an error occurs.
1132    pub fn send_no_shutdown_on_err(self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1133        let _result = self.send_raw(time);
1134        self.drop_without_shutdown();
1135        _result
1136    }
1137
1138    fn send_raw(&self, mut time: fidl::BootInstant) -> Result<(), fidl::Error> {
1139        self.control_handle.inner.send::<RemoteControlGetBootTimeResponse>(
1140            (time,),
1141            self.tx_id,
1142            0x55706f013cd79ebd,
1143            fidl::encoding::DynamicFlags::empty(),
1144        )
1145    }
1146}
1147
1148mod internal {
1149    use super::*;
1150
1151    impl fidl::encoding::ResourceTypeMarker for RemoteControlConnectCapabilityRequest {
1152        type Borrowed<'a> = &'a mut Self;
1153        fn take_or_borrow<'a>(
1154            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1155        ) -> Self::Borrowed<'a> {
1156            value
1157        }
1158    }
1159
1160    unsafe impl fidl::encoding::TypeMarker for RemoteControlConnectCapabilityRequest {
1161        type Owned = Self;
1162
1163        #[inline(always)]
1164        fn inline_align(_context: fidl::encoding::Context) -> usize {
1165            8
1166        }
1167
1168        #[inline(always)]
1169        fn inline_size(_context: fidl::encoding::Context) -> usize {
1170            48
1171        }
1172    }
1173
1174    unsafe impl
1175        fidl::encoding::Encode<
1176            RemoteControlConnectCapabilityRequest,
1177            fdomain_client::fidl::FDomainResourceDialect,
1178        > for &mut RemoteControlConnectCapabilityRequest
1179    {
1180        #[inline]
1181        unsafe fn encode(
1182            self,
1183            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1184            offset: usize,
1185            _depth: fidl::encoding::Depth,
1186        ) -> fidl::Result<()> {
1187            encoder.debug_check_bounds::<RemoteControlConnectCapabilityRequest>(offset);
1188            // Delegate to tuple encoding.
1189            fidl::encoding::Encode::<RemoteControlConnectCapabilityRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
1190                (
1191                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.moniker),
1192                    <fdomain_fuchsia_sys2::OpenDirType as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_set),
1193                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_name),
1194                    <fidl::encoding::HandleType<fdomain_client::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_channel),
1195                ),
1196                encoder, offset, _depth
1197            )
1198        }
1199    }
1200    unsafe impl<
1201        T0: fidl::encoding::Encode<
1202                fidl::encoding::BoundedString<4096>,
1203                fdomain_client::fidl::FDomainResourceDialect,
1204            >,
1205        T1: fidl::encoding::Encode<
1206                fdomain_fuchsia_sys2::OpenDirType,
1207                fdomain_client::fidl::FDomainResourceDialect,
1208            >,
1209        T2: fidl::encoding::Encode<
1210                fidl::encoding::BoundedString<255>,
1211                fdomain_client::fidl::FDomainResourceDialect,
1212            >,
1213        T3: fidl::encoding::Encode<
1214                fidl::encoding::HandleType<
1215                    fdomain_client::Channel,
1216                    { fidl::ObjectType::CHANNEL.into_raw() },
1217                    2147483648,
1218                >,
1219                fdomain_client::fidl::FDomainResourceDialect,
1220            >,
1221    >
1222        fidl::encoding::Encode<
1223            RemoteControlConnectCapabilityRequest,
1224            fdomain_client::fidl::FDomainResourceDialect,
1225        > for (T0, T1, T2, T3)
1226    {
1227        #[inline]
1228        unsafe fn encode(
1229            self,
1230            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1231            offset: usize,
1232            depth: fidl::encoding::Depth,
1233        ) -> fidl::Result<()> {
1234            encoder.debug_check_bounds::<RemoteControlConnectCapabilityRequest>(offset);
1235            // Zero out padding regions. There's no need to apply masks
1236            // because the unmasked parts will be overwritten by fields.
1237            unsafe {
1238                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1239                (ptr as *mut u64).write_unaligned(0);
1240            }
1241            unsafe {
1242                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1243                (ptr as *mut u64).write_unaligned(0);
1244            }
1245            // Write the fields.
1246            self.0.encode(encoder, offset + 0, depth)?;
1247            self.1.encode(encoder, offset + 16, depth)?;
1248            self.2.encode(encoder, offset + 24, depth)?;
1249            self.3.encode(encoder, offset + 40, depth)?;
1250            Ok(())
1251        }
1252    }
1253
1254    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
1255        for RemoteControlConnectCapabilityRequest
1256    {
1257        #[inline(always)]
1258        fn new_empty() -> Self {
1259            Self {
1260                moniker: fidl::new_empty!(
1261                    fidl::encoding::BoundedString<4096>,
1262                    fdomain_client::fidl::FDomainResourceDialect
1263                ),
1264                capability_set: fidl::new_empty!(
1265                    fdomain_fuchsia_sys2::OpenDirType,
1266                    fdomain_client::fidl::FDomainResourceDialect
1267                ),
1268                capability_name: fidl::new_empty!(
1269                    fidl::encoding::BoundedString<255>,
1270                    fdomain_client::fidl::FDomainResourceDialect
1271                ),
1272                server_channel: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>, fdomain_client::fidl::FDomainResourceDialect),
1273            }
1274        }
1275
1276        #[inline]
1277        unsafe fn decode(
1278            &mut self,
1279            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
1280            offset: usize,
1281            _depth: fidl::encoding::Depth,
1282        ) -> fidl::Result<()> {
1283            decoder.debug_check_bounds::<Self>(offset);
1284            // Verify that padding bytes are zero.
1285            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1286            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1287            let mask = 0xffffffff00000000u64;
1288            let maskedval = padval & mask;
1289            if maskedval != 0 {
1290                return Err(fidl::Error::NonZeroPadding {
1291                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1292                });
1293            }
1294            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1295            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1296            let mask = 0xffffffff00000000u64;
1297            let maskedval = padval & mask;
1298            if maskedval != 0 {
1299                return Err(fidl::Error::NonZeroPadding {
1300                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1301                });
1302            }
1303            fidl::decode!(
1304                fidl::encoding::BoundedString<4096>,
1305                fdomain_client::fidl::FDomainResourceDialect,
1306                &mut self.moniker,
1307                decoder,
1308                offset + 0,
1309                _depth
1310            )?;
1311            fidl::decode!(
1312                fdomain_fuchsia_sys2::OpenDirType,
1313                fdomain_client::fidl::FDomainResourceDialect,
1314                &mut self.capability_set,
1315                decoder,
1316                offset + 16,
1317                _depth
1318            )?;
1319            fidl::decode!(
1320                fidl::encoding::BoundedString<255>,
1321                fdomain_client::fidl::FDomainResourceDialect,
1322                &mut self.capability_name,
1323                decoder,
1324                offset + 24,
1325                _depth
1326            )?;
1327            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)?;
1328            Ok(())
1329        }
1330    }
1331}