fidl_fuchsia_hardware_block__common/
fidl_fuchsia_hardware_block__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 MAPPINGS_BATCH_SIZE: u8 = 64;
12
13/// The maximum value for a transfer size, identifying that there
14/// effectively exists no maximum for a single operation.
15pub const MAX_TRANSFER_UNBOUNDED: u32 = 4294967295;
16
17/// Value reserved for "invalid" VmoId. Will never be allocated by the server,
18/// and may be utilized as a local value for an unallocated ID.
19pub const VMOID_INVALID: u16 = 0;
20
21bitflags! {
22    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
23    pub struct Flag: u32 {
24        /// All writes to the block device will fail.
25        const READONLY = 1;
26        /// The block device may be removed from the device during operation.
27        const REMOVABLE = 2;
28        /// The device has a bootdata partition map.
29        const BOOTPART = 4;
30        /// The device provides trim support.
31        const TRIM_SUPPORT = 8;
32        /// The device provides fua support.
33        const FUA_SUPPORT = 16;
34    }
35}
36
37impl Flag {}
38
39#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct BlockGetStatsRequest {
41    pub clear: bool,
42}
43
44impl fidl::Persistable for BlockGetStatsRequest {}
45
46#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
47pub struct BlockInfo {
48    /// The number of blocks in this block device.
49    pub block_count: u64,
50    /// The size of a single block.
51    pub block_size: u32,
52    /// The maximum size, in bytes, of a transfer.
53    /// Set to MAX_TRANSFER_UNBOUNDED if no such maximum exists.
54    pub max_transfer_size: u32,
55    /// Identifiers about the device.
56    pub flags: Flag,
57}
58
59impl fidl::Persistable for BlockInfo {}
60
61/// Describes a re-mapping of a block range.  See OffsetMap.
62/// Note that all fields are in *blocks*, not bytes.
63#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
64#[repr(C)]
65pub struct BlockOffsetMapping {
66    pub source_block_offset: u64,
67    pub target_block_offset: u64,
68    pub length: u64,
69}
70
71impl fidl::Persistable for BlockOffsetMapping {}
72
73/// Returns stats about the block device on the provided buffer. If `clear` is true, the
74/// operation counters will be cleared.
75#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
76#[repr(C)]
77pub struct BlockStats {
78    /// Stats about block read operations from the device.
79    pub read: OperationStats,
80    /// Stats about block write operations to the device.
81    pub write: OperationStats,
82    /// Stats about TRIM commands issued to the device.
83    pub trim: OperationStats,
84    /// Stats about flush commands issued to the device.
85    pub flush: OperationStats,
86}
87
88impl fidl::Persistable for BlockStats {}
89
90#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct BlockGetInfoResponse {
92    pub info: BlockInfo,
93}
94
95impl fidl::Persistable for BlockGetInfoResponse {}
96
97#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
98#[repr(C)]
99pub struct BlockGetStatsResponse {
100    pub stats: BlockStats,
101}
102
103impl fidl::Persistable for BlockGetStatsResponse {}
104
105#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
106#[repr(C)]
107pub struct FtlFormatResponse {
108    pub status: i32,
109}
110
111impl fidl::Persistable for FtlFormatResponse {}
112
113#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
114#[repr(C)]
115pub struct OffsetMapQueryRequest {
116    pub source_block_offset: u64,
117    pub length: u64,
118}
119
120impl fidl::Persistable for OffsetMapQueryRequest {}
121
122#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123pub struct OffsetMapQueryResponse {
124    pub mappings: Vec<BlockOffsetMapping>,
125}
126
127impl fidl::Persistable for OffsetMapQueryResponse {}
128
129/// Helper struct to track device requests grouped by successful versus failed requests.
130#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
131#[repr(C)]
132pub struct OperationStats {
133    /// Stats for successful requests.
134    pub success: RequestStats,
135    /// Stats for failed requests.
136    pub failure: RequestStats,
137}
138
139impl fidl::Persistable for OperationStats {}
140
141/// Stats captured for specific block requests. Unless specified otherwise, time units are in
142/// nanoseconds and data transferred is in bytes
143#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
144#[repr(C)]
145pub struct RequestStats {
146    /// Minimum time taken by a request to be served.
147    pub minimum_latency: u64,
148    /// Maximum time taken by a request to be served.
149    pub maximum_latency: u64,
150    /// Total time spent to serve requests.
151    pub total_time_spent: u64,
152    /// Total number of calls.
153    pub total_calls: u64,
154    /// bytes_transferred represents a specific quantity to the operation being measured. It has
155    /// special meaning for success vs failed calls.
156    /// On success:
157    ///    Partitally succeeded calls, bytes fetched is less than bytes requested,
158    ///    can be considered as successful. To keep latency and time_spent numbers
159    ///    accurate, on success, bytes transferred is number bytes returned to
160    ///    caller. It is NOT the number of bytes fetched from underlying subsystem
161    ///    and it is NOT number of bytes requested by the caller.
162    /// On failure:
163    ///    On failure, bytes_transferred is the number of bytes requested by the caller.
164    pub bytes_transferred: u64,
165}
166
167impl fidl::Persistable for RequestStats {}
168
169#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
170#[repr(C)]
171pub struct SessionAttachVmoResponse {
172    pub vmoid: VmoId,
173}
174
175impl fidl::Persistable for SessionAttachVmoResponse {}
176
177#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
178#[repr(C)]
179pub struct VmoId {
180    pub id: u16,
181}
182
183impl fidl::Persistable for VmoId {}
184
185mod internal {
186    use super::*;
187    unsafe impl fidl::encoding::TypeMarker for Flag {
188        type Owned = Self;
189
190        #[inline(always)]
191        fn inline_align(_context: fidl::encoding::Context) -> usize {
192            4
193        }
194
195        #[inline(always)]
196        fn inline_size(_context: fidl::encoding::Context) -> usize {
197            4
198        }
199    }
200
201    impl fidl::encoding::ValueTypeMarker for Flag {
202        type Borrowed<'a> = Self;
203        #[inline(always)]
204        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
205            *value
206        }
207    }
208
209    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Flag {
210        #[inline]
211        unsafe fn encode(
212            self,
213            encoder: &mut fidl::encoding::Encoder<'_, D>,
214            offset: usize,
215            _depth: fidl::encoding::Depth,
216        ) -> fidl::Result<()> {
217            encoder.debug_check_bounds::<Self>(offset);
218            if self.bits() & Self::all().bits() != self.bits() {
219                return Err(fidl::Error::InvalidBitsValue);
220            }
221            encoder.write_num(self.bits(), offset);
222            Ok(())
223        }
224    }
225
226    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Flag {
227        #[inline(always)]
228        fn new_empty() -> Self {
229            Self::empty()
230        }
231
232        #[inline]
233        unsafe fn decode(
234            &mut self,
235            decoder: &mut fidl::encoding::Decoder<'_, D>,
236            offset: usize,
237            _depth: fidl::encoding::Depth,
238        ) -> fidl::Result<()> {
239            decoder.debug_check_bounds::<Self>(offset);
240            let prim = decoder.read_num::<u32>(offset);
241            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
242            Ok(())
243        }
244    }
245
246    impl fidl::encoding::ValueTypeMarker for BlockGetStatsRequest {
247        type Borrowed<'a> = &'a Self;
248        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
249            value
250        }
251    }
252
253    unsafe impl fidl::encoding::TypeMarker for BlockGetStatsRequest {
254        type Owned = Self;
255
256        #[inline(always)]
257        fn inline_align(_context: fidl::encoding::Context) -> usize {
258            1
259        }
260
261        #[inline(always)]
262        fn inline_size(_context: fidl::encoding::Context) -> usize {
263            1
264        }
265    }
266
267    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockGetStatsRequest, D>
268        for &BlockGetStatsRequest
269    {
270        #[inline]
271        unsafe fn encode(
272            self,
273            encoder: &mut fidl::encoding::Encoder<'_, D>,
274            offset: usize,
275            _depth: fidl::encoding::Depth,
276        ) -> fidl::Result<()> {
277            encoder.debug_check_bounds::<BlockGetStatsRequest>(offset);
278            // Delegate to tuple encoding.
279            fidl::encoding::Encode::<BlockGetStatsRequest, D>::encode(
280                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.clear),),
281                encoder,
282                offset,
283                _depth,
284            )
285        }
286    }
287    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
288        fidl::encoding::Encode<BlockGetStatsRequest, D> for (T0,)
289    {
290        #[inline]
291        unsafe fn encode(
292            self,
293            encoder: &mut fidl::encoding::Encoder<'_, D>,
294            offset: usize,
295            depth: fidl::encoding::Depth,
296        ) -> fidl::Result<()> {
297            encoder.debug_check_bounds::<BlockGetStatsRequest>(offset);
298            // Zero out padding regions. There's no need to apply masks
299            // because the unmasked parts will be overwritten by fields.
300            // Write the fields.
301            self.0.encode(encoder, offset + 0, depth)?;
302            Ok(())
303        }
304    }
305
306    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockGetStatsRequest {
307        #[inline(always)]
308        fn new_empty() -> Self {
309            Self { clear: fidl::new_empty!(bool, D) }
310        }
311
312        #[inline]
313        unsafe fn decode(
314            &mut self,
315            decoder: &mut fidl::encoding::Decoder<'_, D>,
316            offset: usize,
317            _depth: fidl::encoding::Depth,
318        ) -> fidl::Result<()> {
319            decoder.debug_check_bounds::<Self>(offset);
320            // Verify that padding bytes are zero.
321            fidl::decode!(bool, D, &mut self.clear, decoder, offset + 0, _depth)?;
322            Ok(())
323        }
324    }
325
326    impl fidl::encoding::ValueTypeMarker for BlockInfo {
327        type Borrowed<'a> = &'a Self;
328        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
329            value
330        }
331    }
332
333    unsafe impl fidl::encoding::TypeMarker for BlockInfo {
334        type Owned = Self;
335
336        #[inline(always)]
337        fn inline_align(_context: fidl::encoding::Context) -> usize {
338            8
339        }
340
341        #[inline(always)]
342        fn inline_size(_context: fidl::encoding::Context) -> usize {
343            24
344        }
345    }
346
347    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockInfo, D>
348        for &BlockInfo
349    {
350        #[inline]
351        unsafe fn encode(
352            self,
353            encoder: &mut fidl::encoding::Encoder<'_, D>,
354            offset: usize,
355            _depth: fidl::encoding::Depth,
356        ) -> fidl::Result<()> {
357            encoder.debug_check_bounds::<BlockInfo>(offset);
358            // Delegate to tuple encoding.
359            fidl::encoding::Encode::<BlockInfo, D>::encode(
360                (
361                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_count),
362                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.block_size),
363                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_transfer_size),
364                    <Flag as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
365                ),
366                encoder,
367                offset,
368                _depth,
369            )
370        }
371    }
372    unsafe impl<
373            D: fidl::encoding::ResourceDialect,
374            T0: fidl::encoding::Encode<u64, D>,
375            T1: fidl::encoding::Encode<u32, D>,
376            T2: fidl::encoding::Encode<u32, D>,
377            T3: fidl::encoding::Encode<Flag, D>,
378        > fidl::encoding::Encode<BlockInfo, D> for (T0, T1, T2, T3)
379    {
380        #[inline]
381        unsafe fn encode(
382            self,
383            encoder: &mut fidl::encoding::Encoder<'_, D>,
384            offset: usize,
385            depth: fidl::encoding::Depth,
386        ) -> fidl::Result<()> {
387            encoder.debug_check_bounds::<BlockInfo>(offset);
388            // Zero out padding regions. There's no need to apply masks
389            // because the unmasked parts will be overwritten by fields.
390            unsafe {
391                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
392                (ptr as *mut u64).write_unaligned(0);
393            }
394            // Write the fields.
395            self.0.encode(encoder, offset + 0, depth)?;
396            self.1.encode(encoder, offset + 8, depth)?;
397            self.2.encode(encoder, offset + 12, depth)?;
398            self.3.encode(encoder, offset + 16, depth)?;
399            Ok(())
400        }
401    }
402
403    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockInfo {
404        #[inline(always)]
405        fn new_empty() -> Self {
406            Self {
407                block_count: fidl::new_empty!(u64, D),
408                block_size: fidl::new_empty!(u32, D),
409                max_transfer_size: fidl::new_empty!(u32, D),
410                flags: fidl::new_empty!(Flag, D),
411            }
412        }
413
414        #[inline]
415        unsafe fn decode(
416            &mut self,
417            decoder: &mut fidl::encoding::Decoder<'_, D>,
418            offset: usize,
419            _depth: fidl::encoding::Depth,
420        ) -> fidl::Result<()> {
421            decoder.debug_check_bounds::<Self>(offset);
422            // Verify that padding bytes are zero.
423            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
424            let padval = unsafe { (ptr as *const u64).read_unaligned() };
425            let mask = 0xffffffff00000000u64;
426            let maskedval = padval & mask;
427            if maskedval != 0 {
428                return Err(fidl::Error::NonZeroPadding {
429                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
430                });
431            }
432            fidl::decode!(u64, D, &mut self.block_count, decoder, offset + 0, _depth)?;
433            fidl::decode!(u32, D, &mut self.block_size, decoder, offset + 8, _depth)?;
434            fidl::decode!(u32, D, &mut self.max_transfer_size, decoder, offset + 12, _depth)?;
435            fidl::decode!(Flag, D, &mut self.flags, decoder, offset + 16, _depth)?;
436            Ok(())
437        }
438    }
439
440    impl fidl::encoding::ValueTypeMarker for BlockOffsetMapping {
441        type Borrowed<'a> = &'a Self;
442        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
443            value
444        }
445    }
446
447    unsafe impl fidl::encoding::TypeMarker for BlockOffsetMapping {
448        type Owned = Self;
449
450        #[inline(always)]
451        fn inline_align(_context: fidl::encoding::Context) -> usize {
452            8
453        }
454
455        #[inline(always)]
456        fn inline_size(_context: fidl::encoding::Context) -> usize {
457            24
458        }
459        #[inline(always)]
460        fn encode_is_copy() -> bool {
461            true
462        }
463
464        #[inline(always)]
465        fn decode_is_copy() -> bool {
466            true
467        }
468    }
469
470    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockOffsetMapping, D>
471        for &BlockOffsetMapping
472    {
473        #[inline]
474        unsafe fn encode(
475            self,
476            encoder: &mut fidl::encoding::Encoder<'_, D>,
477            offset: usize,
478            _depth: fidl::encoding::Depth,
479        ) -> fidl::Result<()> {
480            encoder.debug_check_bounds::<BlockOffsetMapping>(offset);
481            unsafe {
482                // Copy the object into the buffer.
483                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
484                (buf_ptr as *mut BlockOffsetMapping)
485                    .write_unaligned((self as *const BlockOffsetMapping).read());
486                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
487                // done second because the memcpy will write garbage to these bytes.
488            }
489            Ok(())
490        }
491    }
492    unsafe impl<
493            D: fidl::encoding::ResourceDialect,
494            T0: fidl::encoding::Encode<u64, D>,
495            T1: fidl::encoding::Encode<u64, D>,
496            T2: fidl::encoding::Encode<u64, D>,
497        > fidl::encoding::Encode<BlockOffsetMapping, D> for (T0, T1, T2)
498    {
499        #[inline]
500        unsafe fn encode(
501            self,
502            encoder: &mut fidl::encoding::Encoder<'_, D>,
503            offset: usize,
504            depth: fidl::encoding::Depth,
505        ) -> fidl::Result<()> {
506            encoder.debug_check_bounds::<BlockOffsetMapping>(offset);
507            // Zero out padding regions. There's no need to apply masks
508            // because the unmasked parts will be overwritten by fields.
509            // Write the fields.
510            self.0.encode(encoder, offset + 0, depth)?;
511            self.1.encode(encoder, offset + 8, depth)?;
512            self.2.encode(encoder, offset + 16, depth)?;
513            Ok(())
514        }
515    }
516
517    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockOffsetMapping {
518        #[inline(always)]
519        fn new_empty() -> Self {
520            Self {
521                source_block_offset: fidl::new_empty!(u64, D),
522                target_block_offset: fidl::new_empty!(u64, D),
523                length: fidl::new_empty!(u64, D),
524            }
525        }
526
527        #[inline]
528        unsafe fn decode(
529            &mut self,
530            decoder: &mut fidl::encoding::Decoder<'_, D>,
531            offset: usize,
532            _depth: fidl::encoding::Depth,
533        ) -> fidl::Result<()> {
534            decoder.debug_check_bounds::<Self>(offset);
535            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
536            // Verify that padding bytes are zero.
537            // Copy from the buffer into the object.
538            unsafe {
539                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
540            }
541            Ok(())
542        }
543    }
544
545    impl fidl::encoding::ValueTypeMarker for BlockStats {
546        type Borrowed<'a> = &'a Self;
547        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
548            value
549        }
550    }
551
552    unsafe impl fidl::encoding::TypeMarker for BlockStats {
553        type Owned = Self;
554
555        #[inline(always)]
556        fn inline_align(_context: fidl::encoding::Context) -> usize {
557            8
558        }
559
560        #[inline(always)]
561        fn inline_size(_context: fidl::encoding::Context) -> usize {
562            320
563        }
564        #[inline(always)]
565        fn encode_is_copy() -> bool {
566            true
567        }
568
569        #[inline(always)]
570        fn decode_is_copy() -> bool {
571            true
572        }
573    }
574
575    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockStats, D>
576        for &BlockStats
577    {
578        #[inline]
579        unsafe fn encode(
580            self,
581            encoder: &mut fidl::encoding::Encoder<'_, D>,
582            offset: usize,
583            _depth: fidl::encoding::Depth,
584        ) -> fidl::Result<()> {
585            encoder.debug_check_bounds::<BlockStats>(offset);
586            unsafe {
587                // Copy the object into the buffer.
588                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
589                (buf_ptr as *mut BlockStats).write_unaligned((self as *const BlockStats).read());
590                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
591                // done second because the memcpy will write garbage to these bytes.
592            }
593            Ok(())
594        }
595    }
596    unsafe impl<
597            D: fidl::encoding::ResourceDialect,
598            T0: fidl::encoding::Encode<OperationStats, D>,
599            T1: fidl::encoding::Encode<OperationStats, D>,
600            T2: fidl::encoding::Encode<OperationStats, D>,
601            T3: fidl::encoding::Encode<OperationStats, D>,
602        > fidl::encoding::Encode<BlockStats, D> for (T0, T1, T2, T3)
603    {
604        #[inline]
605        unsafe fn encode(
606            self,
607            encoder: &mut fidl::encoding::Encoder<'_, D>,
608            offset: usize,
609            depth: fidl::encoding::Depth,
610        ) -> fidl::Result<()> {
611            encoder.debug_check_bounds::<BlockStats>(offset);
612            // Zero out padding regions. There's no need to apply masks
613            // because the unmasked parts will be overwritten by fields.
614            // Write the fields.
615            self.0.encode(encoder, offset + 0, depth)?;
616            self.1.encode(encoder, offset + 80, depth)?;
617            self.2.encode(encoder, offset + 160, depth)?;
618            self.3.encode(encoder, offset + 240, depth)?;
619            Ok(())
620        }
621    }
622
623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockStats {
624        #[inline(always)]
625        fn new_empty() -> Self {
626            Self {
627                read: fidl::new_empty!(OperationStats, D),
628                write: fidl::new_empty!(OperationStats, D),
629                trim: fidl::new_empty!(OperationStats, D),
630                flush: fidl::new_empty!(OperationStats, D),
631            }
632        }
633
634        #[inline]
635        unsafe fn decode(
636            &mut self,
637            decoder: &mut fidl::encoding::Decoder<'_, D>,
638            offset: usize,
639            _depth: fidl::encoding::Depth,
640        ) -> fidl::Result<()> {
641            decoder.debug_check_bounds::<Self>(offset);
642            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
643            // Verify that padding bytes are zero.
644            // Copy from the buffer into the object.
645            unsafe {
646                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 320);
647            }
648            Ok(())
649        }
650    }
651
652    impl fidl::encoding::ValueTypeMarker for BlockGetInfoResponse {
653        type Borrowed<'a> = &'a Self;
654        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
655            value
656        }
657    }
658
659    unsafe impl fidl::encoding::TypeMarker for BlockGetInfoResponse {
660        type Owned = Self;
661
662        #[inline(always)]
663        fn inline_align(_context: fidl::encoding::Context) -> usize {
664            8
665        }
666
667        #[inline(always)]
668        fn inline_size(_context: fidl::encoding::Context) -> usize {
669            24
670        }
671    }
672
673    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockGetInfoResponse, D>
674        for &BlockGetInfoResponse
675    {
676        #[inline]
677        unsafe fn encode(
678            self,
679            encoder: &mut fidl::encoding::Encoder<'_, D>,
680            offset: usize,
681            _depth: fidl::encoding::Depth,
682        ) -> fidl::Result<()> {
683            encoder.debug_check_bounds::<BlockGetInfoResponse>(offset);
684            // Delegate to tuple encoding.
685            fidl::encoding::Encode::<BlockGetInfoResponse, D>::encode(
686                (<BlockInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
687                encoder,
688                offset,
689                _depth,
690            )
691        }
692    }
693    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlockInfo, D>>
694        fidl::encoding::Encode<BlockGetInfoResponse, D> for (T0,)
695    {
696        #[inline]
697        unsafe fn encode(
698            self,
699            encoder: &mut fidl::encoding::Encoder<'_, D>,
700            offset: usize,
701            depth: fidl::encoding::Depth,
702        ) -> fidl::Result<()> {
703            encoder.debug_check_bounds::<BlockGetInfoResponse>(offset);
704            // Zero out padding regions. There's no need to apply masks
705            // because the unmasked parts will be overwritten by fields.
706            // Write the fields.
707            self.0.encode(encoder, offset + 0, depth)?;
708            Ok(())
709        }
710    }
711
712    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockGetInfoResponse {
713        #[inline(always)]
714        fn new_empty() -> Self {
715            Self { info: fidl::new_empty!(BlockInfo, D) }
716        }
717
718        #[inline]
719        unsafe fn decode(
720            &mut self,
721            decoder: &mut fidl::encoding::Decoder<'_, D>,
722            offset: usize,
723            _depth: fidl::encoding::Depth,
724        ) -> fidl::Result<()> {
725            decoder.debug_check_bounds::<Self>(offset);
726            // Verify that padding bytes are zero.
727            fidl::decode!(BlockInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
728            Ok(())
729        }
730    }
731
732    impl fidl::encoding::ValueTypeMarker for BlockGetStatsResponse {
733        type Borrowed<'a> = &'a Self;
734        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
735            value
736        }
737    }
738
739    unsafe impl fidl::encoding::TypeMarker for BlockGetStatsResponse {
740        type Owned = Self;
741
742        #[inline(always)]
743        fn inline_align(_context: fidl::encoding::Context) -> usize {
744            8
745        }
746
747        #[inline(always)]
748        fn inline_size(_context: fidl::encoding::Context) -> usize {
749            320
750        }
751        #[inline(always)]
752        fn encode_is_copy() -> bool {
753            true
754        }
755
756        #[inline(always)]
757        fn decode_is_copy() -> bool {
758            true
759        }
760    }
761
762    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BlockGetStatsResponse, D>
763        for &BlockGetStatsResponse
764    {
765        #[inline]
766        unsafe fn encode(
767            self,
768            encoder: &mut fidl::encoding::Encoder<'_, D>,
769            offset: usize,
770            _depth: fidl::encoding::Depth,
771        ) -> fidl::Result<()> {
772            encoder.debug_check_bounds::<BlockGetStatsResponse>(offset);
773            unsafe {
774                // Copy the object into the buffer.
775                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
776                (buf_ptr as *mut BlockGetStatsResponse)
777                    .write_unaligned((self as *const BlockGetStatsResponse).read());
778                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
779                // done second because the memcpy will write garbage to these bytes.
780            }
781            Ok(())
782        }
783    }
784    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<BlockStats, D>>
785        fidl::encoding::Encode<BlockGetStatsResponse, D> for (T0,)
786    {
787        #[inline]
788        unsafe fn encode(
789            self,
790            encoder: &mut fidl::encoding::Encoder<'_, D>,
791            offset: usize,
792            depth: fidl::encoding::Depth,
793        ) -> fidl::Result<()> {
794            encoder.debug_check_bounds::<BlockGetStatsResponse>(offset);
795            // Zero out padding regions. There's no need to apply masks
796            // because the unmasked parts will be overwritten by fields.
797            // Write the fields.
798            self.0.encode(encoder, offset + 0, depth)?;
799            Ok(())
800        }
801    }
802
803    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BlockGetStatsResponse {
804        #[inline(always)]
805        fn new_empty() -> Self {
806            Self { stats: fidl::new_empty!(BlockStats, D) }
807        }
808
809        #[inline]
810        unsafe fn decode(
811            &mut self,
812            decoder: &mut fidl::encoding::Decoder<'_, D>,
813            offset: usize,
814            _depth: fidl::encoding::Depth,
815        ) -> fidl::Result<()> {
816            decoder.debug_check_bounds::<Self>(offset);
817            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
818            // Verify that padding bytes are zero.
819            // Copy from the buffer into the object.
820            unsafe {
821                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 320);
822            }
823            Ok(())
824        }
825    }
826
827    impl fidl::encoding::ValueTypeMarker for FtlFormatResponse {
828        type Borrowed<'a> = &'a Self;
829        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
830            value
831        }
832    }
833
834    unsafe impl fidl::encoding::TypeMarker for FtlFormatResponse {
835        type Owned = Self;
836
837        #[inline(always)]
838        fn inline_align(_context: fidl::encoding::Context) -> usize {
839            4
840        }
841
842        #[inline(always)]
843        fn inline_size(_context: fidl::encoding::Context) -> usize {
844            4
845        }
846        #[inline(always)]
847        fn encode_is_copy() -> bool {
848            true
849        }
850
851        #[inline(always)]
852        fn decode_is_copy() -> bool {
853            true
854        }
855    }
856
857    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FtlFormatResponse, D>
858        for &FtlFormatResponse
859    {
860        #[inline]
861        unsafe fn encode(
862            self,
863            encoder: &mut fidl::encoding::Encoder<'_, D>,
864            offset: usize,
865            _depth: fidl::encoding::Depth,
866        ) -> fidl::Result<()> {
867            encoder.debug_check_bounds::<FtlFormatResponse>(offset);
868            unsafe {
869                // Copy the object into the buffer.
870                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
871                (buf_ptr as *mut FtlFormatResponse)
872                    .write_unaligned((self as *const FtlFormatResponse).read());
873                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
874                // done second because the memcpy will write garbage to these bytes.
875            }
876            Ok(())
877        }
878    }
879    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
880        fidl::encoding::Encode<FtlFormatResponse, D> for (T0,)
881    {
882        #[inline]
883        unsafe fn encode(
884            self,
885            encoder: &mut fidl::encoding::Encoder<'_, D>,
886            offset: usize,
887            depth: fidl::encoding::Depth,
888        ) -> fidl::Result<()> {
889            encoder.debug_check_bounds::<FtlFormatResponse>(offset);
890            // Zero out padding regions. There's no need to apply masks
891            // because the unmasked parts will be overwritten by fields.
892            // Write the fields.
893            self.0.encode(encoder, offset + 0, depth)?;
894            Ok(())
895        }
896    }
897
898    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FtlFormatResponse {
899        #[inline(always)]
900        fn new_empty() -> Self {
901            Self { status: fidl::new_empty!(i32, D) }
902        }
903
904        #[inline]
905        unsafe fn decode(
906            &mut self,
907            decoder: &mut fidl::encoding::Decoder<'_, D>,
908            offset: usize,
909            _depth: fidl::encoding::Depth,
910        ) -> fidl::Result<()> {
911            decoder.debug_check_bounds::<Self>(offset);
912            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
913            // Verify that padding bytes are zero.
914            // Copy from the buffer into the object.
915            unsafe {
916                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
917            }
918            Ok(())
919        }
920    }
921
922    impl fidl::encoding::ValueTypeMarker for OffsetMapQueryRequest {
923        type Borrowed<'a> = &'a Self;
924        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
925            value
926        }
927    }
928
929    unsafe impl fidl::encoding::TypeMarker for OffsetMapQueryRequest {
930        type Owned = Self;
931
932        #[inline(always)]
933        fn inline_align(_context: fidl::encoding::Context) -> usize {
934            8
935        }
936
937        #[inline(always)]
938        fn inline_size(_context: fidl::encoding::Context) -> usize {
939            16
940        }
941        #[inline(always)]
942        fn encode_is_copy() -> bool {
943            true
944        }
945
946        #[inline(always)]
947        fn decode_is_copy() -> bool {
948            true
949        }
950    }
951
952    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OffsetMapQueryRequest, D>
953        for &OffsetMapQueryRequest
954    {
955        #[inline]
956        unsafe fn encode(
957            self,
958            encoder: &mut fidl::encoding::Encoder<'_, D>,
959            offset: usize,
960            _depth: fidl::encoding::Depth,
961        ) -> fidl::Result<()> {
962            encoder.debug_check_bounds::<OffsetMapQueryRequest>(offset);
963            unsafe {
964                // Copy the object into the buffer.
965                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
966                (buf_ptr as *mut OffsetMapQueryRequest)
967                    .write_unaligned((self as *const OffsetMapQueryRequest).read());
968                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
969                // done second because the memcpy will write garbage to these bytes.
970            }
971            Ok(())
972        }
973    }
974    unsafe impl<
975            D: fidl::encoding::ResourceDialect,
976            T0: fidl::encoding::Encode<u64, D>,
977            T1: fidl::encoding::Encode<u64, D>,
978        > fidl::encoding::Encode<OffsetMapQueryRequest, D> for (T0, T1)
979    {
980        #[inline]
981        unsafe fn encode(
982            self,
983            encoder: &mut fidl::encoding::Encoder<'_, D>,
984            offset: usize,
985            depth: fidl::encoding::Depth,
986        ) -> fidl::Result<()> {
987            encoder.debug_check_bounds::<OffsetMapQueryRequest>(offset);
988            // Zero out padding regions. There's no need to apply masks
989            // because the unmasked parts will be overwritten by fields.
990            // Write the fields.
991            self.0.encode(encoder, offset + 0, depth)?;
992            self.1.encode(encoder, offset + 8, depth)?;
993            Ok(())
994        }
995    }
996
997    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OffsetMapQueryRequest {
998        #[inline(always)]
999        fn new_empty() -> Self {
1000            Self { source_block_offset: fidl::new_empty!(u64, D), length: fidl::new_empty!(u64, D) }
1001        }
1002
1003        #[inline]
1004        unsafe fn decode(
1005            &mut self,
1006            decoder: &mut fidl::encoding::Decoder<'_, D>,
1007            offset: usize,
1008            _depth: fidl::encoding::Depth,
1009        ) -> fidl::Result<()> {
1010            decoder.debug_check_bounds::<Self>(offset);
1011            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1012            // Verify that padding bytes are zero.
1013            // Copy from the buffer into the object.
1014            unsafe {
1015                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1016            }
1017            Ok(())
1018        }
1019    }
1020
1021    impl fidl::encoding::ValueTypeMarker for OffsetMapQueryResponse {
1022        type Borrowed<'a> = &'a Self;
1023        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1024            value
1025        }
1026    }
1027
1028    unsafe impl fidl::encoding::TypeMarker for OffsetMapQueryResponse {
1029        type Owned = Self;
1030
1031        #[inline(always)]
1032        fn inline_align(_context: fidl::encoding::Context) -> usize {
1033            8
1034        }
1035
1036        #[inline(always)]
1037        fn inline_size(_context: fidl::encoding::Context) -> usize {
1038            16
1039        }
1040    }
1041
1042    unsafe impl<D: fidl::encoding::ResourceDialect>
1043        fidl::encoding::Encode<OffsetMapQueryResponse, D> for &OffsetMapQueryResponse
1044    {
1045        #[inline]
1046        unsafe fn encode(
1047            self,
1048            encoder: &mut fidl::encoding::Encoder<'_, D>,
1049            offset: usize,
1050            _depth: fidl::encoding::Depth,
1051        ) -> fidl::Result<()> {
1052            encoder.debug_check_bounds::<OffsetMapQueryResponse>(offset);
1053            // Delegate to tuple encoding.
1054            fidl::encoding::Encode::<OffsetMapQueryResponse, D>::encode(
1055                (
1056                    <fidl::encoding::Vector<BlockOffsetMapping, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.mappings),
1057                ),
1058                encoder, offset, _depth
1059            )
1060        }
1061    }
1062    unsafe impl<
1063            D: fidl::encoding::ResourceDialect,
1064            T0: fidl::encoding::Encode<fidl::encoding::Vector<BlockOffsetMapping, 64>, D>,
1065        > fidl::encoding::Encode<OffsetMapQueryResponse, D> for (T0,)
1066    {
1067        #[inline]
1068        unsafe fn encode(
1069            self,
1070            encoder: &mut fidl::encoding::Encoder<'_, D>,
1071            offset: usize,
1072            depth: fidl::encoding::Depth,
1073        ) -> fidl::Result<()> {
1074            encoder.debug_check_bounds::<OffsetMapQueryResponse>(offset);
1075            // Zero out padding regions. There's no need to apply masks
1076            // because the unmasked parts will be overwritten by fields.
1077            // Write the fields.
1078            self.0.encode(encoder, offset + 0, depth)?;
1079            Ok(())
1080        }
1081    }
1082
1083    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1084        for OffsetMapQueryResponse
1085    {
1086        #[inline(always)]
1087        fn new_empty() -> Self {
1088            Self { mappings: fidl::new_empty!(fidl::encoding::Vector<BlockOffsetMapping, 64>, D) }
1089        }
1090
1091        #[inline]
1092        unsafe fn decode(
1093            &mut self,
1094            decoder: &mut fidl::encoding::Decoder<'_, D>,
1095            offset: usize,
1096            _depth: fidl::encoding::Depth,
1097        ) -> fidl::Result<()> {
1098            decoder.debug_check_bounds::<Self>(offset);
1099            // Verify that padding bytes are zero.
1100            fidl::decode!(fidl::encoding::Vector<BlockOffsetMapping, 64>, D, &mut self.mappings, decoder, offset + 0, _depth)?;
1101            Ok(())
1102        }
1103    }
1104
1105    impl fidl::encoding::ValueTypeMarker for OperationStats {
1106        type Borrowed<'a> = &'a Self;
1107        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1108            value
1109        }
1110    }
1111
1112    unsafe impl fidl::encoding::TypeMarker for OperationStats {
1113        type Owned = Self;
1114
1115        #[inline(always)]
1116        fn inline_align(_context: fidl::encoding::Context) -> usize {
1117            8
1118        }
1119
1120        #[inline(always)]
1121        fn inline_size(_context: fidl::encoding::Context) -> usize {
1122            80
1123        }
1124        #[inline(always)]
1125        fn encode_is_copy() -> bool {
1126            true
1127        }
1128
1129        #[inline(always)]
1130        fn decode_is_copy() -> bool {
1131            true
1132        }
1133    }
1134
1135    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OperationStats, D>
1136        for &OperationStats
1137    {
1138        #[inline]
1139        unsafe fn encode(
1140            self,
1141            encoder: &mut fidl::encoding::Encoder<'_, D>,
1142            offset: usize,
1143            _depth: fidl::encoding::Depth,
1144        ) -> fidl::Result<()> {
1145            encoder.debug_check_bounds::<OperationStats>(offset);
1146            unsafe {
1147                // Copy the object into the buffer.
1148                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1149                (buf_ptr as *mut OperationStats)
1150                    .write_unaligned((self as *const OperationStats).read());
1151                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1152                // done second because the memcpy will write garbage to these bytes.
1153            }
1154            Ok(())
1155        }
1156    }
1157    unsafe impl<
1158            D: fidl::encoding::ResourceDialect,
1159            T0: fidl::encoding::Encode<RequestStats, D>,
1160            T1: fidl::encoding::Encode<RequestStats, D>,
1161        > fidl::encoding::Encode<OperationStats, D> for (T0, T1)
1162    {
1163        #[inline]
1164        unsafe fn encode(
1165            self,
1166            encoder: &mut fidl::encoding::Encoder<'_, D>,
1167            offset: usize,
1168            depth: fidl::encoding::Depth,
1169        ) -> fidl::Result<()> {
1170            encoder.debug_check_bounds::<OperationStats>(offset);
1171            // Zero out padding regions. There's no need to apply masks
1172            // because the unmasked parts will be overwritten by fields.
1173            // Write the fields.
1174            self.0.encode(encoder, offset + 0, depth)?;
1175            self.1.encode(encoder, offset + 40, depth)?;
1176            Ok(())
1177        }
1178    }
1179
1180    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OperationStats {
1181        #[inline(always)]
1182        fn new_empty() -> Self {
1183            Self {
1184                success: fidl::new_empty!(RequestStats, D),
1185                failure: fidl::new_empty!(RequestStats, D),
1186            }
1187        }
1188
1189        #[inline]
1190        unsafe fn decode(
1191            &mut self,
1192            decoder: &mut fidl::encoding::Decoder<'_, D>,
1193            offset: usize,
1194            _depth: fidl::encoding::Depth,
1195        ) -> fidl::Result<()> {
1196            decoder.debug_check_bounds::<Self>(offset);
1197            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1198            // Verify that padding bytes are zero.
1199            // Copy from the buffer into the object.
1200            unsafe {
1201                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 80);
1202            }
1203            Ok(())
1204        }
1205    }
1206
1207    impl fidl::encoding::ValueTypeMarker for RequestStats {
1208        type Borrowed<'a> = &'a Self;
1209        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1210            value
1211        }
1212    }
1213
1214    unsafe impl fidl::encoding::TypeMarker for RequestStats {
1215        type Owned = Self;
1216
1217        #[inline(always)]
1218        fn inline_align(_context: fidl::encoding::Context) -> usize {
1219            8
1220        }
1221
1222        #[inline(always)]
1223        fn inline_size(_context: fidl::encoding::Context) -> usize {
1224            40
1225        }
1226        #[inline(always)]
1227        fn encode_is_copy() -> bool {
1228            true
1229        }
1230
1231        #[inline(always)]
1232        fn decode_is_copy() -> bool {
1233            true
1234        }
1235    }
1236
1237    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RequestStats, D>
1238        for &RequestStats
1239    {
1240        #[inline]
1241        unsafe fn encode(
1242            self,
1243            encoder: &mut fidl::encoding::Encoder<'_, D>,
1244            offset: usize,
1245            _depth: fidl::encoding::Depth,
1246        ) -> fidl::Result<()> {
1247            encoder.debug_check_bounds::<RequestStats>(offset);
1248            unsafe {
1249                // Copy the object into the buffer.
1250                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1251                (buf_ptr as *mut RequestStats)
1252                    .write_unaligned((self as *const RequestStats).read());
1253                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1254                // done second because the memcpy will write garbage to these bytes.
1255            }
1256            Ok(())
1257        }
1258    }
1259    unsafe impl<
1260            D: fidl::encoding::ResourceDialect,
1261            T0: fidl::encoding::Encode<u64, D>,
1262            T1: fidl::encoding::Encode<u64, D>,
1263            T2: fidl::encoding::Encode<u64, D>,
1264            T3: fidl::encoding::Encode<u64, D>,
1265            T4: fidl::encoding::Encode<u64, D>,
1266        > fidl::encoding::Encode<RequestStats, D> for (T0, T1, T2, T3, T4)
1267    {
1268        #[inline]
1269        unsafe fn encode(
1270            self,
1271            encoder: &mut fidl::encoding::Encoder<'_, D>,
1272            offset: usize,
1273            depth: fidl::encoding::Depth,
1274        ) -> fidl::Result<()> {
1275            encoder.debug_check_bounds::<RequestStats>(offset);
1276            // Zero out padding regions. There's no need to apply masks
1277            // because the unmasked parts will be overwritten by fields.
1278            // Write the fields.
1279            self.0.encode(encoder, offset + 0, depth)?;
1280            self.1.encode(encoder, offset + 8, depth)?;
1281            self.2.encode(encoder, offset + 16, depth)?;
1282            self.3.encode(encoder, offset + 24, depth)?;
1283            self.4.encode(encoder, offset + 32, depth)?;
1284            Ok(())
1285        }
1286    }
1287
1288    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RequestStats {
1289        #[inline(always)]
1290        fn new_empty() -> Self {
1291            Self {
1292                minimum_latency: fidl::new_empty!(u64, D),
1293                maximum_latency: fidl::new_empty!(u64, D),
1294                total_time_spent: fidl::new_empty!(u64, D),
1295                total_calls: fidl::new_empty!(u64, D),
1296                bytes_transferred: fidl::new_empty!(u64, D),
1297            }
1298        }
1299
1300        #[inline]
1301        unsafe fn decode(
1302            &mut self,
1303            decoder: &mut fidl::encoding::Decoder<'_, D>,
1304            offset: usize,
1305            _depth: fidl::encoding::Depth,
1306        ) -> fidl::Result<()> {
1307            decoder.debug_check_bounds::<Self>(offset);
1308            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1309            // Verify that padding bytes are zero.
1310            // Copy from the buffer into the object.
1311            unsafe {
1312                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
1313            }
1314            Ok(())
1315        }
1316    }
1317
1318    impl fidl::encoding::ValueTypeMarker for SessionAttachVmoResponse {
1319        type Borrowed<'a> = &'a Self;
1320        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1321            value
1322        }
1323    }
1324
1325    unsafe impl fidl::encoding::TypeMarker for SessionAttachVmoResponse {
1326        type Owned = Self;
1327
1328        #[inline(always)]
1329        fn inline_align(_context: fidl::encoding::Context) -> usize {
1330            2
1331        }
1332
1333        #[inline(always)]
1334        fn inline_size(_context: fidl::encoding::Context) -> usize {
1335            2
1336        }
1337        #[inline(always)]
1338        fn encode_is_copy() -> bool {
1339            true
1340        }
1341
1342        #[inline(always)]
1343        fn decode_is_copy() -> bool {
1344            true
1345        }
1346    }
1347
1348    unsafe impl<D: fidl::encoding::ResourceDialect>
1349        fidl::encoding::Encode<SessionAttachVmoResponse, D> for &SessionAttachVmoResponse
1350    {
1351        #[inline]
1352        unsafe fn encode(
1353            self,
1354            encoder: &mut fidl::encoding::Encoder<'_, D>,
1355            offset: usize,
1356            _depth: fidl::encoding::Depth,
1357        ) -> fidl::Result<()> {
1358            encoder.debug_check_bounds::<SessionAttachVmoResponse>(offset);
1359            unsafe {
1360                // Copy the object into the buffer.
1361                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1362                (buf_ptr as *mut SessionAttachVmoResponse)
1363                    .write_unaligned((self as *const SessionAttachVmoResponse).read());
1364                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1365                // done second because the memcpy will write garbage to these bytes.
1366            }
1367            Ok(())
1368        }
1369    }
1370    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<VmoId, D>>
1371        fidl::encoding::Encode<SessionAttachVmoResponse, D> for (T0,)
1372    {
1373        #[inline]
1374        unsafe fn encode(
1375            self,
1376            encoder: &mut fidl::encoding::Encoder<'_, D>,
1377            offset: usize,
1378            depth: fidl::encoding::Depth,
1379        ) -> fidl::Result<()> {
1380            encoder.debug_check_bounds::<SessionAttachVmoResponse>(offset);
1381            // Zero out padding regions. There's no need to apply masks
1382            // because the unmasked parts will be overwritten by fields.
1383            // Write the fields.
1384            self.0.encode(encoder, offset + 0, depth)?;
1385            Ok(())
1386        }
1387    }
1388
1389    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1390        for SessionAttachVmoResponse
1391    {
1392        #[inline(always)]
1393        fn new_empty() -> Self {
1394            Self { vmoid: fidl::new_empty!(VmoId, D) }
1395        }
1396
1397        #[inline]
1398        unsafe fn decode(
1399            &mut self,
1400            decoder: &mut fidl::encoding::Decoder<'_, D>,
1401            offset: usize,
1402            _depth: fidl::encoding::Depth,
1403        ) -> fidl::Result<()> {
1404            decoder.debug_check_bounds::<Self>(offset);
1405            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1406            // Verify that padding bytes are zero.
1407            // Copy from the buffer into the object.
1408            unsafe {
1409                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
1410            }
1411            Ok(())
1412        }
1413    }
1414
1415    impl fidl::encoding::ValueTypeMarker for VmoId {
1416        type Borrowed<'a> = &'a Self;
1417        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1418            value
1419        }
1420    }
1421
1422    unsafe impl fidl::encoding::TypeMarker for VmoId {
1423        type Owned = Self;
1424
1425        #[inline(always)]
1426        fn inline_align(_context: fidl::encoding::Context) -> usize {
1427            2
1428        }
1429
1430        #[inline(always)]
1431        fn inline_size(_context: fidl::encoding::Context) -> usize {
1432            2
1433        }
1434        #[inline(always)]
1435        fn encode_is_copy() -> bool {
1436            true
1437        }
1438
1439        #[inline(always)]
1440        fn decode_is_copy() -> bool {
1441            true
1442        }
1443    }
1444
1445    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VmoId, D> for &VmoId {
1446        #[inline]
1447        unsafe fn encode(
1448            self,
1449            encoder: &mut fidl::encoding::Encoder<'_, D>,
1450            offset: usize,
1451            _depth: fidl::encoding::Depth,
1452        ) -> fidl::Result<()> {
1453            encoder.debug_check_bounds::<VmoId>(offset);
1454            unsafe {
1455                // Copy the object into the buffer.
1456                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1457                (buf_ptr as *mut VmoId).write_unaligned((self as *const VmoId).read());
1458                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1459                // done second because the memcpy will write garbage to these bytes.
1460            }
1461            Ok(())
1462        }
1463    }
1464    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
1465        fidl::encoding::Encode<VmoId, D> for (T0,)
1466    {
1467        #[inline]
1468        unsafe fn encode(
1469            self,
1470            encoder: &mut fidl::encoding::Encoder<'_, D>,
1471            offset: usize,
1472            depth: fidl::encoding::Depth,
1473        ) -> fidl::Result<()> {
1474            encoder.debug_check_bounds::<VmoId>(offset);
1475            // Zero out padding regions. There's no need to apply masks
1476            // because the unmasked parts will be overwritten by fields.
1477            // Write the fields.
1478            self.0.encode(encoder, offset + 0, depth)?;
1479            Ok(())
1480        }
1481    }
1482
1483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VmoId {
1484        #[inline(always)]
1485        fn new_empty() -> Self {
1486            Self { id: fidl::new_empty!(u16, D) }
1487        }
1488
1489        #[inline]
1490        unsafe fn decode(
1491            &mut self,
1492            decoder: &mut fidl::encoding::Decoder<'_, D>,
1493            offset: usize,
1494            _depth: fidl::encoding::Depth,
1495        ) -> fidl::Result<()> {
1496            decoder.debug_check_bounds::<Self>(offset);
1497            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1498            // Verify that padding bytes are zero.
1499            // Copy from the buffer into the object.
1500            unsafe {
1501                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
1502            }
1503            Ok(())
1504        }
1505    }
1506}