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