fidl_fuchsia_testing_harness/
fidl_fuchsia_testing_harness.rs

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