fidl_fuchsia_lowpan_spinel_common/
fidl_fuchsia_lowpan_spinel_common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_FRAME_SIZE: u32 = 4096;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
14#[repr(i32)]
15pub enum Error {
16    /// An unspecified error has occurred. This error type should be
17    /// avoided unless the use of a more specific error would be misleading.
18    ///
19    /// If this error is emitted, it is expected that a more descriptive error
20    /// will be present in the logs.
21    ///
22    /// Run-time Remediation: Close and re-open the device and attempt to use it.
23    /// If the error persists, indicate trouble to a higher level and stop.
24    Unspecified = 1,
25    /// `SendFrame()` was called with a frame that was larger than what
26    /// `GetMaxFrameSize()` indicated to be the maximum frame size.
27    ///
28    /// Note that `MAX_FRAME_SIZE` indicates the largest frame size supported
29    /// by this protocol, whereas `GetMaxFrameSize()` returns the largest
30    /// frame size supported by the Device.
31    ///
32    /// This error typically indicates a bug or logic-error in the use of the
33    /// `fuchsia.lowpan.spinel::Device` protocol.
34    ///
35    /// This error is only emitted via `->OnError()`.
36    OutboundFrameTooLarge = 2,
37    /// The remote device tried to send us a frame that was too large.
38    ///
39    /// This error typically indicates either frame corruption or a
40    /// misconfiguration of some sort.
41    ///
42    /// Run-time Remediation: The device should be reset and re-initialized.
43    ///
44    /// This error is only emitted via `->OnError()`.
45    InboundFrameTooLarge = 3,
46    /// Garbage-bytes/corruption detected on inbound frame.
47    ///
48    /// This error typically indicates that the connection between
49    /// the host and the Spinel device is unreliable. This may be caused
50    /// by hardware problems or implementation bugs.
51    ///
52    /// Run-time Remediation: The device should be reset (by sending a
53    /// spinel reset frame or by closing and re-opening) and then
54    /// re-initialized.
55    ///
56    /// This error is only emitted via `->OnError()`.
57    InboundFrameCorrupt = 4,
58    /// An I/O error has occurred.
59    ///
60    /// When this error is encountered, the device automatically closes.
61    ///
62    /// Run-time Remediation: Re-open the device and attempt to use it. If
63    /// the error persists, indicate trouble to a higher level (for example,
64    /// presenting a UI message indicating a malfunction) and stop.
65    IoError = 5,
66    /// This operation cannot be performed while the Spinel device is closed.
67    ///
68    /// This error typically indicates a bug or logic-error in the use of the
69    /// `fuchsia.lowpan.spinel::Device` protocol.
70    ///
71    /// This error is only emitted via `->OnError()`.
72    Closed = 6,
73}
74
75impl Error {
76    #[inline]
77    pub fn from_primitive(prim: i32) -> Option<Self> {
78        match prim {
79            1 => Some(Self::Unspecified),
80            2 => Some(Self::OutboundFrameTooLarge),
81            3 => Some(Self::InboundFrameTooLarge),
82            4 => Some(Self::InboundFrameCorrupt),
83            5 => Some(Self::IoError),
84            6 => Some(Self::Closed),
85            _ => None,
86        }
87    }
88
89    #[inline]
90    pub const fn into_primitive(self) -> i32 {
91        self as i32
92    }
93}
94
95#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
96#[repr(C)]
97pub struct DeviceGetMaxFrameSizeResponse {
98    pub size: u32,
99}
100
101impl fidl::Persistable for DeviceGetMaxFrameSizeResponse {}
102
103#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
104pub struct DeviceOnErrorRequest {
105    pub error: Error,
106    pub did_close: bool,
107}
108
109impl fidl::Persistable for DeviceOnErrorRequest {}
110
111#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
112#[repr(C)]
113pub struct DeviceOnReadyForSendFramesRequest {
114    pub number_of_frames: u32,
115}
116
117impl fidl::Persistable for DeviceOnReadyForSendFramesRequest {}
118
119#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
120pub struct DeviceOnReceiveFrameRequest {
121    pub data: Vec<u8>,
122}
123
124impl fidl::Persistable for DeviceOnReceiveFrameRequest {}
125
126#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
127#[repr(C)]
128pub struct DeviceReadyToReceiveFramesRequest {
129    pub number_of_frames: u32,
130}
131
132impl fidl::Persistable for DeviceReadyToReceiveFramesRequest {}
133
134#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
135pub struct DeviceSendFrameRequest {
136    pub data: Vec<u8>,
137}
138
139impl fidl::Persistable for DeviceSendFrameRequest {}
140
141mod internal {
142    use super::*;
143    unsafe impl fidl::encoding::TypeMarker for Error {
144        type Owned = Self;
145
146        #[inline(always)]
147        fn inline_align(_context: fidl::encoding::Context) -> usize {
148            std::mem::align_of::<i32>()
149        }
150
151        #[inline(always)]
152        fn inline_size(_context: fidl::encoding::Context) -> usize {
153            std::mem::size_of::<i32>()
154        }
155
156        #[inline(always)]
157        fn encode_is_copy() -> bool {
158            true
159        }
160
161        #[inline(always)]
162        fn decode_is_copy() -> bool {
163            false
164        }
165    }
166
167    impl fidl::encoding::ValueTypeMarker for Error {
168        type Borrowed<'a> = Self;
169        #[inline(always)]
170        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
171            *value
172        }
173    }
174
175    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
176        #[inline]
177        unsafe fn encode(
178            self,
179            encoder: &mut fidl::encoding::Encoder<'_, D>,
180            offset: usize,
181            _depth: fidl::encoding::Depth,
182        ) -> fidl::Result<()> {
183            encoder.debug_check_bounds::<Self>(offset);
184            encoder.write_num(self.into_primitive(), offset);
185            Ok(())
186        }
187    }
188
189    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
190        #[inline(always)]
191        fn new_empty() -> Self {
192            Self::Unspecified
193        }
194
195        #[inline]
196        unsafe fn decode(
197            &mut self,
198            decoder: &mut fidl::encoding::Decoder<'_, D>,
199            offset: usize,
200            _depth: fidl::encoding::Depth,
201        ) -> fidl::Result<()> {
202            decoder.debug_check_bounds::<Self>(offset);
203            let prim = decoder.read_num::<i32>(offset);
204
205            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
206            Ok(())
207        }
208    }
209
210    impl fidl::encoding::ValueTypeMarker for DeviceGetMaxFrameSizeResponse {
211        type Borrowed<'a> = &'a Self;
212        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
213            value
214        }
215    }
216
217    unsafe impl fidl::encoding::TypeMarker for DeviceGetMaxFrameSizeResponse {
218        type Owned = Self;
219
220        #[inline(always)]
221        fn inline_align(_context: fidl::encoding::Context) -> usize {
222            4
223        }
224
225        #[inline(always)]
226        fn inline_size(_context: fidl::encoding::Context) -> usize {
227            4
228        }
229        #[inline(always)]
230        fn encode_is_copy() -> bool {
231            true
232        }
233
234        #[inline(always)]
235        fn decode_is_copy() -> bool {
236            true
237        }
238    }
239
240    unsafe impl<D: fidl::encoding::ResourceDialect>
241        fidl::encoding::Encode<DeviceGetMaxFrameSizeResponse, D>
242        for &DeviceGetMaxFrameSizeResponse
243    {
244        #[inline]
245        unsafe fn encode(
246            self,
247            encoder: &mut fidl::encoding::Encoder<'_, D>,
248            offset: usize,
249            _depth: fidl::encoding::Depth,
250        ) -> fidl::Result<()> {
251            encoder.debug_check_bounds::<DeviceGetMaxFrameSizeResponse>(offset);
252            unsafe {
253                // Copy the object into the buffer.
254                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
255                (buf_ptr as *mut DeviceGetMaxFrameSizeResponse)
256                    .write_unaligned((self as *const DeviceGetMaxFrameSizeResponse).read());
257                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
258                // done second because the memcpy will write garbage to these bytes.
259            }
260            Ok(())
261        }
262    }
263    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
264        fidl::encoding::Encode<DeviceGetMaxFrameSizeResponse, D> for (T0,)
265    {
266        #[inline]
267        unsafe fn encode(
268            self,
269            encoder: &mut fidl::encoding::Encoder<'_, D>,
270            offset: usize,
271            depth: fidl::encoding::Depth,
272        ) -> fidl::Result<()> {
273            encoder.debug_check_bounds::<DeviceGetMaxFrameSizeResponse>(offset);
274            // Zero out padding regions. There's no need to apply masks
275            // because the unmasked parts will be overwritten by fields.
276            // Write the fields.
277            self.0.encode(encoder, offset + 0, depth)?;
278            Ok(())
279        }
280    }
281
282    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
283        for DeviceGetMaxFrameSizeResponse
284    {
285        #[inline(always)]
286        fn new_empty() -> Self {
287            Self { size: fidl::new_empty!(u32, D) }
288        }
289
290        #[inline]
291        unsafe fn decode(
292            &mut self,
293            decoder: &mut fidl::encoding::Decoder<'_, D>,
294            offset: usize,
295            _depth: fidl::encoding::Depth,
296        ) -> fidl::Result<()> {
297            decoder.debug_check_bounds::<Self>(offset);
298            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
299            // Verify that padding bytes are zero.
300            // Copy from the buffer into the object.
301            unsafe {
302                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
303            }
304            Ok(())
305        }
306    }
307
308    impl fidl::encoding::ValueTypeMarker for DeviceOnErrorRequest {
309        type Borrowed<'a> = &'a Self;
310        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
311            value
312        }
313    }
314
315    unsafe impl fidl::encoding::TypeMarker for DeviceOnErrorRequest {
316        type Owned = Self;
317
318        #[inline(always)]
319        fn inline_align(_context: fidl::encoding::Context) -> usize {
320            4
321        }
322
323        #[inline(always)]
324        fn inline_size(_context: fidl::encoding::Context) -> usize {
325            8
326        }
327    }
328
329    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceOnErrorRequest, D>
330        for &DeviceOnErrorRequest
331    {
332        #[inline]
333        unsafe fn encode(
334            self,
335            encoder: &mut fidl::encoding::Encoder<'_, D>,
336            offset: usize,
337            _depth: fidl::encoding::Depth,
338        ) -> fidl::Result<()> {
339            encoder.debug_check_bounds::<DeviceOnErrorRequest>(offset);
340            // Delegate to tuple encoding.
341            fidl::encoding::Encode::<DeviceOnErrorRequest, D>::encode(
342                (
343                    <Error as fidl::encoding::ValueTypeMarker>::borrow(&self.error),
344                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_close),
345                ),
346                encoder,
347                offset,
348                _depth,
349            )
350        }
351    }
352    unsafe impl<
353            D: fidl::encoding::ResourceDialect,
354            T0: fidl::encoding::Encode<Error, D>,
355            T1: fidl::encoding::Encode<bool, D>,
356        > fidl::encoding::Encode<DeviceOnErrorRequest, D> for (T0, T1)
357    {
358        #[inline]
359        unsafe fn encode(
360            self,
361            encoder: &mut fidl::encoding::Encoder<'_, D>,
362            offset: usize,
363            depth: fidl::encoding::Depth,
364        ) -> fidl::Result<()> {
365            encoder.debug_check_bounds::<DeviceOnErrorRequest>(offset);
366            // Zero out padding regions. There's no need to apply masks
367            // because the unmasked parts will be overwritten by fields.
368            unsafe {
369                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
370                (ptr as *mut u32).write_unaligned(0);
371            }
372            // Write the fields.
373            self.0.encode(encoder, offset + 0, depth)?;
374            self.1.encode(encoder, offset + 4, depth)?;
375            Ok(())
376        }
377    }
378
379    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceOnErrorRequest {
380        #[inline(always)]
381        fn new_empty() -> Self {
382            Self { error: fidl::new_empty!(Error, D), did_close: fidl::new_empty!(bool, D) }
383        }
384
385        #[inline]
386        unsafe fn decode(
387            &mut self,
388            decoder: &mut fidl::encoding::Decoder<'_, D>,
389            offset: usize,
390            _depth: fidl::encoding::Depth,
391        ) -> fidl::Result<()> {
392            decoder.debug_check_bounds::<Self>(offset);
393            // Verify that padding bytes are zero.
394            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
395            let padval = unsafe { (ptr as *const u32).read_unaligned() };
396            let mask = 0xffffff00u32;
397            let maskedval = padval & mask;
398            if maskedval != 0 {
399                return Err(fidl::Error::NonZeroPadding {
400                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
401                });
402            }
403            fidl::decode!(Error, D, &mut self.error, decoder, offset + 0, _depth)?;
404            fidl::decode!(bool, D, &mut self.did_close, decoder, offset + 4, _depth)?;
405            Ok(())
406        }
407    }
408
409    impl fidl::encoding::ValueTypeMarker for DeviceOnReadyForSendFramesRequest {
410        type Borrowed<'a> = &'a Self;
411        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
412            value
413        }
414    }
415
416    unsafe impl fidl::encoding::TypeMarker for DeviceOnReadyForSendFramesRequest {
417        type Owned = Self;
418
419        #[inline(always)]
420        fn inline_align(_context: fidl::encoding::Context) -> usize {
421            4
422        }
423
424        #[inline(always)]
425        fn inline_size(_context: fidl::encoding::Context) -> usize {
426            4
427        }
428        #[inline(always)]
429        fn encode_is_copy() -> bool {
430            true
431        }
432
433        #[inline(always)]
434        fn decode_is_copy() -> bool {
435            true
436        }
437    }
438
439    unsafe impl<D: fidl::encoding::ResourceDialect>
440        fidl::encoding::Encode<DeviceOnReadyForSendFramesRequest, D>
441        for &DeviceOnReadyForSendFramesRequest
442    {
443        #[inline]
444        unsafe fn encode(
445            self,
446            encoder: &mut fidl::encoding::Encoder<'_, D>,
447            offset: usize,
448            _depth: fidl::encoding::Depth,
449        ) -> fidl::Result<()> {
450            encoder.debug_check_bounds::<DeviceOnReadyForSendFramesRequest>(offset);
451            unsafe {
452                // Copy the object into the buffer.
453                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
454                (buf_ptr as *mut DeviceOnReadyForSendFramesRequest)
455                    .write_unaligned((self as *const DeviceOnReadyForSendFramesRequest).read());
456                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
457                // done second because the memcpy will write garbage to these bytes.
458            }
459            Ok(())
460        }
461    }
462    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
463        fidl::encoding::Encode<DeviceOnReadyForSendFramesRequest, D> for (T0,)
464    {
465        #[inline]
466        unsafe fn encode(
467            self,
468            encoder: &mut fidl::encoding::Encoder<'_, D>,
469            offset: usize,
470            depth: fidl::encoding::Depth,
471        ) -> fidl::Result<()> {
472            encoder.debug_check_bounds::<DeviceOnReadyForSendFramesRequest>(offset);
473            // Zero out padding regions. There's no need to apply masks
474            // because the unmasked parts will be overwritten by fields.
475            // Write the fields.
476            self.0.encode(encoder, offset + 0, depth)?;
477            Ok(())
478        }
479    }
480
481    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
482        for DeviceOnReadyForSendFramesRequest
483    {
484        #[inline(always)]
485        fn new_empty() -> Self {
486            Self { number_of_frames: fidl::new_empty!(u32, D) }
487        }
488
489        #[inline]
490        unsafe fn decode(
491            &mut self,
492            decoder: &mut fidl::encoding::Decoder<'_, D>,
493            offset: usize,
494            _depth: fidl::encoding::Depth,
495        ) -> fidl::Result<()> {
496            decoder.debug_check_bounds::<Self>(offset);
497            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
498            // Verify that padding bytes are zero.
499            // Copy from the buffer into the object.
500            unsafe {
501                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
502            }
503            Ok(())
504        }
505    }
506
507    impl fidl::encoding::ValueTypeMarker for DeviceOnReceiveFrameRequest {
508        type Borrowed<'a> = &'a Self;
509        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
510            value
511        }
512    }
513
514    unsafe impl fidl::encoding::TypeMarker for DeviceOnReceiveFrameRequest {
515        type Owned = Self;
516
517        #[inline(always)]
518        fn inline_align(_context: fidl::encoding::Context) -> usize {
519            8
520        }
521
522        #[inline(always)]
523        fn inline_size(_context: fidl::encoding::Context) -> usize {
524            16
525        }
526    }
527
528    unsafe impl<D: fidl::encoding::ResourceDialect>
529        fidl::encoding::Encode<DeviceOnReceiveFrameRequest, D> for &DeviceOnReceiveFrameRequest
530    {
531        #[inline]
532        unsafe fn encode(
533            self,
534            encoder: &mut fidl::encoding::Encoder<'_, D>,
535            offset: usize,
536            _depth: fidl::encoding::Depth,
537        ) -> fidl::Result<()> {
538            encoder.debug_check_bounds::<DeviceOnReceiveFrameRequest>(offset);
539            // Delegate to tuple encoding.
540            fidl::encoding::Encode::<DeviceOnReceiveFrameRequest, D>::encode(
541                (<fidl::encoding::Vector<u8, 4096> as fidl::encoding::ValueTypeMarker>::borrow(
542                    &self.data,
543                ),),
544                encoder,
545                offset,
546                _depth,
547            )
548        }
549    }
550    unsafe impl<
551            D: fidl::encoding::ResourceDialect,
552            T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 4096>, D>,
553        > fidl::encoding::Encode<DeviceOnReceiveFrameRequest, D> for (T0,)
554    {
555        #[inline]
556        unsafe fn encode(
557            self,
558            encoder: &mut fidl::encoding::Encoder<'_, D>,
559            offset: usize,
560            depth: fidl::encoding::Depth,
561        ) -> fidl::Result<()> {
562            encoder.debug_check_bounds::<DeviceOnReceiveFrameRequest>(offset);
563            // Zero out padding regions. There's no need to apply masks
564            // because the unmasked parts will be overwritten by fields.
565            // Write the fields.
566            self.0.encode(encoder, offset + 0, depth)?;
567            Ok(())
568        }
569    }
570
571    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
572        for DeviceOnReceiveFrameRequest
573    {
574        #[inline(always)]
575        fn new_empty() -> Self {
576            Self { data: fidl::new_empty!(fidl::encoding::Vector<u8, 4096>, D) }
577        }
578
579        #[inline]
580        unsafe fn decode(
581            &mut self,
582            decoder: &mut fidl::encoding::Decoder<'_, D>,
583            offset: usize,
584            _depth: fidl::encoding::Depth,
585        ) -> fidl::Result<()> {
586            decoder.debug_check_bounds::<Self>(offset);
587            // Verify that padding bytes are zero.
588            fidl::decode!(fidl::encoding::Vector<u8, 4096>, D, &mut self.data, decoder, offset + 0, _depth)?;
589            Ok(())
590        }
591    }
592
593    impl fidl::encoding::ValueTypeMarker for DeviceReadyToReceiveFramesRequest {
594        type Borrowed<'a> = &'a Self;
595        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
596            value
597        }
598    }
599
600    unsafe impl fidl::encoding::TypeMarker for DeviceReadyToReceiveFramesRequest {
601        type Owned = Self;
602
603        #[inline(always)]
604        fn inline_align(_context: fidl::encoding::Context) -> usize {
605            4
606        }
607
608        #[inline(always)]
609        fn inline_size(_context: fidl::encoding::Context) -> usize {
610            4
611        }
612        #[inline(always)]
613        fn encode_is_copy() -> bool {
614            true
615        }
616
617        #[inline(always)]
618        fn decode_is_copy() -> bool {
619            true
620        }
621    }
622
623    unsafe impl<D: fidl::encoding::ResourceDialect>
624        fidl::encoding::Encode<DeviceReadyToReceiveFramesRequest, D>
625        for &DeviceReadyToReceiveFramesRequest
626    {
627        #[inline]
628        unsafe fn encode(
629            self,
630            encoder: &mut fidl::encoding::Encoder<'_, D>,
631            offset: usize,
632            _depth: fidl::encoding::Depth,
633        ) -> fidl::Result<()> {
634            encoder.debug_check_bounds::<DeviceReadyToReceiveFramesRequest>(offset);
635            unsafe {
636                // Copy the object into the buffer.
637                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
638                (buf_ptr as *mut DeviceReadyToReceiveFramesRequest)
639                    .write_unaligned((self as *const DeviceReadyToReceiveFramesRequest).read());
640                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
641                // done second because the memcpy will write garbage to these bytes.
642            }
643            Ok(())
644        }
645    }
646    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
647        fidl::encoding::Encode<DeviceReadyToReceiveFramesRequest, D> for (T0,)
648    {
649        #[inline]
650        unsafe fn encode(
651            self,
652            encoder: &mut fidl::encoding::Encoder<'_, D>,
653            offset: usize,
654            depth: fidl::encoding::Depth,
655        ) -> fidl::Result<()> {
656            encoder.debug_check_bounds::<DeviceReadyToReceiveFramesRequest>(offset);
657            // Zero out padding regions. There's no need to apply masks
658            // because the unmasked parts will be overwritten by fields.
659            // Write the fields.
660            self.0.encode(encoder, offset + 0, depth)?;
661            Ok(())
662        }
663    }
664
665    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
666        for DeviceReadyToReceiveFramesRequest
667    {
668        #[inline(always)]
669        fn new_empty() -> Self {
670            Self { number_of_frames: fidl::new_empty!(u32, D) }
671        }
672
673        #[inline]
674        unsafe fn decode(
675            &mut self,
676            decoder: &mut fidl::encoding::Decoder<'_, D>,
677            offset: usize,
678            _depth: fidl::encoding::Depth,
679        ) -> fidl::Result<()> {
680            decoder.debug_check_bounds::<Self>(offset);
681            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
682            // Verify that padding bytes are zero.
683            // Copy from the buffer into the object.
684            unsafe {
685                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
686            }
687            Ok(())
688        }
689    }
690
691    impl fidl::encoding::ValueTypeMarker for DeviceSendFrameRequest {
692        type Borrowed<'a> = &'a Self;
693        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
694            value
695        }
696    }
697
698    unsafe impl fidl::encoding::TypeMarker for DeviceSendFrameRequest {
699        type Owned = Self;
700
701        #[inline(always)]
702        fn inline_align(_context: fidl::encoding::Context) -> usize {
703            8
704        }
705
706        #[inline(always)]
707        fn inline_size(_context: fidl::encoding::Context) -> usize {
708            16
709        }
710    }
711
712    unsafe impl<D: fidl::encoding::ResourceDialect>
713        fidl::encoding::Encode<DeviceSendFrameRequest, D> for &DeviceSendFrameRequest
714    {
715        #[inline]
716        unsafe fn encode(
717            self,
718            encoder: &mut fidl::encoding::Encoder<'_, D>,
719            offset: usize,
720            _depth: fidl::encoding::Depth,
721        ) -> fidl::Result<()> {
722            encoder.debug_check_bounds::<DeviceSendFrameRequest>(offset);
723            // Delegate to tuple encoding.
724            fidl::encoding::Encode::<DeviceSendFrameRequest, D>::encode(
725                (<fidl::encoding::Vector<u8, 4096> as fidl::encoding::ValueTypeMarker>::borrow(
726                    &self.data,
727                ),),
728                encoder,
729                offset,
730                _depth,
731            )
732        }
733    }
734    unsafe impl<
735            D: fidl::encoding::ResourceDialect,
736            T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 4096>, D>,
737        > fidl::encoding::Encode<DeviceSendFrameRequest, D> for (T0,)
738    {
739        #[inline]
740        unsafe fn encode(
741            self,
742            encoder: &mut fidl::encoding::Encoder<'_, D>,
743            offset: usize,
744            depth: fidl::encoding::Depth,
745        ) -> fidl::Result<()> {
746            encoder.debug_check_bounds::<DeviceSendFrameRequest>(offset);
747            // Zero out padding regions. There's no need to apply masks
748            // because the unmasked parts will be overwritten by fields.
749            // Write the fields.
750            self.0.encode(encoder, offset + 0, depth)?;
751            Ok(())
752        }
753    }
754
755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
756        for DeviceSendFrameRequest
757    {
758        #[inline(always)]
759        fn new_empty() -> Self {
760            Self { data: fidl::new_empty!(fidl::encoding::Vector<u8, 4096>, D) }
761        }
762
763        #[inline]
764        unsafe fn decode(
765            &mut self,
766            decoder: &mut fidl::encoding::Decoder<'_, D>,
767            offset: usize,
768            _depth: fidl::encoding::Depth,
769        ) -> fidl::Result<()> {
770            decoder.debug_check_bounds::<Self>(offset);
771            // Verify that padding bytes are zero.
772            fidl::decode!(fidl::encoding::Vector<u8, 4096>, D, &mut self.data, decoder, offset + 0, _depth)?;
773            Ok(())
774        }
775    }
776}