Skip to main content

fidl_fuchsia_driver_crash/
fidl_fuchsia_driver_crash.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_driver_crash__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15#[repr(C)]
16pub struct CrashIntrospectFindDriverCrashRequest {
17    pub process_koid: u64,
18    pub thread_koid: u64,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for CrashIntrospectFindDriverCrashRequest
23{
24}
25
26#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
27pub struct CrashIntrospectMarker;
28
29impl fidl::endpoints::ProtocolMarker for CrashIntrospectMarker {
30    type Proxy = CrashIntrospectProxy;
31    type RequestStream = CrashIntrospectRequestStream;
32    #[cfg(target_os = "fuchsia")]
33    type SynchronousProxy = CrashIntrospectSynchronousProxy;
34
35    const DEBUG_NAME: &'static str = "fuchsia.driver.crash.CrashIntrospect";
36}
37impl fidl::endpoints::DiscoverableProtocolMarker for CrashIntrospectMarker {}
38pub type CrashIntrospectFindDriverCrashResult = Result<DriverCrashInfo, i32>;
39
40pub trait CrashIntrospectProxyInterface: Send + Sync {
41    type FindDriverCrashResponseFut: std::future::Future<Output = Result<CrashIntrospectFindDriverCrashResult, fidl::Error>>
42        + Send;
43    fn r#find_driver_crash(
44        &self,
45        process_koid: u64,
46        thread_koid: u64,
47    ) -> Self::FindDriverCrashResponseFut;
48}
49#[derive(Debug)]
50#[cfg(target_os = "fuchsia")]
51pub struct CrashIntrospectSynchronousProxy {
52    client: fidl::client::sync::Client,
53}
54
55#[cfg(target_os = "fuchsia")]
56impl fidl::endpoints::SynchronousProxy for CrashIntrospectSynchronousProxy {
57    type Proxy = CrashIntrospectProxy;
58    type Protocol = CrashIntrospectMarker;
59
60    fn from_channel(inner: fidl::Channel) -> Self {
61        Self::new(inner)
62    }
63
64    fn into_channel(self) -> fidl::Channel {
65        self.client.into_channel()
66    }
67
68    fn as_channel(&self) -> &fidl::Channel {
69        self.client.as_channel()
70    }
71}
72
73#[cfg(target_os = "fuchsia")]
74impl CrashIntrospectSynchronousProxy {
75    pub fn new(channel: fidl::Channel) -> Self {
76        let protocol_name = <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
77        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
78    }
79
80    pub fn into_channel(self) -> fidl::Channel {
81        self.client.into_channel()
82    }
83
84    /// Waits until an event arrives and returns it. It is safe for other
85    /// threads to make concurrent requests while waiting for an event.
86    pub fn wait_for_event(
87        &self,
88        deadline: zx::MonotonicInstant,
89    ) -> Result<CrashIntrospectEvent, fidl::Error> {
90        CrashIntrospectEvent::decode(self.client.wait_for_event(deadline)?)
91    }
92
93    /// Given a process and thread koid, returns the information that was stored when the
94    /// driver host observed a crash from that thread.
95    ///
96    /// The information for a crash is deleted when it is accessed.
97    ///
98    /// If there is no information available on the given thread koid,
99    /// `zx::Status::NOT_FOUND` is returned.
100    pub fn r#find_driver_crash(
101        &self,
102        mut process_koid: u64,
103        mut thread_koid: u64,
104        ___deadline: zx::MonotonicInstant,
105    ) -> Result<CrashIntrospectFindDriverCrashResult, fidl::Error> {
106        let _response = self.client.send_query::<
107            CrashIntrospectFindDriverCrashRequest,
108            fidl::encoding::ResultType<CrashIntrospectFindDriverCrashResponse, i32>,
109        >(
110            (process_koid, thread_koid,),
111            0x41237ffcc46267bc,
112            fidl::encoding::DynamicFlags::empty(),
113            ___deadline,
114        )?;
115        Ok(_response.map(|x| x.info))
116    }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl From<CrashIntrospectSynchronousProxy> for zx::NullableHandle {
121    fn from(value: CrashIntrospectSynchronousProxy) -> Self {
122        value.into_channel().into()
123    }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl From<fidl::Channel> for CrashIntrospectSynchronousProxy {
128    fn from(value: fidl::Channel) -> Self {
129        Self::new(value)
130    }
131}
132
133#[cfg(target_os = "fuchsia")]
134impl fidl::endpoints::FromClient for CrashIntrospectSynchronousProxy {
135    type Protocol = CrashIntrospectMarker;
136
137    fn from_client(value: fidl::endpoints::ClientEnd<CrashIntrospectMarker>) -> Self {
138        Self::new(value.into_channel())
139    }
140}
141
142#[derive(Debug, Clone)]
143pub struct CrashIntrospectProxy {
144    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
145}
146
147impl fidl::endpoints::Proxy for CrashIntrospectProxy {
148    type Protocol = CrashIntrospectMarker;
149
150    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
151        Self::new(inner)
152    }
153
154    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
155        self.client.into_channel().map_err(|client| Self { client })
156    }
157
158    fn as_channel(&self) -> &::fidl::AsyncChannel {
159        self.client.as_channel()
160    }
161}
162
163impl CrashIntrospectProxy {
164    /// Create a new Proxy for fuchsia.driver.crash/CrashIntrospect.
165    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
166        let protocol_name = <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
167        Self { client: fidl::client::Client::new(channel, protocol_name) }
168    }
169
170    /// Get a Stream of events from the remote end of the protocol.
171    ///
172    /// # Panics
173    ///
174    /// Panics if the event stream was already taken.
175    pub fn take_event_stream(&self) -> CrashIntrospectEventStream {
176        CrashIntrospectEventStream { event_receiver: self.client.take_event_receiver() }
177    }
178
179    /// Given a process and thread koid, returns the information that was stored when the
180    /// driver host observed a crash from that thread.
181    ///
182    /// The information for a crash is deleted when it is accessed.
183    ///
184    /// If there is no information available on the given thread koid,
185    /// `zx::Status::NOT_FOUND` is returned.
186    pub fn r#find_driver_crash(
187        &self,
188        mut process_koid: u64,
189        mut thread_koid: u64,
190    ) -> fidl::client::QueryResponseFut<
191        CrashIntrospectFindDriverCrashResult,
192        fidl::encoding::DefaultFuchsiaResourceDialect,
193    > {
194        CrashIntrospectProxyInterface::r#find_driver_crash(self, process_koid, thread_koid)
195    }
196}
197
198impl CrashIntrospectProxyInterface for CrashIntrospectProxy {
199    type FindDriverCrashResponseFut = fidl::client::QueryResponseFut<
200        CrashIntrospectFindDriverCrashResult,
201        fidl::encoding::DefaultFuchsiaResourceDialect,
202    >;
203    fn r#find_driver_crash(
204        &self,
205        mut process_koid: u64,
206        mut thread_koid: u64,
207    ) -> Self::FindDriverCrashResponseFut {
208        fn _decode(
209            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
210        ) -> Result<CrashIntrospectFindDriverCrashResult, fidl::Error> {
211            let _response = fidl::client::decode_transaction_body::<
212                fidl::encoding::ResultType<CrashIntrospectFindDriverCrashResponse, i32>,
213                fidl::encoding::DefaultFuchsiaResourceDialect,
214                0x41237ffcc46267bc,
215            >(_buf?)?;
216            Ok(_response.map(|x| x.info))
217        }
218        self.client.send_query_and_decode::<
219            CrashIntrospectFindDriverCrashRequest,
220            CrashIntrospectFindDriverCrashResult,
221        >(
222            (process_koid, thread_koid,),
223            0x41237ffcc46267bc,
224            fidl::encoding::DynamicFlags::empty(),
225            _decode,
226        )
227    }
228}
229
230pub struct CrashIntrospectEventStream {
231    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
232}
233
234impl std::marker::Unpin for CrashIntrospectEventStream {}
235
236impl futures::stream::FusedStream for CrashIntrospectEventStream {
237    fn is_terminated(&self) -> bool {
238        self.event_receiver.is_terminated()
239    }
240}
241
242impl futures::Stream for CrashIntrospectEventStream {
243    type Item = Result<CrashIntrospectEvent, fidl::Error>;
244
245    fn poll_next(
246        mut self: std::pin::Pin<&mut Self>,
247        cx: &mut std::task::Context<'_>,
248    ) -> std::task::Poll<Option<Self::Item>> {
249        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
250            &mut self.event_receiver,
251            cx
252        )?) {
253            Some(buf) => std::task::Poll::Ready(Some(CrashIntrospectEvent::decode(buf))),
254            None => std::task::Poll::Ready(None),
255        }
256    }
257}
258
259#[derive(Debug)]
260pub enum CrashIntrospectEvent {}
261
262impl CrashIntrospectEvent {
263    /// Decodes a message buffer as a [`CrashIntrospectEvent`].
264    fn decode(
265        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
266    ) -> Result<CrashIntrospectEvent, fidl::Error> {
267        let (bytes, _handles) = buf.split_mut();
268        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
269        debug_assert_eq!(tx_header.tx_id, 0);
270        match tx_header.ordinal {
271            _ => Err(fidl::Error::UnknownOrdinal {
272                ordinal: tx_header.ordinal,
273                protocol_name:
274                    <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
275            }),
276        }
277    }
278}
279
280/// A Stream of incoming requests for fuchsia.driver.crash/CrashIntrospect.
281pub struct CrashIntrospectRequestStream {
282    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
283    is_terminated: bool,
284}
285
286impl std::marker::Unpin for CrashIntrospectRequestStream {}
287
288impl futures::stream::FusedStream for CrashIntrospectRequestStream {
289    fn is_terminated(&self) -> bool {
290        self.is_terminated
291    }
292}
293
294impl fidl::endpoints::RequestStream for CrashIntrospectRequestStream {
295    type Protocol = CrashIntrospectMarker;
296    type ControlHandle = CrashIntrospectControlHandle;
297
298    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
299        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
300    }
301
302    fn control_handle(&self) -> Self::ControlHandle {
303        CrashIntrospectControlHandle { inner: self.inner.clone() }
304    }
305
306    fn into_inner(
307        self,
308    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
309    {
310        (self.inner, self.is_terminated)
311    }
312
313    fn from_inner(
314        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
315        is_terminated: bool,
316    ) -> Self {
317        Self { inner, is_terminated }
318    }
319}
320
321impl futures::Stream for CrashIntrospectRequestStream {
322    type Item = Result<CrashIntrospectRequest, fidl::Error>;
323
324    fn poll_next(
325        mut self: std::pin::Pin<&mut Self>,
326        cx: &mut std::task::Context<'_>,
327    ) -> std::task::Poll<Option<Self::Item>> {
328        let this = &mut *self;
329        if this.inner.check_shutdown(cx) {
330            this.is_terminated = true;
331            return std::task::Poll::Ready(None);
332        }
333        if this.is_terminated {
334            panic!("polled CrashIntrospectRequestStream after completion");
335        }
336        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
337            |bytes, handles| {
338                match this.inner.channel().read_etc(cx, bytes, handles) {
339                    std::task::Poll::Ready(Ok(())) => {}
340                    std::task::Poll::Pending => return std::task::Poll::Pending,
341                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
342                        this.is_terminated = true;
343                        return std::task::Poll::Ready(None);
344                    }
345                    std::task::Poll::Ready(Err(e)) => {
346                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
347                            e.into(),
348                        ))));
349                    }
350                }
351
352                // A message has been received from the channel
353                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
354
355                std::task::Poll::Ready(Some(match header.ordinal {
356                    0x41237ffcc46267bc => {
357                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
358                        let mut req = fidl::new_empty!(
359                            CrashIntrospectFindDriverCrashRequest,
360                            fidl::encoding::DefaultFuchsiaResourceDialect
361                        );
362                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CrashIntrospectFindDriverCrashRequest>(&header, _body_bytes, handles, &mut req)?;
363                        let control_handle =
364                            CrashIntrospectControlHandle { inner: this.inner.clone() };
365                        Ok(CrashIntrospectRequest::FindDriverCrash {
366                            process_koid: req.process_koid,
367                            thread_koid: req.thread_koid,
368
369                            responder: CrashIntrospectFindDriverCrashResponder {
370                                control_handle: std::mem::ManuallyDrop::new(control_handle),
371                                tx_id: header.tx_id,
372                            },
373                        })
374                    }
375                    _ => Err(fidl::Error::UnknownOrdinal {
376                        ordinal: header.ordinal,
377                        protocol_name:
378                            <CrashIntrospectMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
379                    }),
380                }))
381            },
382        )
383    }
384}
385
386/// When a thread from a component using the driver runner crashes, the thread
387/// koid along with other information is stored. This protocol can be used to
388/// retrieve that stored information.
389#[derive(Debug)]
390pub enum CrashIntrospectRequest {
391    /// Given a process and thread koid, returns the information that was stored when the
392    /// driver host observed a crash from that thread.
393    ///
394    /// The information for a crash is deleted when it is accessed.
395    ///
396    /// If there is no information available on the given thread koid,
397    /// `zx::Status::NOT_FOUND` is returned.
398    FindDriverCrash {
399        process_koid: u64,
400        thread_koid: u64,
401        responder: CrashIntrospectFindDriverCrashResponder,
402    },
403}
404
405impl CrashIntrospectRequest {
406    #[allow(irrefutable_let_patterns)]
407    pub fn into_find_driver_crash(
408        self,
409    ) -> Option<(u64, u64, CrashIntrospectFindDriverCrashResponder)> {
410        if let CrashIntrospectRequest::FindDriverCrash { process_koid, thread_koid, responder } =
411            self
412        {
413            Some((process_koid, thread_koid, responder))
414        } else {
415            None
416        }
417    }
418
419    /// Name of the method defined in FIDL
420    pub fn method_name(&self) -> &'static str {
421        match *self {
422            CrashIntrospectRequest::FindDriverCrash { .. } => "find_driver_crash",
423        }
424    }
425}
426
427#[derive(Debug, Clone)]
428pub struct CrashIntrospectControlHandle {
429    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
430}
431
432impl fidl::endpoints::ControlHandle for CrashIntrospectControlHandle {
433    fn shutdown(&self) {
434        self.inner.shutdown()
435    }
436
437    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
438        self.inner.shutdown_with_epitaph(status)
439    }
440
441    fn is_closed(&self) -> bool {
442        self.inner.channel().is_closed()
443    }
444    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
445        self.inner.channel().on_closed()
446    }
447
448    #[cfg(target_os = "fuchsia")]
449    fn signal_peer(
450        &self,
451        clear_mask: zx::Signals,
452        set_mask: zx::Signals,
453    ) -> Result<(), zx_status::Status> {
454        use fidl::Peered;
455        self.inner.channel().signal_peer(clear_mask, set_mask)
456    }
457}
458
459impl CrashIntrospectControlHandle {}
460
461#[must_use = "FIDL methods require a response to be sent"]
462#[derive(Debug)]
463pub struct CrashIntrospectFindDriverCrashResponder {
464    control_handle: std::mem::ManuallyDrop<CrashIntrospectControlHandle>,
465    tx_id: u32,
466}
467
468/// Set the the channel to be shutdown (see [`CrashIntrospectControlHandle::shutdown`])
469/// if the responder is dropped without sending a response, so that the client
470/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
471impl std::ops::Drop for CrashIntrospectFindDriverCrashResponder {
472    fn drop(&mut self) {
473        self.control_handle.shutdown();
474        // Safety: drops once, never accessed again
475        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
476    }
477}
478
479impl fidl::endpoints::Responder for CrashIntrospectFindDriverCrashResponder {
480    type ControlHandle = CrashIntrospectControlHandle;
481
482    fn control_handle(&self) -> &CrashIntrospectControlHandle {
483        &self.control_handle
484    }
485
486    fn drop_without_shutdown(mut self) {
487        // Safety: drops once, never accessed again due to mem::forget
488        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
489        // Prevent Drop from running (which would shut down the channel)
490        std::mem::forget(self);
491    }
492}
493
494impl CrashIntrospectFindDriverCrashResponder {
495    /// Sends a response to the FIDL transaction.
496    ///
497    /// Sets the channel to shutdown if an error occurs.
498    pub fn send(self, mut result: Result<&DriverCrashInfo, i32>) -> Result<(), fidl::Error> {
499        let _result = self.send_raw(result);
500        if _result.is_err() {
501            self.control_handle.shutdown();
502        }
503        self.drop_without_shutdown();
504        _result
505    }
506
507    /// Similar to "send" but does not shutdown the channel if an error occurs.
508    pub fn send_no_shutdown_on_err(
509        self,
510        mut result: Result<&DriverCrashInfo, i32>,
511    ) -> Result<(), fidl::Error> {
512        let _result = self.send_raw(result);
513        self.drop_without_shutdown();
514        _result
515    }
516
517    fn send_raw(&self, mut result: Result<&DriverCrashInfo, i32>) -> Result<(), fidl::Error> {
518        self.control_handle.inner.send::<fidl::encoding::ResultType<
519            CrashIntrospectFindDriverCrashResponse,
520            i32,
521        >>(
522            result.map(|info| (info,)),
523            self.tx_id,
524            0x41237ffcc46267bc,
525            fidl::encoding::DynamicFlags::empty(),
526        )
527    }
528}
529
530mod internal {
531    use super::*;
532
533    impl fidl::encoding::ResourceTypeMarker for CrashIntrospectFindDriverCrashRequest {
534        type Borrowed<'a> = &'a mut Self;
535        fn take_or_borrow<'a>(
536            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
537        ) -> Self::Borrowed<'a> {
538            value
539        }
540    }
541
542    unsafe impl fidl::encoding::TypeMarker for CrashIntrospectFindDriverCrashRequest {
543        type Owned = Self;
544
545        #[inline(always)]
546        fn inline_align(_context: fidl::encoding::Context) -> usize {
547            8
548        }
549
550        #[inline(always)]
551        fn inline_size(_context: fidl::encoding::Context) -> usize {
552            16
553        }
554        #[inline(always)]
555        fn encode_is_copy() -> bool {
556            true
557        }
558
559        #[inline(always)]
560        fn decode_is_copy() -> bool {
561            true
562        }
563    }
564
565    unsafe impl
566        fidl::encoding::Encode<
567            CrashIntrospectFindDriverCrashRequest,
568            fidl::encoding::DefaultFuchsiaResourceDialect,
569        > for &mut CrashIntrospectFindDriverCrashRequest
570    {
571        #[inline]
572        unsafe fn encode(
573            self,
574            encoder: &mut fidl::encoding::Encoder<
575                '_,
576                fidl::encoding::DefaultFuchsiaResourceDialect,
577            >,
578            offset: usize,
579            _depth: fidl::encoding::Depth,
580        ) -> fidl::Result<()> {
581            encoder.debug_check_bounds::<CrashIntrospectFindDriverCrashRequest>(offset);
582            unsafe {
583                // Copy the object into the buffer.
584                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
585                (buf_ptr as *mut CrashIntrospectFindDriverCrashRequest)
586                    .write_unaligned((self as *const CrashIntrospectFindDriverCrashRequest).read());
587                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
588                // done second because the memcpy will write garbage to these bytes.
589            }
590            Ok(())
591        }
592    }
593    unsafe impl<
594        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
595        T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
596    >
597        fidl::encoding::Encode<
598            CrashIntrospectFindDriverCrashRequest,
599            fidl::encoding::DefaultFuchsiaResourceDialect,
600        > for (T0, T1)
601    {
602        #[inline]
603        unsafe fn encode(
604            self,
605            encoder: &mut fidl::encoding::Encoder<
606                '_,
607                fidl::encoding::DefaultFuchsiaResourceDialect,
608            >,
609            offset: usize,
610            depth: fidl::encoding::Depth,
611        ) -> fidl::Result<()> {
612            encoder.debug_check_bounds::<CrashIntrospectFindDriverCrashRequest>(offset);
613            // Zero out padding regions. There's no need to apply masks
614            // because the unmasked parts will be overwritten by fields.
615            // Write the fields.
616            self.0.encode(encoder, offset + 0, depth)?;
617            self.1.encode(encoder, offset + 8, depth)?;
618            Ok(())
619        }
620    }
621
622    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
623        for CrashIntrospectFindDriverCrashRequest
624    {
625        #[inline(always)]
626        fn new_empty() -> Self {
627            Self {
628                process_koid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
629                thread_koid: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
630            }
631        }
632
633        #[inline]
634        unsafe fn decode(
635            &mut self,
636            decoder: &mut fidl::encoding::Decoder<
637                '_,
638                fidl::encoding::DefaultFuchsiaResourceDialect,
639            >,
640            offset: usize,
641            _depth: fidl::encoding::Depth,
642        ) -> fidl::Result<()> {
643            decoder.debug_check_bounds::<Self>(offset);
644            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
645            // Verify that padding bytes are zero.
646            // Copy from the buffer into the object.
647            unsafe {
648                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
649            }
650            Ok(())
651        }
652    }
653}