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::Handle {
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    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
467        self.inner.shutdown_with_epitaph(status)
468    }
469
470    fn is_closed(&self) -> bool {
471        self.inner.channel().is_closed()
472    }
473    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
474        self.inner.channel().on_closed()
475    }
476
477    #[cfg(target_os = "fuchsia")]
478    fn signal_peer(
479        &self,
480        clear_mask: zx::Signals,
481        set_mask: zx::Signals,
482    ) -> Result<(), zx_status::Status> {
483        use fidl::Peered;
484        self.inner.channel().signal_peer(clear_mask, set_mask)
485    }
486}
487
488impl RealmFactoryControlHandle {}
489
490#[must_use = "FIDL methods require a response to be sent"]
491#[derive(Debug)]
492pub struct RealmFactoryCreateRealmResponder {
493    control_handle: std::mem::ManuallyDrop<RealmFactoryControlHandle>,
494    tx_id: u32,
495}
496
497/// Set the the channel to be shutdown (see [`RealmFactoryControlHandle::shutdown`])
498/// if the responder is dropped without sending a response, so that the client
499/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
500impl std::ops::Drop for RealmFactoryCreateRealmResponder {
501    fn drop(&mut self) {
502        self.control_handle.shutdown();
503        // Safety: drops once, never accessed again
504        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
505    }
506}
507
508impl fidl::endpoints::Responder for RealmFactoryCreateRealmResponder {
509    type ControlHandle = RealmFactoryControlHandle;
510
511    fn control_handle(&self) -> &RealmFactoryControlHandle {
512        &self.control_handle
513    }
514
515    fn drop_without_shutdown(mut self) {
516        // Safety: drops once, never accessed again due to mem::forget
517        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
518        // Prevent Drop from running (which would shut down the channel)
519        std::mem::forget(self);
520    }
521}
522
523impl RealmFactoryCreateRealmResponder {
524    /// Sends a response to the FIDL transaction.
525    ///
526    /// Sets the channel to shutdown if an error occurs.
527    pub fn send(
528        self,
529        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
530    ) -> Result<(), fidl::Error> {
531        let _result = self.send_raw(result);
532        if _result.is_err() {
533            self.control_handle.shutdown();
534        }
535        self.drop_without_shutdown();
536        _result
537    }
538
539    /// Similar to "send" but does not shutdown the channel if an error occurs.
540    pub fn send_no_shutdown_on_err(
541        self,
542        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
543    ) -> Result<(), fidl::Error> {
544        let _result = self.send_raw(result);
545        self.drop_without_shutdown();
546        _result
547    }
548
549    fn send_raw(
550        &self,
551        mut result: Result<(), fidl_fuchsia_testing_harness::OperationError>,
552    ) -> Result<(), fidl::Error> {
553        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
554            fidl::encoding::EmptyStruct,
555            fidl_fuchsia_testing_harness::OperationError,
556        >>(
557            fidl::encoding::FlexibleResult::new(result),
558            self.tx_id,
559            0x1102c6d49f306da5,
560            fidl::encoding::DynamicFlags::FLEXIBLE,
561        )
562    }
563}
564
565mod internal {
566    use super::*;
567
568    impl fidl::encoding::ResourceTypeMarker for RealmFactoryCreateRealmRequest {
569        type Borrowed<'a> = &'a mut Self;
570        fn take_or_borrow<'a>(
571            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
572        ) -> Self::Borrowed<'a> {
573            value
574        }
575    }
576
577    unsafe impl fidl::encoding::TypeMarker for RealmFactoryCreateRealmRequest {
578        type Owned = Self;
579
580        #[inline(always)]
581        fn inline_align(_context: fidl::encoding::Context) -> usize {
582            4
583        }
584
585        #[inline(always)]
586        fn inline_size(_context: fidl::encoding::Context) -> usize {
587            4
588        }
589    }
590
591    unsafe impl
592        fidl::encoding::Encode<
593            RealmFactoryCreateRealmRequest,
594            fidl::encoding::DefaultFuchsiaResourceDialect,
595        > for &mut RealmFactoryCreateRealmRequest
596    {
597        #[inline]
598        unsafe fn encode(
599            self,
600            encoder: &mut fidl::encoding::Encoder<
601                '_,
602                fidl::encoding::DefaultFuchsiaResourceDialect,
603            >,
604            offset: usize,
605            _depth: fidl::encoding::Depth,
606        ) -> fidl::Result<()> {
607            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
608            // Delegate to tuple encoding.
609            fidl::encoding::Encode::<
610                RealmFactoryCreateRealmRequest,
611                fidl::encoding::DefaultFuchsiaResourceDialect,
612            >::encode(
613                (<fidl::encoding::Endpoint<
614                    fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
615                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
616                    &mut self.dictionary
617                ),),
618                encoder,
619                offset,
620                _depth,
621            )
622        }
623    }
624    unsafe impl<
625            T0: fidl::encoding::Encode<
626                fidl::encoding::Endpoint<
627                    fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
628                >,
629                fidl::encoding::DefaultFuchsiaResourceDialect,
630            >,
631        >
632        fidl::encoding::Encode<
633            RealmFactoryCreateRealmRequest,
634            fidl::encoding::DefaultFuchsiaResourceDialect,
635        > for (T0,)
636    {
637        #[inline]
638        unsafe fn encode(
639            self,
640            encoder: &mut fidl::encoding::Encoder<
641                '_,
642                fidl::encoding::DefaultFuchsiaResourceDialect,
643            >,
644            offset: usize,
645            depth: fidl::encoding::Depth,
646        ) -> fidl::Result<()> {
647            encoder.debug_check_bounds::<RealmFactoryCreateRealmRequest>(offset);
648            // Zero out padding regions. There's no need to apply masks
649            // because the unmasked parts will be overwritten by fields.
650            // Write the fields.
651            self.0.encode(encoder, offset + 0, depth)?;
652            Ok(())
653        }
654    }
655
656    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
657        for RealmFactoryCreateRealmRequest
658    {
659        #[inline(always)]
660        fn new_empty() -> Self {
661            Self {
662                dictionary: fidl::new_empty!(
663                    fidl::encoding::Endpoint<
664                        fidl::endpoints::ServerEnd<
665                            fidl_fuchsia_component_sandbox::DictionaryMarker,
666                        >,
667                    >,
668                    fidl::encoding::DefaultFuchsiaResourceDialect
669                ),
670            }
671        }
672
673        #[inline]
674        unsafe fn decode(
675            &mut self,
676            decoder: &mut fidl::encoding::Decoder<
677                '_,
678                fidl::encoding::DefaultFuchsiaResourceDialect,
679            >,
680            offset: usize,
681            _depth: fidl::encoding::Depth,
682        ) -> fidl::Result<()> {
683            decoder.debug_check_bounds::<Self>(offset);
684            // Verify that padding bytes are zero.
685            fidl::decode!(
686                fidl::encoding::Endpoint<
687                    fidl::endpoints::ServerEnd<fidl_fuchsia_component_sandbox::DictionaryMarker>,
688                >,
689                fidl::encoding::DefaultFuchsiaResourceDialect,
690                &mut self.dictionary,
691                decoder,
692                offset + 0,
693                _depth
694            )?;
695            Ok(())
696        }
697    }
698}