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