Skip to main content

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