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