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