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::Handle {
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 {
400            Some((responder))
401        } else {
402            None
403        }
404    }
405
406    /// Name of the method defined in FIDL
407    pub fn method_name(&self) -> &'static str {
408        match *self {
409            DeviceRequest::Get { .. } => "get",
410            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
411                "unknown one-way method"
412            }
413            DeviceRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
414                "unknown two-way method"
415            }
416        }
417    }
418}
419
420#[derive(Debug, Clone)]
421pub struct DeviceControlHandle {
422    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
423}
424
425impl fidl::endpoints::ControlHandle for DeviceControlHandle {
426    fn shutdown(&self) {
427        self.inner.shutdown()
428    }
429    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
430        self.inner.shutdown_with_epitaph(status)
431    }
432
433    fn is_closed(&self) -> bool {
434        self.inner.channel().is_closed()
435    }
436    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
437        self.inner.channel().on_closed()
438    }
439
440    #[cfg(target_os = "fuchsia")]
441    fn signal_peer(
442        &self,
443        clear_mask: zx::Signals,
444        set_mask: zx::Signals,
445    ) -> Result<(), zx_status::Status> {
446        use fidl::Peered;
447        self.inner.channel().signal_peer(clear_mask, set_mask)
448    }
449}
450
451impl DeviceControlHandle {}
452
453#[must_use = "FIDL methods require a response to be sent"]
454#[derive(Debug)]
455pub struct DeviceGetResponder {
456    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
457    tx_id: u32,
458}
459
460/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
461/// if the responder is dropped without sending a response, so that the client
462/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
463impl std::ops::Drop for DeviceGetResponder {
464    fn drop(&mut self) {
465        self.control_handle.shutdown();
466        // Safety: drops once, never accessed again
467        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
468    }
469}
470
471impl fidl::endpoints::Responder for DeviceGetResponder {
472    type ControlHandle = DeviceControlHandle;
473
474    fn control_handle(&self) -> &DeviceControlHandle {
475        &self.control_handle
476    }
477
478    fn drop_without_shutdown(mut self) {
479        // Safety: drops once, never accessed again due to mem::forget
480        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
481        // Prevent Drop from running (which would shut down the channel)
482        std::mem::forget(self);
483    }
484}
485
486impl DeviceGetResponder {
487    /// Sends a response to the FIDL transaction.
488    ///
489    /// Sets the channel to shutdown if an error occurs.
490    pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
491        let _result = self.send_raw(result);
492        if _result.is_err() {
493            self.control_handle.shutdown();
494        }
495        self.drop_without_shutdown();
496        _result
497    }
498
499    /// Similar to "send" but does not shutdown the channel if an error occurs.
500    pub fn send_no_shutdown_on_err(
501        self,
502        mut result: Result<fidl::Vmo, i32>,
503    ) -> Result<(), fidl::Error> {
504        let _result = self.send_raw(result);
505        self.drop_without_shutdown();
506        _result
507    }
508
509    fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
510        self.control_handle
511            .inner
512            .send::<fidl::encoding::FlexibleResultType<DeviceGetResponse, i32>>(
513                fidl::encoding::FlexibleResult::new(result.map(|vmo| (vmo,))),
514                self.tx_id,
515                0x4ddd5941b27b0d4c,
516                fidl::encoding::DynamicFlags::FLEXIBLE,
517            )
518    }
519}
520
521#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
522pub struct ServiceMarker;
523
524#[cfg(target_os = "fuchsia")]
525impl fidl::endpoints::ServiceMarker for ServiceMarker {
526    type Proxy = ServiceProxy;
527    type Request = ServiceRequest;
528    const SERVICE_NAME: &'static str = "fuchsia.hardware.virtio.pmem.Service";
529}
530
531/// A request for one of the member protocols of Service.
532///
533#[cfg(target_os = "fuchsia")]
534pub enum ServiceRequest {
535    Device(DeviceRequestStream),
536}
537
538#[cfg(target_os = "fuchsia")]
539impl fidl::endpoints::ServiceRequest for ServiceRequest {
540    type Service = ServiceMarker;
541
542    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
543        match name {
544            "device" => Self::Device(
545                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
546            ),
547            _ => panic!("no such member protocol name for service Service"),
548        }
549    }
550
551    fn member_names() -> &'static [&'static str] {
552        &["device"]
553    }
554}
555#[cfg(target_os = "fuchsia")]
556pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
557
558#[cfg(target_os = "fuchsia")]
559impl fidl::endpoints::ServiceProxy for ServiceProxy {
560    type Service = ServiceMarker;
561
562    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
563        Self(opener)
564    }
565}
566
567#[cfg(target_os = "fuchsia")]
568impl ServiceProxy {
569    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
570        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
571        self.connect_channel_to_device(server_end)?;
572        Ok(proxy)
573    }
574
575    /// Like `connect_to_device`, but returns a sync proxy.
576    /// See [`Self::connect_to_device`] for more details.
577    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
578        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
579        self.connect_channel_to_device(server_end)?;
580        Ok(proxy)
581    }
582
583    /// Like `connect_to_device`, but accepts a server end.
584    /// See [`Self::connect_to_device`] for more details.
585    pub fn connect_channel_to_device(
586        &self,
587        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
588    ) -> Result<(), fidl::Error> {
589        self.0.open_member("device", server_end.into_channel())
590    }
591
592    pub fn instance_name(&self) -> &str {
593        self.0.instance_name()
594    }
595}
596
597mod internal {
598    use super::*;
599
600    impl fidl::encoding::ResourceTypeMarker for DeviceGetResponse {
601        type Borrowed<'a> = &'a mut Self;
602        fn take_or_borrow<'a>(
603            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
604        ) -> Self::Borrowed<'a> {
605            value
606        }
607    }
608
609    unsafe impl fidl::encoding::TypeMarker for DeviceGetResponse {
610        type Owned = Self;
611
612        #[inline(always)]
613        fn inline_align(_context: fidl::encoding::Context) -> usize {
614            4
615        }
616
617        #[inline(always)]
618        fn inline_size(_context: fidl::encoding::Context) -> usize {
619            4
620        }
621    }
622
623    unsafe impl
624        fidl::encoding::Encode<DeviceGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
625        for &mut DeviceGetResponse
626    {
627        #[inline]
628        unsafe fn encode(
629            self,
630            encoder: &mut fidl::encoding::Encoder<
631                '_,
632                fidl::encoding::DefaultFuchsiaResourceDialect,
633            >,
634            offset: usize,
635            _depth: fidl::encoding::Depth,
636        ) -> fidl::Result<()> {
637            encoder.debug_check_bounds::<DeviceGetResponse>(offset);
638            // Delegate to tuple encoding.
639            fidl::encoding::Encode::<DeviceGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
640                (
641                    <fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.vmo),
642                ),
643                encoder, offset, _depth
644            )
645        }
646    }
647    unsafe impl<
648            T0: fidl::encoding::Encode<
649                fidl::encoding::HandleType<
650                    fidl::Vmo,
651                    { fidl::ObjectType::VMO.into_raw() },
652                    2147483648,
653                >,
654                fidl::encoding::DefaultFuchsiaResourceDialect,
655            >,
656        >
657        fidl::encoding::Encode<DeviceGetResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
658        for (T0,)
659    {
660        #[inline]
661        unsafe fn encode(
662            self,
663            encoder: &mut fidl::encoding::Encoder<
664                '_,
665                fidl::encoding::DefaultFuchsiaResourceDialect,
666            >,
667            offset: usize,
668            depth: fidl::encoding::Depth,
669        ) -> fidl::Result<()> {
670            encoder.debug_check_bounds::<DeviceGetResponse>(offset);
671            // Zero out padding regions. There's no need to apply masks
672            // because the unmasked parts will be overwritten by fields.
673            // Write the fields.
674            self.0.encode(encoder, offset + 0, depth)?;
675            Ok(())
676        }
677    }
678
679    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
680        for DeviceGetResponse
681    {
682        #[inline(always)]
683        fn new_empty() -> Self {
684            Self {
685                vmo: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
686            }
687        }
688
689        #[inline]
690        unsafe fn decode(
691            &mut self,
692            decoder: &mut fidl::encoding::Decoder<
693                '_,
694                fidl::encoding::DefaultFuchsiaResourceDialect,
695            >,
696            offset: usize,
697            _depth: fidl::encoding::Depth,
698        ) -> fidl::Result<()> {
699            decoder.debug_check_bounds::<Self>(offset);
700            // Verify that padding bytes are zero.
701            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.vmo, decoder, offset + 0, _depth)?;
702            Ok(())
703        }
704    }
705}