fidl_fuchsia_hardware_block_volume__common/
fidl_fuchsia_hardware_block_volume__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
11/// Indicates that the partition should be created as inactive, implying that it
12/// will be destroyed on reboot (unless activated by a call to "Activate").
13pub const ALLOCATE_PARTITION_FLAG_INACTIVE: u32 = 1;
14
15/// An arbitrary cap on the number of slices which may be requested when querying
16/// for allocation information from a volume.
17pub const MAX_SLICE_REQUESTS: u32 = 16;
18
19#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
20#[repr(C)]
21pub struct VolumeDestroyResponse {
22    pub status: i32,
23}
24
25impl fidl::Persistable for VolumeDestroyResponse {}
26
27#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
28#[repr(C)]
29pub struct VolumeExtendRequest {
30    pub start_slice: u64,
31    pub slice_count: u64,
32}
33
34impl fidl::Persistable for VolumeExtendRequest {}
35
36#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37#[repr(C)]
38pub struct VolumeExtendResponse {
39    pub status: i32,
40}
41
42impl fidl::Persistable for VolumeExtendResponse {}
43
44#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct VolumeGetVolumeInfoResponse {
46    pub status: i32,
47    pub manager: Option<Box<VolumeManagerInfo>>,
48    pub volume: Option<Box<VolumeInfo>>,
49}
50
51impl fidl::Persistable for VolumeGetVolumeInfoResponse {}
52
53#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54#[repr(C)]
55pub struct VolumeInfo {
56    /// Number of slices allocated to the volume.
57    pub partition_slice_count: u64,
58    /// Limit on the maximum slices assigned to this partition, if there is one. If the size of the
59    /// partition is not limited, this value will be 0. Partitions can grow into free slices
60    /// available in the volume manager as long as their slices are less than or equal to this
61    /// value.
62    ///
63    /// The partition may be larger than this limit if a smaller limit was applied after the
64    /// partition had already grown to the current size.
65    ///
66    /// See `VolumeManager.GetPartitionLimit()`
67    pub slice_limit: u64,
68}
69
70impl fidl::Persistable for VolumeInfo {}
71
72#[derive(Clone, Debug, PartialEq)]
73pub struct VolumeManagerActivateRequest {
74    pub old_guid: fidl_fuchsia_hardware_block_partition__common::Guid,
75    pub new_guid: fidl_fuchsia_hardware_block_partition__common::Guid,
76}
77
78impl fidl::Persistable for VolumeManagerActivateRequest {}
79
80#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81#[repr(C)]
82pub struct VolumeManagerActivateResponse {
83    pub status: i32,
84}
85
86impl fidl::Persistable for VolumeManagerActivateResponse {}
87
88#[derive(Clone, Debug, PartialEq)]
89pub struct VolumeManagerAllocatePartitionRequest {
90    pub slice_count: u64,
91    pub type_: fidl_fuchsia_hardware_block_partition__common::Guid,
92    pub instance: fidl_fuchsia_hardware_block_partition__common::Guid,
93    pub name: String,
94    pub flags: u32,
95}
96
97impl fidl::Persistable for VolumeManagerAllocatePartitionRequest {}
98
99#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100#[repr(C)]
101pub struct VolumeManagerAllocatePartitionResponse {
102    pub status: i32,
103}
104
105impl fidl::Persistable for VolumeManagerAllocatePartitionResponse {}
106
107#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
108pub struct VolumeManagerGetInfoResponse {
109    pub status: i32,
110    pub info: Option<Box<VolumeManagerInfo>>,
111}
112
113impl fidl::Persistable for VolumeManagerGetInfoResponse {}
114
115#[derive(Clone, Debug, PartialEq)]
116pub struct VolumeManagerGetPartitionLimitRequest {
117    pub guid: fidl_fuchsia_hardware_block_partition__common::Guid,
118}
119
120impl fidl::Persistable for VolumeManagerGetPartitionLimitRequest {}
121
122#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123#[repr(C)]
124pub struct VolumeManagerGetPartitionLimitResponse {
125    pub status: i32,
126    pub slice_count: u64,
127}
128
129impl fidl::Persistable for VolumeManagerGetPartitionLimitResponse {}
130
131/// VolumeManagerInfo describes the properties of the volume manager and not each individual volume.
132#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
133#[repr(C)]
134pub struct VolumeManagerInfo {
135    /// Size of a single slice, in bytes.
136    pub slice_size: u64,
137    /// Number of slices the volume manager is able use right now. This counts the
138    /// allocated_slice_count plus the number of available slices.
139    pub slice_count: u64,
140    /// Number of slices currently assigned to partitions.
141    pub assigned_slice_count: u64,
142    /// The maximum capacity which the Volume Manager could grow to utilize if the partition
143    /// containing the Volume Manager itself expands (i.e., the Volume Manager is initialized on a
144    /// GPT partition that has extended beyond the originally allocated capacity). This value is
145    /// the number of entries reserved in the volume manager header and is not related to the size
146    /// of the physical device (which may be larger or smaller).
147    pub maximum_slice_count: u64,
148    /// Largest value that can be used for a virtual slice number.
149    pub max_virtual_slice: u64,
150}
151
152impl fidl::Persistable for VolumeManagerInfo {}
153
154#[derive(Clone, Debug, PartialEq)]
155pub struct VolumeManagerSetPartitionLimitRequest {
156    pub guid: fidl_fuchsia_hardware_block_partition__common::Guid,
157    pub slice_count: u64,
158}
159
160impl fidl::Persistable for VolumeManagerSetPartitionLimitRequest {}
161
162#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
163#[repr(C)]
164pub struct VolumeManagerSetPartitionLimitResponse {
165    pub status: i32,
166}
167
168impl fidl::Persistable for VolumeManagerSetPartitionLimitResponse {}
169
170#[derive(Clone, Debug, PartialEq)]
171pub struct VolumeManagerSetPartitionNameRequest {
172    pub guid: fidl_fuchsia_hardware_block_partition__common::Guid,
173    pub name: String,
174}
175
176impl fidl::Persistable for VolumeManagerSetPartitionNameRequest {}
177
178#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
179pub struct VolumeQuerySlicesRequest {
180    pub start_slices: Vec<u64>,
181}
182
183impl fidl::Persistable for VolumeQuerySlicesRequest {}
184
185#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
186pub struct VolumeQuerySlicesResponse {
187    pub status: i32,
188    pub response: [VsliceRange; 16],
189    pub response_count: u64,
190}
191
192impl fidl::Persistable for VolumeQuerySlicesResponse {}
193
194#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
195#[repr(C)]
196pub struct VolumeShrinkRequest {
197    pub start_slice: u64,
198    pub slice_count: u64,
199}
200
201impl fidl::Persistable for VolumeShrinkRequest {}
202
203#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
204#[repr(C)]
205pub struct VolumeShrinkResponse {
206    pub status: i32,
207}
208
209impl fidl::Persistable for VolumeShrinkResponse {}
210
211/// VsliceRange describes a range of virtual slices: start, length, and allocated status.
212///
213/// These ranges are returned in an ordered container, which implicitly describes the
214/// starting offset, starting from the "index zero" slice.
215#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
216pub struct VsliceRange {
217    /// True if the virtual slices are allocated, false otherwise.
218    pub allocated: bool,
219    /// The number of contiguous virtual slices.
220    pub count: u64,
221}
222
223impl fidl::Persistable for VsliceRange {}
224
225pub mod volume_ordinals {
226    pub const GET_INFO: u64 = 0x79df1a5cdb6cc6a3;
227    pub const OPEN_SESSION: u64 = 0x7241c68d17614a31;
228    pub const OPEN_SESSION_WITH_OFFSET_MAP: u64 = 0x7a8d3ba3d8bfa10f;
229    pub const GET_TYPE_GUID: u64 = 0x111843d737a9b847;
230    pub const GET_INSTANCE_GUID: u64 = 0x14a5a573b275d435;
231    pub const GET_NAME: u64 = 0x7e3c6f0b0937fc02;
232    pub const GET_METADATA: u64 = 0x42d1464c96c3f3ff;
233    pub const QUERY_SLICES: u64 = 0x589a96828a3e2aa1;
234    pub const GET_VOLUME_INFO: u64 = 0x60417b6cf9e34c80;
235    pub const EXTEND: u64 = 0xdddf872f5039d37;
236    pub const SHRINK: u64 = 0x27ab5ed4f6fdcd29;
237    pub const DESTROY: u64 = 0x732bf4bea39b5e87;
238}
239
240pub mod volume_manager_ordinals {
241    pub const ALLOCATE_PARTITION: u64 = 0x4e79f24ed059e394;
242    pub const GET_INFO: u64 = 0x735b3548582b2c9;
243    pub const ACTIVATE: u64 = 0xc8cef57012874d0;
244    pub const GET_PARTITION_LIMIT: u64 = 0x6e32f6df9fa2a919;
245    pub const SET_PARTITION_LIMIT: u64 = 0x2e09076ef266fa35;
246    pub const SET_PARTITION_NAME: u64 = 0x4539a9b95cba0397;
247}
248
249mod internal {
250    use super::*;
251
252    impl fidl::encoding::ValueTypeMarker for VolumeDestroyResponse {
253        type Borrowed<'a> = &'a Self;
254        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
255            value
256        }
257    }
258
259    unsafe impl fidl::encoding::TypeMarker for VolumeDestroyResponse {
260        type Owned = Self;
261
262        #[inline(always)]
263        fn inline_align(_context: fidl::encoding::Context) -> usize {
264            4
265        }
266
267        #[inline(always)]
268        fn inline_size(_context: fidl::encoding::Context) -> usize {
269            4
270        }
271        #[inline(always)]
272        fn encode_is_copy() -> bool {
273            true
274        }
275
276        #[inline(always)]
277        fn decode_is_copy() -> bool {
278            true
279        }
280    }
281
282    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeDestroyResponse, D>
283        for &VolumeDestroyResponse
284    {
285        #[inline]
286        unsafe fn encode(
287            self,
288            encoder: &mut fidl::encoding::Encoder<'_, D>,
289            offset: usize,
290            _depth: fidl::encoding::Depth,
291        ) -> fidl::Result<()> {
292            encoder.debug_check_bounds::<VolumeDestroyResponse>(offset);
293            unsafe {
294                // Copy the object into the buffer.
295                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
296                (buf_ptr as *mut VolumeDestroyResponse)
297                    .write_unaligned((self as *const VolumeDestroyResponse).read());
298                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
299                // done second because the memcpy will write garbage to these bytes.
300            }
301            Ok(())
302        }
303    }
304    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
305        fidl::encoding::Encode<VolumeDestroyResponse, D> for (T0,)
306    {
307        #[inline]
308        unsafe fn encode(
309            self,
310            encoder: &mut fidl::encoding::Encoder<'_, D>,
311            offset: usize,
312            depth: fidl::encoding::Depth,
313        ) -> fidl::Result<()> {
314            encoder.debug_check_bounds::<VolumeDestroyResponse>(offset);
315            // Zero out padding regions. There's no need to apply masks
316            // because the unmasked parts will be overwritten by fields.
317            // Write the fields.
318            self.0.encode(encoder, offset + 0, depth)?;
319            Ok(())
320        }
321    }
322
323    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeDestroyResponse {
324        #[inline(always)]
325        fn new_empty() -> Self {
326            Self { status: fidl::new_empty!(i32, D) }
327        }
328
329        #[inline]
330        unsafe fn decode(
331            &mut self,
332            decoder: &mut fidl::encoding::Decoder<'_, D>,
333            offset: usize,
334            _depth: fidl::encoding::Depth,
335        ) -> fidl::Result<()> {
336            decoder.debug_check_bounds::<Self>(offset);
337            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
338            // Verify that padding bytes are zero.
339            // Copy from the buffer into the object.
340            unsafe {
341                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
342            }
343            Ok(())
344        }
345    }
346
347    impl fidl::encoding::ValueTypeMarker for VolumeExtendRequest {
348        type Borrowed<'a> = &'a Self;
349        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
350            value
351        }
352    }
353
354    unsafe impl fidl::encoding::TypeMarker for VolumeExtendRequest {
355        type Owned = Self;
356
357        #[inline(always)]
358        fn inline_align(_context: fidl::encoding::Context) -> usize {
359            8
360        }
361
362        #[inline(always)]
363        fn inline_size(_context: fidl::encoding::Context) -> usize {
364            16
365        }
366        #[inline(always)]
367        fn encode_is_copy() -> bool {
368            true
369        }
370
371        #[inline(always)]
372        fn decode_is_copy() -> bool {
373            true
374        }
375    }
376
377    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeExtendRequest, D>
378        for &VolumeExtendRequest
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::<VolumeExtendRequest>(offset);
388            unsafe {
389                // Copy the object into the buffer.
390                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
391                (buf_ptr as *mut VolumeExtendRequest)
392                    .write_unaligned((self as *const VolumeExtendRequest).read());
393                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
394                // done second because the memcpy will write garbage to these bytes.
395            }
396            Ok(())
397        }
398    }
399    unsafe impl<
400        D: fidl::encoding::ResourceDialect,
401        T0: fidl::encoding::Encode<u64, D>,
402        T1: fidl::encoding::Encode<u64, D>,
403    > fidl::encoding::Encode<VolumeExtendRequest, D> for (T0, T1)
404    {
405        #[inline]
406        unsafe fn encode(
407            self,
408            encoder: &mut fidl::encoding::Encoder<'_, D>,
409            offset: usize,
410            depth: fidl::encoding::Depth,
411        ) -> fidl::Result<()> {
412            encoder.debug_check_bounds::<VolumeExtendRequest>(offset);
413            // Zero out padding regions. There's no need to apply masks
414            // because the unmasked parts will be overwritten by fields.
415            // Write the fields.
416            self.0.encode(encoder, offset + 0, depth)?;
417            self.1.encode(encoder, offset + 8, depth)?;
418            Ok(())
419        }
420    }
421
422    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeExtendRequest {
423        #[inline(always)]
424        fn new_empty() -> Self {
425            Self { start_slice: fidl::new_empty!(u64, D), slice_count: fidl::new_empty!(u64, D) }
426        }
427
428        #[inline]
429        unsafe fn decode(
430            &mut self,
431            decoder: &mut fidl::encoding::Decoder<'_, D>,
432            offset: usize,
433            _depth: fidl::encoding::Depth,
434        ) -> fidl::Result<()> {
435            decoder.debug_check_bounds::<Self>(offset);
436            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
437            // Verify that padding bytes are zero.
438            // Copy from the buffer into the object.
439            unsafe {
440                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
441            }
442            Ok(())
443        }
444    }
445
446    impl fidl::encoding::ValueTypeMarker for VolumeExtendResponse {
447        type Borrowed<'a> = &'a Self;
448        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
449            value
450        }
451    }
452
453    unsafe impl fidl::encoding::TypeMarker for VolumeExtendResponse {
454        type Owned = Self;
455
456        #[inline(always)]
457        fn inline_align(_context: fidl::encoding::Context) -> usize {
458            4
459        }
460
461        #[inline(always)]
462        fn inline_size(_context: fidl::encoding::Context) -> usize {
463            4
464        }
465        #[inline(always)]
466        fn encode_is_copy() -> bool {
467            true
468        }
469
470        #[inline(always)]
471        fn decode_is_copy() -> bool {
472            true
473        }
474    }
475
476    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeExtendResponse, D>
477        for &VolumeExtendResponse
478    {
479        #[inline]
480        unsafe fn encode(
481            self,
482            encoder: &mut fidl::encoding::Encoder<'_, D>,
483            offset: usize,
484            _depth: fidl::encoding::Depth,
485        ) -> fidl::Result<()> {
486            encoder.debug_check_bounds::<VolumeExtendResponse>(offset);
487            unsafe {
488                // Copy the object into the buffer.
489                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
490                (buf_ptr as *mut VolumeExtendResponse)
491                    .write_unaligned((self as *const VolumeExtendResponse).read());
492                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
493                // done second because the memcpy will write garbage to these bytes.
494            }
495            Ok(())
496        }
497    }
498    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
499        fidl::encoding::Encode<VolumeExtendResponse, D> for (T0,)
500    {
501        #[inline]
502        unsafe fn encode(
503            self,
504            encoder: &mut fidl::encoding::Encoder<'_, D>,
505            offset: usize,
506            depth: fidl::encoding::Depth,
507        ) -> fidl::Result<()> {
508            encoder.debug_check_bounds::<VolumeExtendResponse>(offset);
509            // Zero out padding regions. There's no need to apply masks
510            // because the unmasked parts will be overwritten by fields.
511            // Write the fields.
512            self.0.encode(encoder, offset + 0, depth)?;
513            Ok(())
514        }
515    }
516
517    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeExtendResponse {
518        #[inline(always)]
519        fn new_empty() -> Self {
520            Self { status: fidl::new_empty!(i32, D) }
521        }
522
523        #[inline]
524        unsafe fn decode(
525            &mut self,
526            decoder: &mut fidl::encoding::Decoder<'_, D>,
527            offset: usize,
528            _depth: fidl::encoding::Depth,
529        ) -> fidl::Result<()> {
530            decoder.debug_check_bounds::<Self>(offset);
531            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
532            // Verify that padding bytes are zero.
533            // Copy from the buffer into the object.
534            unsafe {
535                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
536            }
537            Ok(())
538        }
539    }
540
541    impl fidl::encoding::ValueTypeMarker for VolumeGetVolumeInfoResponse {
542        type Borrowed<'a> = &'a Self;
543        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
544            value
545        }
546    }
547
548    unsafe impl fidl::encoding::TypeMarker for VolumeGetVolumeInfoResponse {
549        type Owned = Self;
550
551        #[inline(always)]
552        fn inline_align(_context: fidl::encoding::Context) -> usize {
553            8
554        }
555
556        #[inline(always)]
557        fn inline_size(_context: fidl::encoding::Context) -> usize {
558            24
559        }
560    }
561
562    unsafe impl<D: fidl::encoding::ResourceDialect>
563        fidl::encoding::Encode<VolumeGetVolumeInfoResponse, D> for &VolumeGetVolumeInfoResponse
564    {
565        #[inline]
566        unsafe fn encode(
567            self,
568            encoder: &mut fidl::encoding::Encoder<'_, D>,
569            offset: usize,
570            _depth: fidl::encoding::Depth,
571        ) -> fidl::Result<()> {
572            encoder.debug_check_bounds::<VolumeGetVolumeInfoResponse>(offset);
573            // Delegate to tuple encoding.
574            fidl::encoding::Encode::<VolumeGetVolumeInfoResponse, D>::encode(
575                (
576                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
577                    <fidl::encoding::Boxed<VolumeManagerInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.manager),
578                    <fidl::encoding::Boxed<VolumeInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.volume),
579                ),
580                encoder, offset, _depth
581            )
582        }
583    }
584    unsafe impl<
585        D: fidl::encoding::ResourceDialect,
586        T0: fidl::encoding::Encode<i32, D>,
587        T1: fidl::encoding::Encode<fidl::encoding::Boxed<VolumeManagerInfo>, D>,
588        T2: fidl::encoding::Encode<fidl::encoding::Boxed<VolumeInfo>, D>,
589    > fidl::encoding::Encode<VolumeGetVolumeInfoResponse, D> for (T0, T1, T2)
590    {
591        #[inline]
592        unsafe fn encode(
593            self,
594            encoder: &mut fidl::encoding::Encoder<'_, D>,
595            offset: usize,
596            depth: fidl::encoding::Depth,
597        ) -> fidl::Result<()> {
598            encoder.debug_check_bounds::<VolumeGetVolumeInfoResponse>(offset);
599            // Zero out padding regions. There's no need to apply masks
600            // because the unmasked parts will be overwritten by fields.
601            unsafe {
602                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
603                (ptr as *mut u64).write_unaligned(0);
604            }
605            // Write the fields.
606            self.0.encode(encoder, offset + 0, depth)?;
607            self.1.encode(encoder, offset + 8, depth)?;
608            self.2.encode(encoder, offset + 16, depth)?;
609            Ok(())
610        }
611    }
612
613    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
614        for VolumeGetVolumeInfoResponse
615    {
616        #[inline(always)]
617        fn new_empty() -> Self {
618            Self {
619                status: fidl::new_empty!(i32, D),
620                manager: fidl::new_empty!(fidl::encoding::Boxed<VolumeManagerInfo>, D),
621                volume: fidl::new_empty!(fidl::encoding::Boxed<VolumeInfo>, D),
622            }
623        }
624
625        #[inline]
626        unsafe fn decode(
627            &mut self,
628            decoder: &mut fidl::encoding::Decoder<'_, D>,
629            offset: usize,
630            _depth: fidl::encoding::Depth,
631        ) -> fidl::Result<()> {
632            decoder.debug_check_bounds::<Self>(offset);
633            // Verify that padding bytes are zero.
634            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
635            let padval = unsafe { (ptr as *const u64).read_unaligned() };
636            let mask = 0xffffffff00000000u64;
637            let maskedval = padval & mask;
638            if maskedval != 0 {
639                return Err(fidl::Error::NonZeroPadding {
640                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
641                });
642            }
643            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
644            fidl::decode!(
645                fidl::encoding::Boxed<VolumeManagerInfo>,
646                D,
647                &mut self.manager,
648                decoder,
649                offset + 8,
650                _depth
651            )?;
652            fidl::decode!(
653                fidl::encoding::Boxed<VolumeInfo>,
654                D,
655                &mut self.volume,
656                decoder,
657                offset + 16,
658                _depth
659            )?;
660            Ok(())
661        }
662    }
663
664    impl fidl::encoding::ValueTypeMarker for VolumeInfo {
665        type Borrowed<'a> = &'a Self;
666        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
667            value
668        }
669    }
670
671    unsafe impl fidl::encoding::TypeMarker for VolumeInfo {
672        type Owned = Self;
673
674        #[inline(always)]
675        fn inline_align(_context: fidl::encoding::Context) -> usize {
676            8
677        }
678
679        #[inline(always)]
680        fn inline_size(_context: fidl::encoding::Context) -> usize {
681            16
682        }
683        #[inline(always)]
684        fn encode_is_copy() -> bool {
685            true
686        }
687
688        #[inline(always)]
689        fn decode_is_copy() -> bool {
690            true
691        }
692    }
693
694    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeInfo, D>
695        for &VolumeInfo
696    {
697        #[inline]
698        unsafe fn encode(
699            self,
700            encoder: &mut fidl::encoding::Encoder<'_, D>,
701            offset: usize,
702            _depth: fidl::encoding::Depth,
703        ) -> fidl::Result<()> {
704            encoder.debug_check_bounds::<VolumeInfo>(offset);
705            unsafe {
706                // Copy the object into the buffer.
707                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
708                (buf_ptr as *mut VolumeInfo).write_unaligned((self as *const VolumeInfo).read());
709                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
710                // done second because the memcpy will write garbage to these bytes.
711            }
712            Ok(())
713        }
714    }
715    unsafe impl<
716        D: fidl::encoding::ResourceDialect,
717        T0: fidl::encoding::Encode<u64, D>,
718        T1: fidl::encoding::Encode<u64, D>,
719    > fidl::encoding::Encode<VolumeInfo, D> for (T0, T1)
720    {
721        #[inline]
722        unsafe fn encode(
723            self,
724            encoder: &mut fidl::encoding::Encoder<'_, D>,
725            offset: usize,
726            depth: fidl::encoding::Depth,
727        ) -> fidl::Result<()> {
728            encoder.debug_check_bounds::<VolumeInfo>(offset);
729            // Zero out padding regions. There's no need to apply masks
730            // because the unmasked parts will be overwritten by fields.
731            // Write the fields.
732            self.0.encode(encoder, offset + 0, depth)?;
733            self.1.encode(encoder, offset + 8, depth)?;
734            Ok(())
735        }
736    }
737
738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeInfo {
739        #[inline(always)]
740        fn new_empty() -> Self {
741            Self {
742                partition_slice_count: fidl::new_empty!(u64, D),
743                slice_limit: fidl::new_empty!(u64, D),
744            }
745        }
746
747        #[inline]
748        unsafe fn decode(
749            &mut self,
750            decoder: &mut fidl::encoding::Decoder<'_, D>,
751            offset: usize,
752            _depth: fidl::encoding::Depth,
753        ) -> fidl::Result<()> {
754            decoder.debug_check_bounds::<Self>(offset);
755            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
756            // Verify that padding bytes are zero.
757            // Copy from the buffer into the object.
758            unsafe {
759                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
760            }
761            Ok(())
762        }
763    }
764
765    impl fidl::encoding::ValueTypeMarker for VolumeManagerActivateRequest {
766        type Borrowed<'a> = &'a Self;
767        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
768            value
769        }
770    }
771
772    unsafe impl fidl::encoding::TypeMarker for VolumeManagerActivateRequest {
773        type Owned = Self;
774
775        #[inline(always)]
776        fn inline_align(_context: fidl::encoding::Context) -> usize {
777            1
778        }
779
780        #[inline(always)]
781        fn inline_size(_context: fidl::encoding::Context) -> usize {
782            32
783        }
784    }
785
786    unsafe impl<D: fidl::encoding::ResourceDialect>
787        fidl::encoding::Encode<VolumeManagerActivateRequest, D> for &VolumeManagerActivateRequest
788    {
789        #[inline]
790        unsafe fn encode(
791            self,
792            encoder: &mut fidl::encoding::Encoder<'_, D>,
793            offset: usize,
794            _depth: fidl::encoding::Depth,
795        ) -> fidl::Result<()> {
796            encoder.debug_check_bounds::<VolumeManagerActivateRequest>(offset);
797            // Delegate to tuple encoding.
798            fidl::encoding::Encode::<VolumeManagerActivateRequest, D>::encode(
799                (
800                    <fidl_fuchsia_hardware_block_partition__common::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.old_guid),
801                    <fidl_fuchsia_hardware_block_partition__common::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.new_guid),
802                ),
803                encoder, offset, _depth
804            )
805        }
806    }
807    unsafe impl<
808        D: fidl::encoding::ResourceDialect,
809        T0: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition__common::Guid, D>,
810        T1: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition__common::Guid, D>,
811    > fidl::encoding::Encode<VolumeManagerActivateRequest, D> for (T0, T1)
812    {
813        #[inline]
814        unsafe fn encode(
815            self,
816            encoder: &mut fidl::encoding::Encoder<'_, D>,
817            offset: usize,
818            depth: fidl::encoding::Depth,
819        ) -> fidl::Result<()> {
820            encoder.debug_check_bounds::<VolumeManagerActivateRequest>(offset);
821            // Zero out padding regions. There's no need to apply masks
822            // because the unmasked parts will be overwritten by fields.
823            // Write the fields.
824            self.0.encode(encoder, offset + 0, depth)?;
825            self.1.encode(encoder, offset + 16, depth)?;
826            Ok(())
827        }
828    }
829
830    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
831        for VolumeManagerActivateRequest
832    {
833        #[inline(always)]
834        fn new_empty() -> Self {
835            Self {
836                old_guid: fidl::new_empty!(fidl_fuchsia_hardware_block_partition__common::Guid, D),
837                new_guid: fidl::new_empty!(fidl_fuchsia_hardware_block_partition__common::Guid, D),
838            }
839        }
840
841        #[inline]
842        unsafe fn decode(
843            &mut self,
844            decoder: &mut fidl::encoding::Decoder<'_, D>,
845            offset: usize,
846            _depth: fidl::encoding::Depth,
847        ) -> fidl::Result<()> {
848            decoder.debug_check_bounds::<Self>(offset);
849            // Verify that padding bytes are zero.
850            fidl::decode!(
851                fidl_fuchsia_hardware_block_partition__common::Guid,
852                D,
853                &mut self.old_guid,
854                decoder,
855                offset + 0,
856                _depth
857            )?;
858            fidl::decode!(
859                fidl_fuchsia_hardware_block_partition__common::Guid,
860                D,
861                &mut self.new_guid,
862                decoder,
863                offset + 16,
864                _depth
865            )?;
866            Ok(())
867        }
868    }
869
870    impl fidl::encoding::ValueTypeMarker for VolumeManagerActivateResponse {
871        type Borrowed<'a> = &'a Self;
872        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
873            value
874        }
875    }
876
877    unsafe impl fidl::encoding::TypeMarker for VolumeManagerActivateResponse {
878        type Owned = Self;
879
880        #[inline(always)]
881        fn inline_align(_context: fidl::encoding::Context) -> usize {
882            4
883        }
884
885        #[inline(always)]
886        fn inline_size(_context: fidl::encoding::Context) -> usize {
887            4
888        }
889        #[inline(always)]
890        fn encode_is_copy() -> bool {
891            true
892        }
893
894        #[inline(always)]
895        fn decode_is_copy() -> bool {
896            true
897        }
898    }
899
900    unsafe impl<D: fidl::encoding::ResourceDialect>
901        fidl::encoding::Encode<VolumeManagerActivateResponse, D>
902        for &VolumeManagerActivateResponse
903    {
904        #[inline]
905        unsafe fn encode(
906            self,
907            encoder: &mut fidl::encoding::Encoder<'_, D>,
908            offset: usize,
909            _depth: fidl::encoding::Depth,
910        ) -> fidl::Result<()> {
911            encoder.debug_check_bounds::<VolumeManagerActivateResponse>(offset);
912            unsafe {
913                // Copy the object into the buffer.
914                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
915                (buf_ptr as *mut VolumeManagerActivateResponse)
916                    .write_unaligned((self as *const VolumeManagerActivateResponse).read());
917                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
918                // done second because the memcpy will write garbage to these bytes.
919            }
920            Ok(())
921        }
922    }
923    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
924        fidl::encoding::Encode<VolumeManagerActivateResponse, D> for (T0,)
925    {
926        #[inline]
927        unsafe fn encode(
928            self,
929            encoder: &mut fidl::encoding::Encoder<'_, D>,
930            offset: usize,
931            depth: fidl::encoding::Depth,
932        ) -> fidl::Result<()> {
933            encoder.debug_check_bounds::<VolumeManagerActivateResponse>(offset);
934            // Zero out padding regions. There's no need to apply masks
935            // because the unmasked parts will be overwritten by fields.
936            // Write the fields.
937            self.0.encode(encoder, offset + 0, depth)?;
938            Ok(())
939        }
940    }
941
942    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
943        for VolumeManagerActivateResponse
944    {
945        #[inline(always)]
946        fn new_empty() -> Self {
947            Self { status: fidl::new_empty!(i32, D) }
948        }
949
950        #[inline]
951        unsafe fn decode(
952            &mut self,
953            decoder: &mut fidl::encoding::Decoder<'_, D>,
954            offset: usize,
955            _depth: fidl::encoding::Depth,
956        ) -> fidl::Result<()> {
957            decoder.debug_check_bounds::<Self>(offset);
958            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
959            // Verify that padding bytes are zero.
960            // Copy from the buffer into the object.
961            unsafe {
962                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
963            }
964            Ok(())
965        }
966    }
967
968    impl fidl::encoding::ValueTypeMarker for VolumeManagerAllocatePartitionRequest {
969        type Borrowed<'a> = &'a Self;
970        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
971            value
972        }
973    }
974
975    unsafe impl fidl::encoding::TypeMarker for VolumeManagerAllocatePartitionRequest {
976        type Owned = Self;
977
978        #[inline(always)]
979        fn inline_align(_context: fidl::encoding::Context) -> usize {
980            8
981        }
982
983        #[inline(always)]
984        fn inline_size(_context: fidl::encoding::Context) -> usize {
985            64
986        }
987    }
988
989    unsafe impl<D: fidl::encoding::ResourceDialect>
990        fidl::encoding::Encode<VolumeManagerAllocatePartitionRequest, D>
991        for &VolumeManagerAllocatePartitionRequest
992    {
993        #[inline]
994        unsafe fn encode(
995            self,
996            encoder: &mut fidl::encoding::Encoder<'_, D>,
997            offset: usize,
998            _depth: fidl::encoding::Depth,
999        ) -> fidl::Result<()> {
1000            encoder.debug_check_bounds::<VolumeManagerAllocatePartitionRequest>(offset);
1001            // Delegate to tuple encoding.
1002            fidl::encoding::Encode::<VolumeManagerAllocatePartitionRequest, D>::encode(
1003                (
1004                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.slice_count),
1005                    <fidl_fuchsia_hardware_block_partition__common::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
1006                    <fidl_fuchsia_hardware_block_partition__common::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.instance),
1007                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1008                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
1009                ),
1010                encoder, offset, _depth
1011            )
1012        }
1013    }
1014    unsafe impl<
1015        D: fidl::encoding::ResourceDialect,
1016        T0: fidl::encoding::Encode<u64, D>,
1017        T1: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition__common::Guid, D>,
1018        T2: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition__common::Guid, D>,
1019        T3: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1020        T4: fidl::encoding::Encode<u32, D>,
1021    > fidl::encoding::Encode<VolumeManagerAllocatePartitionRequest, D> for (T0, T1, T2, T3, T4)
1022    {
1023        #[inline]
1024        unsafe fn encode(
1025            self,
1026            encoder: &mut fidl::encoding::Encoder<'_, D>,
1027            offset: usize,
1028            depth: fidl::encoding::Depth,
1029        ) -> fidl::Result<()> {
1030            encoder.debug_check_bounds::<VolumeManagerAllocatePartitionRequest>(offset);
1031            // Zero out padding regions. There's no need to apply masks
1032            // because the unmasked parts will be overwritten by fields.
1033            unsafe {
1034                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(56);
1035                (ptr as *mut u64).write_unaligned(0);
1036            }
1037            // Write the fields.
1038            self.0.encode(encoder, offset + 0, depth)?;
1039            self.1.encode(encoder, offset + 8, depth)?;
1040            self.2.encode(encoder, offset + 24, depth)?;
1041            self.3.encode(encoder, offset + 40, depth)?;
1042            self.4.encode(encoder, offset + 56, depth)?;
1043            Ok(())
1044        }
1045    }
1046
1047    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1048        for VolumeManagerAllocatePartitionRequest
1049    {
1050        #[inline(always)]
1051        fn new_empty() -> Self {
1052            Self {
1053                slice_count: fidl::new_empty!(u64, D),
1054                type_: fidl::new_empty!(fidl_fuchsia_hardware_block_partition__common::Guid, D),
1055                instance: fidl::new_empty!(fidl_fuchsia_hardware_block_partition__common::Guid, D),
1056                name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
1057                flags: fidl::new_empty!(u32, D),
1058            }
1059        }
1060
1061        #[inline]
1062        unsafe fn decode(
1063            &mut self,
1064            decoder: &mut fidl::encoding::Decoder<'_, D>,
1065            offset: usize,
1066            _depth: fidl::encoding::Depth,
1067        ) -> fidl::Result<()> {
1068            decoder.debug_check_bounds::<Self>(offset);
1069            // Verify that padding bytes are zero.
1070            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(56) };
1071            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1072            let mask = 0xffffffff00000000u64;
1073            let maskedval = padval & mask;
1074            if maskedval != 0 {
1075                return Err(fidl::Error::NonZeroPadding {
1076                    padding_start: offset + 56 + ((mask as u64).trailing_zeros() / 8) as usize,
1077                });
1078            }
1079            fidl::decode!(u64, D, &mut self.slice_count, decoder, offset + 0, _depth)?;
1080            fidl::decode!(
1081                fidl_fuchsia_hardware_block_partition__common::Guid,
1082                D,
1083                &mut self.type_,
1084                decoder,
1085                offset + 8,
1086                _depth
1087            )?;
1088            fidl::decode!(
1089                fidl_fuchsia_hardware_block_partition__common::Guid,
1090                D,
1091                &mut self.instance,
1092                decoder,
1093                offset + 24,
1094                _depth
1095            )?;
1096            fidl::decode!(
1097                fidl::encoding::BoundedString<128>,
1098                D,
1099                &mut self.name,
1100                decoder,
1101                offset + 40,
1102                _depth
1103            )?;
1104            fidl::decode!(u32, D, &mut self.flags, decoder, offset + 56, _depth)?;
1105            Ok(())
1106        }
1107    }
1108
1109    impl fidl::encoding::ValueTypeMarker for VolumeManagerAllocatePartitionResponse {
1110        type Borrowed<'a> = &'a Self;
1111        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1112            value
1113        }
1114    }
1115
1116    unsafe impl fidl::encoding::TypeMarker for VolumeManagerAllocatePartitionResponse {
1117        type Owned = Self;
1118
1119        #[inline(always)]
1120        fn inline_align(_context: fidl::encoding::Context) -> usize {
1121            4
1122        }
1123
1124        #[inline(always)]
1125        fn inline_size(_context: fidl::encoding::Context) -> usize {
1126            4
1127        }
1128        #[inline(always)]
1129        fn encode_is_copy() -> bool {
1130            true
1131        }
1132
1133        #[inline(always)]
1134        fn decode_is_copy() -> bool {
1135            true
1136        }
1137    }
1138
1139    unsafe impl<D: fidl::encoding::ResourceDialect>
1140        fidl::encoding::Encode<VolumeManagerAllocatePartitionResponse, D>
1141        for &VolumeManagerAllocatePartitionResponse
1142    {
1143        #[inline]
1144        unsafe fn encode(
1145            self,
1146            encoder: &mut fidl::encoding::Encoder<'_, D>,
1147            offset: usize,
1148            _depth: fidl::encoding::Depth,
1149        ) -> fidl::Result<()> {
1150            encoder.debug_check_bounds::<VolumeManagerAllocatePartitionResponse>(offset);
1151            unsafe {
1152                // Copy the object into the buffer.
1153                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1154                (buf_ptr as *mut VolumeManagerAllocatePartitionResponse).write_unaligned(
1155                    (self as *const VolumeManagerAllocatePartitionResponse).read(),
1156                );
1157                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1158                // done second because the memcpy will write garbage to these bytes.
1159            }
1160            Ok(())
1161        }
1162    }
1163    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1164        fidl::encoding::Encode<VolumeManagerAllocatePartitionResponse, D> for (T0,)
1165    {
1166        #[inline]
1167        unsafe fn encode(
1168            self,
1169            encoder: &mut fidl::encoding::Encoder<'_, D>,
1170            offset: usize,
1171            depth: fidl::encoding::Depth,
1172        ) -> fidl::Result<()> {
1173            encoder.debug_check_bounds::<VolumeManagerAllocatePartitionResponse>(offset);
1174            // Zero out padding regions. There's no need to apply masks
1175            // because the unmasked parts will be overwritten by fields.
1176            // Write the fields.
1177            self.0.encode(encoder, offset + 0, depth)?;
1178            Ok(())
1179        }
1180    }
1181
1182    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1183        for VolumeManagerAllocatePartitionResponse
1184    {
1185        #[inline(always)]
1186        fn new_empty() -> Self {
1187            Self { status: fidl::new_empty!(i32, D) }
1188        }
1189
1190        #[inline]
1191        unsafe fn decode(
1192            &mut self,
1193            decoder: &mut fidl::encoding::Decoder<'_, D>,
1194            offset: usize,
1195            _depth: fidl::encoding::Depth,
1196        ) -> fidl::Result<()> {
1197            decoder.debug_check_bounds::<Self>(offset);
1198            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1199            // Verify that padding bytes are zero.
1200            // Copy from the buffer into the object.
1201            unsafe {
1202                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1203            }
1204            Ok(())
1205        }
1206    }
1207
1208    impl fidl::encoding::ValueTypeMarker for VolumeManagerGetInfoResponse {
1209        type Borrowed<'a> = &'a Self;
1210        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1211            value
1212        }
1213    }
1214
1215    unsafe impl fidl::encoding::TypeMarker for VolumeManagerGetInfoResponse {
1216        type Owned = Self;
1217
1218        #[inline(always)]
1219        fn inline_align(_context: fidl::encoding::Context) -> usize {
1220            8
1221        }
1222
1223        #[inline(always)]
1224        fn inline_size(_context: fidl::encoding::Context) -> usize {
1225            16
1226        }
1227    }
1228
1229    unsafe impl<D: fidl::encoding::ResourceDialect>
1230        fidl::encoding::Encode<VolumeManagerGetInfoResponse, D> for &VolumeManagerGetInfoResponse
1231    {
1232        #[inline]
1233        unsafe fn encode(
1234            self,
1235            encoder: &mut fidl::encoding::Encoder<'_, D>,
1236            offset: usize,
1237            _depth: fidl::encoding::Depth,
1238        ) -> fidl::Result<()> {
1239            encoder.debug_check_bounds::<VolumeManagerGetInfoResponse>(offset);
1240            // Delegate to tuple encoding.
1241            fidl::encoding::Encode::<VolumeManagerGetInfoResponse, D>::encode(
1242                (
1243                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
1244                    <fidl::encoding::Boxed<VolumeManagerInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
1245                ),
1246                encoder, offset, _depth
1247            )
1248        }
1249    }
1250    unsafe impl<
1251        D: fidl::encoding::ResourceDialect,
1252        T0: fidl::encoding::Encode<i32, D>,
1253        T1: fidl::encoding::Encode<fidl::encoding::Boxed<VolumeManagerInfo>, D>,
1254    > fidl::encoding::Encode<VolumeManagerGetInfoResponse, D> for (T0, T1)
1255    {
1256        #[inline]
1257        unsafe fn encode(
1258            self,
1259            encoder: &mut fidl::encoding::Encoder<'_, D>,
1260            offset: usize,
1261            depth: fidl::encoding::Depth,
1262        ) -> fidl::Result<()> {
1263            encoder.debug_check_bounds::<VolumeManagerGetInfoResponse>(offset);
1264            // Zero out padding regions. There's no need to apply masks
1265            // because the unmasked parts will be overwritten by fields.
1266            unsafe {
1267                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1268                (ptr as *mut u64).write_unaligned(0);
1269            }
1270            // Write the fields.
1271            self.0.encode(encoder, offset + 0, depth)?;
1272            self.1.encode(encoder, offset + 8, depth)?;
1273            Ok(())
1274        }
1275    }
1276
1277    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1278        for VolumeManagerGetInfoResponse
1279    {
1280        #[inline(always)]
1281        fn new_empty() -> Self {
1282            Self {
1283                status: fidl::new_empty!(i32, D),
1284                info: fidl::new_empty!(fidl::encoding::Boxed<VolumeManagerInfo>, D),
1285            }
1286        }
1287
1288        #[inline]
1289        unsafe fn decode(
1290            &mut self,
1291            decoder: &mut fidl::encoding::Decoder<'_, D>,
1292            offset: usize,
1293            _depth: fidl::encoding::Depth,
1294        ) -> fidl::Result<()> {
1295            decoder.debug_check_bounds::<Self>(offset);
1296            // Verify that padding bytes are zero.
1297            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1298            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1299            let mask = 0xffffffff00000000u64;
1300            let maskedval = padval & mask;
1301            if maskedval != 0 {
1302                return Err(fidl::Error::NonZeroPadding {
1303                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1304                });
1305            }
1306            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
1307            fidl::decode!(
1308                fidl::encoding::Boxed<VolumeManagerInfo>,
1309                D,
1310                &mut self.info,
1311                decoder,
1312                offset + 8,
1313                _depth
1314            )?;
1315            Ok(())
1316        }
1317    }
1318
1319    impl fidl::encoding::ValueTypeMarker for VolumeManagerGetPartitionLimitRequest {
1320        type Borrowed<'a> = &'a Self;
1321        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1322            value
1323        }
1324    }
1325
1326    unsafe impl fidl::encoding::TypeMarker for VolumeManagerGetPartitionLimitRequest {
1327        type Owned = Self;
1328
1329        #[inline(always)]
1330        fn inline_align(_context: fidl::encoding::Context) -> usize {
1331            1
1332        }
1333
1334        #[inline(always)]
1335        fn inline_size(_context: fidl::encoding::Context) -> usize {
1336            16
1337        }
1338    }
1339
1340    unsafe impl<D: fidl::encoding::ResourceDialect>
1341        fidl::encoding::Encode<VolumeManagerGetPartitionLimitRequest, D>
1342        for &VolumeManagerGetPartitionLimitRequest
1343    {
1344        #[inline]
1345        unsafe fn encode(
1346            self,
1347            encoder: &mut fidl::encoding::Encoder<'_, D>,
1348            offset: usize,
1349            _depth: fidl::encoding::Depth,
1350        ) -> fidl::Result<()> {
1351            encoder.debug_check_bounds::<VolumeManagerGetPartitionLimitRequest>(offset);
1352            // Delegate to tuple encoding.
1353            fidl::encoding::Encode::<VolumeManagerGetPartitionLimitRequest, D>::encode(
1354                (
1355                    <fidl_fuchsia_hardware_block_partition__common::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.guid),
1356                ),
1357                encoder, offset, _depth
1358            )
1359        }
1360    }
1361    unsafe impl<
1362        D: fidl::encoding::ResourceDialect,
1363        T0: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition__common::Guid, D>,
1364    > fidl::encoding::Encode<VolumeManagerGetPartitionLimitRequest, D> for (T0,)
1365    {
1366        #[inline]
1367        unsafe fn encode(
1368            self,
1369            encoder: &mut fidl::encoding::Encoder<'_, D>,
1370            offset: usize,
1371            depth: fidl::encoding::Depth,
1372        ) -> fidl::Result<()> {
1373            encoder.debug_check_bounds::<VolumeManagerGetPartitionLimitRequest>(offset);
1374            // Zero out padding regions. There's no need to apply masks
1375            // because the unmasked parts will be overwritten by fields.
1376            // Write the fields.
1377            self.0.encode(encoder, offset + 0, depth)?;
1378            Ok(())
1379        }
1380    }
1381
1382    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1383        for VolumeManagerGetPartitionLimitRequest
1384    {
1385        #[inline(always)]
1386        fn new_empty() -> Self {
1387            Self { guid: fidl::new_empty!(fidl_fuchsia_hardware_block_partition__common::Guid, D) }
1388        }
1389
1390        #[inline]
1391        unsafe fn decode(
1392            &mut self,
1393            decoder: &mut fidl::encoding::Decoder<'_, D>,
1394            offset: usize,
1395            _depth: fidl::encoding::Depth,
1396        ) -> fidl::Result<()> {
1397            decoder.debug_check_bounds::<Self>(offset);
1398            // Verify that padding bytes are zero.
1399            fidl::decode!(
1400                fidl_fuchsia_hardware_block_partition__common::Guid,
1401                D,
1402                &mut self.guid,
1403                decoder,
1404                offset + 0,
1405                _depth
1406            )?;
1407            Ok(())
1408        }
1409    }
1410
1411    impl fidl::encoding::ValueTypeMarker for VolumeManagerGetPartitionLimitResponse {
1412        type Borrowed<'a> = &'a Self;
1413        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1414            value
1415        }
1416    }
1417
1418    unsafe impl fidl::encoding::TypeMarker for VolumeManagerGetPartitionLimitResponse {
1419        type Owned = Self;
1420
1421        #[inline(always)]
1422        fn inline_align(_context: fidl::encoding::Context) -> usize {
1423            8
1424        }
1425
1426        #[inline(always)]
1427        fn inline_size(_context: fidl::encoding::Context) -> usize {
1428            16
1429        }
1430    }
1431
1432    unsafe impl<D: fidl::encoding::ResourceDialect>
1433        fidl::encoding::Encode<VolumeManagerGetPartitionLimitResponse, D>
1434        for &VolumeManagerGetPartitionLimitResponse
1435    {
1436        #[inline]
1437        unsafe fn encode(
1438            self,
1439            encoder: &mut fidl::encoding::Encoder<'_, D>,
1440            offset: usize,
1441            _depth: fidl::encoding::Depth,
1442        ) -> fidl::Result<()> {
1443            encoder.debug_check_bounds::<VolumeManagerGetPartitionLimitResponse>(offset);
1444            unsafe {
1445                // Copy the object into the buffer.
1446                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1447                (buf_ptr as *mut VolumeManagerGetPartitionLimitResponse).write_unaligned(
1448                    (self as *const VolumeManagerGetPartitionLimitResponse).read(),
1449                );
1450                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1451                // done second because the memcpy will write garbage to these bytes.
1452                let padding_ptr = buf_ptr.offset(0) as *mut u64;
1453                let padding_mask = 0xffffffff00000000u64;
1454                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1455            }
1456            Ok(())
1457        }
1458    }
1459    unsafe impl<
1460        D: fidl::encoding::ResourceDialect,
1461        T0: fidl::encoding::Encode<i32, D>,
1462        T1: fidl::encoding::Encode<u64, D>,
1463    > fidl::encoding::Encode<VolumeManagerGetPartitionLimitResponse, D> for (T0, T1)
1464    {
1465        #[inline]
1466        unsafe fn encode(
1467            self,
1468            encoder: &mut fidl::encoding::Encoder<'_, D>,
1469            offset: usize,
1470            depth: fidl::encoding::Depth,
1471        ) -> fidl::Result<()> {
1472            encoder.debug_check_bounds::<VolumeManagerGetPartitionLimitResponse>(offset);
1473            // Zero out padding regions. There's no need to apply masks
1474            // because the unmasked parts will be overwritten by fields.
1475            unsafe {
1476                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1477                (ptr as *mut u64).write_unaligned(0);
1478            }
1479            // Write the fields.
1480            self.0.encode(encoder, offset + 0, depth)?;
1481            self.1.encode(encoder, offset + 8, depth)?;
1482            Ok(())
1483        }
1484    }
1485
1486    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1487        for VolumeManagerGetPartitionLimitResponse
1488    {
1489        #[inline(always)]
1490        fn new_empty() -> Self {
1491            Self { status: fidl::new_empty!(i32, D), slice_count: fidl::new_empty!(u64, D) }
1492        }
1493
1494        #[inline]
1495        unsafe fn decode(
1496            &mut self,
1497            decoder: &mut fidl::encoding::Decoder<'_, D>,
1498            offset: usize,
1499            _depth: fidl::encoding::Depth,
1500        ) -> fidl::Result<()> {
1501            decoder.debug_check_bounds::<Self>(offset);
1502            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1503            // Verify that padding bytes are zero.
1504            let ptr = unsafe { buf_ptr.offset(0) };
1505            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1506            let mask = 0xffffffff00000000u64;
1507            let maskedval = padval & mask;
1508            if maskedval != 0 {
1509                return Err(fidl::Error::NonZeroPadding {
1510                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1511                });
1512            }
1513            // Copy from the buffer into the object.
1514            unsafe {
1515                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1516            }
1517            Ok(())
1518        }
1519    }
1520
1521    impl fidl::encoding::ValueTypeMarker for VolumeManagerInfo {
1522        type Borrowed<'a> = &'a Self;
1523        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1524            value
1525        }
1526    }
1527
1528    unsafe impl fidl::encoding::TypeMarker for VolumeManagerInfo {
1529        type Owned = Self;
1530
1531        #[inline(always)]
1532        fn inline_align(_context: fidl::encoding::Context) -> usize {
1533            8
1534        }
1535
1536        #[inline(always)]
1537        fn inline_size(_context: fidl::encoding::Context) -> usize {
1538            40
1539        }
1540        #[inline(always)]
1541        fn encode_is_copy() -> bool {
1542            true
1543        }
1544
1545        #[inline(always)]
1546        fn decode_is_copy() -> bool {
1547            true
1548        }
1549    }
1550
1551    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeManagerInfo, D>
1552        for &VolumeManagerInfo
1553    {
1554        #[inline]
1555        unsafe fn encode(
1556            self,
1557            encoder: &mut fidl::encoding::Encoder<'_, D>,
1558            offset: usize,
1559            _depth: fidl::encoding::Depth,
1560        ) -> fidl::Result<()> {
1561            encoder.debug_check_bounds::<VolumeManagerInfo>(offset);
1562            unsafe {
1563                // Copy the object into the buffer.
1564                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1565                (buf_ptr as *mut VolumeManagerInfo)
1566                    .write_unaligned((self as *const VolumeManagerInfo).read());
1567                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1568                // done second because the memcpy will write garbage to these bytes.
1569            }
1570            Ok(())
1571        }
1572    }
1573    unsafe impl<
1574        D: fidl::encoding::ResourceDialect,
1575        T0: fidl::encoding::Encode<u64, D>,
1576        T1: fidl::encoding::Encode<u64, D>,
1577        T2: fidl::encoding::Encode<u64, D>,
1578        T3: fidl::encoding::Encode<u64, D>,
1579        T4: fidl::encoding::Encode<u64, D>,
1580    > fidl::encoding::Encode<VolumeManagerInfo, D> for (T0, T1, T2, T3, T4)
1581    {
1582        #[inline]
1583        unsafe fn encode(
1584            self,
1585            encoder: &mut fidl::encoding::Encoder<'_, D>,
1586            offset: usize,
1587            depth: fidl::encoding::Depth,
1588        ) -> fidl::Result<()> {
1589            encoder.debug_check_bounds::<VolumeManagerInfo>(offset);
1590            // Zero out padding regions. There's no need to apply masks
1591            // because the unmasked parts will be overwritten by fields.
1592            // Write the fields.
1593            self.0.encode(encoder, offset + 0, depth)?;
1594            self.1.encode(encoder, offset + 8, depth)?;
1595            self.2.encode(encoder, offset + 16, depth)?;
1596            self.3.encode(encoder, offset + 24, depth)?;
1597            self.4.encode(encoder, offset + 32, depth)?;
1598            Ok(())
1599        }
1600    }
1601
1602    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeManagerInfo {
1603        #[inline(always)]
1604        fn new_empty() -> Self {
1605            Self {
1606                slice_size: fidl::new_empty!(u64, D),
1607                slice_count: fidl::new_empty!(u64, D),
1608                assigned_slice_count: fidl::new_empty!(u64, D),
1609                maximum_slice_count: fidl::new_empty!(u64, D),
1610                max_virtual_slice: fidl::new_empty!(u64, D),
1611            }
1612        }
1613
1614        #[inline]
1615        unsafe fn decode(
1616            &mut self,
1617            decoder: &mut fidl::encoding::Decoder<'_, D>,
1618            offset: usize,
1619            _depth: fidl::encoding::Depth,
1620        ) -> fidl::Result<()> {
1621            decoder.debug_check_bounds::<Self>(offset);
1622            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1623            // Verify that padding bytes are zero.
1624            // Copy from the buffer into the object.
1625            unsafe {
1626                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 40);
1627            }
1628            Ok(())
1629        }
1630    }
1631
1632    impl fidl::encoding::ValueTypeMarker for VolumeManagerSetPartitionLimitRequest {
1633        type Borrowed<'a> = &'a Self;
1634        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1635            value
1636        }
1637    }
1638
1639    unsafe impl fidl::encoding::TypeMarker for VolumeManagerSetPartitionLimitRequest {
1640        type Owned = Self;
1641
1642        #[inline(always)]
1643        fn inline_align(_context: fidl::encoding::Context) -> usize {
1644            8
1645        }
1646
1647        #[inline(always)]
1648        fn inline_size(_context: fidl::encoding::Context) -> usize {
1649            24
1650        }
1651    }
1652
1653    unsafe impl<D: fidl::encoding::ResourceDialect>
1654        fidl::encoding::Encode<VolumeManagerSetPartitionLimitRequest, D>
1655        for &VolumeManagerSetPartitionLimitRequest
1656    {
1657        #[inline]
1658        unsafe fn encode(
1659            self,
1660            encoder: &mut fidl::encoding::Encoder<'_, D>,
1661            offset: usize,
1662            _depth: fidl::encoding::Depth,
1663        ) -> fidl::Result<()> {
1664            encoder.debug_check_bounds::<VolumeManagerSetPartitionLimitRequest>(offset);
1665            // Delegate to tuple encoding.
1666            fidl::encoding::Encode::<VolumeManagerSetPartitionLimitRequest, D>::encode(
1667                (
1668                    <fidl_fuchsia_hardware_block_partition__common::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.guid),
1669                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.slice_count),
1670                ),
1671                encoder, offset, _depth
1672            )
1673        }
1674    }
1675    unsafe impl<
1676        D: fidl::encoding::ResourceDialect,
1677        T0: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition__common::Guid, D>,
1678        T1: fidl::encoding::Encode<u64, D>,
1679    > fidl::encoding::Encode<VolumeManagerSetPartitionLimitRequest, D> for (T0, T1)
1680    {
1681        #[inline]
1682        unsafe fn encode(
1683            self,
1684            encoder: &mut fidl::encoding::Encoder<'_, D>,
1685            offset: usize,
1686            depth: fidl::encoding::Depth,
1687        ) -> fidl::Result<()> {
1688            encoder.debug_check_bounds::<VolumeManagerSetPartitionLimitRequest>(offset);
1689            // Zero out padding regions. There's no need to apply masks
1690            // because the unmasked parts will be overwritten by fields.
1691            // Write the fields.
1692            self.0.encode(encoder, offset + 0, depth)?;
1693            self.1.encode(encoder, offset + 16, depth)?;
1694            Ok(())
1695        }
1696    }
1697
1698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1699        for VolumeManagerSetPartitionLimitRequest
1700    {
1701        #[inline(always)]
1702        fn new_empty() -> Self {
1703            Self {
1704                guid: fidl::new_empty!(fidl_fuchsia_hardware_block_partition__common::Guid, D),
1705                slice_count: fidl::new_empty!(u64, D),
1706            }
1707        }
1708
1709        #[inline]
1710        unsafe fn decode(
1711            &mut self,
1712            decoder: &mut fidl::encoding::Decoder<'_, D>,
1713            offset: usize,
1714            _depth: fidl::encoding::Depth,
1715        ) -> fidl::Result<()> {
1716            decoder.debug_check_bounds::<Self>(offset);
1717            // Verify that padding bytes are zero.
1718            fidl::decode!(
1719                fidl_fuchsia_hardware_block_partition__common::Guid,
1720                D,
1721                &mut self.guid,
1722                decoder,
1723                offset + 0,
1724                _depth
1725            )?;
1726            fidl::decode!(u64, D, &mut self.slice_count, decoder, offset + 16, _depth)?;
1727            Ok(())
1728        }
1729    }
1730
1731    impl fidl::encoding::ValueTypeMarker for VolumeManagerSetPartitionLimitResponse {
1732        type Borrowed<'a> = &'a Self;
1733        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1734            value
1735        }
1736    }
1737
1738    unsafe impl fidl::encoding::TypeMarker for VolumeManagerSetPartitionLimitResponse {
1739        type Owned = Self;
1740
1741        #[inline(always)]
1742        fn inline_align(_context: fidl::encoding::Context) -> usize {
1743            4
1744        }
1745
1746        #[inline(always)]
1747        fn inline_size(_context: fidl::encoding::Context) -> usize {
1748            4
1749        }
1750        #[inline(always)]
1751        fn encode_is_copy() -> bool {
1752            true
1753        }
1754
1755        #[inline(always)]
1756        fn decode_is_copy() -> bool {
1757            true
1758        }
1759    }
1760
1761    unsafe impl<D: fidl::encoding::ResourceDialect>
1762        fidl::encoding::Encode<VolumeManagerSetPartitionLimitResponse, D>
1763        for &VolumeManagerSetPartitionLimitResponse
1764    {
1765        #[inline]
1766        unsafe fn encode(
1767            self,
1768            encoder: &mut fidl::encoding::Encoder<'_, D>,
1769            offset: usize,
1770            _depth: fidl::encoding::Depth,
1771        ) -> fidl::Result<()> {
1772            encoder.debug_check_bounds::<VolumeManagerSetPartitionLimitResponse>(offset);
1773            unsafe {
1774                // Copy the object into the buffer.
1775                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1776                (buf_ptr as *mut VolumeManagerSetPartitionLimitResponse).write_unaligned(
1777                    (self as *const VolumeManagerSetPartitionLimitResponse).read(),
1778                );
1779                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1780                // done second because the memcpy will write garbage to these bytes.
1781            }
1782            Ok(())
1783        }
1784    }
1785    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1786        fidl::encoding::Encode<VolumeManagerSetPartitionLimitResponse, D> for (T0,)
1787    {
1788        #[inline]
1789        unsafe fn encode(
1790            self,
1791            encoder: &mut fidl::encoding::Encoder<'_, D>,
1792            offset: usize,
1793            depth: fidl::encoding::Depth,
1794        ) -> fidl::Result<()> {
1795            encoder.debug_check_bounds::<VolumeManagerSetPartitionLimitResponse>(offset);
1796            // Zero out padding regions. There's no need to apply masks
1797            // because the unmasked parts will be overwritten by fields.
1798            // Write the fields.
1799            self.0.encode(encoder, offset + 0, depth)?;
1800            Ok(())
1801        }
1802    }
1803
1804    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1805        for VolumeManagerSetPartitionLimitResponse
1806    {
1807        #[inline(always)]
1808        fn new_empty() -> Self {
1809            Self { status: fidl::new_empty!(i32, D) }
1810        }
1811
1812        #[inline]
1813        unsafe fn decode(
1814            &mut self,
1815            decoder: &mut fidl::encoding::Decoder<'_, D>,
1816            offset: usize,
1817            _depth: fidl::encoding::Depth,
1818        ) -> fidl::Result<()> {
1819            decoder.debug_check_bounds::<Self>(offset);
1820            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1821            // Verify that padding bytes are zero.
1822            // Copy from the buffer into the object.
1823            unsafe {
1824                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1825            }
1826            Ok(())
1827        }
1828    }
1829
1830    impl fidl::encoding::ValueTypeMarker for VolumeManagerSetPartitionNameRequest {
1831        type Borrowed<'a> = &'a Self;
1832        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1833            value
1834        }
1835    }
1836
1837    unsafe impl fidl::encoding::TypeMarker for VolumeManagerSetPartitionNameRequest {
1838        type Owned = Self;
1839
1840        #[inline(always)]
1841        fn inline_align(_context: fidl::encoding::Context) -> usize {
1842            8
1843        }
1844
1845        #[inline(always)]
1846        fn inline_size(_context: fidl::encoding::Context) -> usize {
1847            32
1848        }
1849    }
1850
1851    unsafe impl<D: fidl::encoding::ResourceDialect>
1852        fidl::encoding::Encode<VolumeManagerSetPartitionNameRequest, D>
1853        for &VolumeManagerSetPartitionNameRequest
1854    {
1855        #[inline]
1856        unsafe fn encode(
1857            self,
1858            encoder: &mut fidl::encoding::Encoder<'_, D>,
1859            offset: usize,
1860            _depth: fidl::encoding::Depth,
1861        ) -> fidl::Result<()> {
1862            encoder.debug_check_bounds::<VolumeManagerSetPartitionNameRequest>(offset);
1863            // Delegate to tuple encoding.
1864            fidl::encoding::Encode::<VolumeManagerSetPartitionNameRequest, D>::encode(
1865                (
1866                    <fidl_fuchsia_hardware_block_partition__common::Guid as fidl::encoding::ValueTypeMarker>::borrow(&self.guid),
1867                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
1868                ),
1869                encoder, offset, _depth
1870            )
1871        }
1872    }
1873    unsafe impl<
1874        D: fidl::encoding::ResourceDialect,
1875        T0: fidl::encoding::Encode<fidl_fuchsia_hardware_block_partition__common::Guid, D>,
1876        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<128>, D>,
1877    > fidl::encoding::Encode<VolumeManagerSetPartitionNameRequest, D> for (T0, T1)
1878    {
1879        #[inline]
1880        unsafe fn encode(
1881            self,
1882            encoder: &mut fidl::encoding::Encoder<'_, D>,
1883            offset: usize,
1884            depth: fidl::encoding::Depth,
1885        ) -> fidl::Result<()> {
1886            encoder.debug_check_bounds::<VolumeManagerSetPartitionNameRequest>(offset);
1887            // Zero out padding regions. There's no need to apply masks
1888            // because the unmasked parts will be overwritten by fields.
1889            // Write the fields.
1890            self.0.encode(encoder, offset + 0, depth)?;
1891            self.1.encode(encoder, offset + 16, depth)?;
1892            Ok(())
1893        }
1894    }
1895
1896    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1897        for VolumeManagerSetPartitionNameRequest
1898    {
1899        #[inline(always)]
1900        fn new_empty() -> Self {
1901            Self {
1902                guid: fidl::new_empty!(fidl_fuchsia_hardware_block_partition__common::Guid, D),
1903                name: fidl::new_empty!(fidl::encoding::BoundedString<128>, D),
1904            }
1905        }
1906
1907        #[inline]
1908        unsafe fn decode(
1909            &mut self,
1910            decoder: &mut fidl::encoding::Decoder<'_, D>,
1911            offset: usize,
1912            _depth: fidl::encoding::Depth,
1913        ) -> fidl::Result<()> {
1914            decoder.debug_check_bounds::<Self>(offset);
1915            // Verify that padding bytes are zero.
1916            fidl::decode!(
1917                fidl_fuchsia_hardware_block_partition__common::Guid,
1918                D,
1919                &mut self.guid,
1920                decoder,
1921                offset + 0,
1922                _depth
1923            )?;
1924            fidl::decode!(
1925                fidl::encoding::BoundedString<128>,
1926                D,
1927                &mut self.name,
1928                decoder,
1929                offset + 16,
1930                _depth
1931            )?;
1932            Ok(())
1933        }
1934    }
1935
1936    impl fidl::encoding::ValueTypeMarker for VolumeQuerySlicesRequest {
1937        type Borrowed<'a> = &'a Self;
1938        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1939            value
1940        }
1941    }
1942
1943    unsafe impl fidl::encoding::TypeMarker for VolumeQuerySlicesRequest {
1944        type Owned = Self;
1945
1946        #[inline(always)]
1947        fn inline_align(_context: fidl::encoding::Context) -> usize {
1948            8
1949        }
1950
1951        #[inline(always)]
1952        fn inline_size(_context: fidl::encoding::Context) -> usize {
1953            16
1954        }
1955    }
1956
1957    unsafe impl<D: fidl::encoding::ResourceDialect>
1958        fidl::encoding::Encode<VolumeQuerySlicesRequest, D> for &VolumeQuerySlicesRequest
1959    {
1960        #[inline]
1961        unsafe fn encode(
1962            self,
1963            encoder: &mut fidl::encoding::Encoder<'_, D>,
1964            offset: usize,
1965            _depth: fidl::encoding::Depth,
1966        ) -> fidl::Result<()> {
1967            encoder.debug_check_bounds::<VolumeQuerySlicesRequest>(offset);
1968            // Delegate to tuple encoding.
1969            fidl::encoding::Encode::<VolumeQuerySlicesRequest, D>::encode(
1970                (<fidl::encoding::Vector<u64, 16> as fidl::encoding::ValueTypeMarker>::borrow(
1971                    &self.start_slices,
1972                ),),
1973                encoder,
1974                offset,
1975                _depth,
1976            )
1977        }
1978    }
1979    unsafe impl<
1980        D: fidl::encoding::ResourceDialect,
1981        T0: fidl::encoding::Encode<fidl::encoding::Vector<u64, 16>, D>,
1982    > fidl::encoding::Encode<VolumeQuerySlicesRequest, D> for (T0,)
1983    {
1984        #[inline]
1985        unsafe fn encode(
1986            self,
1987            encoder: &mut fidl::encoding::Encoder<'_, D>,
1988            offset: usize,
1989            depth: fidl::encoding::Depth,
1990        ) -> fidl::Result<()> {
1991            encoder.debug_check_bounds::<VolumeQuerySlicesRequest>(offset);
1992            // Zero out padding regions. There's no need to apply masks
1993            // because the unmasked parts will be overwritten by fields.
1994            // Write the fields.
1995            self.0.encode(encoder, offset + 0, depth)?;
1996            Ok(())
1997        }
1998    }
1999
2000    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2001        for VolumeQuerySlicesRequest
2002    {
2003        #[inline(always)]
2004        fn new_empty() -> Self {
2005            Self { start_slices: fidl::new_empty!(fidl::encoding::Vector<u64, 16>, D) }
2006        }
2007
2008        #[inline]
2009        unsafe fn decode(
2010            &mut self,
2011            decoder: &mut fidl::encoding::Decoder<'_, D>,
2012            offset: usize,
2013            _depth: fidl::encoding::Depth,
2014        ) -> fidl::Result<()> {
2015            decoder.debug_check_bounds::<Self>(offset);
2016            // Verify that padding bytes are zero.
2017            fidl::decode!(fidl::encoding::Vector<u64, 16>, D, &mut self.start_slices, decoder, offset + 0, _depth)?;
2018            Ok(())
2019        }
2020    }
2021
2022    impl fidl::encoding::ValueTypeMarker for VolumeQuerySlicesResponse {
2023        type Borrowed<'a> = &'a Self;
2024        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2025            value
2026        }
2027    }
2028
2029    unsafe impl fidl::encoding::TypeMarker for VolumeQuerySlicesResponse {
2030        type Owned = Self;
2031
2032        #[inline(always)]
2033        fn inline_align(_context: fidl::encoding::Context) -> usize {
2034            8
2035        }
2036
2037        #[inline(always)]
2038        fn inline_size(_context: fidl::encoding::Context) -> usize {
2039            272
2040        }
2041    }
2042
2043    unsafe impl<D: fidl::encoding::ResourceDialect>
2044        fidl::encoding::Encode<VolumeQuerySlicesResponse, D> for &VolumeQuerySlicesResponse
2045    {
2046        #[inline]
2047        unsafe fn encode(
2048            self,
2049            encoder: &mut fidl::encoding::Encoder<'_, D>,
2050            offset: usize,
2051            _depth: fidl::encoding::Depth,
2052        ) -> fidl::Result<()> {
2053            encoder.debug_check_bounds::<VolumeQuerySlicesResponse>(offset);
2054            // Delegate to tuple encoding.
2055            fidl::encoding::Encode::<VolumeQuerySlicesResponse, D>::encode(
2056                (
2057                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
2058                    <fidl::encoding::Array<VsliceRange, 16> as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
2059                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.response_count),
2060                ),
2061                encoder, offset, _depth
2062            )
2063        }
2064    }
2065    unsafe impl<
2066        D: fidl::encoding::ResourceDialect,
2067        T0: fidl::encoding::Encode<i32, D>,
2068        T1: fidl::encoding::Encode<fidl::encoding::Array<VsliceRange, 16>, D>,
2069        T2: fidl::encoding::Encode<u64, D>,
2070    > fidl::encoding::Encode<VolumeQuerySlicesResponse, D> for (T0, T1, T2)
2071    {
2072        #[inline]
2073        unsafe fn encode(
2074            self,
2075            encoder: &mut fidl::encoding::Encoder<'_, D>,
2076            offset: usize,
2077            depth: fidl::encoding::Depth,
2078        ) -> fidl::Result<()> {
2079            encoder.debug_check_bounds::<VolumeQuerySlicesResponse>(offset);
2080            // Zero out padding regions. There's no need to apply masks
2081            // because the unmasked parts will be overwritten by fields.
2082            unsafe {
2083                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2084                (ptr as *mut u64).write_unaligned(0);
2085            }
2086            // Write the fields.
2087            self.0.encode(encoder, offset + 0, depth)?;
2088            self.1.encode(encoder, offset + 8, depth)?;
2089            self.2.encode(encoder, offset + 264, depth)?;
2090            Ok(())
2091        }
2092    }
2093
2094    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2095        for VolumeQuerySlicesResponse
2096    {
2097        #[inline(always)]
2098        fn new_empty() -> Self {
2099            Self {
2100                status: fidl::new_empty!(i32, D),
2101                response: fidl::new_empty!(fidl::encoding::Array<VsliceRange, 16>, D),
2102                response_count: fidl::new_empty!(u64, D),
2103            }
2104        }
2105
2106        #[inline]
2107        unsafe fn decode(
2108            &mut self,
2109            decoder: &mut fidl::encoding::Decoder<'_, D>,
2110            offset: usize,
2111            _depth: fidl::encoding::Depth,
2112        ) -> fidl::Result<()> {
2113            decoder.debug_check_bounds::<Self>(offset);
2114            // Verify that padding bytes are zero.
2115            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2116            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2117            let mask = 0xffffffff00000000u64;
2118            let maskedval = padval & mask;
2119            if maskedval != 0 {
2120                return Err(fidl::Error::NonZeroPadding {
2121                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2122                });
2123            }
2124            fidl::decode!(i32, D, &mut self.status, decoder, offset + 0, _depth)?;
2125            fidl::decode!(fidl::encoding::Array<VsliceRange, 16>, D, &mut self.response, decoder, offset + 8, _depth)?;
2126            fidl::decode!(u64, D, &mut self.response_count, decoder, offset + 264, _depth)?;
2127            Ok(())
2128        }
2129    }
2130
2131    impl fidl::encoding::ValueTypeMarker for VolumeShrinkRequest {
2132        type Borrowed<'a> = &'a Self;
2133        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2134            value
2135        }
2136    }
2137
2138    unsafe impl fidl::encoding::TypeMarker for VolumeShrinkRequest {
2139        type Owned = Self;
2140
2141        #[inline(always)]
2142        fn inline_align(_context: fidl::encoding::Context) -> usize {
2143            8
2144        }
2145
2146        #[inline(always)]
2147        fn inline_size(_context: fidl::encoding::Context) -> usize {
2148            16
2149        }
2150        #[inline(always)]
2151        fn encode_is_copy() -> bool {
2152            true
2153        }
2154
2155        #[inline(always)]
2156        fn decode_is_copy() -> bool {
2157            true
2158        }
2159    }
2160
2161    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeShrinkRequest, D>
2162        for &VolumeShrinkRequest
2163    {
2164        #[inline]
2165        unsafe fn encode(
2166            self,
2167            encoder: &mut fidl::encoding::Encoder<'_, D>,
2168            offset: usize,
2169            _depth: fidl::encoding::Depth,
2170        ) -> fidl::Result<()> {
2171            encoder.debug_check_bounds::<VolumeShrinkRequest>(offset);
2172            unsafe {
2173                // Copy the object into the buffer.
2174                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2175                (buf_ptr as *mut VolumeShrinkRequest)
2176                    .write_unaligned((self as *const VolumeShrinkRequest).read());
2177                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2178                // done second because the memcpy will write garbage to these bytes.
2179            }
2180            Ok(())
2181        }
2182    }
2183    unsafe impl<
2184        D: fidl::encoding::ResourceDialect,
2185        T0: fidl::encoding::Encode<u64, D>,
2186        T1: fidl::encoding::Encode<u64, D>,
2187    > fidl::encoding::Encode<VolumeShrinkRequest, D> for (T0, T1)
2188    {
2189        #[inline]
2190        unsafe fn encode(
2191            self,
2192            encoder: &mut fidl::encoding::Encoder<'_, D>,
2193            offset: usize,
2194            depth: fidl::encoding::Depth,
2195        ) -> fidl::Result<()> {
2196            encoder.debug_check_bounds::<VolumeShrinkRequest>(offset);
2197            // Zero out padding regions. There's no need to apply masks
2198            // because the unmasked parts will be overwritten by fields.
2199            // Write the fields.
2200            self.0.encode(encoder, offset + 0, depth)?;
2201            self.1.encode(encoder, offset + 8, depth)?;
2202            Ok(())
2203        }
2204    }
2205
2206    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeShrinkRequest {
2207        #[inline(always)]
2208        fn new_empty() -> Self {
2209            Self { start_slice: fidl::new_empty!(u64, D), slice_count: fidl::new_empty!(u64, D) }
2210        }
2211
2212        #[inline]
2213        unsafe fn decode(
2214            &mut self,
2215            decoder: &mut fidl::encoding::Decoder<'_, D>,
2216            offset: usize,
2217            _depth: fidl::encoding::Depth,
2218        ) -> fidl::Result<()> {
2219            decoder.debug_check_bounds::<Self>(offset);
2220            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2221            // Verify that padding bytes are zero.
2222            // Copy from the buffer into the object.
2223            unsafe {
2224                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2225            }
2226            Ok(())
2227        }
2228    }
2229
2230    impl fidl::encoding::ValueTypeMarker for VolumeShrinkResponse {
2231        type Borrowed<'a> = &'a Self;
2232        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2233            value
2234        }
2235    }
2236
2237    unsafe impl fidl::encoding::TypeMarker for VolumeShrinkResponse {
2238        type Owned = Self;
2239
2240        #[inline(always)]
2241        fn inline_align(_context: fidl::encoding::Context) -> usize {
2242            4
2243        }
2244
2245        #[inline(always)]
2246        fn inline_size(_context: fidl::encoding::Context) -> usize {
2247            4
2248        }
2249        #[inline(always)]
2250        fn encode_is_copy() -> bool {
2251            true
2252        }
2253
2254        #[inline(always)]
2255        fn decode_is_copy() -> bool {
2256            true
2257        }
2258    }
2259
2260    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VolumeShrinkResponse, D>
2261        for &VolumeShrinkResponse
2262    {
2263        #[inline]
2264        unsafe fn encode(
2265            self,
2266            encoder: &mut fidl::encoding::Encoder<'_, D>,
2267            offset: usize,
2268            _depth: fidl::encoding::Depth,
2269        ) -> fidl::Result<()> {
2270            encoder.debug_check_bounds::<VolumeShrinkResponse>(offset);
2271            unsafe {
2272                // Copy the object into the buffer.
2273                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2274                (buf_ptr as *mut VolumeShrinkResponse)
2275                    .write_unaligned((self as *const VolumeShrinkResponse).read());
2276                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2277                // done second because the memcpy will write garbage to these bytes.
2278            }
2279            Ok(())
2280        }
2281    }
2282    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2283        fidl::encoding::Encode<VolumeShrinkResponse, D> for (T0,)
2284    {
2285        #[inline]
2286        unsafe fn encode(
2287            self,
2288            encoder: &mut fidl::encoding::Encoder<'_, D>,
2289            offset: usize,
2290            depth: fidl::encoding::Depth,
2291        ) -> fidl::Result<()> {
2292            encoder.debug_check_bounds::<VolumeShrinkResponse>(offset);
2293            // Zero out padding regions. There's no need to apply masks
2294            // because the unmasked parts will be overwritten by fields.
2295            // Write the fields.
2296            self.0.encode(encoder, offset + 0, depth)?;
2297            Ok(())
2298        }
2299    }
2300
2301    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VolumeShrinkResponse {
2302        #[inline(always)]
2303        fn new_empty() -> Self {
2304            Self { status: fidl::new_empty!(i32, D) }
2305        }
2306
2307        #[inline]
2308        unsafe fn decode(
2309            &mut self,
2310            decoder: &mut fidl::encoding::Decoder<'_, D>,
2311            offset: usize,
2312            _depth: fidl::encoding::Depth,
2313        ) -> fidl::Result<()> {
2314            decoder.debug_check_bounds::<Self>(offset);
2315            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2316            // Verify that padding bytes are zero.
2317            // Copy from the buffer into the object.
2318            unsafe {
2319                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2320            }
2321            Ok(())
2322        }
2323    }
2324
2325    impl fidl::encoding::ValueTypeMarker for VsliceRange {
2326        type Borrowed<'a> = &'a Self;
2327        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2328            value
2329        }
2330    }
2331
2332    unsafe impl fidl::encoding::TypeMarker for VsliceRange {
2333        type Owned = Self;
2334
2335        #[inline(always)]
2336        fn inline_align(_context: fidl::encoding::Context) -> usize {
2337            8
2338        }
2339
2340        #[inline(always)]
2341        fn inline_size(_context: fidl::encoding::Context) -> usize {
2342            16
2343        }
2344    }
2345
2346    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VsliceRange, D>
2347        for &VsliceRange
2348    {
2349        #[inline]
2350        unsafe fn encode(
2351            self,
2352            encoder: &mut fidl::encoding::Encoder<'_, D>,
2353            offset: usize,
2354            _depth: fidl::encoding::Depth,
2355        ) -> fidl::Result<()> {
2356            encoder.debug_check_bounds::<VsliceRange>(offset);
2357            // Delegate to tuple encoding.
2358            fidl::encoding::Encode::<VsliceRange, D>::encode(
2359                (
2360                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.allocated),
2361                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.count),
2362                ),
2363                encoder,
2364                offset,
2365                _depth,
2366            )
2367        }
2368    }
2369    unsafe impl<
2370        D: fidl::encoding::ResourceDialect,
2371        T0: fidl::encoding::Encode<bool, D>,
2372        T1: fidl::encoding::Encode<u64, D>,
2373    > fidl::encoding::Encode<VsliceRange, D> for (T0, T1)
2374    {
2375        #[inline]
2376        unsafe fn encode(
2377            self,
2378            encoder: &mut fidl::encoding::Encoder<'_, D>,
2379            offset: usize,
2380            depth: fidl::encoding::Depth,
2381        ) -> fidl::Result<()> {
2382            encoder.debug_check_bounds::<VsliceRange>(offset);
2383            // Zero out padding regions. There's no need to apply masks
2384            // because the unmasked parts will be overwritten by fields.
2385            unsafe {
2386                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2387                (ptr as *mut u64).write_unaligned(0);
2388            }
2389            // Write the fields.
2390            self.0.encode(encoder, offset + 0, depth)?;
2391            self.1.encode(encoder, offset + 8, depth)?;
2392            Ok(())
2393        }
2394    }
2395
2396    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VsliceRange {
2397        #[inline(always)]
2398        fn new_empty() -> Self {
2399            Self { allocated: fidl::new_empty!(bool, D), count: fidl::new_empty!(u64, D) }
2400        }
2401
2402        #[inline]
2403        unsafe fn decode(
2404            &mut self,
2405            decoder: &mut fidl::encoding::Decoder<'_, D>,
2406            offset: usize,
2407            _depth: fidl::encoding::Depth,
2408        ) -> fidl::Result<()> {
2409            decoder.debug_check_bounds::<Self>(offset);
2410            // Verify that padding bytes are zero.
2411            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2412            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2413            let mask = 0xffffffffffffff00u64;
2414            let maskedval = padval & mask;
2415            if maskedval != 0 {
2416                return Err(fidl::Error::NonZeroPadding {
2417                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2418                });
2419            }
2420            fidl::decode!(bool, D, &mut self.allocated, decoder, offset + 0, _depth)?;
2421            fidl::decode!(u64, D, &mut self.count, decoder, offset + 8, _depth)?;
2422            Ok(())
2423        }
2424    }
2425}