Skip to main content

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