Skip to main content

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