fidl_fuchsia_sensors_realm/
fidl_fuchsia_sensors_realm.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_sensors_realm__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct RealmFactoryCreateRealmRequest {
16    pub dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for RealmFactoryCreateRealmRequest
21{
22}
23
24#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct RealmFactoryMarker;
26
27impl fidl::endpoints::ProtocolMarker for RealmFactoryMarker {
28    type Proxy = RealmFactoryProxy;
29    type RequestStream = RealmFactoryRequestStream;
30    #[cfg(target_os = "fuchsia")]
31    type SynchronousProxy = RealmFactorySynchronousProxy;
32
33    const DEBUG_NAME: &'static str = "fuchsia.sensors.realm.RealmFactory";
34}
35impl fidl::endpoints::DiscoverableProtocolMarker for RealmFactoryMarker {}
36pub type RealmFactoryCreateRealmResult = Result<(), fidl_fuchsia_testing_harness::OperationError>;
37
38pub trait RealmFactoryProxyInterface: Send + Sync {
39    type CreateRealmResponseFut: std::future::Future<Output = Result<RealmFactoryCreateRealmResult, fidl::Error>>
40        + Send;
41    fn r#create_realm(
42        &self,
43        dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
44    ) -> Self::CreateRealmResponseFut;
45}
46#[derive(Debug)]
47#[cfg(target_os = "fuchsia")]
48pub struct RealmFactorySynchronousProxy {
49    client: fidl::client::sync::Client,
50}
51
52#[cfg(target_os = "fuchsia")]
53impl fidl::endpoints::SynchronousProxy for RealmFactorySynchronousProxy {
54    type Proxy = RealmFactoryProxy;
55    type Protocol = RealmFactoryMarker;
56
57    fn from_channel(inner: fidl::Channel) -> Self {
58        Self::new(inner)
59    }
60
61    fn into_channel(self) -> fidl::Channel {
62        self.client.into_channel()
63    }
64
65    fn as_channel(&self) -> &fidl::Channel {
66        self.client.as_channel()
67    }
68}
69
70#[cfg(target_os = "fuchsia")]
71impl RealmFactorySynchronousProxy {
72    pub fn new(channel: fidl::Channel) -> Self {
73        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
74        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
75    }
76
77    pub fn into_channel(self) -> fidl::Channel {
78        self.client.into_channel()
79    }
80
81    /// Waits until an event arrives and returns it. It is safe for other
82    /// threads to make concurrent requests while waiting for an event.
83    pub fn wait_for_event(
84        &self,
85        deadline: zx::MonotonicInstant,
86    ) -> Result<RealmFactoryEvent, fidl::Error> {
87        RealmFactoryEvent::decode(self.client.wait_for_event(deadline)?)
88    }
89
90    pub fn r#create_realm(
91        &self,
92        mut dictionary: fidl::endpoints::ServerEnd<
93            fidl_fuchsia_component_sandbox::DictionaryMarker,
94        >,
95        ___deadline: zx::MonotonicInstant,
96    ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
97        let _response = self
98            .client
99            .send_query::<RealmFactoryCreateRealmRequest, fidl::encoding::FlexibleResultType<
100                fidl::encoding::EmptyStruct,
101                fidl_fuchsia_testing_harness::OperationError,
102            >>(
103                (dictionary,),
104                0x1102c6d49f306da5,
105                fidl::encoding::DynamicFlags::FLEXIBLE,
106                ___deadline,
107            )?
108            .into_result::<RealmFactoryMarker>("create_realm")?;
109        Ok(_response.map(|x| x))
110    }
111}
112
113#[cfg(target_os = "fuchsia")]
114impl From<RealmFactorySynchronousProxy> for zx::NullableHandle {
115    fn from(value: RealmFactorySynchronousProxy) -> Self {
116        value.into_channel().into()
117    }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl From<fidl::Channel> for RealmFactorySynchronousProxy {
122    fn from(value: fidl::Channel) -> Self {
123        Self::new(value)
124    }
125}
126
127#[cfg(target_os = "fuchsia")]
128impl fidl::endpoints::FromClient for RealmFactorySynchronousProxy {
129    type Protocol = RealmFactoryMarker;
130
131    fn from_client(value: fidl::endpoints::ClientEnd<RealmFactoryMarker>) -> Self {
132        Self::new(value.into_channel())
133    }
134}
135
136#[derive(Debug, Clone)]
137pub struct RealmFactoryProxy {
138    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
139}
140
141impl fidl::endpoints::Proxy for RealmFactoryProxy {
142    type Protocol = RealmFactoryMarker;
143
144    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
145        Self::new(inner)
146    }
147
148    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
149        self.client.into_channel().map_err(|client| Self { client })
150    }
151
152    fn as_channel(&self) -> &::fidl::AsyncChannel {
153        self.client.as_channel()
154    }
155}
156
157impl RealmFactoryProxy {
158    /// Create a new Proxy for fuchsia.sensors.realm/RealmFactory.
159    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
160        let protocol_name = <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
161        Self { client: fidl::client::Client::new(channel, protocol_name) }
162    }
163
164    /// Get a Stream of events from the remote end of the protocol.
165    ///
166    /// # Panics
167    ///
168    /// Panics if the event stream was already taken.
169    pub fn take_event_stream(&self) -> RealmFactoryEventStream {
170        RealmFactoryEventStream { event_receiver: self.client.take_event_receiver() }
171    }
172
173    pub fn r#create_realm(
174        &self,
175        mut dictionary: fidl::endpoints::ServerEnd<
176            fidl_fuchsia_component_sandbox::DictionaryMarker,
177        >,
178    ) -> fidl::client::QueryResponseFut<
179        RealmFactoryCreateRealmResult,
180        fidl::encoding::DefaultFuchsiaResourceDialect,
181    > {
182        RealmFactoryProxyInterface::r#create_realm(self, dictionary)
183    }
184}
185
186impl RealmFactoryProxyInterface for RealmFactoryProxy {
187    type CreateRealmResponseFut = fidl::client::QueryResponseFut<
188        RealmFactoryCreateRealmResult,
189        fidl::encoding::DefaultFuchsiaResourceDialect,
190    >;
191    fn r#create_realm(
192        &self,
193        mut dictionary: fidl::endpoints::ServerEnd<
194            fidl_fuchsia_component_sandbox::DictionaryMarker,
195        >,
196    ) -> Self::CreateRealmResponseFut {
197        fn _decode(
198            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
199        ) -> Result<RealmFactoryCreateRealmResult, fidl::Error> {
200            let _response = fidl::client::decode_transaction_body::<
201                fidl::encoding::FlexibleResultType<
202                    fidl::encoding::EmptyStruct,
203                    fidl_fuchsia_testing_harness::OperationError,
204                >,
205                fidl::encoding::DefaultFuchsiaResourceDialect,
206                0x1102c6d49f306da5,
207            >(_buf?)?
208            .into_result::<RealmFactoryMarker>("create_realm")?;
209            Ok(_response.map(|x| x))
210        }
211        self.client
212            .send_query_and_decode::<RealmFactoryCreateRealmRequest, RealmFactoryCreateRealmResult>(
213                (dictionary,),
214                0x1102c6d49f306da5,
215                fidl::encoding::DynamicFlags::FLEXIBLE,
216                _decode,
217            )
218    }
219}
220
221pub struct RealmFactoryEventStream {
222    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
223}
224
225impl std::marker::Unpin for RealmFactoryEventStream {}
226
227impl futures::stream::FusedStream for RealmFactoryEventStream {
228    fn is_terminated(&self) -> bool {
229        self.event_receiver.is_terminated()
230    }
231}
232
233impl futures::Stream for RealmFactoryEventStream {
234    type Item = Result<RealmFactoryEvent, fidl::Error>;
235
236    fn poll_next(
237        mut self: std::pin::Pin<&mut Self>,
238        cx: &mut std::task::Context<'_>,
239    ) -> std::task::Poll<Option<Self::Item>> {
240        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
241            &mut self.event_receiver,
242            cx
243        )?) {
244            Some(buf) => std::task::Poll::Ready(Some(RealmFactoryEvent::decode(buf))),
245            None => std::task::Poll::Ready(None),
246        }
247    }
248}
249
250#[derive(Debug)]
251pub enum RealmFactoryEvent {
252    #[non_exhaustive]
253    _UnknownEvent {
254        /// Ordinal of the event that was sent.
255        ordinal: u64,
256    },
257}
258
259impl RealmFactoryEvent {
260    /// Decodes a message buffer as a [`RealmFactoryEvent`].
261    fn decode(
262        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
263    ) -> Result<RealmFactoryEvent, fidl::Error> {
264        let (bytes, _handles) = buf.split_mut();
265        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
266        debug_assert_eq!(tx_header.tx_id, 0);
267        match tx_header.ordinal {
268            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
269                Ok(RealmFactoryEvent::_UnknownEvent { ordinal: tx_header.ordinal })
270            }
271            _ => Err(fidl::Error::UnknownOrdinal {
272                ordinal: tx_header.ordinal,
273                protocol_name: <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
274            }),
275        }
276    }
277}
278
279/// A Stream of incoming requests for fuchsia.sensors.realm/RealmFactory.
280pub struct RealmFactoryRequestStream {
281    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
282    is_terminated: bool,
283}
284
285impl std::marker::Unpin for RealmFactoryRequestStream {}
286
287impl futures::stream::FusedStream for RealmFactoryRequestStream {
288    fn is_terminated(&self) -> bool {
289        self.is_terminated
290    }
291}
292
293impl fidl::endpoints::RequestStream for RealmFactoryRequestStream {
294    type Protocol = RealmFactoryMarker;
295    type ControlHandle = RealmFactoryControlHandle;
296
297    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
298        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
299    }
300
301    fn control_handle(&self) -> Self::ControlHandle {
302        RealmFactoryControlHandle { inner: self.inner.clone() }
303    }
304
305    fn into_inner(
306        self,
307    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
308    {
309        (self.inner, self.is_terminated)
310    }
311
312    fn from_inner(
313        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
314        is_terminated: bool,
315    ) -> Self {
316        Self { inner, is_terminated }
317    }
318}
319
320impl futures::Stream for RealmFactoryRequestStream {
321    type Item = Result<RealmFactoryRequest, fidl::Error>;
322
323    fn poll_next(
324        mut self: std::pin::Pin<&mut Self>,
325        cx: &mut std::task::Context<'_>,
326    ) -> std::task::Poll<Option<Self::Item>> {
327        let this = &mut *self;
328        if this.inner.check_shutdown(cx) {
329            this.is_terminated = true;
330            return std::task::Poll::Ready(None);
331        }
332        if this.is_terminated {
333            panic!("polled RealmFactoryRequestStream after completion");
334        }
335        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
336            |bytes, handles| {
337                match this.inner.channel().read_etc(cx, bytes, handles) {
338                    std::task::Poll::Ready(Ok(())) => {}
339                    std::task::Poll::Pending => return std::task::Poll::Pending,
340                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
341                        this.is_terminated = true;
342                        return std::task::Poll::Ready(None);
343                    }
344                    std::task::Poll::Ready(Err(e)) => {
345                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
346                            e.into(),
347                        ))));
348                    }
349                }
350
351                // A message has been received from the channel
352                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
353
354                std::task::Poll::Ready(Some(match header.ordinal {
355                    0x1102c6d49f306da5 => {
356                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
357                        let mut req = fidl::new_empty!(
358                            RealmFactoryCreateRealmRequest,
359                            fidl::encoding::DefaultFuchsiaResourceDialect
360                        );
361                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RealmFactoryCreateRealmRequest>(&header, _body_bytes, handles, &mut req)?;
362                        let control_handle =
363                            RealmFactoryControlHandle { inner: this.inner.clone() };
364                        Ok(RealmFactoryRequest::CreateRealm {
365                            dictionary: req.dictionary,
366
367                            responder: RealmFactoryCreateRealmResponder {
368                                control_handle: std::mem::ManuallyDrop::new(control_handle),
369                                tx_id: header.tx_id,
370                            },
371                        })
372                    }
373                    _ if header.tx_id == 0
374                        && header
375                            .dynamic_flags()
376                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
377                    {
378                        Ok(RealmFactoryRequest::_UnknownMethod {
379                            ordinal: header.ordinal,
380                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
381                            method_type: fidl::MethodType::OneWay,
382                        })
383                    }
384                    _ if header
385                        .dynamic_flags()
386                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
387                    {
388                        this.inner.send_framework_err(
389                            fidl::encoding::FrameworkErr::UnknownMethod,
390                            header.tx_id,
391                            header.ordinal,
392                            header.dynamic_flags(),
393                            (bytes, handles),
394                        )?;
395                        Ok(RealmFactoryRequest::_UnknownMethod {
396                            ordinal: header.ordinal,
397                            control_handle: RealmFactoryControlHandle { inner: this.inner.clone() },
398                            method_type: fidl::MethodType::TwoWay,
399                        })
400                    }
401                    _ => Err(fidl::Error::UnknownOrdinal {
402                        ordinal: header.ordinal,
403                        protocol_name:
404                            <RealmFactoryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
405                    }),
406                }))
407            },
408        )
409    }
410}
411
412#[derive(Debug)]
413pub enum RealmFactoryRequest {
414    CreateRealm {
415        dictionary: fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
416        responder: RealmFactoryCreateRealmResponder,
417    },
418    /// An interaction was received which does not match any known method.
419    #[non_exhaustive]
420    _UnknownMethod {
421        /// Ordinal of the method that was called.
422        ordinal: u64,
423        control_handle: RealmFactoryControlHandle,
424        method_type: fidl::MethodType,
425    },
426}
427
428impl RealmFactoryRequest {
429    #[allow(irrefutable_let_patterns)]
430    pub fn into_create_realm(
431        self,
432    ) -> Option<(
433        fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
434        RealmFactoryCreateRealmResponder,
435    )> {
436        if let RealmFactoryRequest::CreateRealm { dictionary, responder } = self {
437            Some((dictionary, responder))
438        } else {
439            None
440        }
441    }
442
443    /// Name of the method defined in FIDL
444    pub fn method_name(&self) -> &'static str {
445        match *self {
446            RealmFactoryRequest::CreateRealm { .. } => "create_realm",
447            RealmFactoryRequest::_UnknownMethod {
448                method_type: fidl::MethodType::OneWay, ..
449            } => "unknown one-way method",
450            RealmFactoryRequest::_UnknownMethod {
451                method_type: fidl::MethodType::TwoWay, ..
452            } => "unknown two-way method",
453        }
454    }
455}
456
457#[derive(Debug, Clone)]
458pub struct RealmFactoryControlHandle {
459    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
460}
461
462impl fidl::endpoints::ControlHandle for RealmFactoryControlHandle {
463    fn shutdown(&self) {
464        self.inner.shutdown()
465    }
466
467    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
468        self.inner.shutdown_with_epitaph(status)
469    }
470
471    fn is_closed(&self) -> bool {
472        self.inner.channel().is_closed()
473    }
474    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
475        self.inner.channel().on_closed()
476    }
477
478    #[cfg(target_os = "fuchsia")]
479    fn signal_peer(
480        &self,
481        clear_mask: zx::Signals,
482        set_mask: zx::Signals,
483    ) -> Result<(), zx_status::Status> {
484        use fidl::Peered;
485        self.inner.channel().signal_peer(clear_mask, set_mask)
486    }
487}
488
489impl RealmFactoryControlHandle {}
490
491#[must_use = "FIDL methods require a response to be sent"]
492#[derive(Debug)]
493pub struct RealmFactoryCreateRealmResponder {
494    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
495    tx_id: u32,
496}
497
498/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
499/// if the responder is dropped without sending a response, so that the client
500/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
501impl std::ops::Drop for RealmFactoryCreateRealmResponder {
502    fn drop(&mut self) {
503        self.control_handle.shutdown();
504        // Safety: drops once, never accessed again
505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
506    }
507}
508
509impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
510    type ControlHandle = RealmFactoryControlHandle;
511
512    fn control_handle(&self) -> &RealmFactoryControlHandle {
513        &self.control_handle
514    }
515
516    fn drop_without_shutdown(mut self) {
517        // Safety: drops once, never accessed again due to mem::forget
518        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
519        // Prevent Drop from running (which would shut down the channel)
520        std::mem::forget(self);
521    }
522}
523
524impl RealmFactoryCreateRealmResponder {
525    /// Sends a response to the FIDL transaction.
526    ///
527    /// Sets the channel to shutdown if an error occurs.
528    pub fn send(
529        self,
530        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
531    ) -> Result<(), fidl::Error> {
532        let _result = self.send_raw(result);
533        if _result.is_err() {
534            self.control_handle.shutdown();
535        }
536        self.drop_without_shutdown();
537        _result
538    }
539
540    /// Similar to "send" but does not shutdown the channel if an error occurs.
541    pub fn send_no_shutdown_on_err(
542        self,
543        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
544    ) -> Result<(), fidl::Error> {
545        let _result = self.send_raw(result);
546        self.drop_without_shutdown();
547        _result
548    }
549
550    fn send_raw(
551        &self,
552        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
553    ) -> Result<(), fidl::Error> {
554        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
555            fidl::encoding::EmptyStruct,
556            fidl_fuchsia_testing_harness::OperationError,
557        >>(
558            fidl::encoding::FlexibleResult::new(result),
559            self.tx_id,
560            0x1102c6d49f306da5,
561            fidl::encoding::DynamicFlags::FLEXIBLE,
562        )
563    }
564}
565
566mod internal {
567    use super::*;
568
569    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
570        type Borrowed<'a> = &'a mut Self;
571        fn take_or_borrow<'a>(
572            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
573        ) -> Self::Borrowed<'a> {
574            value
575        }
576    }
577
578    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
579        type Owned = Self;
580
581        #[inline(always)]
582        fn inline_align(_context: fidl::encoding::Context) -> usize {
583            4
584        }
585
586        #[inline(always)]
587        fn inline_size(_context: fidl::encoding::Context) -> usize {
588            4
589        }
590    }
591
592    unsafe impl
593        fidl::encoding::Encode<
594            RealmFactoryCreateRealmRequest,
595            fidl::encoding::DefaultFuchsiaResourceDialect,
596        > for &mut RealmFactoryCreateRealmRequest
597    {
598        #[inline]
599        unsafe fn encode(
600            self,
601            encoder: &mut fidl::encoding::Encoder<
602                '_,
603                fidl::encoding::DefaultFuchsiaResourceDialect,
604            >,
605            offset: usize,
606            _depth: fidl::encoding::Depth,
607        ) -> fidl::Result<()> {
608            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
609            // Delegate to tuple encoding.
610            fidl::encoding::Encode::<
611                RealmFactoryCreateRealmRequest,
612                fidl::encoding::DefaultFuchsiaResourceDialect,
613            >::encode(
614                (<fidl::encoding::Endpoint<
615                    fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
616                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
617                    &mut self.dictionary
618                ),),
619                encoder,
620                offset,
621                _depth,
622            )
623        }
624    }
625    unsafe impl<
626        T0: fidl::encoding::Encode<
627                fidl::encoding::Endpoint<
628                    fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
629                >,
630                fidl::encoding::DefaultFuchsiaResourceDialect,
631            >,
632    >
633        fidl::encoding::Encode<
634            RealmFactoryCreateRealmRequest,
635            fidl::encoding::DefaultFuchsiaResourceDialect,
636        > for (T0,)
637    {
638        #[inline]
639        unsafe fn encode(
640            self,
641            encoder: &mut fidl::encoding::Encoder<
642                '_,
643                fidl::encoding::DefaultFuchsiaResourceDialect,
644            >,
645            offset: usize,
646            depth: fidl::encoding::Depth,
647        ) -> fidl::Result<()> {
648            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
649            // Zero out padding regions. There's no need to apply masks
650            // because the unmasked parts will be overwritten by fields.
651            // Write the fields.
652            self.0.encode(encoder, offset + 0, depth)?;
653            Ok(())
654        }
655    }
656
657    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
658        for RealmFactoryCreateRealmRequest
659    {
660        #[inline(always)]
661        fn new_empty() -> Self {
662            Self {
663                dictionary: fidl::new_empty!(
664                    fidl::encoding::Endpoint<
665                        fidl::endpoints::ServerEnd<
666                            fidl_fuchsia_component_sandbox::DictionaryMarker,
667                        >,
668                    >,
669                    fidl::encoding::DefaultFuchsiaResourceDialect
670                ),
671            }
672        }
673
674        #[inline]
675        unsafe fn decode(
676            &mut self,
677            decoder: &mut fidl::encoding::Decoder<
678                '_,
679                fidl::encoding::DefaultFuchsiaResourceDialect,
680            >,
681            offset: usize,
682            _depth: fidl::encoding::Depth,
683        ) -> fidl::Result<()> {
684            decoder.debug_check_bounds::<Self>(offset);
685            // Verify that padding bytes are zero.
686            fidl::decode!(
687                fidl::encoding::Endpoint<
688                    fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
689                >,
690                fidl::encoding::DefaultFuchsiaResourceDialect,
691                &mut self.dictionary,
692                decoder,
693                offset + 0,
694                _depth
695            )?;
696            Ok(())
697        }
698    }
699}