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