fidl_fuchsia_sysmem_common/
fidl_fuchsia_sysmem_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const FORMAT_MODIFIER_ARM_AFBC_16_X16: u64 = 576460752303423489;
12
13pub const FORMAT_MODIFIER_ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV: u64 = 576460752303423601;
14
15pub const FORMAT_MODIFIER_ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TE: u64 = 576460752303427697;
16
17pub const FORMAT_MODIFIER_ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TE_TILED_HEADER: u64 =
18    576460752303435889;
19
20pub const FORMAT_MODIFIER_ARM_AFBC_16_X16_SPLIT_BLOCK_SPARSE_YUV_TILED_HEADER: u64 =
21    576460752303431793;
22
23pub const FORMAT_MODIFIER_ARM_AFBC_16_X16_TE: u64 = 576460752303427585;
24
25pub const FORMAT_MODIFIER_ARM_AFBC_16_X16_YUV_TILED_HEADER: u64 = 576460752303431697;
26
27pub const FORMAT_MODIFIER_ARM_AFBC_32_X8: u64 = 576460752303423490;
28
29pub const FORMAT_MODIFIER_ARM_AFBC_32_X8_TE: u64 = 576460752303427586;
30
31pub const FORMAT_MODIFIER_ARM_BCH_BIT: u64 = 2048;
32
33pub const FORMAT_MODIFIER_ARM_LINEAR_TE: u64 = 576460752303427584;
34
35pub const FORMAT_MODIFIER_ARM_SPARSE_BIT: u64 = 64;
36
37pub const FORMAT_MODIFIER_ARM_SPLIT_BLOCK_BIT: u64 = 32;
38
39pub const FORMAT_MODIFIER_ARM_TE_BIT: u64 = 4096;
40
41pub const FORMAT_MODIFIER_ARM_TILED_HEADER_BIT: u64 = 8192;
42
43pub const FORMAT_MODIFIER_ARM_YUV_BIT: u64 = 16;
44
45pub const FORMAT_MODIFIER_GOOGLE_GOLDFISH_OPTIMAL: u64 = 648518346341351425;
46
47pub const FORMAT_MODIFIER_INTEL_CCS_BIT: u64 = 16777216;
48
49pub const FORMAT_MODIFIER_INTEL_I915_X_TILED: u64 = 72057594037927937;
50
51pub const FORMAT_MODIFIER_INTEL_I915_YF_TILED: u64 = 72057594037927939;
52
53pub const FORMAT_MODIFIER_INTEL_I915_YF_TILED_CCS: u64 = 72057594054705155;
54
55pub const FORMAT_MODIFIER_INTEL_I915_Y_TILED: u64 = 72057594037927938;
56
57pub const FORMAT_MODIFIER_INTEL_I915_Y_TILED_CCS: u64 = 72057594054705154;
58
59pub const FORMAT_MODIFIER_INVALID: u64 = FORMAT_MODIFIER_VALUE_RESERVED as u64;
60
61pub const FORMAT_MODIFIER_LINEAR: u64 = 0;
62
63pub const FORMAT_MODIFIER_NONE: u64 = 0;
64
65pub const FORMAT_MODIFIER_VALUE_RESERVED: u64 = 72057594037927935;
66
67pub const FORMAT_MODIFIER_VENDOR_AMD: u64 = 144115188075855872;
68
69pub const FORMAT_MODIFIER_VENDOR_ARM: u64 = 576460752303423488;
70
71pub const FORMAT_MODIFIER_VENDOR_BROADCOM: u64 = 504403158265495552;
72
73/// This meaning of this value is deprecated. Use fuchsia.images2.FORMAT_MODIFIER_VENDOR_GOOGLE
74/// instead which has a different value.
75pub const FORMAT_MODIFIER_VENDOR_GOOGLE: u64 = 648518346341351424;
76
77pub const FORMAT_MODIFIER_VENDOR_INTEL: u64 = 72057594037927936;
78
79pub const FORMAT_MODIFIER_VENDOR_NONE: u64 = 0;
80
81pub const FORMAT_MODIFIER_VENDOR_NVIDIA: u64 = 216172782113783808;
82
83pub const FORMAT_MODIFIER_VENDOR_QCOM: u64 = 360287970189639680;
84
85pub const FORMAT_MODIFIER_VENDOR_SAMSUNG: u64 = 288230376151711744;
86
87pub const FORMAT_MODIFIER_VENDOR_VIVANTE: u64 = 432345564227567616;
88
89pub const MAX_COUNT_BUFFER_COLLECTION_CONSTRAINTS_IMAGE_FORMAT_CONSTRAINTS: u32 = 32;
90
91pub const MAX_COUNT_BUFFER_COLLECTION_INFO_BUFFERS: u32 = 64;
92
93pub const MAX_COUNT_BUFFER_MEMORY_CONSTRAINTS_HEAP_PERMITTED: u32 = 32;
94
95/// Actually creating this many children isn't recommended in most typical
96/// scenarios, but isn't prevented, for testing reasons, and just in case an
97/// unusual scenario needs it.  Mitigation of potentially high time complexity
98/// in sysmem will limit the actual number of group child combinations
99/// considered in aggregation attempts to a separate maximum that is not
100/// settable via these protocols.  The maximum number of total nodes in a sysmem
101/// token tree is limited to a separate maximum that is not settable via these
102/// protocols.
103pub const MAX_COUNT_CREATE_CHILDREN: i32 = 64;
104
105pub const MAX_COUNT_DUPLICATES: u32 = 64;
106
107pub const MAX_COUNT_IMAGE_FORMAT_CONSTRAINTS_COLOR_SPACES: u32 = 32;
108
109pub const MAX_HEAPS_COUNT: u32 = 32;
110
111pub const MAX_RANGES_COUNT: u32 = 128;
112
113pub const VULKAN_BUFFER_USAGE_INDEX_BUFFER: u32 = 4194304;
114
115pub const VULKAN_BUFFER_USAGE_INDIRECT_BUFFER: u32 = 16777216;
116
117pub const VULKAN_BUFFER_USAGE_STORAGE_BUFFER: u32 = 2097152;
118
119pub const VULKAN_BUFFER_USAGE_STORAGE_TEXEL_BUFFER: u32 = 524288;
120
121pub const VULKAN_BUFFER_USAGE_TRANSFER_DST: u32 = 131072;
122
123pub const VULKAN_BUFFER_USAGE_TRANSFER_SRC: u32 = 65536;
124
125pub const VULKAN_BUFFER_USAGE_UNIFORM_BUFFER: u32 = 1048576;
126
127pub const VULKAN_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER: u32 = 262144;
128
129pub const VULKAN_BUFFER_USAGE_VERTEX_BUFFER: u32 = 8388608;
130
131pub const VULKAN_IMAGE_USAGE_COLOR_ATTACHMENT: u32 = 16;
132
133pub const VULKAN_IMAGE_USAGE_INPUT_ATTACHMENT: u32 = 128;
134
135pub const VULKAN_IMAGE_USAGE_SAMPLED: u32 = 4;
136
137pub const VULKAN_IMAGE_USAGE_STENCIL_ATTACHMENT: u32 = 32;
138
139pub const VULKAN_IMAGE_USAGE_STORAGE: u32 = 8;
140
141pub const VULKAN_IMAGE_USAGE_TRANSFER_DST: u32 = 2;
142
143pub const VULKAN_IMAGE_USAGE_TRANSFER_SRC: u32 = 1;
144
145pub const VULKAN_IMAGE_USAGE_TRANSIENT_ATTACHMENT: u32 = 64;
146
147pub const CPU_USAGE_READ: u32 = 1;
148
149pub const CPU_USAGE_READ_OFTEN: u32 = 2;
150
151pub const CPU_USAGE_WRITE: u32 = 4;
152
153pub const CPU_USAGE_WRITE_OFTEN: u32 = 8;
154
155pub const DISPLAY_USAGE_CURSOR: u32 = 2;
156
157pub const DISPLAY_USAGE_LAYER: u32 = 1;
158
159pub const NONE_USAGE: u32 = 1;
160
161pub const VIDEO_USAGE_CAPTURE: u32 = 8;
162
163pub const VIDEO_USAGE_DECRYPTOR_OUTPUT: u32 = 16;
164
165pub const VIDEO_USAGE_HW_DECODER: u32 = 1;
166
167pub const VIDEO_USAGE_HW_DECODER_INTERNAL: u32 = 32;
168
169pub const VIDEO_USAGE_HW_ENCODER: u32 = 2;
170
171pub const VIDEO_USAGE_HW_PROTECTED: u32 = 4;
172
173pub const VULKAN_USAGE_COLOR_ATTACHMENT: u32 = 16;
174
175pub const VULKAN_USAGE_INPUT_ATTACHMENT: u32 = 128;
176
177pub const VULKAN_USAGE_SAMPLED: u32 = 4;
178
179pub const VULKAN_USAGE_STENCIL_ATTACHMENT: u32 = 32;
180
181pub const VULKAN_USAGE_STORAGE: u32 = 8;
182
183pub const VULKAN_USAGE_TRANSFER_DST: u32 = 2;
184
185pub const VULKAN_USAGE_TRANSFER_SRC: u32 = 1;
186
187pub const VULKAN_USAGE_TRANSIENT_ATTACHMENT: u32 = 64;
188
189/// Inaccessible is only for cases where there is no CPU-based access to the
190/// buffers.  A secure_required buffer can still have CoherencyDomain Cpu or
191/// Ram even if the secure_required buffer can only be accessed by the CPU when
192/// the CPU is running in secure mode (or similar).  In contrast, device-local
193/// memory that isn't reachable from the CPU is CoherencyDomain Inaccessible,
194/// even if it's possible to cause a device (physical or virtual) to copy the
195/// data from the Inaccessible buffers to buffers that are visible to the CPU.
196#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
197#[repr(u32)]
198pub enum CoherencyDomain {
199    Cpu = 0,
200    Ram = 1,
201    Inaccessible = 2,
202}
203
204impl CoherencyDomain {
205    #[inline]
206    pub fn from_primitive(prim: u32) -> Option<Self> {
207        match prim {
208            0 => Some(Self::Cpu),
209            1 => Some(Self::Ram),
210            2 => Some(Self::Inaccessible),
211            _ => None,
212        }
213    }
214
215    #[inline]
216    pub const fn into_primitive(self) -> u32 {
217        self as u32
218    }
219}
220
221/// This list has a separate entry for each variant of a color space standard.
222///
223/// For this reason, should we ever add support for the RGB variant of 709, for
224/// example, we'd add a separate entry to this list for that variant.  Similarly
225/// for the RGB variants of 2020 or 2100.  Similarly for the YcCbcCrc variant of
226/// 2020.  Similarly for the ICtCp variant of 2100.
227///
228/// A given ColorSpaceType may permit usage with a PixelFormatType(s) that
229/// provides a bits-per-sample that's compatible with the ColorSpaceType's
230/// official spec.  Not all spec-valid combinations are necessarily supported.
231/// See ImageFormatIsSupportedColorSpaceForPixelFormat() for the best-case degree
232/// of support, but a "true" from that function doesn't guarantee that any given
233/// combination of participants will all support the desired combination of
234/// ColorSpaceType and PixelFormatType.
235///
236/// The sysmem service helps find a mutually supported combination and allocate
237/// suitable buffers.
238///
239/// A ColorSpaceType's spec is not implicitly extended to support
240/// outside-the-standard bits-per-sample (R, G, B, or Y sample).  For example,
241/// for 2020 and 2100, 8 bits-per-Y-sample is not supported (by sysmem), because
242/// 8 bits-per-Y-sample is not in the spec for 2020 or 2100.  A sysmem
243/// participant that attempts to advertise support for a PixelFormat + ColorSpace
244/// that's non-standard will cause sysmem to reject the combo and fail to
245/// allocate (intentionally, to strongly discourage specifying
246/// insufficiently-defined combos).
247///
248/// This type is deprecated for new code, but is still used by some camera code.
249#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
250#[repr(u32)]
251pub enum ColorSpaceType {
252    /// Not a valid color space type.
253    Invalid = 0,
254    /// sRGB
255    Srgb = 1,
256    /// 601 NTSC ("525 line") YCbCr primaries, narrow
257    Rec601Ntsc = 2,
258    /// 601 NTSC ("525 line") YCbCr primaries, wide
259    Rec601NtscFullRange = 3,
260    /// 601 PAL ("625 line") YCbCr primaries, narrow
261    Rec601Pal = 4,
262    /// 601 PAL ("625 line") YCbCr primaries, wide
263    Rec601PalFullRange = 5,
264    /// 709 YCbCr (not RGB)
265    Rec709 = 6,
266    /// 2020 YCbCr (not RGB, not YcCbcCrc)
267    Rec2020 = 7,
268    /// 2100 YCbCr (not RGB, not ICtCp)
269    Rec2100 = 8,
270    /// Either the pixel format doesn't represent a color, or it's in an
271    /// application-specific colorspace that isn't describable by another entry
272    /// in this enum.
273    PassThrough = 9,
274    /// The sysmem client is explicitly indicating that the sysmem client does
275    /// not care which color space is chosen / used.
276    DoNotCare = 4294967294,
277}
278
279impl ColorSpaceType {
280    #[inline]
281    pub fn from_primitive(prim: u32) -> Option<Self> {
282        match prim {
283            0 => Some(Self::Invalid),
284            1 => Some(Self::Srgb),
285            2 => Some(Self::Rec601Ntsc),
286            3 => Some(Self::Rec601NtscFullRange),
287            4 => Some(Self::Rec601Pal),
288            5 => Some(Self::Rec601PalFullRange),
289            6 => Some(Self::Rec709),
290            7 => Some(Self::Rec2020),
291            8 => Some(Self::Rec2100),
292            9 => Some(Self::PassThrough),
293            4294967294 => Some(Self::DoNotCare),
294            _ => None,
295        }
296    }
297
298    #[inline]
299    pub const fn into_primitive(self) -> u32 {
300        self as u32
301    }
302}
303
304/// Known heap types.
305/// Device specific types should have bit 60 set. Top order bit is reserved
306/// and should not be set.
307///
308/// This type is deprecated for new code, but is still used by some camera code.
309#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
310#[repr(u64)]
311pub enum HeapType {
312    SystemRam = 0,
313    /// Heap used for amlogic protected memory.
314    AmlogicSecure = 1152921504606912512,
315    /// Heap used for amlogic protected memory between decrypt and video decode.
316    AmlogicSecureVdec = 1152921504606912513,
317    /// Heap used by goldfish vulkan for device-local memory.
318    GoldfishDeviceLocal = 1152921504606978048,
319    /// Heap used by goldfish vulkan for host-visible memory.
320    GoldfishHostVisible = 1152921504606978049,
321    /// Heap used for display framebuffer. This is used by display drivers
322    /// limited to a single framebuffer located at a specific physical address.
323    /// The framebuffer heap makes it possible to create buffer collections
324    /// for the framebuffer and enables sysmem support in these drivers.
325    Framebuffer = 1152921504607043585,
326}
327
328impl HeapType {
329    #[inline]
330    pub fn from_primitive(prim: u64) -> Option<Self> {
331        match prim {
332            0 => Some(Self::SystemRam),
333            1152921504606912512 => Some(Self::AmlogicSecure),
334            1152921504606912513 => Some(Self::AmlogicSecureVdec),
335            1152921504606978048 => Some(Self::GoldfishDeviceLocal),
336            1152921504606978049 => Some(Self::GoldfishHostVisible),
337            1152921504607043585 => Some(Self::Framebuffer),
338            _ => None,
339        }
340    }
341
342    #[inline]
343    pub const fn into_primitive(self) -> u64 {
344        self as u64
345    }
346}
347
348/// The ordering of the channels in the format name reflects how
349/// the actual layout of the channel.
350///
351/// Each of these values is opinionated re. the color spaces that can be
352/// contained within (in contrast with Vulkan).
353///
354/// This should be kept in sync with fuchsia.sysmem2.PixelFormatType.
355///
356/// This type is deprecated for new code, but is still used by some camera code.
357#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
358#[repr(u32)]
359pub enum PixelFormatType {
360    Invalid = 0,
361    /// RGB only, 8 bits per each of R/G/B/A sample
362    /// Compatible with VK_FORMAT_R8G8B8A8_UNORM.
363    R8G8B8A8 = 1,
364    /// 32bpp BGRA, 1 plane.  RGB only, 8 bits per each of B/G/R/A sample.
365    /// Compatible with VK_FORMAT_B8G8R8A8_UNORM.
366    Bgra32 = 101,
367    /// YUV only, 8 bits per Y sample
368    /// Compatible with VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM.
369    I420 = 102,
370    /// YUV only, 8 bits per Y sample
371    /// Not compatible with any vulkan format.
372    M420 = 103,
373    /// YUV only, 8 bits per Y sample
374    /// Compatible with VK_FORMAT_G8_B8R8_2PLANE_420_UNORM.
375    Nv12 = 104,
376    /// YUV only, 8 bits per Y sample
377    /// Compatible with VK_FORMAT_G8B8G8R8_422_UNORM.
378    Yuy2 = 105,
379    Mjpeg = 106,
380    /// YUV only, 8 bits per Y sample
381    /// Compatible with VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM. The U plane may be located in either
382    /// the B or R plane for the image (and likewise for the V plane); the ordering may be
383    /// determined by looking at the members of
384    /// `VkBufferCollectionPropertiesFUCHSIA.samplerYcbcrConversionComponents`.
385    Yv12 = 107,
386    /// 24bpp BGR, 1 plane. RGB only, 8 bits per each of B/G/R sample
387    /// Compatible with VK_FORMAT_B8G8R8_UNORM.
388    Bgr24 = 108,
389    /// 16bpp RGB, 1 plane. 5 bits R, 6 bits G, 5 bits B
390    /// Compatible with VK_FORMAT_R5G6B5_UNORM_PACK16.
391    Rgb565 = 109,
392    /// 8bpp RGB, 1 plane. 3 bits R, 3 bits G, 2 bits B
393    /// Not compatible with any vulkan format.
394    Rgb332 = 110,
395    /// 8bpp RGB, 1 plane. 2 bits R, 2 bits G, 2 bits B
396    /// Not compatible with any vulkan format.
397    Rgb2220 = 111,
398    /// 8bpp, Luminance-only (red, green and blue have identical values.)
399    /// Compatible with VK_FORMAT_R8_UNORM.
400    L8 = 112,
401    /// 8bpp, Red-only (Green and Blue are to be interpreted as 0).
402    /// Compatible with VK_FORMAT_R8_UNORM.
403    R8 = 113,
404    /// 16bpp RG, 1 plane. 8 bits R, 8 bits G.
405    /// Compatible with VK_FORMAT_R8G8_UNORM.
406    R8G8 = 114,
407    /// 32bpp RGBA, 1 plane. 2 bits A, 10 bits R/G/B.
408    /// Compatible with VK_FORMAT_A2R10G10B10_UNORM_PACK32.
409    A2R10G10B10 = 115,
410    /// 32bpp BGRA, 1 plane. 2 bits A, 10 bits R/G/B.
411    /// Compatible with VK_FORMAT_A2B10G10R10_UNORM_PACK32.
412    A2B10G10R10 = 116,
413    /// The sysmem client is explicitly indicating that the sysmem client does
414    /// not care which pixel format is chosen / used.  When setting this value,
415    /// the sysmem client must not set format_modifier_value.
416    DoNotCare = 4294967294,
417}
418
419impl PixelFormatType {
420    #[inline]
421    pub fn from_primitive(prim: u32) -> Option<Self> {
422        match prim {
423            0 => Some(Self::Invalid),
424            1 => Some(Self::R8G8B8A8),
425            101 => Some(Self::Bgra32),
426            102 => Some(Self::I420),
427            103 => Some(Self::M420),
428            104 => Some(Self::Nv12),
429            105 => Some(Self::Yuy2),
430            106 => Some(Self::Mjpeg),
431            107 => Some(Self::Yv12),
432            108 => Some(Self::Bgr24),
433            109 => Some(Self::Rgb565),
434            110 => Some(Self::Rgb332),
435            111 => Some(Self::Rgb2220),
436            112 => Some(Self::L8),
437            113 => Some(Self::R8),
438            114 => Some(Self::R8G8),
439            115 => Some(Self::A2R10G10B10),
440            116 => Some(Self::A2B10G10R10),
441            4294967294 => Some(Self::DoNotCare),
442            _ => None,
443        }
444    }
445
446    #[inline]
447    pub const fn into_primitive(self) -> u32 {
448        self as u32
449    }
450}
451
452#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
453pub struct AllocatorSetDebugClientInfoRequest {
454    pub name: String,
455    pub id: u64,
456}
457
458impl fidl::Persistable for AllocatorSetDebugClientInfoRequest {}
459
460#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
461#[repr(C)]
462pub struct AllocatorValidateBufferCollectionTokenRequest {
463    pub token_server_koid: u64,
464}
465
466impl fidl::Persistable for AllocatorValidateBufferCollectionTokenRequest {}
467
468#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
469pub struct AllocatorValidateBufferCollectionTokenResponse {
470    pub is_known: bool,
471}
472
473impl fidl::Persistable for AllocatorValidateBufferCollectionTokenResponse {}
474
475#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
476#[repr(C)]
477pub struct BufferCollectionCheckBuffersAllocatedResponse {
478    pub status: i32,
479}
480
481impl fidl::Persistable for BufferCollectionCheckBuffersAllocatedResponse {}
482
483/// Constraints on BufferCollection parameters.  These constraints can be
484/// specified per-participant.  The sysmem service implements aggregation of
485/// constraints from multiple participants.
486///
487/// This type is deprecated for new code, but is still used by some camera code.
488#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
489pub struct BufferCollectionConstraints {
490    /// The usage is only meant as a hint to help sysmem choose a more optimal
491    /// PixelFormat or similar when multiple compatible options exist.
492    ///
493    /// When aggregating BufferCollectionConstraints, these values bitwise-OR.
494    ///
495    /// At least one usage bit must be specified unless the whole
496    /// BufferCollectionConstraints is logically null due to !has_constraints.
497    pub usage: BufferUsage,
498    /// Per-participant number of buffers that the participant may concurrently
499    /// hold for its exclusive use for a non-transient period of time (camp on).
500    ///
501    /// For example, a video decoder would specify (at least) the maximum number
502    /// of reference frames + 1 frame currently being decoded into.
503    ///
504    /// A participant must not camp on more buffers than specified here (except
505    /// very transiently) else processing may get stuck.
506    ///
507    /// When aggregating BufferCollectionConstraints, these values add.
508    ///
509    /// In testing scenarios, camping on more buffers than this for any
510    /// significant duration may (ideally will) be flagged as a failure.  In
511    /// testing scenarios, the participant may not be provided with more buffers
512    /// than this concurrently.
513    pub min_buffer_count_for_camping: u32,
514    /// Per-participant minimum number of buffers that are needed for slack
515    /// reasons, for better overlap of processing / better performance.
516    ///
517    /// When aggregating BufferCollectionConstraints, these values add.
518    ///
519    /// A participant should typically specify 0 or 1 here - typically 0 is
520    /// appropriate if min_buffer_count_for_camping is already enough to keep
521    /// the participant busy 100% of the time when the participant is slightly
522    /// behind, while 1 can be appropriate if 1 more buffer than strictly needed
523    /// for min-camping reasons gives enough slack to stay busy 100% of the time
524    /// (when slightly behind, vs. lower % without the extra buffer).
525    ///
526    /// In testing scenarios, this field may be forced to 0, and all
527    /// participants are expected to continue to work without getting stuck.  If
528    /// a buffer is needed for forward progress reasons, that buffer should be
529    /// accounted for in min_buffer_count_for_camping.
530    pub min_buffer_count_for_dedicated_slack: u32,
531    /// Similar to min_buffer_count_for_dedicated_slack, except when aggregating
532    /// these values max (instead of add).  The value here is not shared with
533    /// any participant's min_buffer_count_for_dedicated_slack.
534    ///
535    /// A participant can specify > 0 here if a participant would like to ensure
536    /// there's some slack overall, but doesn't need that slack to be dedicated.
537    ///
538    /// The choice whether to use min_buffer_count_for_dedicated_slack or
539    /// min_buffer_count_for_shared_slack (or both) will typically be about the
540    /// degree to which the extra slack improves performance.
541    ///
542    /// In testing scenarios, this field may be forced to 0, and all
543    /// participants are expected to continue to work without getting stuck.  If
544    /// a buffer is needed for forward progress reasons, that buffer should be
545    /// accounted for in min_buffer_count_for_camping.
546    pub min_buffer_count_for_shared_slack: u32,
547    /// A particularly-picky participant may unfortunately need to demand a
548    /// tight range of buffer_count, or even a specific buffer_count.  This
549    /// field should remain 0 unless a participant really must set this field to
550    /// constrain the overall BufferCollectionInfo_2.buffer_count.  Any such
551    /// participant should still fill out the min_buffer_count_for_* fields
552    /// above.
553    pub min_buffer_count: u32,
554    /// 0 is treated as 0xFFFFFFFF.
555    pub max_buffer_count: u32,
556    /// Constraints on BufferCollectionSettings.buffer_settings.
557    ///
558    /// A participant that intends to specify image_format_constraints_count > 1
559    /// will typically specify the minimum buffer size implicitly via
560    /// image_format_constraints, and possibly specify only the max buffer size
561    /// via buffer_memory_constraints.
562    pub has_buffer_memory_constraints: bool,
563    pub buffer_memory_constraints: BufferMemoryConstraints,
564    /// Optional constraints on the image format parameters of an image stored
565    /// in a buffer of the BufferCollection.  This includes pixel format and
566    /// image layout.  These constraints are per-pixel-format, so more than one
567    /// is permitted. Entries in the list must have unique pixel_formats.
568    ///
569    /// When aggregating, only pixel formats that are specified by all
570    /// participants with non-zero image_format_constraints_count (and non-Null)
571    /// BufferCollectionConstraints) are retained.
572    pub image_format_constraints_count: u32,
573    pub image_format_constraints: [ImageFormatConstraints; 32],
574}
575
576impl fidl::Persistable for BufferCollectionConstraints {}
577
578#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
579pub struct BufferCollectionConstraintsAuxBuffers {
580    /// If true, a secure heap may only be selected if all participants with
581    /// BufferMemoryConstraints specify allow_clear_aux_buffers_for_secure.  If
582    /// "need" is true, "allow" must also be true.
583    ///
584    /// If false, the participant can still work, potentially even with secure
585    /// memory (depending on supported heaps), without clear aux buffers.
586    pub need_clear_aux_buffers_for_secure: bool,
587    /// If true, the participant will use clear aux buffers, if they are
588    /// allocated, as appropriate to the participant's role.  If the participant
589    /// is a producer, then the participant producer will populate the clear aux
590    /// buffers with the clear (not-encrypted, not-DRM-protected) bytes, and
591    /// fill protected bytes with data that does not emulate start codes, such
592    /// as 0xFF.
593    ///
594    /// If BufferCollectionConstraintsAuxBuffers is never sent by a
595    /// participant, then "allow" is true iff the participant specifies usage
596    /// which is read only.
597    ///
598    /// If unspecified by a participant with write usage, or false, the
599    /// buffer collection won't be able to allocate if any participant specifies
600    /// need_clear_aux_buffers_for_secure true.
601    pub allow_clear_aux_buffers_for_secure: bool,
602}
603
604impl fidl::Persistable for BufferCollectionConstraintsAuxBuffers {}
605
606#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
607pub struct BufferCollectionSetConstraintsAuxBuffersRequest {
608    pub constraints: BufferCollectionConstraintsAuxBuffers,
609}
610
611impl fidl::Persistable for BufferCollectionSetConstraintsAuxBuffersRequest {}
612
613#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
614pub struct BufferCollectionSetConstraintsRequest {
615    pub has_constraints: bool,
616    pub constraints: BufferCollectionConstraints,
617}
618
619impl fidl::Persistable for BufferCollectionSetConstraintsRequest {}
620
621#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
622pub struct BufferCollectionTokenDuplicateSyncRequest {
623    pub rights_attenuation_masks: Vec<fidl::Rights>,
624}
625
626impl fidl::Persistable for BufferCollectionTokenDuplicateSyncRequest {}
627
628#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
629pub struct BufferCollectionTokenGroupCreateChildrenSyncRequest {
630    pub rights_attenuation_masks: Vec<fidl::Rights>,
631}
632
633impl fidl::Persistable for BufferCollectionTokenGroupCreateChildrenSyncRequest {}
634
635/// Describes how the contents of buffers are represented.
636/// Buffers of each type are described by their own tables.
637///
638/// This type is deprecated for new code, but is still used by some camera code.
639#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
640pub struct BufferFormat {
641    /// Since this struct used to be a single member union, we kept the tag
642    /// to avoid any wire format changes. The tag must be set to `0`,
643    /// no other value is correct.
644    pub tag: u32,
645    pub image: ImageFormat,
646}
647
648impl fidl::Persistable for BufferFormat {}
649
650/// This type is deprecated for new code, but is still used by some camera code.
651#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
652pub struct BufferMemoryConstraints {
653    pub min_size_bytes: u32,
654    /// 0 is treated as 0xFFFFFFFF.
655    pub max_size_bytes: u32,
656    pub physically_contiguous_required: bool,
657    /// If true, at least one participant requires secure memory.
658    ///
659    /// When aggregating BufferCollectionConstraints, these values boolean-OR.
660    pub secure_required: bool,
661    /// By default, participants must ensure the CPU can read or write data to
662    /// the buffer without cache operations. If they support using the RAM
663    /// domain, data must be available in RAM (with CPU cache state such that
664    /// the RAM data won't get corrupted by a dirty CPU cache line writing
665    /// incorrect data to RAM), and a consumer reading using the CPU must
666    /// invalidate CPU cache before reading (the producer doesn't guarantee
667    /// zero stale "clean" cache lines)
668    pub ram_domain_supported: bool,
669    pub cpu_domain_supported: bool,
670    pub inaccessible_domain_supported: bool,
671    /// Optional heap constraints. Participants that don't care which heap
672    /// memory is allocated on should leave this field 0.
673    pub heap_permitted_count: u32,
674    pub heap_permitted: [HeapType; 32],
675}
676
677impl fidl::Persistable for BufferMemoryConstraints {}
678
679#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
680pub struct BufferMemorySettings {
681    pub size_bytes: u32,
682    pub is_physically_contiguous: bool,
683    pub is_secure: bool,
684    pub coherency_domain: CoherencyDomain,
685    /// The specific heap from which buffers are allocated.
686    /// See above in this file for heap identifier values.
687    pub heap: HeapType,
688}
689
690impl fidl::Persistable for BufferMemorySettings {}
691
692/// Describes how a client will access the contents of a buffer.
693///
694/// This type is deprecated for new code, but is still used by some camera code.
695#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
696#[repr(C)]
697pub struct BufferUsage {
698    pub none: u32,
699    pub cpu: u32,
700    pub vulkan: u32,
701    pub display: u32,
702    pub video: u32,
703}
704
705impl fidl::Persistable for BufferUsage {}
706
707/// Describes how the pixels within an image are meant to be presented.
708/// Simple color spaces need only a type.
709/// Parametric color spaces may require additional properties.
710///
711/// This type is deprecated for new code, but is still used by some camera code.
712#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
713pub struct ColorSpace {
714    pub type_: ColorSpaceType,
715}
716
717impl fidl::Persistable for ColorSpace {}
718
719/// This type is deprecated for new code, but is still used by some camera code.
720#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
721#[repr(C)]
722pub struct FormatModifier {
723    /// The upper 8 bits are a vendor code as allocated in FormatModifierVendor
724    /// enum.  The lower 56 bits are vendor-defined.
725    ///
726    /// This field and the values that go in this field are defined this way for
727    /// compatibility reasons.
728    pub value: u64,
729}
730
731impl fidl::Persistable for FormatModifier {}
732
733/// Describes how an image is represented.
734///
735/// This type is deprecated for new code, but still used by some camera code.
736#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
737pub struct ImageFormat {
738    /// Row width in pixels.
739    pub width: u32,
740    /// Number of rows.
741    pub height: u32,
742    /// Number of layers within a multi-layered image.
743    /// Defaults to 1 if not specified.
744    pub layers: u32,
745    /// Pixel format.
746    pub pixel_format: PixelFormat,
747    /// Color space.
748    pub color_space: ColorSpace,
749    pub planes: [ImagePlane; 4],
750}
751
752impl fidl::Persistable for ImageFormat {}
753
754/// Describes constraints on layout of image data in buffers.
755///
756/// This type is deprecated for new code, but is still used by some camera code.
757#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
758pub struct ImageFormatConstraints {
759    /// The PixelFormat for which the following constraints apply.  A
760    /// participant may have more than one PixelFormat that's supported, in
761    /// which case that participant can use a list of ImageFormatConstraints
762    /// with an entry per PixelFormat.  It's not uncommon for the other fields
763    /// of ImageFormatConstraints to vary by PixelFormat - for example for a
764    /// linear format to support smaller max size than a tiled format.
765    pub pixel_format: PixelFormat,
766    /// Empty is an error.  Redundant entries are an error.  Arbitrary ordering
767    /// is not an error.
768    pub color_spaces_count: u32,
769    pub color_space: [ColorSpace; 32],
770    /// Minimum permitted width in pixels.
771    ///
772    /// For example a video decoder participant may set this field to the
773    /// minimum coded_width that might potentially be specified by a stream.  In
774    /// contrast, required_min_coded_width would be set to the current
775    /// coded_width specified by the stream.  While min_coded_width aggregates
776    /// by taking the max, required_min_coded_width aggregates by taking the
777    /// min.
778    ///
779    /// See also required_min_coded_width.
780    pub min_coded_width: u32,
781    /// Maximum width in pixels.  For example Scenic may set this field
782    /// (directly or via sub-participants) to the maximum width that can be
783    /// composited.
784    /// 0 is treated as 0xFFFFFFFF.
785    pub max_coded_width: u32,
786    /// Minimum height in pixels.  For example a video decoder participant may
787    /// set this field to the coded_height specified by a stream.
788    pub min_coded_height: u32,
789    /// Maximum height in pixels.  For example Scenic may set this field
790    /// (directly or via sub-participants) to the maximum height that can be
791    /// composited.
792    /// 0 is treated as 0xFFFFFFFF.
793    pub max_coded_height: u32,
794    /// Must be >= the value implied by min_coded_width for plane 0.
795    pub min_bytes_per_row: u32,
796    /// Must be >= the value implied by max_coded_width for plane 0.
797    /// 0 is treated as 0xFFFFFFFF.
798    pub max_bytes_per_row: u32,
799    /// The max image area in pixels is limited indirectly via
800    /// BufferSettings.size_bytes, and can also be enforced directly via this
801    /// field.
802    /// 0 is treated as 0xFFFFFFFF.
803    pub max_coded_width_times_coded_height: u32,
804    /// Number of layers within a multi-layered image.
805    /// 0 is treated as 1.
806    pub layers: u32,
807    /// coded_width % width_divisor must be 0.
808    /// 0 is treated as 1.
809    pub coded_width_divisor: u32,
810    /// coded_height % height_divisor must be 0.
811    /// 0 is treated as 1.
812    pub coded_height_divisor: u32,
813    /// bytes_per_row % bytes_per_row_divisor must be 0.
814    /// 0 is treated as 1.
815    pub bytes_per_row_divisor: u32,
816    /// vmo_usable_start % start_offset_divisor must be 0.
817    /// 0 is treated as 1.
818    pub start_offset_divisor: u32,
819    /// display_width % display_width_divisor must be 0.
820    /// 0 is treated as 1.
821    pub display_width_divisor: u32,
822    /// display_height % display_height_divisor must be 0.
823    /// 0 is treated as 1.
824    pub display_height_divisor: u32,
825    /// required_ dimension bounds.
826    ///
827    /// In contrast to the corresponding fields without "required_" at the
828    /// start, these fields (when set to non-zero values) express a requirement
829    /// that the resulting aggregated non-required_ fields specify a space that
830    /// fully contain the space expressed by each participant's required_
831    /// fields.
832    ///
833    /// For example, a producer video decoder is perfectly happy for the
834    /// consumer to be willing to accept anything, and the video decoder doesn't
835    /// really want to constrain the potential space of dimensions that might be
836    /// seen in a stream and may be acceptable to the consumer, but the video
837    /// decoder needs to ensure that the resulting dimension ranges contain
838    /// at least the current dimensions decoded from the stream.
839    ///
840    /// Similarly, an initiator with a particular dynamic-dimension scenario in
841    /// mind may wish to require up front that participants agree to handle at
842    /// least the range of dimensions expected by the initiator in that
843    /// scenario (else fail earlier rather than later, maybe trying again with
844    /// smaller required_ space).
845    ///
846    /// It's much more common for a producer or initiator to set these fields
847    /// than for a consumer to set these fields.
848    ///
849    /// While the non-required_ fields aggregate by taking the intersection, the
850    /// required_ fields aggregate by taking the union.
851    ///
852    /// If set, the required_max_coded_width and required_max_coded_height will
853    /// cause the allocated buffers to be large enough to hold an image that is
854    /// required_max_coded_width * required_max_coded_height.
855    ///
856    /// TODO(dustingreen): Make it easier to allocate buffers of minimal size
857    /// that can (optionally) also handle 90 degree rotated version of the max
858    /// dimensions / alternate required bounds for another main aspect ratio.
859    /// 0 is treated as 0xFFFFFFFF.
860    pub required_min_coded_width: u32,
861    pub required_max_coded_width: u32,
862    /// 0 is treated as 0xFFFFFFFF.
863    pub required_min_coded_height: u32,
864    pub required_max_coded_height: u32,
865    /// 0 is treated as 0xFFFFFFFF.
866    pub required_min_bytes_per_row: u32,
867    pub required_max_bytes_per_row: u32,
868}
869
870impl fidl::Persistable for ImageFormatConstraints {}
871
872/// Describes how an image is represented.
873///
874/// This type is deprecated for new code, but is still used by some camera code.
875#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
876pub struct ImageFormat2 {
877    /// Pixel format.
878    pub pixel_format: PixelFormat,
879    /// Row width in pixels that exist in the buffer.  Must be >= display_width.
880    /// Can be < the width implied by stride_bytes.
881    pub coded_width: u32,
882    /// Number of rows.  Must be >= display_height.
883    pub coded_height: u32,
884    /// Stride in bytes of plane 0.  Planes beyond plane 0 (if any, depending on
885    /// pixel_format) have a known fixed relationship with plane 0's stride.
886    /// For Intel tiled textures, the stride is for the linearized version of the texture.
887    pub bytes_per_row: u32,
888    /// Row width in pixels that are to be displayed.  This can be <=
889    /// coded_width.  Any cropping occurs on the right of the image (not left).
890    pub display_width: u32,
891    /// Number of rows to be displayed.  This can be <= coded_height, with any
892    /// cropping on the bottom (not top).
893    pub display_height: u32,
894    /// Number of layers within a multi-layered image.
895    pub layers: u32,
896    /// Color space.
897    pub color_space: ColorSpace,
898    /// The pixel_aspect_ratio_width : pixel_aspect_ratio_height is the
899    /// pixel aspect ratio (AKA sample aspect ratio aka SAR) for the luma
900    /// (AKA Y) samples. A pixel_aspect_ratio of 1:1 mean square pixels. A
901    /// pixel_aspect_ratio of 2:1 would mean pixels that are displayed twice
902    /// as wide as they are tall. Codec implementation should ensure these
903    /// two values are relatively prime by reducing the fraction (dividing
904    /// both by GCF) if necessary.
905    ///
906    /// When has_pixel_aspect_ratio == false, the pixel_aspect_ratio is unknown.
907    /// A default of 1:1 can be appropriate in some cases, but as always, a
908    /// consumer may determine the actual pixel_aspect_ratio by OOB means.
909    pub has_pixel_aspect_ratio: bool,
910    pub pixel_aspect_ratio_width: u32,
911    pub pixel_aspect_ratio_height: u32,
912}
913
914impl fidl::Persistable for ImageFormat2 {}
915
916/// This type is deprecated without a direct replacement (intentionally), as
917/// fuchsia.images2 doesn't require describing each plane separately.
918#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
919#[repr(C)]
920pub struct ImagePlane {
921    /// Byte offset of the start of the plane from the beginning of the image.
922    pub byte_offset: u32,
923    /// Stride in bytes per row.
924    /// Only meaningful for linear buffer formats.
925    pub bytes_per_row: u32,
926}
927
928impl fidl::Persistable for ImagePlane {}
929
930/// Describes constraints for allocating images of some desired form.
931#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
932pub struct ImageSpec {
933    /// Minimum width in pixels.
934    pub min_width: u32,
935    /// Minimum height in pixels.
936    pub min_height: u32,
937    /// Number of layers within a multi-layered image.
938    /// Defaults to 1 if not specified.
939    pub layers: u32,
940    /// Pixel format.
941    pub pixel_format: PixelFormat,
942    /// Color space.
943    pub color_space: ColorSpace,
944}
945
946impl fidl::Persistable for ImageSpec {}
947
948#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
949pub struct NodeSetDebugClientInfoRequest {
950    pub name: String,
951    pub id: u64,
952}
953
954impl fidl::Persistable for NodeSetDebugClientInfoRequest {}
955
956#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
957#[repr(C)]
958pub struct NodeSetDebugTimeoutLogDeadlineRequest {
959    pub deadline: i64,
960}
961
962impl fidl::Persistable for NodeSetDebugTimeoutLogDeadlineRequest {}
963
964#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
965pub struct NodeSetNameRequest {
966    pub priority: u32,
967    pub name: String,
968}
969
970impl fidl::Persistable for NodeSetNameRequest {}
971
972#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
973pub struct NodeIsAlternateForResponse {
974    pub is_alternate: bool,
975}
976
977impl fidl::Persistable for NodeIsAlternateForResponse {}
978
979/// Describes how the pixels within an image are represented.
980/// Simple formats need only a type.
981/// Parametric pixel formats may require additional properties.
982///
983/// This type is deprecated for new code, but is still used by some camera code.
984#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
985pub struct PixelFormat {
986    pub type_: PixelFormatType,
987    /// This bool effectively makes format_modifier optional, to satisfy
988    /// 'ForDeprecatedCBindings', to satisfy "FIDL Simple C Bindings".
989    pub has_format_modifier: bool,
990    pub format_modifier: FormatModifier,
991}
992
993impl fidl::Persistable for PixelFormat {}
994
995#[derive(Clone, Debug, PartialEq)]
996pub struct SecureMemAddSecureHeapPhysicalRangeRequest {
997    pub heap_range: SecureHeapAndRange,
998}
999
1000impl fidl::Persistable for SecureMemAddSecureHeapPhysicalRangeRequest {}
1001
1002#[derive(Clone, Debug, PartialEq)]
1003pub struct SecureMemDeleteSecureHeapPhysicalRangeRequest {
1004    pub heap_range: SecureHeapAndRange,
1005}
1006
1007impl fidl::Persistable for SecureMemDeleteSecureHeapPhysicalRangeRequest {}
1008
1009#[derive(Clone, Debug, PartialEq)]
1010pub struct SecureMemGetPhysicalSecureHeapPropertiesRequest {
1011    pub entire_heap: SecureHeapAndRange,
1012}
1013
1014impl fidl::Persistable for SecureMemGetPhysicalSecureHeapPropertiesRequest {}
1015
1016#[derive(Clone, Debug, PartialEq)]
1017pub struct SecureMemModifySecureHeapPhysicalRangeRequest {
1018    pub range_modification: SecureHeapAndRangeModification,
1019}
1020
1021impl fidl::Persistable for SecureMemModifySecureHeapPhysicalRangeRequest {}
1022
1023#[derive(Clone, Debug, PartialEq)]
1024pub struct SecureMemZeroSubRangeRequest {
1025    pub is_covering_range_explicit: bool,
1026    pub heap_range: SecureHeapAndRange,
1027}
1028
1029impl fidl::Persistable for SecureMemZeroSubRangeRequest {}
1030
1031#[derive(Clone, Debug, PartialEq)]
1032pub struct SecureMemGetPhysicalSecureHeapPropertiesResponse {
1033    pub properties: SecureHeapProperties,
1034}
1035
1036impl fidl::Persistable for SecureMemGetPhysicalSecureHeapPropertiesResponse {}
1037
1038#[derive(Clone, Debug, PartialEq)]
1039pub struct SecureMemGetPhysicalSecureHeapsResponse {
1040    pub heaps: SecureHeapsAndRanges,
1041}
1042
1043impl fidl::Persistable for SecureMemGetPhysicalSecureHeapsResponse {}
1044
1045/// After the initial buffer allocation, it's allowed to close old buffers and
1046/// allocate new buffers.  When a new buffer is allocated its settings can
1047/// differ from the rest of the buffers in the collection, and the single
1048/// buffer's settings are delivered via OnSingleBufferAllocated() using this
1049/// struct:
1050#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1051pub struct SingleBufferSettings {
1052    pub buffer_settings: BufferMemorySettings,
1053    /// Buffers holding data that is not uncompressed image data will not have
1054    /// this field set.  Buffers holding data that is uncompressed image data
1055    /// _may_ have this field set.
1056    ///
1057    /// At least for now, changing the PixelFormat requires re-allocating
1058    /// buffers.
1059    pub has_image_format_constraints: bool,
1060    pub image_format_constraints: ImageFormatConstraints,
1061}
1062
1063impl fidl::Persistable for SingleBufferSettings {}
1064
1065#[derive(Clone, Debug, Default, PartialEq)]
1066pub struct SecureHeapAndRange {
1067    pub heap: Option<HeapType>,
1068    pub range: Option<SecureHeapRange>,
1069    #[doc(hidden)]
1070    pub __source_breaking: fidl::marker::SourceBreaking,
1071}
1072
1073impl fidl::Persistable for SecureHeapAndRange {}
1074
1075#[derive(Clone, Debug, Default, PartialEq)]
1076pub struct SecureHeapAndRangeModification {
1077    pub heap: Option<HeapType>,
1078    pub old_range: Option<SecureHeapRange>,
1079    pub new_range: Option<SecureHeapRange>,
1080    #[doc(hidden)]
1081    pub __source_breaking: fidl::marker::SourceBreaking,
1082}
1083
1084impl fidl::Persistable for SecureHeapAndRangeModification {}
1085
1086#[derive(Clone, Debug, Default, PartialEq)]
1087pub struct SecureHeapAndRanges {
1088    /// This is which secure/protected heap.
1089    pub heap: Option<HeapType>,
1090    /// The list of physical ranges.  This list must be sorted by
1091    /// physical_address (lower first), and must not have any overlapping
1092    /// ranges.  Ranges that are directly adjacent are allowed (not
1093    /// overlapping).
1094    pub ranges: Option<Vec<SecureHeapRange>>,
1095    #[doc(hidden)]
1096    pub __source_breaking: fidl::marker::SourceBreaking,
1097}
1098
1099impl fidl::Persistable for SecureHeapAndRanges {}
1100
1101#[derive(Clone, Debug, Default, PartialEq)]
1102pub struct SecureHeapProperties {
1103    /// The HeapType is repeated here for convenience.
1104    pub heap: Option<HeapType>,
1105    /// If true, more than one call to SetPhysicalSecureHeap() for the same
1106    /// heap is allowed.  If false, only one SetPhyscialSecureHeap() call is
1107    /// allowed, and no calls to DeleteSecureHeapPhysicalRange() or
1108    /// ModifySecureHeapPhysicalRange() are allowed.  Even when this is false,
1109    /// the SecureMem server (driver) is still responsible for de-protecting
1110    /// just before warm reboot if protected ranges would not otherwise be
1111    /// cleaned up during a warm reboot.
1112    pub dynamic_protection_ranges: Option<bool>,
1113    /// The granularity of protection ranges.  If the granularity of start is
1114    /// different than granularity of end or length, then this is the max
1115    /// granularity value among those values.
1116    ///
1117    /// This must be a power of 2.  The client must not request ranges that
1118    /// specify smaller granularity.
1119    ///
1120    /// This must be at least zx_system_page_size() even if the HW can do
1121    /// smaller granularity.
1122    pub protected_range_granularity: Option<u32>,
1123    /// The SecureMem server should not count reserved ranges that the SecureMem
1124    /// server uses internally to get from range set A to range set B, if the
1125    /// SecureMem server needs to do any emulation of that sort.  Normally such
1126    /// emulation by the SecureMem server is unnecessary.  If any ranges are
1127    /// reserved by the SecureMem server, those reserved ranges are not
1128    /// available for use by the SecureMem client.
1129    ///
1130    /// If the number of ranges is limited only by available memory, it's ok for
1131    /// the SecureMem server to report 0xFFFFFFFFFFFFFFFF for this value.  The
1132    /// field must still be set.  As usual, the SecureMem server should ensure
1133    /// that SetPhysicalSecureHeapRanges() succeeds or fails atomically (either
1134    /// fully updates or rolls back before completing).
1135    pub max_protected_range_count: Option<u64>,
1136    /// Iff true, ModifySecureHeapPhysicalRange() is implemented.  Calling
1137    /// ModifySecureHeapPhysicalRange() when is_mod_protected_range_available
1138    /// is false is prohibited.  Don't attempt to detect availability of
1139    /// ModifySecureHeapPhysicalRange() by calling it to see if it fails; it
1140    /// may ZX_PANIC().
1141    pub is_mod_protected_range_available: Option<bool>,
1142    #[doc(hidden)]
1143    pub __source_breaking: fidl::marker::SourceBreaking,
1144}
1145
1146impl fidl::Persistable for SecureHeapProperties {}
1147
1148#[derive(Clone, Debug, Default, PartialEq)]
1149pub struct SecureHeapRange {
1150    /// Must be aligned to at least heap_range_granularity.
1151    pub physical_address: Option<u64>,
1152    /// Must be aligned to at least heap_range_granularity.
1153    pub size_bytes: Option<u64>,
1154    #[doc(hidden)]
1155    pub __source_breaking: fidl::marker::SourceBreaking,
1156}
1157
1158impl fidl::Persistable for SecureHeapRange {}
1159
1160#[derive(Clone, Debug, Default, PartialEq)]
1161pub struct SecureHeapsAndRanges {
1162    pub heaps: Option<Vec<SecureHeapAndRanges>>,
1163    #[doc(hidden)]
1164    pub __source_breaking: fidl::marker::SourceBreaking,
1165}
1166
1167impl fidl::Persistable for SecureHeapsAndRanges {}
1168
1169mod internal {
1170    use super::*;
1171    unsafe impl fidl::encoding::TypeMarker for CoherencyDomain {
1172        type Owned = Self;
1173
1174        #[inline(always)]
1175        fn inline_align(_context: fidl::encoding::Context) -> usize {
1176            std::mem::align_of::<u32>()
1177        }
1178
1179        #[inline(always)]
1180        fn inline_size(_context: fidl::encoding::Context) -> usize {
1181            std::mem::size_of::<u32>()
1182        }
1183
1184        #[inline(always)]
1185        fn encode_is_copy() -> bool {
1186            true
1187        }
1188
1189        #[inline(always)]
1190        fn decode_is_copy() -> bool {
1191            false
1192        }
1193    }
1194
1195    impl fidl::encoding::ValueTypeMarker for CoherencyDomain {
1196        type Borrowed<'a> = Self;
1197        #[inline(always)]
1198        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1199            *value
1200        }
1201    }
1202
1203    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1204        for CoherencyDomain
1205    {
1206        #[inline]
1207        unsafe fn encode(
1208            self,
1209            encoder: &mut fidl::encoding::Encoder<'_, D>,
1210            offset: usize,
1211            _depth: fidl::encoding::Depth,
1212        ) -> fidl::Result<()> {
1213            encoder.debug_check_bounds::<Self>(offset);
1214            encoder.write_num(self.into_primitive(), offset);
1215            Ok(())
1216        }
1217    }
1218
1219    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CoherencyDomain {
1220        #[inline(always)]
1221        fn new_empty() -> Self {
1222            Self::Cpu
1223        }
1224
1225        #[inline]
1226        unsafe fn decode(
1227            &mut self,
1228            decoder: &mut fidl::encoding::Decoder<'_, D>,
1229            offset: usize,
1230            _depth: fidl::encoding::Depth,
1231        ) -> fidl::Result<()> {
1232            decoder.debug_check_bounds::<Self>(offset);
1233            let prim = decoder.read_num::<u32>(offset);
1234
1235            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1236            Ok(())
1237        }
1238    }
1239    unsafe impl fidl::encoding::TypeMarker for ColorSpaceType {
1240        type Owned = Self;
1241
1242        #[inline(always)]
1243        fn inline_align(_context: fidl::encoding::Context) -> usize {
1244            std::mem::align_of::<u32>()
1245        }
1246
1247        #[inline(always)]
1248        fn inline_size(_context: fidl::encoding::Context) -> usize {
1249            std::mem::size_of::<u32>()
1250        }
1251
1252        #[inline(always)]
1253        fn encode_is_copy() -> bool {
1254            true
1255        }
1256
1257        #[inline(always)]
1258        fn decode_is_copy() -> bool {
1259            false
1260        }
1261    }
1262
1263    impl fidl::encoding::ValueTypeMarker for ColorSpaceType {
1264        type Borrowed<'a> = Self;
1265        #[inline(always)]
1266        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1267            *value
1268        }
1269    }
1270
1271    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ColorSpaceType {
1272        #[inline]
1273        unsafe fn encode(
1274            self,
1275            encoder: &mut fidl::encoding::Encoder<'_, D>,
1276            offset: usize,
1277            _depth: fidl::encoding::Depth,
1278        ) -> fidl::Result<()> {
1279            encoder.debug_check_bounds::<Self>(offset);
1280            encoder.write_num(self.into_primitive(), offset);
1281            Ok(())
1282        }
1283    }
1284
1285    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorSpaceType {
1286        #[inline(always)]
1287        fn new_empty() -> Self {
1288            Self::Invalid
1289        }
1290
1291        #[inline]
1292        unsafe fn decode(
1293            &mut self,
1294            decoder: &mut fidl::encoding::Decoder<'_, D>,
1295            offset: usize,
1296            _depth: fidl::encoding::Depth,
1297        ) -> fidl::Result<()> {
1298            decoder.debug_check_bounds::<Self>(offset);
1299            let prim = decoder.read_num::<u32>(offset);
1300
1301            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1302            Ok(())
1303        }
1304    }
1305    unsafe impl fidl::encoding::TypeMarker for HeapType {
1306        type Owned = Self;
1307
1308        #[inline(always)]
1309        fn inline_align(_context: fidl::encoding::Context) -> usize {
1310            std::mem::align_of::<u64>()
1311        }
1312
1313        #[inline(always)]
1314        fn inline_size(_context: fidl::encoding::Context) -> usize {
1315            std::mem::size_of::<u64>()
1316        }
1317
1318        #[inline(always)]
1319        fn encode_is_copy() -> bool {
1320            true
1321        }
1322
1323        #[inline(always)]
1324        fn decode_is_copy() -> bool {
1325            false
1326        }
1327    }
1328
1329    impl fidl::encoding::ValueTypeMarker for HeapType {
1330        type Borrowed<'a> = Self;
1331        #[inline(always)]
1332        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1333            *value
1334        }
1335    }
1336
1337    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HeapType {
1338        #[inline]
1339        unsafe fn encode(
1340            self,
1341            encoder: &mut fidl::encoding::Encoder<'_, D>,
1342            offset: usize,
1343            _depth: fidl::encoding::Depth,
1344        ) -> fidl::Result<()> {
1345            encoder.debug_check_bounds::<Self>(offset);
1346            encoder.write_num(self.into_primitive(), offset);
1347            Ok(())
1348        }
1349    }
1350
1351    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HeapType {
1352        #[inline(always)]
1353        fn new_empty() -> Self {
1354            Self::SystemRam
1355        }
1356
1357        #[inline]
1358        unsafe fn decode(
1359            &mut self,
1360            decoder: &mut fidl::encoding::Decoder<'_, D>,
1361            offset: usize,
1362            _depth: fidl::encoding::Depth,
1363        ) -> fidl::Result<()> {
1364            decoder.debug_check_bounds::<Self>(offset);
1365            let prim = decoder.read_num::<u64>(offset);
1366
1367            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1368            Ok(())
1369        }
1370    }
1371    unsafe impl fidl::encoding::TypeMarker for PixelFormatType {
1372        type Owned = Self;
1373
1374        #[inline(always)]
1375        fn inline_align(_context: fidl::encoding::Context) -> usize {
1376            std::mem::align_of::<u32>()
1377        }
1378
1379        #[inline(always)]
1380        fn inline_size(_context: fidl::encoding::Context) -> usize {
1381            std::mem::size_of::<u32>()
1382        }
1383
1384        #[inline(always)]
1385        fn encode_is_copy() -> bool {
1386            true
1387        }
1388
1389        #[inline(always)]
1390        fn decode_is_copy() -> bool {
1391            false
1392        }
1393    }
1394
1395    impl fidl::encoding::ValueTypeMarker for PixelFormatType {
1396        type Borrowed<'a> = Self;
1397        #[inline(always)]
1398        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1399            *value
1400        }
1401    }
1402
1403    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1404        for PixelFormatType
1405    {
1406        #[inline]
1407        unsafe fn encode(
1408            self,
1409            encoder: &mut fidl::encoding::Encoder<'_, D>,
1410            offset: usize,
1411            _depth: fidl::encoding::Depth,
1412        ) -> fidl::Result<()> {
1413            encoder.debug_check_bounds::<Self>(offset);
1414            encoder.write_num(self.into_primitive(), offset);
1415            Ok(())
1416        }
1417    }
1418
1419    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PixelFormatType {
1420        #[inline(always)]
1421        fn new_empty() -> Self {
1422            Self::Invalid
1423        }
1424
1425        #[inline]
1426        unsafe fn decode(
1427            &mut self,
1428            decoder: &mut fidl::encoding::Decoder<'_, D>,
1429            offset: usize,
1430            _depth: fidl::encoding::Depth,
1431        ) -> fidl::Result<()> {
1432            decoder.debug_check_bounds::<Self>(offset);
1433            let prim = decoder.read_num::<u32>(offset);
1434
1435            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1436            Ok(())
1437        }
1438    }
1439
1440    impl fidl::encoding::ValueTypeMarker for AllocatorSetDebugClientInfoRequest {
1441        type Borrowed<'a> = &'a Self;
1442        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1443            value
1444        }
1445    }
1446
1447    unsafe impl fidl::encoding::TypeMarker for AllocatorSetDebugClientInfoRequest {
1448        type Owned = Self;
1449
1450        #[inline(always)]
1451        fn inline_align(_context: fidl::encoding::Context) -> usize {
1452            8
1453        }
1454
1455        #[inline(always)]
1456        fn inline_size(_context: fidl::encoding::Context) -> usize {
1457            24
1458        }
1459    }
1460
1461    unsafe impl<D: fidl::encoding::ResourceDialect>
1462        fidl::encoding::Encode<AllocatorSetDebugClientInfoRequest, D>
1463        for &AllocatorSetDebugClientInfoRequest
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::<AllocatorSetDebugClientInfoRequest>(offset);
1473            // Delegate to tuple encoding.
1474            fidl::encoding::Encode::<AllocatorSetDebugClientInfoRequest, D>::encode(
1475                (
1476                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1477                        &self.name,
1478                    ),
1479                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1480                ),
1481                encoder,
1482                offset,
1483                _depth,
1484            )
1485        }
1486    }
1487    unsafe impl<
1488            D: fidl::encoding::ResourceDialect,
1489            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1490            T1: fidl::encoding::Encode<u64, D>,
1491        > fidl::encoding::Encode<AllocatorSetDebugClientInfoRequest, D> for (T0, T1)
1492    {
1493        #[inline]
1494        unsafe fn encode(
1495            self,
1496            encoder: &mut fidl::encoding::Encoder<'_, D>,
1497            offset: usize,
1498            depth: fidl::encoding::Depth,
1499        ) -> fidl::Result<()> {
1500            encoder.debug_check_bounds::<AllocatorSetDebugClientInfoRequest>(offset);
1501            // Zero out padding regions. There's no need to apply masks
1502            // because the unmasked parts will be overwritten by fields.
1503            // Write the fields.
1504            self.0.encode(encoder, offset + 0, depth)?;
1505            self.1.encode(encoder, offset + 16, depth)?;
1506            Ok(())
1507        }
1508    }
1509
1510    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1511        for AllocatorSetDebugClientInfoRequest
1512    {
1513        #[inline(always)]
1514        fn new_empty() -> Self {
1515            Self {
1516                name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
1517                id: fidl::new_empty!(u64, D),
1518            }
1519        }
1520
1521        #[inline]
1522        unsafe fn decode(
1523            &mut self,
1524            decoder: &mut fidl::encoding::Decoder<'_, D>,
1525            offset: usize,
1526            _depth: fidl::encoding::Depth,
1527        ) -> fidl::Result<()> {
1528            decoder.debug_check_bounds::<Self>(offset);
1529            // Verify that padding bytes are zero.
1530            fidl::decode!(
1531                fidl::encoding::BoundedString<64>,
1532                D,
1533                &mut self.name,
1534                decoder,
1535                offset + 0,
1536                _depth
1537            )?;
1538            fidl::decode!(u64, D, &mut self.id, decoder, offset + 16, _depth)?;
1539            Ok(())
1540        }
1541    }
1542
1543    impl fidl::encoding::ValueTypeMarker for AllocatorValidateBufferCollectionTokenRequest {
1544        type Borrowed<'a> = &'a Self;
1545        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1546            value
1547        }
1548    }
1549
1550    unsafe impl fidl::encoding::TypeMarker for AllocatorValidateBufferCollectionTokenRequest {
1551        type Owned = Self;
1552
1553        #[inline(always)]
1554        fn inline_align(_context: fidl::encoding::Context) -> usize {
1555            8
1556        }
1557
1558        #[inline(always)]
1559        fn inline_size(_context: fidl::encoding::Context) -> usize {
1560            8
1561        }
1562        #[inline(always)]
1563        fn encode_is_copy() -> bool {
1564            true
1565        }
1566
1567        #[inline(always)]
1568        fn decode_is_copy() -> bool {
1569            true
1570        }
1571    }
1572
1573    unsafe impl<D: fidl::encoding::ResourceDialect>
1574        fidl::encoding::Encode<AllocatorValidateBufferCollectionTokenRequest, D>
1575        for &AllocatorValidateBufferCollectionTokenRequest
1576    {
1577        #[inline]
1578        unsafe fn encode(
1579            self,
1580            encoder: &mut fidl::encoding::Encoder<'_, D>,
1581            offset: usize,
1582            _depth: fidl::encoding::Depth,
1583        ) -> fidl::Result<()> {
1584            encoder.debug_check_bounds::<AllocatorValidateBufferCollectionTokenRequest>(offset);
1585            unsafe {
1586                // Copy the object into the buffer.
1587                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1588                (buf_ptr as *mut AllocatorValidateBufferCollectionTokenRequest).write_unaligned(
1589                    (self as *const AllocatorValidateBufferCollectionTokenRequest).read(),
1590                );
1591                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1592                // done second because the memcpy will write garbage to these bytes.
1593            }
1594            Ok(())
1595        }
1596    }
1597    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1598        fidl::encoding::Encode<AllocatorValidateBufferCollectionTokenRequest, D> for (T0,)
1599    {
1600        #[inline]
1601        unsafe fn encode(
1602            self,
1603            encoder: &mut fidl::encoding::Encoder<'_, D>,
1604            offset: usize,
1605            depth: fidl::encoding::Depth,
1606        ) -> fidl::Result<()> {
1607            encoder.debug_check_bounds::<AllocatorValidateBufferCollectionTokenRequest>(offset);
1608            // Zero out padding regions. There's no need to apply masks
1609            // because the unmasked parts will be overwritten by fields.
1610            // Write the fields.
1611            self.0.encode(encoder, offset + 0, depth)?;
1612            Ok(())
1613        }
1614    }
1615
1616    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1617        for AllocatorValidateBufferCollectionTokenRequest
1618    {
1619        #[inline(always)]
1620        fn new_empty() -> Self {
1621            Self { token_server_koid: fidl::new_empty!(u64, D) }
1622        }
1623
1624        #[inline]
1625        unsafe fn decode(
1626            &mut self,
1627            decoder: &mut fidl::encoding::Decoder<'_, D>,
1628            offset: usize,
1629            _depth: fidl::encoding::Depth,
1630        ) -> fidl::Result<()> {
1631            decoder.debug_check_bounds::<Self>(offset);
1632            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1633            // Verify that padding bytes are zero.
1634            // Copy from the buffer into the object.
1635            unsafe {
1636                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1637            }
1638            Ok(())
1639        }
1640    }
1641
1642    impl fidl::encoding::ValueTypeMarker for AllocatorValidateBufferCollectionTokenResponse {
1643        type Borrowed<'a> = &'a Self;
1644        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1645            value
1646        }
1647    }
1648
1649    unsafe impl fidl::encoding::TypeMarker for AllocatorValidateBufferCollectionTokenResponse {
1650        type Owned = Self;
1651
1652        #[inline(always)]
1653        fn inline_align(_context: fidl::encoding::Context) -> usize {
1654            1
1655        }
1656
1657        #[inline(always)]
1658        fn inline_size(_context: fidl::encoding::Context) -> usize {
1659            1
1660        }
1661    }
1662
1663    unsafe impl<D: fidl::encoding::ResourceDialect>
1664        fidl::encoding::Encode<AllocatorValidateBufferCollectionTokenResponse, D>
1665        for &AllocatorValidateBufferCollectionTokenResponse
1666    {
1667        #[inline]
1668        unsafe fn encode(
1669            self,
1670            encoder: &mut fidl::encoding::Encoder<'_, D>,
1671            offset: usize,
1672            _depth: fidl::encoding::Depth,
1673        ) -> fidl::Result<()> {
1674            encoder.debug_check_bounds::<AllocatorValidateBufferCollectionTokenResponse>(offset);
1675            // Delegate to tuple encoding.
1676            fidl::encoding::Encode::<AllocatorValidateBufferCollectionTokenResponse, D>::encode(
1677                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_known),),
1678                encoder,
1679                offset,
1680                _depth,
1681            )
1682        }
1683    }
1684    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1685        fidl::encoding::Encode<AllocatorValidateBufferCollectionTokenResponse, D> for (T0,)
1686    {
1687        #[inline]
1688        unsafe fn encode(
1689            self,
1690            encoder: &mut fidl::encoding::Encoder<'_, D>,
1691            offset: usize,
1692            depth: fidl::encoding::Depth,
1693        ) -> fidl::Result<()> {
1694            encoder.debug_check_bounds::<AllocatorValidateBufferCollectionTokenResponse>(offset);
1695            // Zero out padding regions. There's no need to apply masks
1696            // because the unmasked parts will be overwritten by fields.
1697            // Write the fields.
1698            self.0.encode(encoder, offset + 0, depth)?;
1699            Ok(())
1700        }
1701    }
1702
1703    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1704        for AllocatorValidateBufferCollectionTokenResponse
1705    {
1706        #[inline(always)]
1707        fn new_empty() -> Self {
1708            Self { is_known: fidl::new_empty!(bool, D) }
1709        }
1710
1711        #[inline]
1712        unsafe fn decode(
1713            &mut self,
1714            decoder: &mut fidl::encoding::Decoder<'_, D>,
1715            offset: usize,
1716            _depth: fidl::encoding::Depth,
1717        ) -> fidl::Result<()> {
1718            decoder.debug_check_bounds::<Self>(offset);
1719            // Verify that padding bytes are zero.
1720            fidl::decode!(bool, D, &mut self.is_known, decoder, offset + 0, _depth)?;
1721            Ok(())
1722        }
1723    }
1724
1725    impl fidl::encoding::ValueTypeMarker for BufferCollectionCheckBuffersAllocatedResponse {
1726        type Borrowed<'a> = &'a Self;
1727        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1728            value
1729        }
1730    }
1731
1732    unsafe impl fidl::encoding::TypeMarker for BufferCollectionCheckBuffersAllocatedResponse {
1733        type Owned = Self;
1734
1735        #[inline(always)]
1736        fn inline_align(_context: fidl::encoding::Context) -> usize {
1737            4
1738        }
1739
1740        #[inline(always)]
1741        fn inline_size(_context: fidl::encoding::Context) -> usize {
1742            4
1743        }
1744        #[inline(always)]
1745        fn encode_is_copy() -> bool {
1746            true
1747        }
1748
1749        #[inline(always)]
1750        fn decode_is_copy() -> bool {
1751            true
1752        }
1753    }
1754
1755    unsafe impl<D: fidl::encoding::ResourceDialect>
1756        fidl::encoding::Encode<BufferCollectionCheckBuffersAllocatedResponse, D>
1757        for &BufferCollectionCheckBuffersAllocatedResponse
1758    {
1759        #[inline]
1760        unsafe fn encode(
1761            self,
1762            encoder: &mut fidl::encoding::Encoder<'_, D>,
1763            offset: usize,
1764            _depth: fidl::encoding::Depth,
1765        ) -> fidl::Result<()> {
1766            encoder.debug_check_bounds::<BufferCollectionCheckBuffersAllocatedResponse>(offset);
1767            unsafe {
1768                // Copy the object into the buffer.
1769                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1770                (buf_ptr as *mut BufferCollectionCheckBuffersAllocatedResponse).write_unaligned(
1771                    (self as *const BufferCollectionCheckBuffersAllocatedResponse).read(),
1772                );
1773                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1774                // done second because the memcpy will write garbage to these bytes.
1775            }
1776            Ok(())
1777        }
1778    }
1779    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
1780        fidl::encoding::Encode<BufferCollectionCheckBuffersAllocatedResponse, D> for (T0,)
1781    {
1782        #[inline]
1783        unsafe fn encode(
1784            self,
1785            encoder: &mut fidl::encoding::Encoder<'_, D>,
1786            offset: usize,
1787            depth: fidl::encoding::Depth,
1788        ) -> fidl::Result<()> {
1789            encoder.debug_check_bounds::<BufferCollectionCheckBuffersAllocatedResponse>(offset);
1790            // Zero out padding regions. There's no need to apply masks
1791            // because the unmasked parts will be overwritten by fields.
1792            // Write the fields.
1793            self.0.encode(encoder, offset + 0, depth)?;
1794            Ok(())
1795        }
1796    }
1797
1798    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1799        for BufferCollectionCheckBuffersAllocatedResponse
1800    {
1801        #[inline(always)]
1802        fn new_empty() -> Self {
1803            Self { status: fidl::new_empty!(i32, D) }
1804        }
1805
1806        #[inline]
1807        unsafe fn decode(
1808            &mut self,
1809            decoder: &mut fidl::encoding::Decoder<'_, D>,
1810            offset: usize,
1811            _depth: fidl::encoding::Depth,
1812        ) -> fidl::Result<()> {
1813            decoder.debug_check_bounds::<Self>(offset);
1814            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1815            // Verify that padding bytes are zero.
1816            // Copy from the buffer into the object.
1817            unsafe {
1818                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1819            }
1820            Ok(())
1821        }
1822    }
1823
1824    impl fidl::encoding::ValueTypeMarker for BufferCollectionConstraints {
1825        type Borrowed<'a> = &'a Self;
1826        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1827            value
1828        }
1829    }
1830
1831    unsafe impl fidl::encoding::TypeMarker for BufferCollectionConstraints {
1832        type Owned = Self;
1833
1834        #[inline(always)]
1835        fn inline_align(_context: fidl::encoding::Context) -> usize {
1836            8
1837        }
1838
1839        #[inline(always)]
1840        fn inline_size(_context: fidl::encoding::Context) -> usize {
1841            7760
1842        }
1843    }
1844
1845    unsafe impl<D: fidl::encoding::ResourceDialect>
1846        fidl::encoding::Encode<BufferCollectionConstraints, D> for &BufferCollectionConstraints
1847    {
1848        #[inline]
1849        unsafe fn encode(
1850            self,
1851            encoder: &mut fidl::encoding::Encoder<'_, D>,
1852            offset: usize,
1853            _depth: fidl::encoding::Depth,
1854        ) -> fidl::Result<()> {
1855            encoder.debug_check_bounds::<BufferCollectionConstraints>(offset);
1856            // Delegate to tuple encoding.
1857            fidl::encoding::Encode::<BufferCollectionConstraints, D>::encode(
1858                (
1859                    <BufferUsage as fidl::encoding::ValueTypeMarker>::borrow(&self.usage),
1860                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_buffer_count_for_camping),
1861                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_buffer_count_for_dedicated_slack),
1862                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_buffer_count_for_shared_slack),
1863                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_buffer_count),
1864                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_buffer_count),
1865                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_buffer_memory_constraints),
1866                    <BufferMemoryConstraints as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_memory_constraints),
1867                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format_constraints_count),
1868                    <fidl::encoding::Array<ImageFormatConstraints, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format_constraints),
1869                ),
1870                encoder, offset, _depth
1871            )
1872        }
1873    }
1874    unsafe impl<
1875            D: fidl::encoding::ResourceDialect,
1876            T0: fidl::encoding::Encode<BufferUsage, D>,
1877            T1: fidl::encoding::Encode<u32, D>,
1878            T2: fidl::encoding::Encode<u32, D>,
1879            T3: fidl::encoding::Encode<u32, D>,
1880            T4: fidl::encoding::Encode<u32, D>,
1881            T5: fidl::encoding::Encode<u32, D>,
1882            T6: fidl::encoding::Encode<bool, D>,
1883            T7: fidl::encoding::Encode<BufferMemoryConstraints, D>,
1884            T8: fidl::encoding::Encode<u32, D>,
1885            T9: fidl::encoding::Encode<fidl::encoding::Array<ImageFormatConstraints, 32>, D>,
1886        > fidl::encoding::Encode<BufferCollectionConstraints, D>
1887        for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
1888    {
1889        #[inline]
1890        unsafe fn encode(
1891            self,
1892            encoder: &mut fidl::encoding::Encoder<'_, D>,
1893            offset: usize,
1894            depth: fidl::encoding::Depth,
1895        ) -> fidl::Result<()> {
1896            encoder.debug_check_bounds::<BufferCollectionConstraints>(offset);
1897            // Zero out padding regions. There's no need to apply masks
1898            // because the unmasked parts will be overwritten by fields.
1899            unsafe {
1900                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
1901                (ptr as *mut u64).write_unaligned(0);
1902            }
1903            unsafe {
1904                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(328);
1905                (ptr as *mut u64).write_unaligned(0);
1906            }
1907            // Write the fields.
1908            self.0.encode(encoder, offset + 0, depth)?;
1909            self.1.encode(encoder, offset + 20, depth)?;
1910            self.2.encode(encoder, offset + 24, depth)?;
1911            self.3.encode(encoder, offset + 28, depth)?;
1912            self.4.encode(encoder, offset + 32, depth)?;
1913            self.5.encode(encoder, offset + 36, depth)?;
1914            self.6.encode(encoder, offset + 40, depth)?;
1915            self.7.encode(encoder, offset + 48, depth)?;
1916            self.8.encode(encoder, offset + 328, depth)?;
1917            self.9.encode(encoder, offset + 336, depth)?;
1918            Ok(())
1919        }
1920    }
1921
1922    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1923        for BufferCollectionConstraints
1924    {
1925        #[inline(always)]
1926        fn new_empty() -> Self {
1927            Self {
1928                usage: fidl::new_empty!(BufferUsage, D),
1929                min_buffer_count_for_camping: fidl::new_empty!(u32, D),
1930                min_buffer_count_for_dedicated_slack: fidl::new_empty!(u32, D),
1931                min_buffer_count_for_shared_slack: fidl::new_empty!(u32, D),
1932                min_buffer_count: fidl::new_empty!(u32, D),
1933                max_buffer_count: fidl::new_empty!(u32, D),
1934                has_buffer_memory_constraints: fidl::new_empty!(bool, D),
1935                buffer_memory_constraints: fidl::new_empty!(BufferMemoryConstraints, D),
1936                image_format_constraints_count: fidl::new_empty!(u32, D),
1937                image_format_constraints: fidl::new_empty!(fidl::encoding::Array<ImageFormatConstraints, 32>, D),
1938            }
1939        }
1940
1941        #[inline]
1942        unsafe fn decode(
1943            &mut self,
1944            decoder: &mut fidl::encoding::Decoder<'_, D>,
1945            offset: usize,
1946            _depth: fidl::encoding::Depth,
1947        ) -> fidl::Result<()> {
1948            decoder.debug_check_bounds::<Self>(offset);
1949            // Verify that padding bytes are zero.
1950            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
1951            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1952            let mask = 0xffffffffffffff00u64;
1953            let maskedval = padval & mask;
1954            if maskedval != 0 {
1955                return Err(fidl::Error::NonZeroPadding {
1956                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
1957                });
1958            }
1959            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(328) };
1960            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1961            let mask = 0xffffffff00000000u64;
1962            let maskedval = padval & mask;
1963            if maskedval != 0 {
1964                return Err(fidl::Error::NonZeroPadding {
1965                    padding_start: offset + 328 + ((mask as u64).trailing_zeros() / 8) as usize,
1966                });
1967            }
1968            fidl::decode!(BufferUsage, D, &mut self.usage, decoder, offset + 0, _depth)?;
1969            fidl::decode!(
1970                u32,
1971                D,
1972                &mut self.min_buffer_count_for_camping,
1973                decoder,
1974                offset + 20,
1975                _depth
1976            )?;
1977            fidl::decode!(
1978                u32,
1979                D,
1980                &mut self.min_buffer_count_for_dedicated_slack,
1981                decoder,
1982                offset + 24,
1983                _depth
1984            )?;
1985            fidl::decode!(
1986                u32,
1987                D,
1988                &mut self.min_buffer_count_for_shared_slack,
1989                decoder,
1990                offset + 28,
1991                _depth
1992            )?;
1993            fidl::decode!(u32, D, &mut self.min_buffer_count, decoder, offset + 32, _depth)?;
1994            fidl::decode!(u32, D, &mut self.max_buffer_count, decoder, offset + 36, _depth)?;
1995            fidl::decode!(
1996                bool,
1997                D,
1998                &mut self.has_buffer_memory_constraints,
1999                decoder,
2000                offset + 40,
2001                _depth
2002            )?;
2003            fidl::decode!(
2004                BufferMemoryConstraints,
2005                D,
2006                &mut self.buffer_memory_constraints,
2007                decoder,
2008                offset + 48,
2009                _depth
2010            )?;
2011            fidl::decode!(
2012                u32,
2013                D,
2014                &mut self.image_format_constraints_count,
2015                decoder,
2016                offset + 328,
2017                _depth
2018            )?;
2019            fidl::decode!(fidl::encoding::Array<ImageFormatConstraints, 32>, D, &mut self.image_format_constraints, decoder, offset + 336, _depth)?;
2020            Ok(())
2021        }
2022    }
2023
2024    impl fidl::encoding::ValueTypeMarker for BufferCollectionConstraintsAuxBuffers {
2025        type Borrowed<'a> = &'a Self;
2026        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2027            value
2028        }
2029    }
2030
2031    unsafe impl fidl::encoding::TypeMarker for BufferCollectionConstraintsAuxBuffers {
2032        type Owned = Self;
2033
2034        #[inline(always)]
2035        fn inline_align(_context: fidl::encoding::Context) -> usize {
2036            1
2037        }
2038
2039        #[inline(always)]
2040        fn inline_size(_context: fidl::encoding::Context) -> usize {
2041            2
2042        }
2043    }
2044
2045    unsafe impl<D: fidl::encoding::ResourceDialect>
2046        fidl::encoding::Encode<BufferCollectionConstraintsAuxBuffers, D>
2047        for &BufferCollectionConstraintsAuxBuffers
2048    {
2049        #[inline]
2050        unsafe fn encode(
2051            self,
2052            encoder: &mut fidl::encoding::Encoder<'_, D>,
2053            offset: usize,
2054            _depth: fidl::encoding::Depth,
2055        ) -> fidl::Result<()> {
2056            encoder.debug_check_bounds::<BufferCollectionConstraintsAuxBuffers>(offset);
2057            // Delegate to tuple encoding.
2058            fidl::encoding::Encode::<BufferCollectionConstraintsAuxBuffers, D>::encode(
2059                (
2060                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
2061                        &self.need_clear_aux_buffers_for_secure,
2062                    ),
2063                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
2064                        &self.allow_clear_aux_buffers_for_secure,
2065                    ),
2066                ),
2067                encoder,
2068                offset,
2069                _depth,
2070            )
2071        }
2072    }
2073    unsafe impl<
2074            D: fidl::encoding::ResourceDialect,
2075            T0: fidl::encoding::Encode<bool, D>,
2076            T1: fidl::encoding::Encode<bool, D>,
2077        > fidl::encoding::Encode<BufferCollectionConstraintsAuxBuffers, D> for (T0, T1)
2078    {
2079        #[inline]
2080        unsafe fn encode(
2081            self,
2082            encoder: &mut fidl::encoding::Encoder<'_, D>,
2083            offset: usize,
2084            depth: fidl::encoding::Depth,
2085        ) -> fidl::Result<()> {
2086            encoder.debug_check_bounds::<BufferCollectionConstraintsAuxBuffers>(offset);
2087            // Zero out padding regions. There's no need to apply masks
2088            // because the unmasked parts will be overwritten by fields.
2089            // Write the fields.
2090            self.0.encode(encoder, offset + 0, depth)?;
2091            self.1.encode(encoder, offset + 1, depth)?;
2092            Ok(())
2093        }
2094    }
2095
2096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2097        for BufferCollectionConstraintsAuxBuffers
2098    {
2099        #[inline(always)]
2100        fn new_empty() -> Self {
2101            Self {
2102                need_clear_aux_buffers_for_secure: fidl::new_empty!(bool, D),
2103                allow_clear_aux_buffers_for_secure: fidl::new_empty!(bool, D),
2104            }
2105        }
2106
2107        #[inline]
2108        unsafe fn decode(
2109            &mut self,
2110            decoder: &mut fidl::encoding::Decoder<'_, D>,
2111            offset: usize,
2112            _depth: fidl::encoding::Depth,
2113        ) -> fidl::Result<()> {
2114            decoder.debug_check_bounds::<Self>(offset);
2115            // Verify that padding bytes are zero.
2116            fidl::decode!(
2117                bool,
2118                D,
2119                &mut self.need_clear_aux_buffers_for_secure,
2120                decoder,
2121                offset + 0,
2122                _depth
2123            )?;
2124            fidl::decode!(
2125                bool,
2126                D,
2127                &mut self.allow_clear_aux_buffers_for_secure,
2128                decoder,
2129                offset + 1,
2130                _depth
2131            )?;
2132            Ok(())
2133        }
2134    }
2135
2136    impl fidl::encoding::ValueTypeMarker for BufferCollectionSetConstraintsAuxBuffersRequest {
2137        type Borrowed<'a> = &'a Self;
2138        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2139            value
2140        }
2141    }
2142
2143    unsafe impl fidl::encoding::TypeMarker for BufferCollectionSetConstraintsAuxBuffersRequest {
2144        type Owned = Self;
2145
2146        #[inline(always)]
2147        fn inline_align(_context: fidl::encoding::Context) -> usize {
2148            1
2149        }
2150
2151        #[inline(always)]
2152        fn inline_size(_context: fidl::encoding::Context) -> usize {
2153            2
2154        }
2155    }
2156
2157    unsafe impl<D: fidl::encoding::ResourceDialect>
2158        fidl::encoding::Encode<BufferCollectionSetConstraintsAuxBuffersRequest, D>
2159        for &BufferCollectionSetConstraintsAuxBuffersRequest
2160    {
2161        #[inline]
2162        unsafe fn encode(
2163            self,
2164            encoder: &mut fidl::encoding::Encoder<'_, D>,
2165            offset: usize,
2166            _depth: fidl::encoding::Depth,
2167        ) -> fidl::Result<()> {
2168            encoder.debug_check_bounds::<BufferCollectionSetConstraintsAuxBuffersRequest>(offset);
2169            // Delegate to tuple encoding.
2170            fidl::encoding::Encode::<BufferCollectionSetConstraintsAuxBuffersRequest, D>::encode(
2171                (
2172                    <BufferCollectionConstraintsAuxBuffers as fidl::encoding::ValueTypeMarker>::borrow(&self.constraints),
2173                ),
2174                encoder, offset, _depth
2175            )
2176        }
2177    }
2178    unsafe impl<
2179            D: fidl::encoding::ResourceDialect,
2180            T0: fidl::encoding::Encode<BufferCollectionConstraintsAuxBuffers, D>,
2181        > fidl::encoding::Encode<BufferCollectionSetConstraintsAuxBuffersRequest, D> for (T0,)
2182    {
2183        #[inline]
2184        unsafe fn encode(
2185            self,
2186            encoder: &mut fidl::encoding::Encoder<'_, D>,
2187            offset: usize,
2188            depth: fidl::encoding::Depth,
2189        ) -> fidl::Result<()> {
2190            encoder.debug_check_bounds::<BufferCollectionSetConstraintsAuxBuffersRequest>(offset);
2191            // Zero out padding regions. There's no need to apply masks
2192            // because the unmasked parts will be overwritten by fields.
2193            // Write the fields.
2194            self.0.encode(encoder, offset + 0, depth)?;
2195            Ok(())
2196        }
2197    }
2198
2199    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2200        for BufferCollectionSetConstraintsAuxBuffersRequest
2201    {
2202        #[inline(always)]
2203        fn new_empty() -> Self {
2204            Self { constraints: fidl::new_empty!(BufferCollectionConstraintsAuxBuffers, D) }
2205        }
2206
2207        #[inline]
2208        unsafe fn decode(
2209            &mut self,
2210            decoder: &mut fidl::encoding::Decoder<'_, D>,
2211            offset: usize,
2212            _depth: fidl::encoding::Depth,
2213        ) -> fidl::Result<()> {
2214            decoder.debug_check_bounds::<Self>(offset);
2215            // Verify that padding bytes are zero.
2216            fidl::decode!(
2217                BufferCollectionConstraintsAuxBuffers,
2218                D,
2219                &mut self.constraints,
2220                decoder,
2221                offset + 0,
2222                _depth
2223            )?;
2224            Ok(())
2225        }
2226    }
2227
2228    impl fidl::encoding::ValueTypeMarker for BufferCollectionSetConstraintsRequest {
2229        type Borrowed<'a> = &'a Self;
2230        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2231            value
2232        }
2233    }
2234
2235    unsafe impl fidl::encoding::TypeMarker for BufferCollectionSetConstraintsRequest {
2236        type Owned = Self;
2237
2238        #[inline(always)]
2239        fn inline_align(_context: fidl::encoding::Context) -> usize {
2240            8
2241        }
2242
2243        #[inline(always)]
2244        fn inline_size(_context: fidl::encoding::Context) -> usize {
2245            7768
2246        }
2247    }
2248
2249    unsafe impl<D: fidl::encoding::ResourceDialect>
2250        fidl::encoding::Encode<BufferCollectionSetConstraintsRequest, D>
2251        for &BufferCollectionSetConstraintsRequest
2252    {
2253        #[inline]
2254        unsafe fn encode(
2255            self,
2256            encoder: &mut fidl::encoding::Encoder<'_, D>,
2257            offset: usize,
2258            _depth: fidl::encoding::Depth,
2259        ) -> fidl::Result<()> {
2260            encoder.debug_check_bounds::<BufferCollectionSetConstraintsRequest>(offset);
2261            // Delegate to tuple encoding.
2262            fidl::encoding::Encode::<BufferCollectionSetConstraintsRequest, D>::encode(
2263                (
2264                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_constraints),
2265                    <BufferCollectionConstraints as fidl::encoding::ValueTypeMarker>::borrow(
2266                        &self.constraints,
2267                    ),
2268                ),
2269                encoder,
2270                offset,
2271                _depth,
2272            )
2273        }
2274    }
2275    unsafe impl<
2276            D: fidl::encoding::ResourceDialect,
2277            T0: fidl::encoding::Encode<bool, D>,
2278            T1: fidl::encoding::Encode<BufferCollectionConstraints, D>,
2279        > fidl::encoding::Encode<BufferCollectionSetConstraintsRequest, D> for (T0, T1)
2280    {
2281        #[inline]
2282        unsafe fn encode(
2283            self,
2284            encoder: &mut fidl::encoding::Encoder<'_, D>,
2285            offset: usize,
2286            depth: fidl::encoding::Depth,
2287        ) -> fidl::Result<()> {
2288            encoder.debug_check_bounds::<BufferCollectionSetConstraintsRequest>(offset);
2289            // Zero out padding regions. There's no need to apply masks
2290            // because the unmasked parts will be overwritten by fields.
2291            unsafe {
2292                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2293                (ptr as *mut u64).write_unaligned(0);
2294            }
2295            // Write the fields.
2296            self.0.encode(encoder, offset + 0, depth)?;
2297            self.1.encode(encoder, offset + 8, depth)?;
2298            Ok(())
2299        }
2300    }
2301
2302    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2303        for BufferCollectionSetConstraintsRequest
2304    {
2305        #[inline(always)]
2306        fn new_empty() -> Self {
2307            Self {
2308                has_constraints: fidl::new_empty!(bool, D),
2309                constraints: fidl::new_empty!(BufferCollectionConstraints, D),
2310            }
2311        }
2312
2313        #[inline]
2314        unsafe fn decode(
2315            &mut self,
2316            decoder: &mut fidl::encoding::Decoder<'_, D>,
2317            offset: usize,
2318            _depth: fidl::encoding::Depth,
2319        ) -> fidl::Result<()> {
2320            decoder.debug_check_bounds::<Self>(offset);
2321            // Verify that padding bytes are zero.
2322            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2323            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2324            let mask = 0xffffffffffffff00u64;
2325            let maskedval = padval & mask;
2326            if maskedval != 0 {
2327                return Err(fidl::Error::NonZeroPadding {
2328                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2329                });
2330            }
2331            fidl::decode!(bool, D, &mut self.has_constraints, decoder, offset + 0, _depth)?;
2332            fidl::decode!(
2333                BufferCollectionConstraints,
2334                D,
2335                &mut self.constraints,
2336                decoder,
2337                offset + 8,
2338                _depth
2339            )?;
2340            Ok(())
2341        }
2342    }
2343
2344    impl fidl::encoding::ValueTypeMarker for BufferCollectionTokenDuplicateSyncRequest {
2345        type Borrowed<'a> = &'a Self;
2346        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2347            value
2348        }
2349    }
2350
2351    unsafe impl fidl::encoding::TypeMarker for BufferCollectionTokenDuplicateSyncRequest {
2352        type Owned = Self;
2353
2354        #[inline(always)]
2355        fn inline_align(_context: fidl::encoding::Context) -> usize {
2356            8
2357        }
2358
2359        #[inline(always)]
2360        fn inline_size(_context: fidl::encoding::Context) -> usize {
2361            16
2362        }
2363    }
2364
2365    unsafe impl<D: fidl::encoding::ResourceDialect>
2366        fidl::encoding::Encode<BufferCollectionTokenDuplicateSyncRequest, D>
2367        for &BufferCollectionTokenDuplicateSyncRequest
2368    {
2369        #[inline]
2370        unsafe fn encode(
2371            self,
2372            encoder: &mut fidl::encoding::Encoder<'_, D>,
2373            offset: usize,
2374            _depth: fidl::encoding::Depth,
2375        ) -> fidl::Result<()> {
2376            encoder.debug_check_bounds::<BufferCollectionTokenDuplicateSyncRequest>(offset);
2377            // Delegate to tuple encoding.
2378            fidl::encoding::Encode::<BufferCollectionTokenDuplicateSyncRequest, D>::encode(
2379                (
2380                    <fidl::encoding::Vector<fidl::Rights, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.rights_attenuation_masks),
2381                ),
2382                encoder, offset, _depth
2383            )
2384        }
2385    }
2386    unsafe impl<
2387            D: fidl::encoding::ResourceDialect,
2388            T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl::Rights, 64>, D>,
2389        > fidl::encoding::Encode<BufferCollectionTokenDuplicateSyncRequest, D> for (T0,)
2390    {
2391        #[inline]
2392        unsafe fn encode(
2393            self,
2394            encoder: &mut fidl::encoding::Encoder<'_, D>,
2395            offset: usize,
2396            depth: fidl::encoding::Depth,
2397        ) -> fidl::Result<()> {
2398            encoder.debug_check_bounds::<BufferCollectionTokenDuplicateSyncRequest>(offset);
2399            // Zero out padding regions. There's no need to apply masks
2400            // because the unmasked parts will be overwritten by fields.
2401            // Write the fields.
2402            self.0.encode(encoder, offset + 0, depth)?;
2403            Ok(())
2404        }
2405    }
2406
2407    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2408        for BufferCollectionTokenDuplicateSyncRequest
2409    {
2410        #[inline(always)]
2411        fn new_empty() -> Self {
2412            Self {
2413                rights_attenuation_masks: fidl::new_empty!(fidl::encoding::Vector<fidl::Rights, 64>, D),
2414            }
2415        }
2416
2417        #[inline]
2418        unsafe fn decode(
2419            &mut self,
2420            decoder: &mut fidl::encoding::Decoder<'_, D>,
2421            offset: usize,
2422            _depth: fidl::encoding::Depth,
2423        ) -> fidl::Result<()> {
2424            decoder.debug_check_bounds::<Self>(offset);
2425            // Verify that padding bytes are zero.
2426            fidl::decode!(fidl::encoding::Vector<fidl::Rights, 64>, D, &mut self.rights_attenuation_masks, decoder, offset + 0, _depth)?;
2427            Ok(())
2428        }
2429    }
2430
2431    impl fidl::encoding::ValueTypeMarker for BufferCollectionTokenGroupCreateChildrenSyncRequest {
2432        type Borrowed<'a> = &'a Self;
2433        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2434            value
2435        }
2436    }
2437
2438    unsafe impl fidl::encoding::TypeMarker for BufferCollectionTokenGroupCreateChildrenSyncRequest {
2439        type Owned = Self;
2440
2441        #[inline(always)]
2442        fn inline_align(_context: fidl::encoding::Context) -> usize {
2443            8
2444        }
2445
2446        #[inline(always)]
2447        fn inline_size(_context: fidl::encoding::Context) -> usize {
2448            16
2449        }
2450    }
2451
2452    unsafe impl<D: fidl::encoding::ResourceDialect>
2453        fidl::encoding::Encode<BufferCollectionTokenGroupCreateChildrenSyncRequest, D>
2454        for &BufferCollectionTokenGroupCreateChildrenSyncRequest
2455    {
2456        #[inline]
2457        unsafe fn encode(
2458            self,
2459            encoder: &mut fidl::encoding::Encoder<'_, D>,
2460            offset: usize,
2461            _depth: fidl::encoding::Depth,
2462        ) -> fidl::Result<()> {
2463            encoder
2464                .debug_check_bounds::<BufferCollectionTokenGroupCreateChildrenSyncRequest>(offset);
2465            // Delegate to tuple encoding.
2466            fidl::encoding::Encode::<BufferCollectionTokenGroupCreateChildrenSyncRequest, D>::encode(
2467                (
2468                    <fidl::encoding::Vector<fidl::Rights, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.rights_attenuation_masks),
2469                ),
2470                encoder, offset, _depth
2471            )
2472        }
2473    }
2474    unsafe impl<
2475            D: fidl::encoding::ResourceDialect,
2476            T0: fidl::encoding::Encode<fidl::encoding::Vector<fidl::Rights, 64>, D>,
2477        > fidl::encoding::Encode<BufferCollectionTokenGroupCreateChildrenSyncRequest, D> for (T0,)
2478    {
2479        #[inline]
2480        unsafe fn encode(
2481            self,
2482            encoder: &mut fidl::encoding::Encoder<'_, D>,
2483            offset: usize,
2484            depth: fidl::encoding::Depth,
2485        ) -> fidl::Result<()> {
2486            encoder
2487                .debug_check_bounds::<BufferCollectionTokenGroupCreateChildrenSyncRequest>(offset);
2488            // Zero out padding regions. There's no need to apply masks
2489            // because the unmasked parts will be overwritten by fields.
2490            // Write the fields.
2491            self.0.encode(encoder, offset + 0, depth)?;
2492            Ok(())
2493        }
2494    }
2495
2496    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2497        for BufferCollectionTokenGroupCreateChildrenSyncRequest
2498    {
2499        #[inline(always)]
2500        fn new_empty() -> Self {
2501            Self {
2502                rights_attenuation_masks: fidl::new_empty!(fidl::encoding::Vector<fidl::Rights, 64>, D),
2503            }
2504        }
2505
2506        #[inline]
2507        unsafe fn decode(
2508            &mut self,
2509            decoder: &mut fidl::encoding::Decoder<'_, D>,
2510            offset: usize,
2511            _depth: fidl::encoding::Depth,
2512        ) -> fidl::Result<()> {
2513            decoder.debug_check_bounds::<Self>(offset);
2514            // Verify that padding bytes are zero.
2515            fidl::decode!(fidl::encoding::Vector<fidl::Rights, 64>, D, &mut self.rights_attenuation_masks, decoder, offset + 0, _depth)?;
2516            Ok(())
2517        }
2518    }
2519
2520    impl fidl::encoding::ValueTypeMarker for BufferFormat {
2521        type Borrowed<'a> = &'a Self;
2522        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2523            value
2524        }
2525    }
2526
2527    unsafe impl fidl::encoding::TypeMarker for BufferFormat {
2528        type Owned = Self;
2529
2530        #[inline(always)]
2531        fn inline_align(_context: fidl::encoding::Context) -> usize {
2532            8
2533        }
2534
2535        #[inline(always)]
2536        fn inline_size(_context: fidl::encoding::Context) -> usize {
2537            80
2538        }
2539    }
2540
2541    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BufferFormat, D>
2542        for &BufferFormat
2543    {
2544        #[inline]
2545        unsafe fn encode(
2546            self,
2547            encoder: &mut fidl::encoding::Encoder<'_, D>,
2548            offset: usize,
2549            _depth: fidl::encoding::Depth,
2550        ) -> fidl::Result<()> {
2551            encoder.debug_check_bounds::<BufferFormat>(offset);
2552            // Delegate to tuple encoding.
2553            fidl::encoding::Encode::<BufferFormat, D>::encode(
2554                (
2555                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.tag),
2556                    <ImageFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.image),
2557                ),
2558                encoder,
2559                offset,
2560                _depth,
2561            )
2562        }
2563    }
2564    unsafe impl<
2565            D: fidl::encoding::ResourceDialect,
2566            T0: fidl::encoding::Encode<u32, D>,
2567            T1: fidl::encoding::Encode<ImageFormat, D>,
2568        > fidl::encoding::Encode<BufferFormat, D> for (T0, T1)
2569    {
2570        #[inline]
2571        unsafe fn encode(
2572            self,
2573            encoder: &mut fidl::encoding::Encoder<'_, D>,
2574            offset: usize,
2575            depth: fidl::encoding::Depth,
2576        ) -> fidl::Result<()> {
2577            encoder.debug_check_bounds::<BufferFormat>(offset);
2578            // Zero out padding regions. There's no need to apply masks
2579            // because the unmasked parts will be overwritten by fields.
2580            unsafe {
2581                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2582                (ptr as *mut u64).write_unaligned(0);
2583            }
2584            // Write the fields.
2585            self.0.encode(encoder, offset + 0, depth)?;
2586            self.1.encode(encoder, offset + 8, depth)?;
2587            Ok(())
2588        }
2589    }
2590
2591    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferFormat {
2592        #[inline(always)]
2593        fn new_empty() -> Self {
2594            Self { tag: fidl::new_empty!(u32, D), image: fidl::new_empty!(ImageFormat, D) }
2595        }
2596
2597        #[inline]
2598        unsafe fn decode(
2599            &mut self,
2600            decoder: &mut fidl::encoding::Decoder<'_, D>,
2601            offset: usize,
2602            _depth: fidl::encoding::Depth,
2603        ) -> fidl::Result<()> {
2604            decoder.debug_check_bounds::<Self>(offset);
2605            // Verify that padding bytes are zero.
2606            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2607            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2608            let mask = 0xffffffff00000000u64;
2609            let maskedval = padval & mask;
2610            if maskedval != 0 {
2611                return Err(fidl::Error::NonZeroPadding {
2612                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2613                });
2614            }
2615            fidl::decode!(u32, D, &mut self.tag, decoder, offset + 0, _depth)?;
2616            fidl::decode!(ImageFormat, D, &mut self.image, decoder, offset + 8, _depth)?;
2617            Ok(())
2618        }
2619    }
2620
2621    impl fidl::encoding::ValueTypeMarker for BufferMemoryConstraints {
2622        type Borrowed<'a> = &'a Self;
2623        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2624            value
2625        }
2626    }
2627
2628    unsafe impl fidl::encoding::TypeMarker for BufferMemoryConstraints {
2629        type Owned = Self;
2630
2631        #[inline(always)]
2632        fn inline_align(_context: fidl::encoding::Context) -> usize {
2633            8
2634        }
2635
2636        #[inline(always)]
2637        fn inline_size(_context: fidl::encoding::Context) -> usize {
2638            280
2639        }
2640    }
2641
2642    unsafe impl<D: fidl::encoding::ResourceDialect>
2643        fidl::encoding::Encode<BufferMemoryConstraints, D> for &BufferMemoryConstraints
2644    {
2645        #[inline]
2646        unsafe fn encode(
2647            self,
2648            encoder: &mut fidl::encoding::Encoder<'_, D>,
2649            offset: usize,
2650            _depth: fidl::encoding::Depth,
2651        ) -> fidl::Result<()> {
2652            encoder.debug_check_bounds::<BufferMemoryConstraints>(offset);
2653            // Delegate to tuple encoding.
2654            fidl::encoding::Encode::<BufferMemoryConstraints, D>::encode(
2655                (
2656                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_size_bytes),
2657                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_size_bytes),
2658                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.physically_contiguous_required),
2659                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.secure_required),
2660                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.ram_domain_supported),
2661                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.cpu_domain_supported),
2662                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.inaccessible_domain_supported),
2663                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.heap_permitted_count),
2664                    <fidl::encoding::Array<HeapType, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.heap_permitted),
2665                ),
2666                encoder, offset, _depth
2667            )
2668        }
2669    }
2670    unsafe impl<
2671            D: fidl::encoding::ResourceDialect,
2672            T0: fidl::encoding::Encode<u32, D>,
2673            T1: fidl::encoding::Encode<u32, D>,
2674            T2: fidl::encoding::Encode<bool, D>,
2675            T3: fidl::encoding::Encode<bool, D>,
2676            T4: fidl::encoding::Encode<bool, D>,
2677            T5: fidl::encoding::Encode<bool, D>,
2678            T6: fidl::encoding::Encode<bool, D>,
2679            T7: fidl::encoding::Encode<u32, D>,
2680            T8: fidl::encoding::Encode<fidl::encoding::Array<HeapType, 32>, D>,
2681        > fidl::encoding::Encode<BufferMemoryConstraints, D>
2682        for (T0, T1, T2, T3, T4, T5, T6, T7, T8)
2683    {
2684        #[inline]
2685        unsafe fn encode(
2686            self,
2687            encoder: &mut fidl::encoding::Encoder<'_, D>,
2688            offset: usize,
2689            depth: fidl::encoding::Depth,
2690        ) -> fidl::Result<()> {
2691            encoder.debug_check_bounds::<BufferMemoryConstraints>(offset);
2692            // Zero out padding regions. There's no need to apply masks
2693            // because the unmasked parts will be overwritten by fields.
2694            unsafe {
2695                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2696                (ptr as *mut u64).write_unaligned(0);
2697            }
2698            unsafe {
2699                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2700                (ptr as *mut u64).write_unaligned(0);
2701            }
2702            // Write the fields.
2703            self.0.encode(encoder, offset + 0, depth)?;
2704            self.1.encode(encoder, offset + 4, depth)?;
2705            self.2.encode(encoder, offset + 8, depth)?;
2706            self.3.encode(encoder, offset + 9, depth)?;
2707            self.4.encode(encoder, offset + 10, depth)?;
2708            self.5.encode(encoder, offset + 11, depth)?;
2709            self.6.encode(encoder, offset + 12, depth)?;
2710            self.7.encode(encoder, offset + 16, depth)?;
2711            self.8.encode(encoder, offset + 24, depth)?;
2712            Ok(())
2713        }
2714    }
2715
2716    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2717        for BufferMemoryConstraints
2718    {
2719        #[inline(always)]
2720        fn new_empty() -> Self {
2721            Self {
2722                min_size_bytes: fidl::new_empty!(u32, D),
2723                max_size_bytes: fidl::new_empty!(u32, D),
2724                physically_contiguous_required: fidl::new_empty!(bool, D),
2725                secure_required: fidl::new_empty!(bool, D),
2726                ram_domain_supported: fidl::new_empty!(bool, D),
2727                cpu_domain_supported: fidl::new_empty!(bool, D),
2728                inaccessible_domain_supported: fidl::new_empty!(bool, D),
2729                heap_permitted_count: fidl::new_empty!(u32, D),
2730                heap_permitted: fidl::new_empty!(fidl::encoding::Array<HeapType, 32>, D),
2731            }
2732        }
2733
2734        #[inline]
2735        unsafe fn decode(
2736            &mut self,
2737            decoder: &mut fidl::encoding::Decoder<'_, D>,
2738            offset: usize,
2739            _depth: fidl::encoding::Depth,
2740        ) -> fidl::Result<()> {
2741            decoder.debug_check_bounds::<Self>(offset);
2742            // Verify that padding bytes are zero.
2743            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2744            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2745            let mask = 0xffffff0000000000u64;
2746            let maskedval = padval & mask;
2747            if maskedval != 0 {
2748                return Err(fidl::Error::NonZeroPadding {
2749                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2750                });
2751            }
2752            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2753            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2754            let mask = 0xffffffff00000000u64;
2755            let maskedval = padval & mask;
2756            if maskedval != 0 {
2757                return Err(fidl::Error::NonZeroPadding {
2758                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2759                });
2760            }
2761            fidl::decode!(u32, D, &mut self.min_size_bytes, decoder, offset + 0, _depth)?;
2762            fidl::decode!(u32, D, &mut self.max_size_bytes, decoder, offset + 4, _depth)?;
2763            fidl::decode!(
2764                bool,
2765                D,
2766                &mut self.physically_contiguous_required,
2767                decoder,
2768                offset + 8,
2769                _depth
2770            )?;
2771            fidl::decode!(bool, D, &mut self.secure_required, decoder, offset + 9, _depth)?;
2772            fidl::decode!(bool, D, &mut self.ram_domain_supported, decoder, offset + 10, _depth)?;
2773            fidl::decode!(bool, D, &mut self.cpu_domain_supported, decoder, offset + 11, _depth)?;
2774            fidl::decode!(
2775                bool,
2776                D,
2777                &mut self.inaccessible_domain_supported,
2778                decoder,
2779                offset + 12,
2780                _depth
2781            )?;
2782            fidl::decode!(u32, D, &mut self.heap_permitted_count, decoder, offset + 16, _depth)?;
2783            fidl::decode!(fidl::encoding::Array<HeapType, 32>, D, &mut self.heap_permitted, decoder, offset + 24, _depth)?;
2784            Ok(())
2785        }
2786    }
2787
2788    impl fidl::encoding::ValueTypeMarker for BufferMemorySettings {
2789        type Borrowed<'a> = &'a Self;
2790        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2791            value
2792        }
2793    }
2794
2795    unsafe impl fidl::encoding::TypeMarker for BufferMemorySettings {
2796        type Owned = Self;
2797
2798        #[inline(always)]
2799        fn inline_align(_context: fidl::encoding::Context) -> usize {
2800            8
2801        }
2802
2803        #[inline(always)]
2804        fn inline_size(_context: fidl::encoding::Context) -> usize {
2805            24
2806        }
2807    }
2808
2809    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BufferMemorySettings, D>
2810        for &BufferMemorySettings
2811    {
2812        #[inline]
2813        unsafe fn encode(
2814            self,
2815            encoder: &mut fidl::encoding::Encoder<'_, D>,
2816            offset: usize,
2817            _depth: fidl::encoding::Depth,
2818        ) -> fidl::Result<()> {
2819            encoder.debug_check_bounds::<BufferMemorySettings>(offset);
2820            // Delegate to tuple encoding.
2821            fidl::encoding::Encode::<BufferMemorySettings, D>::encode(
2822                (
2823                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.size_bytes),
2824                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
2825                        &self.is_physically_contiguous,
2826                    ),
2827                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_secure),
2828                    <CoherencyDomain as fidl::encoding::ValueTypeMarker>::borrow(
2829                        &self.coherency_domain,
2830                    ),
2831                    <HeapType as fidl::encoding::ValueTypeMarker>::borrow(&self.heap),
2832                ),
2833                encoder,
2834                offset,
2835                _depth,
2836            )
2837        }
2838    }
2839    unsafe impl<
2840            D: fidl::encoding::ResourceDialect,
2841            T0: fidl::encoding::Encode<u32, D>,
2842            T1: fidl::encoding::Encode<bool, D>,
2843            T2: fidl::encoding::Encode<bool, D>,
2844            T3: fidl::encoding::Encode<CoherencyDomain, D>,
2845            T4: fidl::encoding::Encode<HeapType, D>,
2846        > fidl::encoding::Encode<BufferMemorySettings, D> for (T0, T1, T2, T3, T4)
2847    {
2848        #[inline]
2849        unsafe fn encode(
2850            self,
2851            encoder: &mut fidl::encoding::Encoder<'_, D>,
2852            offset: usize,
2853            depth: fidl::encoding::Depth,
2854        ) -> fidl::Result<()> {
2855            encoder.debug_check_bounds::<BufferMemorySettings>(offset);
2856            // Zero out padding regions. There's no need to apply masks
2857            // because the unmasked parts will be overwritten by fields.
2858            unsafe {
2859                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2860                (ptr as *mut u64).write_unaligned(0);
2861            }
2862            unsafe {
2863                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2864                (ptr as *mut u64).write_unaligned(0);
2865            }
2866            // Write the fields.
2867            self.0.encode(encoder, offset + 0, depth)?;
2868            self.1.encode(encoder, offset + 4, depth)?;
2869            self.2.encode(encoder, offset + 5, depth)?;
2870            self.3.encode(encoder, offset + 8, depth)?;
2871            self.4.encode(encoder, offset + 16, depth)?;
2872            Ok(())
2873        }
2874    }
2875
2876    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferMemorySettings {
2877        #[inline(always)]
2878        fn new_empty() -> Self {
2879            Self {
2880                size_bytes: fidl::new_empty!(u32, D),
2881                is_physically_contiguous: fidl::new_empty!(bool, D),
2882                is_secure: fidl::new_empty!(bool, D),
2883                coherency_domain: fidl::new_empty!(CoherencyDomain, D),
2884                heap: fidl::new_empty!(HeapType, D),
2885            }
2886        }
2887
2888        #[inline]
2889        unsafe fn decode(
2890            &mut self,
2891            decoder: &mut fidl::encoding::Decoder<'_, D>,
2892            offset: usize,
2893            _depth: fidl::encoding::Depth,
2894        ) -> fidl::Result<()> {
2895            decoder.debug_check_bounds::<Self>(offset);
2896            // Verify that padding bytes are zero.
2897            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2898            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2899            let mask = 0xffff000000000000u64;
2900            let maskedval = padval & mask;
2901            if maskedval != 0 {
2902                return Err(fidl::Error::NonZeroPadding {
2903                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2904                });
2905            }
2906            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2907            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2908            let mask = 0xffffffff00000000u64;
2909            let maskedval = padval & mask;
2910            if maskedval != 0 {
2911                return Err(fidl::Error::NonZeroPadding {
2912                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2913                });
2914            }
2915            fidl::decode!(u32, D, &mut self.size_bytes, decoder, offset + 0, _depth)?;
2916            fidl::decode!(
2917                bool,
2918                D,
2919                &mut self.is_physically_contiguous,
2920                decoder,
2921                offset + 4,
2922                _depth
2923            )?;
2924            fidl::decode!(bool, D, &mut self.is_secure, decoder, offset + 5, _depth)?;
2925            fidl::decode!(
2926                CoherencyDomain,
2927                D,
2928                &mut self.coherency_domain,
2929                decoder,
2930                offset + 8,
2931                _depth
2932            )?;
2933            fidl::decode!(HeapType, D, &mut self.heap, decoder, offset + 16, _depth)?;
2934            Ok(())
2935        }
2936    }
2937
2938    impl fidl::encoding::ValueTypeMarker for BufferUsage {
2939        type Borrowed<'a> = &'a Self;
2940        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2941            value
2942        }
2943    }
2944
2945    unsafe impl fidl::encoding::TypeMarker for BufferUsage {
2946        type Owned = Self;
2947
2948        #[inline(always)]
2949        fn inline_align(_context: fidl::encoding::Context) -> usize {
2950            4
2951        }
2952
2953        #[inline(always)]
2954        fn inline_size(_context: fidl::encoding::Context) -> usize {
2955            20
2956        }
2957        #[inline(always)]
2958        fn encode_is_copy() -> bool {
2959            true
2960        }
2961
2962        #[inline(always)]
2963        fn decode_is_copy() -> bool {
2964            true
2965        }
2966    }
2967
2968    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BufferUsage, D>
2969        for &BufferUsage
2970    {
2971        #[inline]
2972        unsafe fn encode(
2973            self,
2974            encoder: &mut fidl::encoding::Encoder<'_, D>,
2975            offset: usize,
2976            _depth: fidl::encoding::Depth,
2977        ) -> fidl::Result<()> {
2978            encoder.debug_check_bounds::<BufferUsage>(offset);
2979            unsafe {
2980                // Copy the object into the buffer.
2981                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2982                (buf_ptr as *mut BufferUsage).write_unaligned((self as *const BufferUsage).read());
2983                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2984                // done second because the memcpy will write garbage to these bytes.
2985            }
2986            Ok(())
2987        }
2988    }
2989    unsafe impl<
2990            D: fidl::encoding::ResourceDialect,
2991            T0: fidl::encoding::Encode<u32, D>,
2992            T1: fidl::encoding::Encode<u32, D>,
2993            T2: fidl::encoding::Encode<u32, D>,
2994            T3: fidl::encoding::Encode<u32, D>,
2995            T4: fidl::encoding::Encode<u32, D>,
2996        > fidl::encoding::Encode<BufferUsage, D> for (T0, T1, T2, T3, T4)
2997    {
2998        #[inline]
2999        unsafe fn encode(
3000            self,
3001            encoder: &mut fidl::encoding::Encoder<'_, D>,
3002            offset: usize,
3003            depth: fidl::encoding::Depth,
3004        ) -> fidl::Result<()> {
3005            encoder.debug_check_bounds::<BufferUsage>(offset);
3006            // Zero out padding regions. There's no need to apply masks
3007            // because the unmasked parts will be overwritten by fields.
3008            // Write the fields.
3009            self.0.encode(encoder, offset + 0, depth)?;
3010            self.1.encode(encoder, offset + 4, depth)?;
3011            self.2.encode(encoder, offset + 8, depth)?;
3012            self.3.encode(encoder, offset + 12, depth)?;
3013            self.4.encode(encoder, offset + 16, depth)?;
3014            Ok(())
3015        }
3016    }
3017
3018    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferUsage {
3019        #[inline(always)]
3020        fn new_empty() -> Self {
3021            Self {
3022                none: fidl::new_empty!(u32, D),
3023                cpu: fidl::new_empty!(u32, D),
3024                vulkan: fidl::new_empty!(u32, D),
3025                display: fidl::new_empty!(u32, D),
3026                video: fidl::new_empty!(u32, D),
3027            }
3028        }
3029
3030        #[inline]
3031        unsafe fn decode(
3032            &mut self,
3033            decoder: &mut fidl::encoding::Decoder<'_, D>,
3034            offset: usize,
3035            _depth: fidl::encoding::Depth,
3036        ) -> fidl::Result<()> {
3037            decoder.debug_check_bounds::<Self>(offset);
3038            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3039            // Verify that padding bytes are zero.
3040            // Copy from the buffer into the object.
3041            unsafe {
3042                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
3043            }
3044            Ok(())
3045        }
3046    }
3047
3048    impl fidl::encoding::ValueTypeMarker for ColorSpace {
3049        type Borrowed<'a> = &'a Self;
3050        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3051            value
3052        }
3053    }
3054
3055    unsafe impl fidl::encoding::TypeMarker for ColorSpace {
3056        type Owned = Self;
3057
3058        #[inline(always)]
3059        fn inline_align(_context: fidl::encoding::Context) -> usize {
3060            4
3061        }
3062
3063        #[inline(always)]
3064        fn inline_size(_context: fidl::encoding::Context) -> usize {
3065            4
3066        }
3067    }
3068
3069    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ColorSpace, D>
3070        for &ColorSpace
3071    {
3072        #[inline]
3073        unsafe fn encode(
3074            self,
3075            encoder: &mut fidl::encoding::Encoder<'_, D>,
3076            offset: usize,
3077            _depth: fidl::encoding::Depth,
3078        ) -> fidl::Result<()> {
3079            encoder.debug_check_bounds::<ColorSpace>(offset);
3080            // Delegate to tuple encoding.
3081            fidl::encoding::Encode::<ColorSpace, D>::encode(
3082                (<ColorSpaceType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),),
3083                encoder,
3084                offset,
3085                _depth,
3086            )
3087        }
3088    }
3089    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ColorSpaceType, D>>
3090        fidl::encoding::Encode<ColorSpace, D> for (T0,)
3091    {
3092        #[inline]
3093        unsafe fn encode(
3094            self,
3095            encoder: &mut fidl::encoding::Encoder<'_, D>,
3096            offset: usize,
3097            depth: fidl::encoding::Depth,
3098        ) -> fidl::Result<()> {
3099            encoder.debug_check_bounds::<ColorSpace>(offset);
3100            // Zero out padding regions. There's no need to apply masks
3101            // because the unmasked parts will be overwritten by fields.
3102            // Write the fields.
3103            self.0.encode(encoder, offset + 0, depth)?;
3104            Ok(())
3105        }
3106    }
3107
3108    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorSpace {
3109        #[inline(always)]
3110        fn new_empty() -> Self {
3111            Self { type_: fidl::new_empty!(ColorSpaceType, D) }
3112        }
3113
3114        #[inline]
3115        unsafe fn decode(
3116            &mut self,
3117            decoder: &mut fidl::encoding::Decoder<'_, D>,
3118            offset: usize,
3119            _depth: fidl::encoding::Depth,
3120        ) -> fidl::Result<()> {
3121            decoder.debug_check_bounds::<Self>(offset);
3122            // Verify that padding bytes are zero.
3123            fidl::decode!(ColorSpaceType, D, &mut self.type_, decoder, offset + 0, _depth)?;
3124            Ok(())
3125        }
3126    }
3127
3128    impl fidl::encoding::ValueTypeMarker for FormatModifier {
3129        type Borrowed<'a> = &'a Self;
3130        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3131            value
3132        }
3133    }
3134
3135    unsafe impl fidl::encoding::TypeMarker for FormatModifier {
3136        type Owned = Self;
3137
3138        #[inline(always)]
3139        fn inline_align(_context: fidl::encoding::Context) -> usize {
3140            8
3141        }
3142
3143        #[inline(always)]
3144        fn inline_size(_context: fidl::encoding::Context) -> usize {
3145            8
3146        }
3147        #[inline(always)]
3148        fn encode_is_copy() -> bool {
3149            true
3150        }
3151
3152        #[inline(always)]
3153        fn decode_is_copy() -> bool {
3154            true
3155        }
3156    }
3157
3158    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FormatModifier, D>
3159        for &FormatModifier
3160    {
3161        #[inline]
3162        unsafe fn encode(
3163            self,
3164            encoder: &mut fidl::encoding::Encoder<'_, D>,
3165            offset: usize,
3166            _depth: fidl::encoding::Depth,
3167        ) -> fidl::Result<()> {
3168            encoder.debug_check_bounds::<FormatModifier>(offset);
3169            unsafe {
3170                // Copy the object into the buffer.
3171                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3172                (buf_ptr as *mut FormatModifier)
3173                    .write_unaligned((self as *const FormatModifier).read());
3174                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3175                // done second because the memcpy will write garbage to these bytes.
3176            }
3177            Ok(())
3178        }
3179    }
3180    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
3181        fidl::encoding::Encode<FormatModifier, D> for (T0,)
3182    {
3183        #[inline]
3184        unsafe fn encode(
3185            self,
3186            encoder: &mut fidl::encoding::Encoder<'_, D>,
3187            offset: usize,
3188            depth: fidl::encoding::Depth,
3189        ) -> fidl::Result<()> {
3190            encoder.debug_check_bounds::<FormatModifier>(offset);
3191            // Zero out padding regions. There's no need to apply masks
3192            // because the unmasked parts will be overwritten by fields.
3193            // Write the fields.
3194            self.0.encode(encoder, offset + 0, depth)?;
3195            Ok(())
3196        }
3197    }
3198
3199    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FormatModifier {
3200        #[inline(always)]
3201        fn new_empty() -> Self {
3202            Self { value: fidl::new_empty!(u64, D) }
3203        }
3204
3205        #[inline]
3206        unsafe fn decode(
3207            &mut self,
3208            decoder: &mut fidl::encoding::Decoder<'_, D>,
3209            offset: usize,
3210            _depth: fidl::encoding::Depth,
3211        ) -> fidl::Result<()> {
3212            decoder.debug_check_bounds::<Self>(offset);
3213            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3214            // Verify that padding bytes are zero.
3215            // Copy from the buffer into the object.
3216            unsafe {
3217                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3218            }
3219            Ok(())
3220        }
3221    }
3222
3223    impl fidl::encoding::ValueTypeMarker for ImageFormat {
3224        type Borrowed<'a> = &'a Self;
3225        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3226            value
3227        }
3228    }
3229
3230    unsafe impl fidl::encoding::TypeMarker for ImageFormat {
3231        type Owned = Self;
3232
3233        #[inline(always)]
3234        fn inline_align(_context: fidl::encoding::Context) -> usize {
3235            8
3236        }
3237
3238        #[inline(always)]
3239        fn inline_size(_context: fidl::encoding::Context) -> usize {
3240            72
3241        }
3242    }
3243
3244    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageFormat, D>
3245        for &ImageFormat
3246    {
3247        #[inline]
3248        unsafe fn encode(
3249            self,
3250            encoder: &mut fidl::encoding::Encoder<'_, D>,
3251            offset: usize,
3252            _depth: fidl::encoding::Depth,
3253        ) -> fidl::Result<()> {
3254            encoder.debug_check_bounds::<ImageFormat>(offset);
3255            // Delegate to tuple encoding.
3256            fidl::encoding::Encode::<ImageFormat, D>::encode(
3257                (
3258                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
3259                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
3260                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.layers),
3261                    <PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
3262                    <ColorSpace as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
3263                    <fidl::encoding::Array<ImagePlane, 4> as fidl::encoding::ValueTypeMarker>::borrow(&self.planes),
3264                ),
3265                encoder, offset, _depth
3266            )
3267        }
3268    }
3269    unsafe impl<
3270            D: fidl::encoding::ResourceDialect,
3271            T0: fidl::encoding::Encode<u32, D>,
3272            T1: fidl::encoding::Encode<u32, D>,
3273            T2: fidl::encoding::Encode<u32, D>,
3274            T3: fidl::encoding::Encode<PixelFormat, D>,
3275            T4: fidl::encoding::Encode<ColorSpace, D>,
3276            T5: fidl::encoding::Encode<fidl::encoding::Array<ImagePlane, 4>, D>,
3277        > fidl::encoding::Encode<ImageFormat, D> for (T0, T1, T2, T3, T4, T5)
3278    {
3279        #[inline]
3280        unsafe fn encode(
3281            self,
3282            encoder: &mut fidl::encoding::Encoder<'_, D>,
3283            offset: usize,
3284            depth: fidl::encoding::Depth,
3285        ) -> fidl::Result<()> {
3286            encoder.debug_check_bounds::<ImageFormat>(offset);
3287            // Zero out padding regions. There's no need to apply masks
3288            // because the unmasked parts will be overwritten by fields.
3289            unsafe {
3290                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3291                (ptr as *mut u64).write_unaligned(0);
3292            }
3293            unsafe {
3294                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
3295                (ptr as *mut u64).write_unaligned(0);
3296            }
3297            // Write the fields.
3298            self.0.encode(encoder, offset + 0, depth)?;
3299            self.1.encode(encoder, offset + 4, depth)?;
3300            self.2.encode(encoder, offset + 8, depth)?;
3301            self.3.encode(encoder, offset + 16, depth)?;
3302            self.4.encode(encoder, offset + 32, depth)?;
3303            self.5.encode(encoder, offset + 36, depth)?;
3304            Ok(())
3305        }
3306    }
3307
3308    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageFormat {
3309        #[inline(always)]
3310        fn new_empty() -> Self {
3311            Self {
3312                width: fidl::new_empty!(u32, D),
3313                height: fidl::new_empty!(u32, D),
3314                layers: fidl::new_empty!(u32, D),
3315                pixel_format: fidl::new_empty!(PixelFormat, D),
3316                color_space: fidl::new_empty!(ColorSpace, D),
3317                planes: fidl::new_empty!(fidl::encoding::Array<ImagePlane, 4>, D),
3318            }
3319        }
3320
3321        #[inline]
3322        unsafe fn decode(
3323            &mut self,
3324            decoder: &mut fidl::encoding::Decoder<'_, D>,
3325            offset: usize,
3326            _depth: fidl::encoding::Depth,
3327        ) -> fidl::Result<()> {
3328            decoder.debug_check_bounds::<Self>(offset);
3329            // Verify that padding bytes are zero.
3330            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3331            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3332            let mask = 0xffffffff00000000u64;
3333            let maskedval = padval & mask;
3334            if maskedval != 0 {
3335                return Err(fidl::Error::NonZeroPadding {
3336                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3337                });
3338            }
3339            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
3340            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3341            let mask = 0xffffffff00000000u64;
3342            let maskedval = padval & mask;
3343            if maskedval != 0 {
3344                return Err(fidl::Error::NonZeroPadding {
3345                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
3346                });
3347            }
3348            fidl::decode!(u32, D, &mut self.width, decoder, offset + 0, _depth)?;
3349            fidl::decode!(u32, D, &mut self.height, decoder, offset + 4, _depth)?;
3350            fidl::decode!(u32, D, &mut self.layers, decoder, offset + 8, _depth)?;
3351            fidl::decode!(PixelFormat, D, &mut self.pixel_format, decoder, offset + 16, _depth)?;
3352            fidl::decode!(ColorSpace, D, &mut self.color_space, decoder, offset + 32, _depth)?;
3353            fidl::decode!(fidl::encoding::Array<ImagePlane, 4>, D, &mut self.planes, decoder, offset + 36, _depth)?;
3354            Ok(())
3355        }
3356    }
3357
3358    impl fidl::encoding::ValueTypeMarker for ImageFormatConstraints {
3359        type Borrowed<'a> = &'a Self;
3360        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3361            value
3362        }
3363    }
3364
3365    unsafe impl fidl::encoding::TypeMarker for ImageFormatConstraints {
3366        type Owned = Self;
3367
3368        #[inline(always)]
3369        fn inline_align(_context: fidl::encoding::Context) -> usize {
3370            8
3371        }
3372
3373        #[inline(always)]
3374        fn inline_size(_context: fidl::encoding::Context) -> usize {
3375            232
3376        }
3377    }
3378
3379    unsafe impl<D: fidl::encoding::ResourceDialect>
3380        fidl::encoding::Encode<ImageFormatConstraints, D> for &ImageFormatConstraints
3381    {
3382        #[inline]
3383        unsafe fn encode(
3384            self,
3385            encoder: &mut fidl::encoding::Encoder<'_, D>,
3386            offset: usize,
3387            _depth: fidl::encoding::Depth,
3388        ) -> fidl::Result<()> {
3389            encoder.debug_check_bounds::<ImageFormatConstraints>(offset);
3390            // Delegate to tuple encoding.
3391            fidl::encoding::Encode::<ImageFormatConstraints, D>::encode(
3392                (
3393                    <PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
3394                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.color_spaces_count),
3395                    <fidl::encoding::Array<ColorSpace, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
3396                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_coded_width),
3397                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_coded_width),
3398                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_coded_height),
3399                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_coded_height),
3400                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_bytes_per_row),
3401                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_bytes_per_row),
3402                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_coded_width_times_coded_height),
3403                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.layers),
3404                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_width_divisor),
3405                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_height_divisor),
3406                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bytes_per_row_divisor),
3407                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.start_offset_divisor),
3408                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_width_divisor),
3409                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_height_divisor),
3410                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.required_min_coded_width),
3411                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.required_max_coded_width),
3412                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.required_min_coded_height),
3413                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.required_max_coded_height),
3414                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.required_min_bytes_per_row),
3415                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.required_max_bytes_per_row),
3416                ),
3417                encoder, offset, _depth
3418            )
3419        }
3420    }
3421    unsafe impl<
3422            D: fidl::encoding::ResourceDialect,
3423            T0: fidl::encoding::Encode<PixelFormat, D>,
3424            T1: fidl::encoding::Encode<u32, D>,
3425            T2: fidl::encoding::Encode<fidl::encoding::Array<ColorSpace, 32>, D>,
3426            T3: fidl::encoding::Encode<u32, D>,
3427            T4: fidl::encoding::Encode<u32, D>,
3428            T5: fidl::encoding::Encode<u32, D>,
3429            T6: fidl::encoding::Encode<u32, D>,
3430            T7: fidl::encoding::Encode<u32, D>,
3431            T8: fidl::encoding::Encode<u32, D>,
3432            T9: fidl::encoding::Encode<u32, D>,
3433            T10: fidl::encoding::Encode<u32, D>,
3434            T11: fidl::encoding::Encode<u32, D>,
3435            T12: fidl::encoding::Encode<u32, D>,
3436            T13: fidl::encoding::Encode<u32, D>,
3437            T14: fidl::encoding::Encode<u32, D>,
3438            T15: fidl::encoding::Encode<u32, D>,
3439            T16: fidl::encoding::Encode<u32, D>,
3440            T17: fidl::encoding::Encode<u32, D>,
3441            T18: fidl::encoding::Encode<u32, D>,
3442            T19: fidl::encoding::Encode<u32, D>,
3443            T20: fidl::encoding::Encode<u32, D>,
3444            T21: fidl::encoding::Encode<u32, D>,
3445            T22: fidl::encoding::Encode<u32, D>,
3446        > fidl::encoding::Encode<ImageFormatConstraints, D>
3447        for (
3448            T0,
3449            T1,
3450            T2,
3451            T3,
3452            T4,
3453            T5,
3454            T6,
3455            T7,
3456            T8,
3457            T9,
3458            T10,
3459            T11,
3460            T12,
3461            T13,
3462            T14,
3463            T15,
3464            T16,
3465            T17,
3466            T18,
3467            T19,
3468            T20,
3469            T21,
3470            T22,
3471        )
3472    {
3473        #[inline]
3474        unsafe fn encode(
3475            self,
3476            encoder: &mut fidl::encoding::Encoder<'_, D>,
3477            offset: usize,
3478            depth: fidl::encoding::Depth,
3479        ) -> fidl::Result<()> {
3480            encoder.debug_check_bounds::<ImageFormatConstraints>(offset);
3481            // Zero out padding regions. There's no need to apply masks
3482            // because the unmasked parts will be overwritten by fields.
3483            unsafe {
3484                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(224);
3485                (ptr as *mut u64).write_unaligned(0);
3486            }
3487            // Write the fields.
3488            self.0.encode(encoder, offset + 0, depth)?;
3489            self.1.encode(encoder, offset + 16, depth)?;
3490            self.2.encode(encoder, offset + 20, depth)?;
3491            self.3.encode(encoder, offset + 148, depth)?;
3492            self.4.encode(encoder, offset + 152, depth)?;
3493            self.5.encode(encoder, offset + 156, depth)?;
3494            self.6.encode(encoder, offset + 160, depth)?;
3495            self.7.encode(encoder, offset + 164, depth)?;
3496            self.8.encode(encoder, offset + 168, depth)?;
3497            self.9.encode(encoder, offset + 172, depth)?;
3498            self.10.encode(encoder, offset + 176, depth)?;
3499            self.11.encode(encoder, offset + 180, depth)?;
3500            self.12.encode(encoder, offset + 184, depth)?;
3501            self.13.encode(encoder, offset + 188, depth)?;
3502            self.14.encode(encoder, offset + 192, depth)?;
3503            self.15.encode(encoder, offset + 196, depth)?;
3504            self.16.encode(encoder, offset + 200, depth)?;
3505            self.17.encode(encoder, offset + 204, depth)?;
3506            self.18.encode(encoder, offset + 208, depth)?;
3507            self.19.encode(encoder, offset + 212, depth)?;
3508            self.20.encode(encoder, offset + 216, depth)?;
3509            self.21.encode(encoder, offset + 220, depth)?;
3510            self.22.encode(encoder, offset + 224, depth)?;
3511            Ok(())
3512        }
3513    }
3514
3515    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3516        for ImageFormatConstraints
3517    {
3518        #[inline(always)]
3519        fn new_empty() -> Self {
3520            Self {
3521                pixel_format: fidl::new_empty!(PixelFormat, D),
3522                color_spaces_count: fidl::new_empty!(u32, D),
3523                color_space: fidl::new_empty!(fidl::encoding::Array<ColorSpace, 32>, D),
3524                min_coded_width: fidl::new_empty!(u32, D),
3525                max_coded_width: fidl::new_empty!(u32, D),
3526                min_coded_height: fidl::new_empty!(u32, D),
3527                max_coded_height: fidl::new_empty!(u32, D),
3528                min_bytes_per_row: fidl::new_empty!(u32, D),
3529                max_bytes_per_row: fidl::new_empty!(u32, D),
3530                max_coded_width_times_coded_height: fidl::new_empty!(u32, D),
3531                layers: fidl::new_empty!(u32, D),
3532                coded_width_divisor: fidl::new_empty!(u32, D),
3533                coded_height_divisor: fidl::new_empty!(u32, D),
3534                bytes_per_row_divisor: fidl::new_empty!(u32, D),
3535                start_offset_divisor: fidl::new_empty!(u32, D),
3536                display_width_divisor: fidl::new_empty!(u32, D),
3537                display_height_divisor: fidl::new_empty!(u32, D),
3538                required_min_coded_width: fidl::new_empty!(u32, D),
3539                required_max_coded_width: fidl::new_empty!(u32, D),
3540                required_min_coded_height: fidl::new_empty!(u32, D),
3541                required_max_coded_height: fidl::new_empty!(u32, D),
3542                required_min_bytes_per_row: fidl::new_empty!(u32, D),
3543                required_max_bytes_per_row: fidl::new_empty!(u32, D),
3544            }
3545        }
3546
3547        #[inline]
3548        unsafe fn decode(
3549            &mut self,
3550            decoder: &mut fidl::encoding::Decoder<'_, D>,
3551            offset: usize,
3552            _depth: fidl::encoding::Depth,
3553        ) -> fidl::Result<()> {
3554            decoder.debug_check_bounds::<Self>(offset);
3555            // Verify that padding bytes are zero.
3556            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(224) };
3557            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3558            let mask = 0xffffffff00000000u64;
3559            let maskedval = padval & mask;
3560            if maskedval != 0 {
3561                return Err(fidl::Error::NonZeroPadding {
3562                    padding_start: offset + 224 + ((mask as u64).trailing_zeros() / 8) as usize,
3563                });
3564            }
3565            fidl::decode!(PixelFormat, D, &mut self.pixel_format, decoder, offset + 0, _depth)?;
3566            fidl::decode!(u32, D, &mut self.color_spaces_count, decoder, offset + 16, _depth)?;
3567            fidl::decode!(fidl::encoding::Array<ColorSpace, 32>, D, &mut self.color_space, decoder, offset + 20, _depth)?;
3568            fidl::decode!(u32, D, &mut self.min_coded_width, decoder, offset + 148, _depth)?;
3569            fidl::decode!(u32, D, &mut self.max_coded_width, decoder, offset + 152, _depth)?;
3570            fidl::decode!(u32, D, &mut self.min_coded_height, decoder, offset + 156, _depth)?;
3571            fidl::decode!(u32, D, &mut self.max_coded_height, decoder, offset + 160, _depth)?;
3572            fidl::decode!(u32, D, &mut self.min_bytes_per_row, decoder, offset + 164, _depth)?;
3573            fidl::decode!(u32, D, &mut self.max_bytes_per_row, decoder, offset + 168, _depth)?;
3574            fidl::decode!(
3575                u32,
3576                D,
3577                &mut self.max_coded_width_times_coded_height,
3578                decoder,
3579                offset + 172,
3580                _depth
3581            )?;
3582            fidl::decode!(u32, D, &mut self.layers, decoder, offset + 176, _depth)?;
3583            fidl::decode!(u32, D, &mut self.coded_width_divisor, decoder, offset + 180, _depth)?;
3584            fidl::decode!(u32, D, &mut self.coded_height_divisor, decoder, offset + 184, _depth)?;
3585            fidl::decode!(u32, D, &mut self.bytes_per_row_divisor, decoder, offset + 188, _depth)?;
3586            fidl::decode!(u32, D, &mut self.start_offset_divisor, decoder, offset + 192, _depth)?;
3587            fidl::decode!(u32, D, &mut self.display_width_divisor, decoder, offset + 196, _depth)?;
3588            fidl::decode!(u32, D, &mut self.display_height_divisor, decoder, offset + 200, _depth)?;
3589            fidl::decode!(
3590                u32,
3591                D,
3592                &mut self.required_min_coded_width,
3593                decoder,
3594                offset + 204,
3595                _depth
3596            )?;
3597            fidl::decode!(
3598                u32,
3599                D,
3600                &mut self.required_max_coded_width,
3601                decoder,
3602                offset + 208,
3603                _depth
3604            )?;
3605            fidl::decode!(
3606                u32,
3607                D,
3608                &mut self.required_min_coded_height,
3609                decoder,
3610                offset + 212,
3611                _depth
3612            )?;
3613            fidl::decode!(
3614                u32,
3615                D,
3616                &mut self.required_max_coded_height,
3617                decoder,
3618                offset + 216,
3619                _depth
3620            )?;
3621            fidl::decode!(
3622                u32,
3623                D,
3624                &mut self.required_min_bytes_per_row,
3625                decoder,
3626                offset + 220,
3627                _depth
3628            )?;
3629            fidl::decode!(
3630                u32,
3631                D,
3632                &mut self.required_max_bytes_per_row,
3633                decoder,
3634                offset + 224,
3635                _depth
3636            )?;
3637            Ok(())
3638        }
3639    }
3640
3641    impl fidl::encoding::ValueTypeMarker for ImageFormat2 {
3642        type Borrowed<'a> = &'a Self;
3643        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3644            value
3645        }
3646    }
3647
3648    unsafe impl fidl::encoding::TypeMarker for ImageFormat2 {
3649        type Owned = Self;
3650
3651        #[inline(always)]
3652        fn inline_align(_context: fidl::encoding::Context) -> usize {
3653            8
3654        }
3655
3656        #[inline(always)]
3657        fn inline_size(_context: fidl::encoding::Context) -> usize {
3658            56
3659        }
3660    }
3661
3662    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageFormat2, D>
3663        for &ImageFormat2
3664    {
3665        #[inline]
3666        unsafe fn encode(
3667            self,
3668            encoder: &mut fidl::encoding::Encoder<'_, D>,
3669            offset: usize,
3670            _depth: fidl::encoding::Depth,
3671        ) -> fidl::Result<()> {
3672            encoder.debug_check_bounds::<ImageFormat2>(offset);
3673            // Delegate to tuple encoding.
3674            fidl::encoding::Encode::<ImageFormat2, D>::encode(
3675                (
3676                    <PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
3677                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_width),
3678                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.coded_height),
3679                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bytes_per_row),
3680                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_width),
3681                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.display_height),
3682                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.layers),
3683                    <ColorSpace as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
3684                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_pixel_aspect_ratio),
3685                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(
3686                        &self.pixel_aspect_ratio_width,
3687                    ),
3688                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(
3689                        &self.pixel_aspect_ratio_height,
3690                    ),
3691                ),
3692                encoder,
3693                offset,
3694                _depth,
3695            )
3696        }
3697    }
3698    unsafe impl<
3699            D: fidl::encoding::ResourceDialect,
3700            T0: fidl::encoding::Encode<PixelFormat, D>,
3701            T1: fidl::encoding::Encode<u32, D>,
3702            T2: fidl::encoding::Encode<u32, D>,
3703            T3: fidl::encoding::Encode<u32, D>,
3704            T4: fidl::encoding::Encode<u32, D>,
3705            T5: fidl::encoding::Encode<u32, D>,
3706            T6: fidl::encoding::Encode<u32, D>,
3707            T7: fidl::encoding::Encode<ColorSpace, D>,
3708            T8: fidl::encoding::Encode<bool, D>,
3709            T9: fidl::encoding::Encode<u32, D>,
3710            T10: fidl::encoding::Encode<u32, D>,
3711        > fidl::encoding::Encode<ImageFormat2, D>
3712        for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
3713    {
3714        #[inline]
3715        unsafe fn encode(
3716            self,
3717            encoder: &mut fidl::encoding::Encoder<'_, D>,
3718            offset: usize,
3719            depth: fidl::encoding::Depth,
3720        ) -> fidl::Result<()> {
3721            encoder.debug_check_bounds::<ImageFormat2>(offset);
3722            // Zero out padding regions. There's no need to apply masks
3723            // because the unmasked parts will be overwritten by fields.
3724            unsafe {
3725                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
3726                (ptr as *mut u64).write_unaligned(0);
3727            }
3728            // Write the fields.
3729            self.0.encode(encoder, offset + 0, depth)?;
3730            self.1.encode(encoder, offset + 16, depth)?;
3731            self.2.encode(encoder, offset + 20, depth)?;
3732            self.3.encode(encoder, offset + 24, depth)?;
3733            self.4.encode(encoder, offset + 28, depth)?;
3734            self.5.encode(encoder, offset + 32, depth)?;
3735            self.6.encode(encoder, offset + 36, depth)?;
3736            self.7.encode(encoder, offset + 40, depth)?;
3737            self.8.encode(encoder, offset + 44, depth)?;
3738            self.9.encode(encoder, offset + 48, depth)?;
3739            self.10.encode(encoder, offset + 52, depth)?;
3740            Ok(())
3741        }
3742    }
3743
3744    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageFormat2 {
3745        #[inline(always)]
3746        fn new_empty() -> Self {
3747            Self {
3748                pixel_format: fidl::new_empty!(PixelFormat, D),
3749                coded_width: fidl::new_empty!(u32, D),
3750                coded_height: fidl::new_empty!(u32, D),
3751                bytes_per_row: fidl::new_empty!(u32, D),
3752                display_width: fidl::new_empty!(u32, D),
3753                display_height: fidl::new_empty!(u32, D),
3754                layers: fidl::new_empty!(u32, D),
3755                color_space: fidl::new_empty!(ColorSpace, D),
3756                has_pixel_aspect_ratio: fidl::new_empty!(bool, D),
3757                pixel_aspect_ratio_width: fidl::new_empty!(u32, D),
3758                pixel_aspect_ratio_height: fidl::new_empty!(u32, D),
3759            }
3760        }
3761
3762        #[inline]
3763        unsafe fn decode(
3764            &mut self,
3765            decoder: &mut fidl::encoding::Decoder<'_, D>,
3766            offset: usize,
3767            _depth: fidl::encoding::Depth,
3768        ) -> fidl::Result<()> {
3769            decoder.debug_check_bounds::<Self>(offset);
3770            // Verify that padding bytes are zero.
3771            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
3772            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3773            let mask = 0xffffff0000000000u64;
3774            let maskedval = padval & mask;
3775            if maskedval != 0 {
3776                return Err(fidl::Error::NonZeroPadding {
3777                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
3778                });
3779            }
3780            fidl::decode!(PixelFormat, D, &mut self.pixel_format, decoder, offset + 0, _depth)?;
3781            fidl::decode!(u32, D, &mut self.coded_width, decoder, offset + 16, _depth)?;
3782            fidl::decode!(u32, D, &mut self.coded_height, decoder, offset + 20, _depth)?;
3783            fidl::decode!(u32, D, &mut self.bytes_per_row, decoder, offset + 24, _depth)?;
3784            fidl::decode!(u32, D, &mut self.display_width, decoder, offset + 28, _depth)?;
3785            fidl::decode!(u32, D, &mut self.display_height, decoder, offset + 32, _depth)?;
3786            fidl::decode!(u32, D, &mut self.layers, decoder, offset + 36, _depth)?;
3787            fidl::decode!(ColorSpace, D, &mut self.color_space, decoder, offset + 40, _depth)?;
3788            fidl::decode!(bool, D, &mut self.has_pixel_aspect_ratio, decoder, offset + 44, _depth)?;
3789            fidl::decode!(
3790                u32,
3791                D,
3792                &mut self.pixel_aspect_ratio_width,
3793                decoder,
3794                offset + 48,
3795                _depth
3796            )?;
3797            fidl::decode!(
3798                u32,
3799                D,
3800                &mut self.pixel_aspect_ratio_height,
3801                decoder,
3802                offset + 52,
3803                _depth
3804            )?;
3805            Ok(())
3806        }
3807    }
3808
3809    impl fidl::encoding::ValueTypeMarker for ImagePlane {
3810        type Borrowed<'a> = &'a Self;
3811        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3812            value
3813        }
3814    }
3815
3816    unsafe impl fidl::encoding::TypeMarker for ImagePlane {
3817        type Owned = Self;
3818
3819        #[inline(always)]
3820        fn inline_align(_context: fidl::encoding::Context) -> usize {
3821            4
3822        }
3823
3824        #[inline(always)]
3825        fn inline_size(_context: fidl::encoding::Context) -> usize {
3826            8
3827        }
3828        #[inline(always)]
3829        fn encode_is_copy() -> bool {
3830            true
3831        }
3832
3833        #[inline(always)]
3834        fn decode_is_copy() -> bool {
3835            true
3836        }
3837    }
3838
3839    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImagePlane, D>
3840        for &ImagePlane
3841    {
3842        #[inline]
3843        unsafe fn encode(
3844            self,
3845            encoder: &mut fidl::encoding::Encoder<'_, D>,
3846            offset: usize,
3847            _depth: fidl::encoding::Depth,
3848        ) -> fidl::Result<()> {
3849            encoder.debug_check_bounds::<ImagePlane>(offset);
3850            unsafe {
3851                // Copy the object into the buffer.
3852                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3853                (buf_ptr as *mut ImagePlane).write_unaligned((self as *const ImagePlane).read());
3854                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3855                // done second because the memcpy will write garbage to these bytes.
3856            }
3857            Ok(())
3858        }
3859    }
3860    unsafe impl<
3861            D: fidl::encoding::ResourceDialect,
3862            T0: fidl::encoding::Encode<u32, D>,
3863            T1: fidl::encoding::Encode<u32, D>,
3864        > fidl::encoding::Encode<ImagePlane, D> for (T0, T1)
3865    {
3866        #[inline]
3867        unsafe fn encode(
3868            self,
3869            encoder: &mut fidl::encoding::Encoder<'_, D>,
3870            offset: usize,
3871            depth: fidl::encoding::Depth,
3872        ) -> fidl::Result<()> {
3873            encoder.debug_check_bounds::<ImagePlane>(offset);
3874            // Zero out padding regions. There's no need to apply masks
3875            // because the unmasked parts will be overwritten by fields.
3876            // Write the fields.
3877            self.0.encode(encoder, offset + 0, depth)?;
3878            self.1.encode(encoder, offset + 4, depth)?;
3879            Ok(())
3880        }
3881    }
3882
3883    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImagePlane {
3884        #[inline(always)]
3885        fn new_empty() -> Self {
3886            Self { byte_offset: fidl::new_empty!(u32, D), bytes_per_row: fidl::new_empty!(u32, D) }
3887        }
3888
3889        #[inline]
3890        unsafe fn decode(
3891            &mut self,
3892            decoder: &mut fidl::encoding::Decoder<'_, D>,
3893            offset: usize,
3894            _depth: fidl::encoding::Depth,
3895        ) -> fidl::Result<()> {
3896            decoder.debug_check_bounds::<Self>(offset);
3897            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3898            // Verify that padding bytes are zero.
3899            // Copy from the buffer into the object.
3900            unsafe {
3901                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3902            }
3903            Ok(())
3904        }
3905    }
3906
3907    impl fidl::encoding::ValueTypeMarker for ImageSpec {
3908        type Borrowed<'a> = &'a Self;
3909        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3910            value
3911        }
3912    }
3913
3914    unsafe impl fidl::encoding::TypeMarker for ImageSpec {
3915        type Owned = Self;
3916
3917        #[inline(always)]
3918        fn inline_align(_context: fidl::encoding::Context) -> usize {
3919            8
3920        }
3921
3922        #[inline(always)]
3923        fn inline_size(_context: fidl::encoding::Context) -> usize {
3924            40
3925        }
3926    }
3927
3928    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageSpec, D>
3929        for &ImageSpec
3930    {
3931        #[inline]
3932        unsafe fn encode(
3933            self,
3934            encoder: &mut fidl::encoding::Encoder<'_, D>,
3935            offset: usize,
3936            _depth: fidl::encoding::Depth,
3937        ) -> fidl::Result<()> {
3938            encoder.debug_check_bounds::<ImageSpec>(offset);
3939            // Delegate to tuple encoding.
3940            fidl::encoding::Encode::<ImageSpec, D>::encode(
3941                (
3942                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_width),
3943                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_height),
3944                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.layers),
3945                    <PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
3946                    <ColorSpace as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
3947                ),
3948                encoder,
3949                offset,
3950                _depth,
3951            )
3952        }
3953    }
3954    unsafe impl<
3955            D: fidl::encoding::ResourceDialect,
3956            T0: fidl::encoding::Encode<u32, D>,
3957            T1: fidl::encoding::Encode<u32, D>,
3958            T2: fidl::encoding::Encode<u32, D>,
3959            T3: fidl::encoding::Encode<PixelFormat, D>,
3960            T4: fidl::encoding::Encode<ColorSpace, D>,
3961        > fidl::encoding::Encode<ImageSpec, D> for (T0, T1, T2, T3, T4)
3962    {
3963        #[inline]
3964        unsafe fn encode(
3965            self,
3966            encoder: &mut fidl::encoding::Encoder<'_, D>,
3967            offset: usize,
3968            depth: fidl::encoding::Depth,
3969        ) -> fidl::Result<()> {
3970            encoder.debug_check_bounds::<ImageSpec>(offset);
3971            // Zero out padding regions. There's no need to apply masks
3972            // because the unmasked parts will be overwritten by fields.
3973            unsafe {
3974                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3975                (ptr as *mut u64).write_unaligned(0);
3976            }
3977            unsafe {
3978                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
3979                (ptr as *mut u64).write_unaligned(0);
3980            }
3981            // Write the fields.
3982            self.0.encode(encoder, offset + 0, depth)?;
3983            self.1.encode(encoder, offset + 4, depth)?;
3984            self.2.encode(encoder, offset + 8, depth)?;
3985            self.3.encode(encoder, offset + 16, depth)?;
3986            self.4.encode(encoder, offset + 32, depth)?;
3987            Ok(())
3988        }
3989    }
3990
3991    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageSpec {
3992        #[inline(always)]
3993        fn new_empty() -> Self {
3994            Self {
3995                min_width: fidl::new_empty!(u32, D),
3996                min_height: fidl::new_empty!(u32, D),
3997                layers: fidl::new_empty!(u32, D),
3998                pixel_format: fidl::new_empty!(PixelFormat, D),
3999                color_space: fidl::new_empty!(ColorSpace, D),
4000            }
4001        }
4002
4003        #[inline]
4004        unsafe fn decode(
4005            &mut self,
4006            decoder: &mut fidl::encoding::Decoder<'_, D>,
4007            offset: usize,
4008            _depth: fidl::encoding::Depth,
4009        ) -> fidl::Result<()> {
4010            decoder.debug_check_bounds::<Self>(offset);
4011            // Verify that padding bytes are zero.
4012            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4013            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4014            let mask = 0xffffffff00000000u64;
4015            let maskedval = padval & mask;
4016            if maskedval != 0 {
4017                return Err(fidl::Error::NonZeroPadding {
4018                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4019                });
4020            }
4021            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
4022            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4023            let mask = 0xffffffff00000000u64;
4024            let maskedval = padval & mask;
4025            if maskedval != 0 {
4026                return Err(fidl::Error::NonZeroPadding {
4027                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
4028                });
4029            }
4030            fidl::decode!(u32, D, &mut self.min_width, decoder, offset + 0, _depth)?;
4031            fidl::decode!(u32, D, &mut self.min_height, decoder, offset + 4, _depth)?;
4032            fidl::decode!(u32, D, &mut self.layers, decoder, offset + 8, _depth)?;
4033            fidl::decode!(PixelFormat, D, &mut self.pixel_format, decoder, offset + 16, _depth)?;
4034            fidl::decode!(ColorSpace, D, &mut self.color_space, decoder, offset + 32, _depth)?;
4035            Ok(())
4036        }
4037    }
4038
4039    impl fidl::encoding::ValueTypeMarker for NodeSetDebugClientInfoRequest {
4040        type Borrowed<'a> = &'a Self;
4041        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4042            value
4043        }
4044    }
4045
4046    unsafe impl fidl::encoding::TypeMarker for NodeSetDebugClientInfoRequest {
4047        type Owned = Self;
4048
4049        #[inline(always)]
4050        fn inline_align(_context: fidl::encoding::Context) -> usize {
4051            8
4052        }
4053
4054        #[inline(always)]
4055        fn inline_size(_context: fidl::encoding::Context) -> usize {
4056            24
4057        }
4058    }
4059
4060    unsafe impl<D: fidl::encoding::ResourceDialect>
4061        fidl::encoding::Encode<NodeSetDebugClientInfoRequest, D>
4062        for &NodeSetDebugClientInfoRequest
4063    {
4064        #[inline]
4065        unsafe fn encode(
4066            self,
4067            encoder: &mut fidl::encoding::Encoder<'_, D>,
4068            offset: usize,
4069            _depth: fidl::encoding::Depth,
4070        ) -> fidl::Result<()> {
4071            encoder.debug_check_bounds::<NodeSetDebugClientInfoRequest>(offset);
4072            // Delegate to tuple encoding.
4073            fidl::encoding::Encode::<NodeSetDebugClientInfoRequest, D>::encode(
4074                (
4075                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
4076                        &self.name,
4077                    ),
4078                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
4079                ),
4080                encoder,
4081                offset,
4082                _depth,
4083            )
4084        }
4085    }
4086    unsafe impl<
4087            D: fidl::encoding::ResourceDialect,
4088            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
4089            T1: fidl::encoding::Encode<u64, D>,
4090        > fidl::encoding::Encode<NodeSetDebugClientInfoRequest, D> for (T0, T1)
4091    {
4092        #[inline]
4093        unsafe fn encode(
4094            self,
4095            encoder: &mut fidl::encoding::Encoder<'_, D>,
4096            offset: usize,
4097            depth: fidl::encoding::Depth,
4098        ) -> fidl::Result<()> {
4099            encoder.debug_check_bounds::<NodeSetDebugClientInfoRequest>(offset);
4100            // Zero out padding regions. There's no need to apply masks
4101            // because the unmasked parts will be overwritten by fields.
4102            // Write the fields.
4103            self.0.encode(encoder, offset + 0, depth)?;
4104            self.1.encode(encoder, offset + 16, depth)?;
4105            Ok(())
4106        }
4107    }
4108
4109    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4110        for NodeSetDebugClientInfoRequest
4111    {
4112        #[inline(always)]
4113        fn new_empty() -> Self {
4114            Self {
4115                name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
4116                id: fidl::new_empty!(u64, D),
4117            }
4118        }
4119
4120        #[inline]
4121        unsafe fn decode(
4122            &mut self,
4123            decoder: &mut fidl::encoding::Decoder<'_, D>,
4124            offset: usize,
4125            _depth: fidl::encoding::Depth,
4126        ) -> fidl::Result<()> {
4127            decoder.debug_check_bounds::<Self>(offset);
4128            // Verify that padding bytes are zero.
4129            fidl::decode!(
4130                fidl::encoding::BoundedString<64>,
4131                D,
4132                &mut self.name,
4133                decoder,
4134                offset + 0,
4135                _depth
4136            )?;
4137            fidl::decode!(u64, D, &mut self.id, decoder, offset + 16, _depth)?;
4138            Ok(())
4139        }
4140    }
4141
4142    impl fidl::encoding::ValueTypeMarker for NodeSetDebugTimeoutLogDeadlineRequest {
4143        type Borrowed<'a> = &'a Self;
4144        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4145            value
4146        }
4147    }
4148
4149    unsafe impl fidl::encoding::TypeMarker for NodeSetDebugTimeoutLogDeadlineRequest {
4150        type Owned = Self;
4151
4152        #[inline(always)]
4153        fn inline_align(_context: fidl::encoding::Context) -> usize {
4154            8
4155        }
4156
4157        #[inline(always)]
4158        fn inline_size(_context: fidl::encoding::Context) -> usize {
4159            8
4160        }
4161        #[inline(always)]
4162        fn encode_is_copy() -> bool {
4163            true
4164        }
4165
4166        #[inline(always)]
4167        fn decode_is_copy() -> bool {
4168            true
4169        }
4170    }
4171
4172    unsafe impl<D: fidl::encoding::ResourceDialect>
4173        fidl::encoding::Encode<NodeSetDebugTimeoutLogDeadlineRequest, D>
4174        for &NodeSetDebugTimeoutLogDeadlineRequest
4175    {
4176        #[inline]
4177        unsafe fn encode(
4178            self,
4179            encoder: &mut fidl::encoding::Encoder<'_, D>,
4180            offset: usize,
4181            _depth: fidl::encoding::Depth,
4182        ) -> fidl::Result<()> {
4183            encoder.debug_check_bounds::<NodeSetDebugTimeoutLogDeadlineRequest>(offset);
4184            unsafe {
4185                // Copy the object into the buffer.
4186                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4187                (buf_ptr as *mut NodeSetDebugTimeoutLogDeadlineRequest)
4188                    .write_unaligned((self as *const NodeSetDebugTimeoutLogDeadlineRequest).read());
4189                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4190                // done second because the memcpy will write garbage to these bytes.
4191            }
4192            Ok(())
4193        }
4194    }
4195    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
4196        fidl::encoding::Encode<NodeSetDebugTimeoutLogDeadlineRequest, D> for (T0,)
4197    {
4198        #[inline]
4199        unsafe fn encode(
4200            self,
4201            encoder: &mut fidl::encoding::Encoder<'_, D>,
4202            offset: usize,
4203            depth: fidl::encoding::Depth,
4204        ) -> fidl::Result<()> {
4205            encoder.debug_check_bounds::<NodeSetDebugTimeoutLogDeadlineRequest>(offset);
4206            // Zero out padding regions. There's no need to apply masks
4207            // because the unmasked parts will be overwritten by fields.
4208            // Write the fields.
4209            self.0.encode(encoder, offset + 0, depth)?;
4210            Ok(())
4211        }
4212    }
4213
4214    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4215        for NodeSetDebugTimeoutLogDeadlineRequest
4216    {
4217        #[inline(always)]
4218        fn new_empty() -> Self {
4219            Self { deadline: fidl::new_empty!(i64, D) }
4220        }
4221
4222        #[inline]
4223        unsafe fn decode(
4224            &mut self,
4225            decoder: &mut fidl::encoding::Decoder<'_, D>,
4226            offset: usize,
4227            _depth: fidl::encoding::Depth,
4228        ) -> fidl::Result<()> {
4229            decoder.debug_check_bounds::<Self>(offset);
4230            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4231            // Verify that padding bytes are zero.
4232            // Copy from the buffer into the object.
4233            unsafe {
4234                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4235            }
4236            Ok(())
4237        }
4238    }
4239
4240    impl fidl::encoding::ValueTypeMarker for NodeSetNameRequest {
4241        type Borrowed<'a> = &'a Self;
4242        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4243            value
4244        }
4245    }
4246
4247    unsafe impl fidl::encoding::TypeMarker for NodeSetNameRequest {
4248        type Owned = Self;
4249
4250        #[inline(always)]
4251        fn inline_align(_context: fidl::encoding::Context) -> usize {
4252            8
4253        }
4254
4255        #[inline(always)]
4256        fn inline_size(_context: fidl::encoding::Context) -> usize {
4257            24
4258        }
4259    }
4260
4261    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodeSetNameRequest, D>
4262        for &NodeSetNameRequest
4263    {
4264        #[inline]
4265        unsafe fn encode(
4266            self,
4267            encoder: &mut fidl::encoding::Encoder<'_, D>,
4268            offset: usize,
4269            _depth: fidl::encoding::Depth,
4270        ) -> fidl::Result<()> {
4271            encoder.debug_check_bounds::<NodeSetNameRequest>(offset);
4272            // Delegate to tuple encoding.
4273            fidl::encoding::Encode::<NodeSetNameRequest, D>::encode(
4274                (
4275                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
4276                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
4277                        &self.name,
4278                    ),
4279                ),
4280                encoder,
4281                offset,
4282                _depth,
4283            )
4284        }
4285    }
4286    unsafe impl<
4287            D: fidl::encoding::ResourceDialect,
4288            T0: fidl::encoding::Encode<u32, D>,
4289            T1: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
4290        > fidl::encoding::Encode<NodeSetNameRequest, D> for (T0, T1)
4291    {
4292        #[inline]
4293        unsafe fn encode(
4294            self,
4295            encoder: &mut fidl::encoding::Encoder<'_, D>,
4296            offset: usize,
4297            depth: fidl::encoding::Depth,
4298        ) -> fidl::Result<()> {
4299            encoder.debug_check_bounds::<NodeSetNameRequest>(offset);
4300            // Zero out padding regions. There's no need to apply masks
4301            // because the unmasked parts will be overwritten by fields.
4302            unsafe {
4303                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4304                (ptr as *mut u64).write_unaligned(0);
4305            }
4306            // Write the fields.
4307            self.0.encode(encoder, offset + 0, depth)?;
4308            self.1.encode(encoder, offset + 8, depth)?;
4309            Ok(())
4310        }
4311    }
4312
4313    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodeSetNameRequest {
4314        #[inline(always)]
4315        fn new_empty() -> Self {
4316            Self {
4317                priority: fidl::new_empty!(u32, D),
4318                name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D),
4319            }
4320        }
4321
4322        #[inline]
4323        unsafe fn decode(
4324            &mut self,
4325            decoder: &mut fidl::encoding::Decoder<'_, D>,
4326            offset: usize,
4327            _depth: fidl::encoding::Depth,
4328        ) -> fidl::Result<()> {
4329            decoder.debug_check_bounds::<Self>(offset);
4330            // Verify that padding bytes are zero.
4331            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4332            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4333            let mask = 0xffffffff00000000u64;
4334            let maskedval = padval & mask;
4335            if maskedval != 0 {
4336                return Err(fidl::Error::NonZeroPadding {
4337                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4338                });
4339            }
4340            fidl::decode!(u32, D, &mut self.priority, decoder, offset + 0, _depth)?;
4341            fidl::decode!(
4342                fidl::encoding::BoundedString<64>,
4343                D,
4344                &mut self.name,
4345                decoder,
4346                offset + 8,
4347                _depth
4348            )?;
4349            Ok(())
4350        }
4351    }
4352
4353    impl fidl::encoding::ValueTypeMarker for NodeIsAlternateForResponse {
4354        type Borrowed<'a> = &'a Self;
4355        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4356            value
4357        }
4358    }
4359
4360    unsafe impl fidl::encoding::TypeMarker for NodeIsAlternateForResponse {
4361        type Owned = Self;
4362
4363        #[inline(always)]
4364        fn inline_align(_context: fidl::encoding::Context) -> usize {
4365            1
4366        }
4367
4368        #[inline(always)]
4369        fn inline_size(_context: fidl::encoding::Context) -> usize {
4370            1
4371        }
4372    }
4373
4374    unsafe impl<D: fidl::encoding::ResourceDialect>
4375        fidl::encoding::Encode<NodeIsAlternateForResponse, D> for &NodeIsAlternateForResponse
4376    {
4377        #[inline]
4378        unsafe fn encode(
4379            self,
4380            encoder: &mut fidl::encoding::Encoder<'_, D>,
4381            offset: usize,
4382            _depth: fidl::encoding::Depth,
4383        ) -> fidl::Result<()> {
4384            encoder.debug_check_bounds::<NodeIsAlternateForResponse>(offset);
4385            // Delegate to tuple encoding.
4386            fidl::encoding::Encode::<NodeIsAlternateForResponse, D>::encode(
4387                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_alternate),),
4388                encoder,
4389                offset,
4390                _depth,
4391            )
4392        }
4393    }
4394    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4395        fidl::encoding::Encode<NodeIsAlternateForResponse, D> for (T0,)
4396    {
4397        #[inline]
4398        unsafe fn encode(
4399            self,
4400            encoder: &mut fidl::encoding::Encoder<'_, D>,
4401            offset: usize,
4402            depth: fidl::encoding::Depth,
4403        ) -> fidl::Result<()> {
4404            encoder.debug_check_bounds::<NodeIsAlternateForResponse>(offset);
4405            // Zero out padding regions. There's no need to apply masks
4406            // because the unmasked parts will be overwritten by fields.
4407            // Write the fields.
4408            self.0.encode(encoder, offset + 0, depth)?;
4409            Ok(())
4410        }
4411    }
4412
4413    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4414        for NodeIsAlternateForResponse
4415    {
4416        #[inline(always)]
4417        fn new_empty() -> Self {
4418            Self { is_alternate: fidl::new_empty!(bool, D) }
4419        }
4420
4421        #[inline]
4422        unsafe fn decode(
4423            &mut self,
4424            decoder: &mut fidl::encoding::Decoder<'_, D>,
4425            offset: usize,
4426            _depth: fidl::encoding::Depth,
4427        ) -> fidl::Result<()> {
4428            decoder.debug_check_bounds::<Self>(offset);
4429            // Verify that padding bytes are zero.
4430            fidl::decode!(bool, D, &mut self.is_alternate, decoder, offset + 0, _depth)?;
4431            Ok(())
4432        }
4433    }
4434
4435    impl fidl::encoding::ValueTypeMarker for PixelFormat {
4436        type Borrowed<'a> = &'a Self;
4437        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4438            value
4439        }
4440    }
4441
4442    unsafe impl fidl::encoding::TypeMarker for PixelFormat {
4443        type Owned = Self;
4444
4445        #[inline(always)]
4446        fn inline_align(_context: fidl::encoding::Context) -> usize {
4447            8
4448        }
4449
4450        #[inline(always)]
4451        fn inline_size(_context: fidl::encoding::Context) -> usize {
4452            16
4453        }
4454    }
4455
4456    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PixelFormat, D>
4457        for &PixelFormat
4458    {
4459        #[inline]
4460        unsafe fn encode(
4461            self,
4462            encoder: &mut fidl::encoding::Encoder<'_, D>,
4463            offset: usize,
4464            _depth: fidl::encoding::Depth,
4465        ) -> fidl::Result<()> {
4466            encoder.debug_check_bounds::<PixelFormat>(offset);
4467            // Delegate to tuple encoding.
4468            fidl::encoding::Encode::<PixelFormat, D>::encode(
4469                (
4470                    <PixelFormatType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4471                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_format_modifier),
4472                    <FormatModifier as fidl::encoding::ValueTypeMarker>::borrow(
4473                        &self.format_modifier,
4474                    ),
4475                ),
4476                encoder,
4477                offset,
4478                _depth,
4479            )
4480        }
4481    }
4482    unsafe impl<
4483            D: fidl::encoding::ResourceDialect,
4484            T0: fidl::encoding::Encode<PixelFormatType, D>,
4485            T1: fidl::encoding::Encode<bool, D>,
4486            T2: fidl::encoding::Encode<FormatModifier, D>,
4487        > fidl::encoding::Encode<PixelFormat, D> for (T0, T1, T2)
4488    {
4489        #[inline]
4490        unsafe fn encode(
4491            self,
4492            encoder: &mut fidl::encoding::Encoder<'_, D>,
4493            offset: usize,
4494            depth: fidl::encoding::Depth,
4495        ) -> fidl::Result<()> {
4496            encoder.debug_check_bounds::<PixelFormat>(offset);
4497            // Zero out padding regions. There's no need to apply masks
4498            // because the unmasked parts will be overwritten by fields.
4499            unsafe {
4500                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4501                (ptr as *mut u64).write_unaligned(0);
4502            }
4503            // Write the fields.
4504            self.0.encode(encoder, offset + 0, depth)?;
4505            self.1.encode(encoder, offset + 4, depth)?;
4506            self.2.encode(encoder, offset + 8, depth)?;
4507            Ok(())
4508        }
4509    }
4510
4511    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PixelFormat {
4512        #[inline(always)]
4513        fn new_empty() -> Self {
4514            Self {
4515                type_: fidl::new_empty!(PixelFormatType, D),
4516                has_format_modifier: fidl::new_empty!(bool, D),
4517                format_modifier: fidl::new_empty!(FormatModifier, D),
4518            }
4519        }
4520
4521        #[inline]
4522        unsafe fn decode(
4523            &mut self,
4524            decoder: &mut fidl::encoding::Decoder<'_, D>,
4525            offset: usize,
4526            _depth: fidl::encoding::Depth,
4527        ) -> fidl::Result<()> {
4528            decoder.debug_check_bounds::<Self>(offset);
4529            // Verify that padding bytes are zero.
4530            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4531            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4532            let mask = 0xffffff0000000000u64;
4533            let maskedval = padval & mask;
4534            if maskedval != 0 {
4535                return Err(fidl::Error::NonZeroPadding {
4536                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4537                });
4538            }
4539            fidl::decode!(PixelFormatType, D, &mut self.type_, decoder, offset + 0, _depth)?;
4540            fidl::decode!(bool, D, &mut self.has_format_modifier, decoder, offset + 4, _depth)?;
4541            fidl::decode!(
4542                FormatModifier,
4543                D,
4544                &mut self.format_modifier,
4545                decoder,
4546                offset + 8,
4547                _depth
4548            )?;
4549            Ok(())
4550        }
4551    }
4552
4553    impl fidl::encoding::ValueTypeMarker for SecureMemAddSecureHeapPhysicalRangeRequest {
4554        type Borrowed<'a> = &'a Self;
4555        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4556            value
4557        }
4558    }
4559
4560    unsafe impl fidl::encoding::TypeMarker for SecureMemAddSecureHeapPhysicalRangeRequest {
4561        type Owned = Self;
4562
4563        #[inline(always)]
4564        fn inline_align(_context: fidl::encoding::Context) -> usize {
4565            8
4566        }
4567
4568        #[inline(always)]
4569        fn inline_size(_context: fidl::encoding::Context) -> usize {
4570            16
4571        }
4572    }
4573
4574    unsafe impl<D: fidl::encoding::ResourceDialect>
4575        fidl::encoding::Encode<SecureMemAddSecureHeapPhysicalRangeRequest, D>
4576        for &SecureMemAddSecureHeapPhysicalRangeRequest
4577    {
4578        #[inline]
4579        unsafe fn encode(
4580            self,
4581            encoder: &mut fidl::encoding::Encoder<'_, D>,
4582            offset: usize,
4583            _depth: fidl::encoding::Depth,
4584        ) -> fidl::Result<()> {
4585            encoder.debug_check_bounds::<SecureMemAddSecureHeapPhysicalRangeRequest>(offset);
4586            // Delegate to tuple encoding.
4587            fidl::encoding::Encode::<SecureMemAddSecureHeapPhysicalRangeRequest, D>::encode(
4588                (<SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow(&self.heap_range),),
4589                encoder,
4590                offset,
4591                _depth,
4592            )
4593        }
4594    }
4595    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SecureHeapAndRange, D>>
4596        fidl::encoding::Encode<SecureMemAddSecureHeapPhysicalRangeRequest, D> for (T0,)
4597    {
4598        #[inline]
4599        unsafe fn encode(
4600            self,
4601            encoder: &mut fidl::encoding::Encoder<'_, D>,
4602            offset: usize,
4603            depth: fidl::encoding::Depth,
4604        ) -> fidl::Result<()> {
4605            encoder.debug_check_bounds::<SecureMemAddSecureHeapPhysicalRangeRequest>(offset);
4606            // Zero out padding regions. There's no need to apply masks
4607            // because the unmasked parts will be overwritten by fields.
4608            // Write the fields.
4609            self.0.encode(encoder, offset + 0, depth)?;
4610            Ok(())
4611        }
4612    }
4613
4614    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4615        for SecureMemAddSecureHeapPhysicalRangeRequest
4616    {
4617        #[inline(always)]
4618        fn new_empty() -> Self {
4619            Self { heap_range: fidl::new_empty!(SecureHeapAndRange, D) }
4620        }
4621
4622        #[inline]
4623        unsafe fn decode(
4624            &mut self,
4625            decoder: &mut fidl::encoding::Decoder<'_, D>,
4626            offset: usize,
4627            _depth: fidl::encoding::Depth,
4628        ) -> fidl::Result<()> {
4629            decoder.debug_check_bounds::<Self>(offset);
4630            // Verify that padding bytes are zero.
4631            fidl::decode!(
4632                SecureHeapAndRange,
4633                D,
4634                &mut self.heap_range,
4635                decoder,
4636                offset + 0,
4637                _depth
4638            )?;
4639            Ok(())
4640        }
4641    }
4642
4643    impl fidl::encoding::ValueTypeMarker for SecureMemDeleteSecureHeapPhysicalRangeRequest {
4644        type Borrowed<'a> = &'a Self;
4645        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4646            value
4647        }
4648    }
4649
4650    unsafe impl fidl::encoding::TypeMarker for SecureMemDeleteSecureHeapPhysicalRangeRequest {
4651        type Owned = Self;
4652
4653        #[inline(always)]
4654        fn inline_align(_context: fidl::encoding::Context) -> usize {
4655            8
4656        }
4657
4658        #[inline(always)]
4659        fn inline_size(_context: fidl::encoding::Context) -> usize {
4660            16
4661        }
4662    }
4663
4664    unsafe impl<D: fidl::encoding::ResourceDialect>
4665        fidl::encoding::Encode<SecureMemDeleteSecureHeapPhysicalRangeRequest, D>
4666        for &SecureMemDeleteSecureHeapPhysicalRangeRequest
4667    {
4668        #[inline]
4669        unsafe fn encode(
4670            self,
4671            encoder: &mut fidl::encoding::Encoder<'_, D>,
4672            offset: usize,
4673            _depth: fidl::encoding::Depth,
4674        ) -> fidl::Result<()> {
4675            encoder.debug_check_bounds::<SecureMemDeleteSecureHeapPhysicalRangeRequest>(offset);
4676            // Delegate to tuple encoding.
4677            fidl::encoding::Encode::<SecureMemDeleteSecureHeapPhysicalRangeRequest, D>::encode(
4678                (<SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow(&self.heap_range),),
4679                encoder,
4680                offset,
4681                _depth,
4682            )
4683        }
4684    }
4685    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SecureHeapAndRange, D>>
4686        fidl::encoding::Encode<SecureMemDeleteSecureHeapPhysicalRangeRequest, D> for (T0,)
4687    {
4688        #[inline]
4689        unsafe fn encode(
4690            self,
4691            encoder: &mut fidl::encoding::Encoder<'_, D>,
4692            offset: usize,
4693            depth: fidl::encoding::Depth,
4694        ) -> fidl::Result<()> {
4695            encoder.debug_check_bounds::<SecureMemDeleteSecureHeapPhysicalRangeRequest>(offset);
4696            // Zero out padding regions. There's no need to apply masks
4697            // because the unmasked parts will be overwritten by fields.
4698            // Write the fields.
4699            self.0.encode(encoder, offset + 0, depth)?;
4700            Ok(())
4701        }
4702    }
4703
4704    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4705        for SecureMemDeleteSecureHeapPhysicalRangeRequest
4706    {
4707        #[inline(always)]
4708        fn new_empty() -> Self {
4709            Self { heap_range: fidl::new_empty!(SecureHeapAndRange, D) }
4710        }
4711
4712        #[inline]
4713        unsafe fn decode(
4714            &mut self,
4715            decoder: &mut fidl::encoding::Decoder<'_, D>,
4716            offset: usize,
4717            _depth: fidl::encoding::Depth,
4718        ) -> fidl::Result<()> {
4719            decoder.debug_check_bounds::<Self>(offset);
4720            // Verify that padding bytes are zero.
4721            fidl::decode!(
4722                SecureHeapAndRange,
4723                D,
4724                &mut self.heap_range,
4725                decoder,
4726                offset + 0,
4727                _depth
4728            )?;
4729            Ok(())
4730        }
4731    }
4732
4733    impl fidl::encoding::ValueTypeMarker for SecureMemGetPhysicalSecureHeapPropertiesRequest {
4734        type Borrowed<'a> = &'a Self;
4735        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4736            value
4737        }
4738    }
4739
4740    unsafe impl fidl::encoding::TypeMarker for SecureMemGetPhysicalSecureHeapPropertiesRequest {
4741        type Owned = Self;
4742
4743        #[inline(always)]
4744        fn inline_align(_context: fidl::encoding::Context) -> usize {
4745            8
4746        }
4747
4748        #[inline(always)]
4749        fn inline_size(_context: fidl::encoding::Context) -> usize {
4750            16
4751        }
4752    }
4753
4754    unsafe impl<D: fidl::encoding::ResourceDialect>
4755        fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapPropertiesRequest, D>
4756        for &SecureMemGetPhysicalSecureHeapPropertiesRequest
4757    {
4758        #[inline]
4759        unsafe fn encode(
4760            self,
4761            encoder: &mut fidl::encoding::Encoder<'_, D>,
4762            offset: usize,
4763            _depth: fidl::encoding::Depth,
4764        ) -> fidl::Result<()> {
4765            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapPropertiesRequest>(offset);
4766            // Delegate to tuple encoding.
4767            fidl::encoding::Encode::<SecureMemGetPhysicalSecureHeapPropertiesRequest, D>::encode(
4768                (<SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow(
4769                    &self.entire_heap,
4770                ),),
4771                encoder,
4772                offset,
4773                _depth,
4774            )
4775        }
4776    }
4777    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SecureHeapAndRange, D>>
4778        fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapPropertiesRequest, D> for (T0,)
4779    {
4780        #[inline]
4781        unsafe fn encode(
4782            self,
4783            encoder: &mut fidl::encoding::Encoder<'_, D>,
4784            offset: usize,
4785            depth: fidl::encoding::Depth,
4786        ) -> fidl::Result<()> {
4787            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapPropertiesRequest>(offset);
4788            // Zero out padding regions. There's no need to apply masks
4789            // because the unmasked parts will be overwritten by fields.
4790            // Write the fields.
4791            self.0.encode(encoder, offset + 0, depth)?;
4792            Ok(())
4793        }
4794    }
4795
4796    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4797        for SecureMemGetPhysicalSecureHeapPropertiesRequest
4798    {
4799        #[inline(always)]
4800        fn new_empty() -> Self {
4801            Self { entire_heap: fidl::new_empty!(SecureHeapAndRange, D) }
4802        }
4803
4804        #[inline]
4805        unsafe fn decode(
4806            &mut self,
4807            decoder: &mut fidl::encoding::Decoder<'_, D>,
4808            offset: usize,
4809            _depth: fidl::encoding::Depth,
4810        ) -> fidl::Result<()> {
4811            decoder.debug_check_bounds::<Self>(offset);
4812            // Verify that padding bytes are zero.
4813            fidl::decode!(
4814                SecureHeapAndRange,
4815                D,
4816                &mut self.entire_heap,
4817                decoder,
4818                offset + 0,
4819                _depth
4820            )?;
4821            Ok(())
4822        }
4823    }
4824
4825    impl fidl::encoding::ValueTypeMarker for SecureMemModifySecureHeapPhysicalRangeRequest {
4826        type Borrowed<'a> = &'a Self;
4827        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4828            value
4829        }
4830    }
4831
4832    unsafe impl fidl::encoding::TypeMarker for SecureMemModifySecureHeapPhysicalRangeRequest {
4833        type Owned = Self;
4834
4835        #[inline(always)]
4836        fn inline_align(_context: fidl::encoding::Context) -> usize {
4837            8
4838        }
4839
4840        #[inline(always)]
4841        fn inline_size(_context: fidl::encoding::Context) -> usize {
4842            16
4843        }
4844    }
4845
4846    unsafe impl<D: fidl::encoding::ResourceDialect>
4847        fidl::encoding::Encode<SecureMemModifySecureHeapPhysicalRangeRequest, D>
4848        for &SecureMemModifySecureHeapPhysicalRangeRequest
4849    {
4850        #[inline]
4851        unsafe fn encode(
4852            self,
4853            encoder: &mut fidl::encoding::Encoder<'_, D>,
4854            offset: usize,
4855            _depth: fidl::encoding::Depth,
4856        ) -> fidl::Result<()> {
4857            encoder.debug_check_bounds::<SecureMemModifySecureHeapPhysicalRangeRequest>(offset);
4858            // Delegate to tuple encoding.
4859            fidl::encoding::Encode::<SecureMemModifySecureHeapPhysicalRangeRequest, D>::encode(
4860                (<SecureHeapAndRangeModification as fidl::encoding::ValueTypeMarker>::borrow(
4861                    &self.range_modification,
4862                ),),
4863                encoder,
4864                offset,
4865                _depth,
4866            )
4867        }
4868    }
4869    unsafe impl<
4870            D: fidl::encoding::ResourceDialect,
4871            T0: fidl::encoding::Encode<SecureHeapAndRangeModification, D>,
4872        > fidl::encoding::Encode<SecureMemModifySecureHeapPhysicalRangeRequest, D> for (T0,)
4873    {
4874        #[inline]
4875        unsafe fn encode(
4876            self,
4877            encoder: &mut fidl::encoding::Encoder<'_, D>,
4878            offset: usize,
4879            depth: fidl::encoding::Depth,
4880        ) -> fidl::Result<()> {
4881            encoder.debug_check_bounds::<SecureMemModifySecureHeapPhysicalRangeRequest>(offset);
4882            // Zero out padding regions. There's no need to apply masks
4883            // because the unmasked parts will be overwritten by fields.
4884            // Write the fields.
4885            self.0.encode(encoder, offset + 0, depth)?;
4886            Ok(())
4887        }
4888    }
4889
4890    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4891        for SecureMemModifySecureHeapPhysicalRangeRequest
4892    {
4893        #[inline(always)]
4894        fn new_empty() -> Self {
4895            Self { range_modification: fidl::new_empty!(SecureHeapAndRangeModification, D) }
4896        }
4897
4898        #[inline]
4899        unsafe fn decode(
4900            &mut self,
4901            decoder: &mut fidl::encoding::Decoder<'_, D>,
4902            offset: usize,
4903            _depth: fidl::encoding::Depth,
4904        ) -> fidl::Result<()> {
4905            decoder.debug_check_bounds::<Self>(offset);
4906            // Verify that padding bytes are zero.
4907            fidl::decode!(
4908                SecureHeapAndRangeModification,
4909                D,
4910                &mut self.range_modification,
4911                decoder,
4912                offset + 0,
4913                _depth
4914            )?;
4915            Ok(())
4916        }
4917    }
4918
4919    impl fidl::encoding::ValueTypeMarker for SecureMemZeroSubRangeRequest {
4920        type Borrowed<'a> = &'a Self;
4921        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4922            value
4923        }
4924    }
4925
4926    unsafe impl fidl::encoding::TypeMarker for SecureMemZeroSubRangeRequest {
4927        type Owned = Self;
4928
4929        #[inline(always)]
4930        fn inline_align(_context: fidl::encoding::Context) -> usize {
4931            8
4932        }
4933
4934        #[inline(always)]
4935        fn inline_size(_context: fidl::encoding::Context) -> usize {
4936            24
4937        }
4938    }
4939
4940    unsafe impl<D: fidl::encoding::ResourceDialect>
4941        fidl::encoding::Encode<SecureMemZeroSubRangeRequest, D> for &SecureMemZeroSubRangeRequest
4942    {
4943        #[inline]
4944        unsafe fn encode(
4945            self,
4946            encoder: &mut fidl::encoding::Encoder<'_, D>,
4947            offset: usize,
4948            _depth: fidl::encoding::Depth,
4949        ) -> fidl::Result<()> {
4950            encoder.debug_check_bounds::<SecureMemZeroSubRangeRequest>(offset);
4951            // Delegate to tuple encoding.
4952            fidl::encoding::Encode::<SecureMemZeroSubRangeRequest, D>::encode(
4953                (
4954                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
4955                        &self.is_covering_range_explicit,
4956                    ),
4957                    <SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow(
4958                        &self.heap_range,
4959                    ),
4960                ),
4961                encoder,
4962                offset,
4963                _depth,
4964            )
4965        }
4966    }
4967    unsafe impl<
4968            D: fidl::encoding::ResourceDialect,
4969            T0: fidl::encoding::Encode<bool, D>,
4970            T1: fidl::encoding::Encode<SecureHeapAndRange, D>,
4971        > fidl::encoding::Encode<SecureMemZeroSubRangeRequest, D> for (T0, T1)
4972    {
4973        #[inline]
4974        unsafe fn encode(
4975            self,
4976            encoder: &mut fidl::encoding::Encoder<'_, D>,
4977            offset: usize,
4978            depth: fidl::encoding::Depth,
4979        ) -> fidl::Result<()> {
4980            encoder.debug_check_bounds::<SecureMemZeroSubRangeRequest>(offset);
4981            // Zero out padding regions. There's no need to apply masks
4982            // because the unmasked parts will be overwritten by fields.
4983            unsafe {
4984                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4985                (ptr as *mut u64).write_unaligned(0);
4986            }
4987            // Write the fields.
4988            self.0.encode(encoder, offset + 0, depth)?;
4989            self.1.encode(encoder, offset + 8, depth)?;
4990            Ok(())
4991        }
4992    }
4993
4994    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4995        for SecureMemZeroSubRangeRequest
4996    {
4997        #[inline(always)]
4998        fn new_empty() -> Self {
4999            Self {
5000                is_covering_range_explicit: fidl::new_empty!(bool, D),
5001                heap_range: fidl::new_empty!(SecureHeapAndRange, D),
5002            }
5003        }
5004
5005        #[inline]
5006        unsafe fn decode(
5007            &mut self,
5008            decoder: &mut fidl::encoding::Decoder<'_, D>,
5009            offset: usize,
5010            _depth: fidl::encoding::Depth,
5011        ) -> fidl::Result<()> {
5012            decoder.debug_check_bounds::<Self>(offset);
5013            // Verify that padding bytes are zero.
5014            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5015            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5016            let mask = 0xffffffffffffff00u64;
5017            let maskedval = padval & mask;
5018            if maskedval != 0 {
5019                return Err(fidl::Error::NonZeroPadding {
5020                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5021                });
5022            }
5023            fidl::decode!(
5024                bool,
5025                D,
5026                &mut self.is_covering_range_explicit,
5027                decoder,
5028                offset + 0,
5029                _depth
5030            )?;
5031            fidl::decode!(
5032                SecureHeapAndRange,
5033                D,
5034                &mut self.heap_range,
5035                decoder,
5036                offset + 8,
5037                _depth
5038            )?;
5039            Ok(())
5040        }
5041    }
5042
5043    impl fidl::encoding::ValueTypeMarker for SecureMemGetPhysicalSecureHeapPropertiesResponse {
5044        type Borrowed<'a> = &'a Self;
5045        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5046            value
5047        }
5048    }
5049
5050    unsafe impl fidl::encoding::TypeMarker for SecureMemGetPhysicalSecureHeapPropertiesResponse {
5051        type Owned = Self;
5052
5053        #[inline(always)]
5054        fn inline_align(_context: fidl::encoding::Context) -> usize {
5055            8
5056        }
5057
5058        #[inline(always)]
5059        fn inline_size(_context: fidl::encoding::Context) -> usize {
5060            16
5061        }
5062    }
5063
5064    unsafe impl<D: fidl::encoding::ResourceDialect>
5065        fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapPropertiesResponse, D>
5066        for &SecureMemGetPhysicalSecureHeapPropertiesResponse
5067    {
5068        #[inline]
5069        unsafe fn encode(
5070            self,
5071            encoder: &mut fidl::encoding::Encoder<'_, D>,
5072            offset: usize,
5073            _depth: fidl::encoding::Depth,
5074        ) -> fidl::Result<()> {
5075            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapPropertiesResponse>(offset);
5076            // Delegate to tuple encoding.
5077            fidl::encoding::Encode::<SecureMemGetPhysicalSecureHeapPropertiesResponse, D>::encode(
5078                (<SecureHeapProperties as fidl::encoding::ValueTypeMarker>::borrow(
5079                    &self.properties,
5080                ),),
5081                encoder,
5082                offset,
5083                _depth,
5084            )
5085        }
5086    }
5087    unsafe impl<
5088            D: fidl::encoding::ResourceDialect,
5089            T0: fidl::encoding::Encode<SecureHeapProperties, D>,
5090        > fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapPropertiesResponse, D> for (T0,)
5091    {
5092        #[inline]
5093        unsafe fn encode(
5094            self,
5095            encoder: &mut fidl::encoding::Encoder<'_, D>,
5096            offset: usize,
5097            depth: fidl::encoding::Depth,
5098        ) -> fidl::Result<()> {
5099            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapPropertiesResponse>(offset);
5100            // Zero out padding regions. There's no need to apply masks
5101            // because the unmasked parts will be overwritten by fields.
5102            // Write the fields.
5103            self.0.encode(encoder, offset + 0, depth)?;
5104            Ok(())
5105        }
5106    }
5107
5108    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5109        for SecureMemGetPhysicalSecureHeapPropertiesResponse
5110    {
5111        #[inline(always)]
5112        fn new_empty() -> Self {
5113            Self { properties: fidl::new_empty!(SecureHeapProperties, D) }
5114        }
5115
5116        #[inline]
5117        unsafe fn decode(
5118            &mut self,
5119            decoder: &mut fidl::encoding::Decoder<'_, D>,
5120            offset: usize,
5121            _depth: fidl::encoding::Depth,
5122        ) -> fidl::Result<()> {
5123            decoder.debug_check_bounds::<Self>(offset);
5124            // Verify that padding bytes are zero.
5125            fidl::decode!(
5126                SecureHeapProperties,
5127                D,
5128                &mut self.properties,
5129                decoder,
5130                offset + 0,
5131                _depth
5132            )?;
5133            Ok(())
5134        }
5135    }
5136
5137    impl fidl::encoding::ValueTypeMarker for SecureMemGetPhysicalSecureHeapsResponse {
5138        type Borrowed<'a> = &'a Self;
5139        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5140            value
5141        }
5142    }
5143
5144    unsafe impl fidl::encoding::TypeMarker for SecureMemGetPhysicalSecureHeapsResponse {
5145        type Owned = Self;
5146
5147        #[inline(always)]
5148        fn inline_align(_context: fidl::encoding::Context) -> usize {
5149            8
5150        }
5151
5152        #[inline(always)]
5153        fn inline_size(_context: fidl::encoding::Context) -> usize {
5154            16
5155        }
5156    }
5157
5158    unsafe impl<D: fidl::encoding::ResourceDialect>
5159        fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapsResponse, D>
5160        for &SecureMemGetPhysicalSecureHeapsResponse
5161    {
5162        #[inline]
5163        unsafe fn encode(
5164            self,
5165            encoder: &mut fidl::encoding::Encoder<'_, D>,
5166            offset: usize,
5167            _depth: fidl::encoding::Depth,
5168        ) -> fidl::Result<()> {
5169            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapsResponse>(offset);
5170            // Delegate to tuple encoding.
5171            fidl::encoding::Encode::<SecureMemGetPhysicalSecureHeapsResponse, D>::encode(
5172                (<SecureHeapsAndRanges as fidl::encoding::ValueTypeMarker>::borrow(&self.heaps),),
5173                encoder,
5174                offset,
5175                _depth,
5176            )
5177        }
5178    }
5179    unsafe impl<
5180            D: fidl::encoding::ResourceDialect,
5181            T0: fidl::encoding::Encode<SecureHeapsAndRanges, D>,
5182        > fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapsResponse, D> for (T0,)
5183    {
5184        #[inline]
5185        unsafe fn encode(
5186            self,
5187            encoder: &mut fidl::encoding::Encoder<'_, D>,
5188            offset: usize,
5189            depth: fidl::encoding::Depth,
5190        ) -> fidl::Result<()> {
5191            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapsResponse>(offset);
5192            // Zero out padding regions. There's no need to apply masks
5193            // because the unmasked parts will be overwritten by fields.
5194            // Write the fields.
5195            self.0.encode(encoder, offset + 0, depth)?;
5196            Ok(())
5197        }
5198    }
5199
5200    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5201        for SecureMemGetPhysicalSecureHeapsResponse
5202    {
5203        #[inline(always)]
5204        fn new_empty() -> Self {
5205            Self { heaps: fidl::new_empty!(SecureHeapsAndRanges, D) }
5206        }
5207
5208        #[inline]
5209        unsafe fn decode(
5210            &mut self,
5211            decoder: &mut fidl::encoding::Decoder<'_, D>,
5212            offset: usize,
5213            _depth: fidl::encoding::Depth,
5214        ) -> fidl::Result<()> {
5215            decoder.debug_check_bounds::<Self>(offset);
5216            // Verify that padding bytes are zero.
5217            fidl::decode!(SecureHeapsAndRanges, D, &mut self.heaps, decoder, offset + 0, _depth)?;
5218            Ok(())
5219        }
5220    }
5221
5222    impl fidl::encoding::ValueTypeMarker for SingleBufferSettings {
5223        type Borrowed<'a> = &'a Self;
5224        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5225            value
5226        }
5227    }
5228
5229    unsafe impl fidl::encoding::TypeMarker for SingleBufferSettings {
5230        type Owned = Self;
5231
5232        #[inline(always)]
5233        fn inline_align(_context: fidl::encoding::Context) -> usize {
5234            8
5235        }
5236
5237        #[inline(always)]
5238        fn inline_size(_context: fidl::encoding::Context) -> usize {
5239            264
5240        }
5241    }
5242
5243    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SingleBufferSettings, D>
5244        for &SingleBufferSettings
5245    {
5246        #[inline]
5247        unsafe fn encode(
5248            self,
5249            encoder: &mut fidl::encoding::Encoder<'_, D>,
5250            offset: usize,
5251            _depth: fidl::encoding::Depth,
5252        ) -> fidl::Result<()> {
5253            encoder.debug_check_bounds::<SingleBufferSettings>(offset);
5254            // Delegate to tuple encoding.
5255            fidl::encoding::Encode::<SingleBufferSettings, D>::encode(
5256                (
5257                    <BufferMemorySettings as fidl::encoding::ValueTypeMarker>::borrow(
5258                        &self.buffer_settings,
5259                    ),
5260                    <bool as fidl::encoding::ValueTypeMarker>::borrow(
5261                        &self.has_image_format_constraints,
5262                    ),
5263                    <ImageFormatConstraints as fidl::encoding::ValueTypeMarker>::borrow(
5264                        &self.image_format_constraints,
5265                    ),
5266                ),
5267                encoder,
5268                offset,
5269                _depth,
5270            )
5271        }
5272    }
5273    unsafe impl<
5274            D: fidl::encoding::ResourceDialect,
5275            T0: fidl::encoding::Encode<BufferMemorySettings, D>,
5276            T1: fidl::encoding::Encode<bool, D>,
5277            T2: fidl::encoding::Encode<ImageFormatConstraints, D>,
5278        > fidl::encoding::Encode<SingleBufferSettings, D> for (T0, T1, T2)
5279    {
5280        #[inline]
5281        unsafe fn encode(
5282            self,
5283            encoder: &mut fidl::encoding::Encoder<'_, D>,
5284            offset: usize,
5285            depth: fidl::encoding::Depth,
5286        ) -> fidl::Result<()> {
5287            encoder.debug_check_bounds::<SingleBufferSettings>(offset);
5288            // Zero out padding regions. There's no need to apply masks
5289            // because the unmasked parts will be overwritten by fields.
5290            unsafe {
5291                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
5292                (ptr as *mut u64).write_unaligned(0);
5293            }
5294            // Write the fields.
5295            self.0.encode(encoder, offset + 0, depth)?;
5296            self.1.encode(encoder, offset + 24, depth)?;
5297            self.2.encode(encoder, offset + 32, depth)?;
5298            Ok(())
5299        }
5300    }
5301
5302    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SingleBufferSettings {
5303        #[inline(always)]
5304        fn new_empty() -> Self {
5305            Self {
5306                buffer_settings: fidl::new_empty!(BufferMemorySettings, D),
5307                has_image_format_constraints: fidl::new_empty!(bool, D),
5308                image_format_constraints: fidl::new_empty!(ImageFormatConstraints, D),
5309            }
5310        }
5311
5312        #[inline]
5313        unsafe fn decode(
5314            &mut self,
5315            decoder: &mut fidl::encoding::Decoder<'_, D>,
5316            offset: usize,
5317            _depth: fidl::encoding::Depth,
5318        ) -> fidl::Result<()> {
5319            decoder.debug_check_bounds::<Self>(offset);
5320            // Verify that padding bytes are zero.
5321            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
5322            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5323            let mask = 0xffffffffffffff00u64;
5324            let maskedval = padval & mask;
5325            if maskedval != 0 {
5326                return Err(fidl::Error::NonZeroPadding {
5327                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
5328                });
5329            }
5330            fidl::decode!(
5331                BufferMemorySettings,
5332                D,
5333                &mut self.buffer_settings,
5334                decoder,
5335                offset + 0,
5336                _depth
5337            )?;
5338            fidl::decode!(
5339                bool,
5340                D,
5341                &mut self.has_image_format_constraints,
5342                decoder,
5343                offset + 24,
5344                _depth
5345            )?;
5346            fidl::decode!(
5347                ImageFormatConstraints,
5348                D,
5349                &mut self.image_format_constraints,
5350                decoder,
5351                offset + 32,
5352                _depth
5353            )?;
5354            Ok(())
5355        }
5356    }
5357
5358    impl SecureHeapAndRange {
5359        #[inline(always)]
5360        fn max_ordinal_present(&self) -> u64 {
5361            if let Some(_) = self.range {
5362                return 2;
5363            }
5364            if let Some(_) = self.heap {
5365                return 1;
5366            }
5367            0
5368        }
5369    }
5370
5371    impl fidl::encoding::ValueTypeMarker for SecureHeapAndRange {
5372        type Borrowed<'a> = &'a Self;
5373        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5374            value
5375        }
5376    }
5377
5378    unsafe impl fidl::encoding::TypeMarker for SecureHeapAndRange {
5379        type Owned = Self;
5380
5381        #[inline(always)]
5382        fn inline_align(_context: fidl::encoding::Context) -> usize {
5383            8
5384        }
5385
5386        #[inline(always)]
5387        fn inline_size(_context: fidl::encoding::Context) -> usize {
5388            16
5389        }
5390    }
5391
5392    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapAndRange, D>
5393        for &SecureHeapAndRange
5394    {
5395        unsafe fn encode(
5396            self,
5397            encoder: &mut fidl::encoding::Encoder<'_, D>,
5398            offset: usize,
5399            mut depth: fidl::encoding::Depth,
5400        ) -> fidl::Result<()> {
5401            encoder.debug_check_bounds::<SecureHeapAndRange>(offset);
5402            // Vector header
5403            let max_ordinal: u64 = self.max_ordinal_present();
5404            encoder.write_num(max_ordinal, offset);
5405            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5406            // Calling encoder.out_of_line_offset(0) is not allowed.
5407            if max_ordinal == 0 {
5408                return Ok(());
5409            }
5410            depth.increment()?;
5411            let envelope_size = 8;
5412            let bytes_len = max_ordinal as usize * envelope_size;
5413            #[allow(unused_variables)]
5414            let offset = encoder.out_of_line_offset(bytes_len);
5415            let mut _prev_end_offset: usize = 0;
5416            if 1 > max_ordinal {
5417                return Ok(());
5418            }
5419
5420            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5421            // are envelope_size bytes.
5422            let cur_offset: usize = (1 - 1) * envelope_size;
5423
5424            // Zero reserved fields.
5425            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5426
5427            // Safety:
5428            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5429            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5430            //   envelope_size bytes, there is always sufficient room.
5431            fidl::encoding::encode_in_envelope_optional::<HeapType, D>(
5432                self.heap.as_ref().map(<HeapType as fidl::encoding::ValueTypeMarker>::borrow),
5433                encoder,
5434                offset + cur_offset,
5435                depth,
5436            )?;
5437
5438            _prev_end_offset = cur_offset + envelope_size;
5439            if 2 > max_ordinal {
5440                return Ok(());
5441            }
5442
5443            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5444            // are envelope_size bytes.
5445            let cur_offset: usize = (2 - 1) * envelope_size;
5446
5447            // Zero reserved fields.
5448            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5449
5450            // Safety:
5451            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5452            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5453            //   envelope_size bytes, there is always sufficient room.
5454            fidl::encoding::encode_in_envelope_optional::<SecureHeapRange, D>(
5455                self.range
5456                    .as_ref()
5457                    .map(<SecureHeapRange as fidl::encoding::ValueTypeMarker>::borrow),
5458                encoder,
5459                offset + cur_offset,
5460                depth,
5461            )?;
5462
5463            _prev_end_offset = cur_offset + envelope_size;
5464
5465            Ok(())
5466        }
5467    }
5468
5469    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapAndRange {
5470        #[inline(always)]
5471        fn new_empty() -> Self {
5472            Self::default()
5473        }
5474
5475        unsafe fn decode(
5476            &mut self,
5477            decoder: &mut fidl::encoding::Decoder<'_, D>,
5478            offset: usize,
5479            mut depth: fidl::encoding::Depth,
5480        ) -> fidl::Result<()> {
5481            decoder.debug_check_bounds::<Self>(offset);
5482            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5483                None => return Err(fidl::Error::NotNullable),
5484                Some(len) => len,
5485            };
5486            // Calling decoder.out_of_line_offset(0) is not allowed.
5487            if len == 0 {
5488                return Ok(());
5489            };
5490            depth.increment()?;
5491            let envelope_size = 8;
5492            let bytes_len = len * envelope_size;
5493            let offset = decoder.out_of_line_offset(bytes_len)?;
5494            // Decode the envelope for each type.
5495            let mut _next_ordinal_to_read = 0;
5496            let mut next_offset = offset;
5497            let end_offset = offset + bytes_len;
5498            _next_ordinal_to_read += 1;
5499            if next_offset >= end_offset {
5500                return Ok(());
5501            }
5502
5503            // Decode unknown envelopes for gaps in ordinals.
5504            while _next_ordinal_to_read < 1 {
5505                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5506                _next_ordinal_to_read += 1;
5507                next_offset += envelope_size;
5508            }
5509
5510            let next_out_of_line = decoder.next_out_of_line();
5511            let handles_before = decoder.remaining_handles();
5512            if let Some((inlined, num_bytes, num_handles)) =
5513                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5514            {
5515                let member_inline_size =
5516                    <HeapType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5517                if inlined != (member_inline_size <= 4) {
5518                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5519                }
5520                let inner_offset;
5521                let mut inner_depth = depth.clone();
5522                if inlined {
5523                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5524                    inner_offset = next_offset;
5525                } else {
5526                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5527                    inner_depth.increment()?;
5528                }
5529                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(HeapType, D));
5530                fidl::decode!(HeapType, D, val_ref, decoder, inner_offset, inner_depth)?;
5531                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5532                {
5533                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5534                }
5535                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5536                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5537                }
5538            }
5539
5540            next_offset += envelope_size;
5541            _next_ordinal_to_read += 1;
5542            if next_offset >= end_offset {
5543                return Ok(());
5544            }
5545
5546            // Decode unknown envelopes for gaps in ordinals.
5547            while _next_ordinal_to_read < 2 {
5548                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5549                _next_ordinal_to_read += 1;
5550                next_offset += envelope_size;
5551            }
5552
5553            let next_out_of_line = decoder.next_out_of_line();
5554            let handles_before = decoder.remaining_handles();
5555            if let Some((inlined, num_bytes, num_handles)) =
5556                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5557            {
5558                let member_inline_size =
5559                    <SecureHeapRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5560                if inlined != (member_inline_size <= 4) {
5561                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5562                }
5563                let inner_offset;
5564                let mut inner_depth = depth.clone();
5565                if inlined {
5566                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5567                    inner_offset = next_offset;
5568                } else {
5569                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5570                    inner_depth.increment()?;
5571                }
5572                let val_ref =
5573                    self.range.get_or_insert_with(|| fidl::new_empty!(SecureHeapRange, D));
5574                fidl::decode!(SecureHeapRange, D, val_ref, decoder, inner_offset, inner_depth)?;
5575                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5576                {
5577                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5578                }
5579                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5580                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5581                }
5582            }
5583
5584            next_offset += envelope_size;
5585
5586            // Decode the remaining unknown envelopes.
5587            while next_offset < end_offset {
5588                _next_ordinal_to_read += 1;
5589                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5590                next_offset += envelope_size;
5591            }
5592
5593            Ok(())
5594        }
5595    }
5596
5597    impl SecureHeapAndRangeModification {
5598        #[inline(always)]
5599        fn max_ordinal_present(&self) -> u64 {
5600            if let Some(_) = self.new_range {
5601                return 3;
5602            }
5603            if let Some(_) = self.old_range {
5604                return 2;
5605            }
5606            if let Some(_) = self.heap {
5607                return 1;
5608            }
5609            0
5610        }
5611    }
5612
5613    impl fidl::encoding::ValueTypeMarker for SecureHeapAndRangeModification {
5614        type Borrowed<'a> = &'a Self;
5615        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5616            value
5617        }
5618    }
5619
5620    unsafe impl fidl::encoding::TypeMarker for SecureHeapAndRangeModification {
5621        type Owned = Self;
5622
5623        #[inline(always)]
5624        fn inline_align(_context: fidl::encoding::Context) -> usize {
5625            8
5626        }
5627
5628        #[inline(always)]
5629        fn inline_size(_context: fidl::encoding::Context) -> usize {
5630            16
5631        }
5632    }
5633
5634    unsafe impl<D: fidl::encoding::ResourceDialect>
5635        fidl::encoding::Encode<SecureHeapAndRangeModification, D>
5636        for &SecureHeapAndRangeModification
5637    {
5638        unsafe fn encode(
5639            self,
5640            encoder: &mut fidl::encoding::Encoder<'_, D>,
5641            offset: usize,
5642            mut depth: fidl::encoding::Depth,
5643        ) -> fidl::Result<()> {
5644            encoder.debug_check_bounds::<SecureHeapAndRangeModification>(offset);
5645            // Vector header
5646            let max_ordinal: u64 = self.max_ordinal_present();
5647            encoder.write_num(max_ordinal, offset);
5648            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5649            // Calling encoder.out_of_line_offset(0) is not allowed.
5650            if max_ordinal == 0 {
5651                return Ok(());
5652            }
5653            depth.increment()?;
5654            let envelope_size = 8;
5655            let bytes_len = max_ordinal as usize * envelope_size;
5656            #[allow(unused_variables)]
5657            let offset = encoder.out_of_line_offset(bytes_len);
5658            let mut _prev_end_offset: usize = 0;
5659            if 1 > max_ordinal {
5660                return Ok(());
5661            }
5662
5663            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5664            // are envelope_size bytes.
5665            let cur_offset: usize = (1 - 1) * envelope_size;
5666
5667            // Zero reserved fields.
5668            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5669
5670            // Safety:
5671            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5672            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5673            //   envelope_size bytes, there is always sufficient room.
5674            fidl::encoding::encode_in_envelope_optional::<HeapType, D>(
5675                self.heap.as_ref().map(<HeapType as fidl::encoding::ValueTypeMarker>::borrow),
5676                encoder,
5677                offset + cur_offset,
5678                depth,
5679            )?;
5680
5681            _prev_end_offset = cur_offset + envelope_size;
5682            if 2 > max_ordinal {
5683                return Ok(());
5684            }
5685
5686            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5687            // are envelope_size bytes.
5688            let cur_offset: usize = (2 - 1) * envelope_size;
5689
5690            // Zero reserved fields.
5691            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5692
5693            // Safety:
5694            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5695            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5696            //   envelope_size bytes, there is always sufficient room.
5697            fidl::encoding::encode_in_envelope_optional::<SecureHeapRange, D>(
5698                self.old_range
5699                    .as_ref()
5700                    .map(<SecureHeapRange as fidl::encoding::ValueTypeMarker>::borrow),
5701                encoder,
5702                offset + cur_offset,
5703                depth,
5704            )?;
5705
5706            _prev_end_offset = cur_offset + envelope_size;
5707            if 3 > max_ordinal {
5708                return Ok(());
5709            }
5710
5711            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5712            // are envelope_size bytes.
5713            let cur_offset: usize = (3 - 1) * envelope_size;
5714
5715            // Zero reserved fields.
5716            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5717
5718            // Safety:
5719            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5720            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5721            //   envelope_size bytes, there is always sufficient room.
5722            fidl::encoding::encode_in_envelope_optional::<SecureHeapRange, D>(
5723                self.new_range
5724                    .as_ref()
5725                    .map(<SecureHeapRange as fidl::encoding::ValueTypeMarker>::borrow),
5726                encoder,
5727                offset + cur_offset,
5728                depth,
5729            )?;
5730
5731            _prev_end_offset = cur_offset + envelope_size;
5732
5733            Ok(())
5734        }
5735    }
5736
5737    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5738        for SecureHeapAndRangeModification
5739    {
5740        #[inline(always)]
5741        fn new_empty() -> Self {
5742            Self::default()
5743        }
5744
5745        unsafe fn decode(
5746            &mut self,
5747            decoder: &mut fidl::encoding::Decoder<'_, D>,
5748            offset: usize,
5749            mut depth: fidl::encoding::Depth,
5750        ) -> fidl::Result<()> {
5751            decoder.debug_check_bounds::<Self>(offset);
5752            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5753                None => return Err(fidl::Error::NotNullable),
5754                Some(len) => len,
5755            };
5756            // Calling decoder.out_of_line_offset(0) is not allowed.
5757            if len == 0 {
5758                return Ok(());
5759            };
5760            depth.increment()?;
5761            let envelope_size = 8;
5762            let bytes_len = len * envelope_size;
5763            let offset = decoder.out_of_line_offset(bytes_len)?;
5764            // Decode the envelope for each type.
5765            let mut _next_ordinal_to_read = 0;
5766            let mut next_offset = offset;
5767            let end_offset = offset + bytes_len;
5768            _next_ordinal_to_read += 1;
5769            if next_offset >= end_offset {
5770                return Ok(());
5771            }
5772
5773            // Decode unknown envelopes for gaps in ordinals.
5774            while _next_ordinal_to_read < 1 {
5775                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5776                _next_ordinal_to_read += 1;
5777                next_offset += envelope_size;
5778            }
5779
5780            let next_out_of_line = decoder.next_out_of_line();
5781            let handles_before = decoder.remaining_handles();
5782            if let Some((inlined, num_bytes, num_handles)) =
5783                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5784            {
5785                let member_inline_size =
5786                    <HeapType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5787                if inlined != (member_inline_size <= 4) {
5788                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5789                }
5790                let inner_offset;
5791                let mut inner_depth = depth.clone();
5792                if inlined {
5793                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5794                    inner_offset = next_offset;
5795                } else {
5796                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5797                    inner_depth.increment()?;
5798                }
5799                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(HeapType, D));
5800                fidl::decode!(HeapType, D, val_ref, decoder, inner_offset, inner_depth)?;
5801                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5802                {
5803                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5804                }
5805                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5806                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5807                }
5808            }
5809
5810            next_offset += envelope_size;
5811            _next_ordinal_to_read += 1;
5812            if next_offset >= end_offset {
5813                return Ok(());
5814            }
5815
5816            // Decode unknown envelopes for gaps in ordinals.
5817            while _next_ordinal_to_read < 2 {
5818                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5819                _next_ordinal_to_read += 1;
5820                next_offset += envelope_size;
5821            }
5822
5823            let next_out_of_line = decoder.next_out_of_line();
5824            let handles_before = decoder.remaining_handles();
5825            if let Some((inlined, num_bytes, num_handles)) =
5826                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5827            {
5828                let member_inline_size =
5829                    <SecureHeapRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5830                if inlined != (member_inline_size <= 4) {
5831                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5832                }
5833                let inner_offset;
5834                let mut inner_depth = depth.clone();
5835                if inlined {
5836                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5837                    inner_offset = next_offset;
5838                } else {
5839                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5840                    inner_depth.increment()?;
5841                }
5842                let val_ref =
5843                    self.old_range.get_or_insert_with(|| fidl::new_empty!(SecureHeapRange, D));
5844                fidl::decode!(SecureHeapRange, D, val_ref, decoder, inner_offset, inner_depth)?;
5845                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5846                {
5847                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5848                }
5849                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5850                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5851                }
5852            }
5853
5854            next_offset += envelope_size;
5855            _next_ordinal_to_read += 1;
5856            if next_offset >= end_offset {
5857                return Ok(());
5858            }
5859
5860            // Decode unknown envelopes for gaps in ordinals.
5861            while _next_ordinal_to_read < 3 {
5862                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5863                _next_ordinal_to_read += 1;
5864                next_offset += envelope_size;
5865            }
5866
5867            let next_out_of_line = decoder.next_out_of_line();
5868            let handles_before = decoder.remaining_handles();
5869            if let Some((inlined, num_bytes, num_handles)) =
5870                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5871            {
5872                let member_inline_size =
5873                    <SecureHeapRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5874                if inlined != (member_inline_size <= 4) {
5875                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5876                }
5877                let inner_offset;
5878                let mut inner_depth = depth.clone();
5879                if inlined {
5880                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5881                    inner_offset = next_offset;
5882                } else {
5883                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5884                    inner_depth.increment()?;
5885                }
5886                let val_ref =
5887                    self.new_range.get_or_insert_with(|| fidl::new_empty!(SecureHeapRange, D));
5888                fidl::decode!(SecureHeapRange, D, val_ref, decoder, inner_offset, inner_depth)?;
5889                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5890                {
5891                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5892                }
5893                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5894                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5895                }
5896            }
5897
5898            next_offset += envelope_size;
5899
5900            // Decode the remaining unknown envelopes.
5901            while next_offset < end_offset {
5902                _next_ordinal_to_read += 1;
5903                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5904                next_offset += envelope_size;
5905            }
5906
5907            Ok(())
5908        }
5909    }
5910
5911    impl SecureHeapAndRanges {
5912        #[inline(always)]
5913        fn max_ordinal_present(&self) -> u64 {
5914            if let Some(_) = self.ranges {
5915                return 2;
5916            }
5917            if let Some(_) = self.heap {
5918                return 1;
5919            }
5920            0
5921        }
5922    }
5923
5924    impl fidl::encoding::ValueTypeMarker for SecureHeapAndRanges {
5925        type Borrowed<'a> = &'a Self;
5926        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5927            value
5928        }
5929    }
5930
5931    unsafe impl fidl::encoding::TypeMarker for SecureHeapAndRanges {
5932        type Owned = Self;
5933
5934        #[inline(always)]
5935        fn inline_align(_context: fidl::encoding::Context) -> usize {
5936            8
5937        }
5938
5939        #[inline(always)]
5940        fn inline_size(_context: fidl::encoding::Context) -> usize {
5941            16
5942        }
5943    }
5944
5945    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapAndRanges, D>
5946        for &SecureHeapAndRanges
5947    {
5948        unsafe fn encode(
5949            self,
5950            encoder: &mut fidl::encoding::Encoder<'_, D>,
5951            offset: usize,
5952            mut depth: fidl::encoding::Depth,
5953        ) -> fidl::Result<()> {
5954            encoder.debug_check_bounds::<SecureHeapAndRanges>(offset);
5955            // Vector header
5956            let max_ordinal: u64 = self.max_ordinal_present();
5957            encoder.write_num(max_ordinal, offset);
5958            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5959            // Calling encoder.out_of_line_offset(0) is not allowed.
5960            if max_ordinal == 0 {
5961                return Ok(());
5962            }
5963            depth.increment()?;
5964            let envelope_size = 8;
5965            let bytes_len = max_ordinal as usize * envelope_size;
5966            #[allow(unused_variables)]
5967            let offset = encoder.out_of_line_offset(bytes_len);
5968            let mut _prev_end_offset: usize = 0;
5969            if 1 > max_ordinal {
5970                return Ok(());
5971            }
5972
5973            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5974            // are envelope_size bytes.
5975            let cur_offset: usize = (1 - 1) * envelope_size;
5976
5977            // Zero reserved fields.
5978            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5979
5980            // Safety:
5981            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5982            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5983            //   envelope_size bytes, there is always sufficient room.
5984            fidl::encoding::encode_in_envelope_optional::<HeapType, D>(
5985                self.heap.as_ref().map(<HeapType as fidl::encoding::ValueTypeMarker>::borrow),
5986                encoder,
5987                offset + cur_offset,
5988                depth,
5989            )?;
5990
5991            _prev_end_offset = cur_offset + envelope_size;
5992            if 2 > max_ordinal {
5993                return Ok(());
5994            }
5995
5996            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5997            // are envelope_size bytes.
5998            let cur_offset: usize = (2 - 1) * envelope_size;
5999
6000            // Zero reserved fields.
6001            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6002
6003            // Safety:
6004            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6005            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6006            //   envelope_size bytes, there is always sufficient room.
6007            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SecureHeapRange, 128>, D>(
6008            self.ranges.as_ref().map(<fidl::encoding::Vector<SecureHeapRange, 128> as fidl::encoding::ValueTypeMarker>::borrow),
6009            encoder, offset + cur_offset, depth
6010        )?;
6011
6012            _prev_end_offset = cur_offset + envelope_size;
6013
6014            Ok(())
6015        }
6016    }
6017
6018    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapAndRanges {
6019        #[inline(always)]
6020        fn new_empty() -> Self {
6021            Self::default()
6022        }
6023
6024        unsafe fn decode(
6025            &mut self,
6026            decoder: &mut fidl::encoding::Decoder<'_, D>,
6027            offset: usize,
6028            mut depth: fidl::encoding::Depth,
6029        ) -> fidl::Result<()> {
6030            decoder.debug_check_bounds::<Self>(offset);
6031            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6032                None => return Err(fidl::Error::NotNullable),
6033                Some(len) => len,
6034            };
6035            // Calling decoder.out_of_line_offset(0) is not allowed.
6036            if len == 0 {
6037                return Ok(());
6038            };
6039            depth.increment()?;
6040            let envelope_size = 8;
6041            let bytes_len = len * envelope_size;
6042            let offset = decoder.out_of_line_offset(bytes_len)?;
6043            // Decode the envelope for each type.
6044            let mut _next_ordinal_to_read = 0;
6045            let mut next_offset = offset;
6046            let end_offset = offset + bytes_len;
6047            _next_ordinal_to_read += 1;
6048            if next_offset >= end_offset {
6049                return Ok(());
6050            }
6051
6052            // Decode unknown envelopes for gaps in ordinals.
6053            while _next_ordinal_to_read < 1 {
6054                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6055                _next_ordinal_to_read += 1;
6056                next_offset += envelope_size;
6057            }
6058
6059            let next_out_of_line = decoder.next_out_of_line();
6060            let handles_before = decoder.remaining_handles();
6061            if let Some((inlined, num_bytes, num_handles)) =
6062                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6063            {
6064                let member_inline_size =
6065                    <HeapType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6066                if inlined != (member_inline_size <= 4) {
6067                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6068                }
6069                let inner_offset;
6070                let mut inner_depth = depth.clone();
6071                if inlined {
6072                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6073                    inner_offset = next_offset;
6074                } else {
6075                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6076                    inner_depth.increment()?;
6077                }
6078                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(HeapType, D));
6079                fidl::decode!(HeapType, D, val_ref, decoder, inner_offset, inner_depth)?;
6080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6081                {
6082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6083                }
6084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6086                }
6087            }
6088
6089            next_offset += envelope_size;
6090            _next_ordinal_to_read += 1;
6091            if next_offset >= end_offset {
6092                return Ok(());
6093            }
6094
6095            // Decode unknown envelopes for gaps in ordinals.
6096            while _next_ordinal_to_read < 2 {
6097                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6098                _next_ordinal_to_read += 1;
6099                next_offset += envelope_size;
6100            }
6101
6102            let next_out_of_line = decoder.next_out_of_line();
6103            let handles_before = decoder.remaining_handles();
6104            if let Some((inlined, num_bytes, num_handles)) =
6105                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6106            {
6107                let member_inline_size = <fidl::encoding::Vector<SecureHeapRange, 128> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6108                if inlined != (member_inline_size <= 4) {
6109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6110                }
6111                let inner_offset;
6112                let mut inner_depth = depth.clone();
6113                if inlined {
6114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6115                    inner_offset = next_offset;
6116                } else {
6117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6118                    inner_depth.increment()?;
6119                }
6120                let val_ref = self.ranges.get_or_insert_with(
6121                    || fidl::new_empty!(fidl::encoding::Vector<SecureHeapRange, 128>, D),
6122                );
6123                fidl::decode!(fidl::encoding::Vector<SecureHeapRange, 128>, D, val_ref, decoder, inner_offset, inner_depth)?;
6124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6125                {
6126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6127                }
6128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6130                }
6131            }
6132
6133            next_offset += envelope_size;
6134
6135            // Decode the remaining unknown envelopes.
6136            while next_offset < end_offset {
6137                _next_ordinal_to_read += 1;
6138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6139                next_offset += envelope_size;
6140            }
6141
6142            Ok(())
6143        }
6144    }
6145
6146    impl SecureHeapProperties {
6147        #[inline(always)]
6148        fn max_ordinal_present(&self) -> u64 {
6149            if let Some(_) = self.is_mod_protected_range_available {
6150                return 5;
6151            }
6152            if let Some(_) = self.max_protected_range_count {
6153                return 4;
6154            }
6155            if let Some(_) = self.protected_range_granularity {
6156                return 3;
6157            }
6158            if let Some(_) = self.dynamic_protection_ranges {
6159                return 2;
6160            }
6161            if let Some(_) = self.heap {
6162                return 1;
6163            }
6164            0
6165        }
6166    }
6167
6168    impl fidl::encoding::ValueTypeMarker for SecureHeapProperties {
6169        type Borrowed<'a> = &'a Self;
6170        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6171            value
6172        }
6173    }
6174
6175    unsafe impl fidl::encoding::TypeMarker for SecureHeapProperties {
6176        type Owned = Self;
6177
6178        #[inline(always)]
6179        fn inline_align(_context: fidl::encoding::Context) -> usize {
6180            8
6181        }
6182
6183        #[inline(always)]
6184        fn inline_size(_context: fidl::encoding::Context) -> usize {
6185            16
6186        }
6187    }
6188
6189    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapProperties, D>
6190        for &SecureHeapProperties
6191    {
6192        unsafe fn encode(
6193            self,
6194            encoder: &mut fidl::encoding::Encoder<'_, D>,
6195            offset: usize,
6196            mut depth: fidl::encoding::Depth,
6197        ) -> fidl::Result<()> {
6198            encoder.debug_check_bounds::<SecureHeapProperties>(offset);
6199            // Vector header
6200            let max_ordinal: u64 = self.max_ordinal_present();
6201            encoder.write_num(max_ordinal, offset);
6202            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6203            // Calling encoder.out_of_line_offset(0) is not allowed.
6204            if max_ordinal == 0 {
6205                return Ok(());
6206            }
6207            depth.increment()?;
6208            let envelope_size = 8;
6209            let bytes_len = max_ordinal as usize * envelope_size;
6210            #[allow(unused_variables)]
6211            let offset = encoder.out_of_line_offset(bytes_len);
6212            let mut _prev_end_offset: usize = 0;
6213            if 1 > max_ordinal {
6214                return Ok(());
6215            }
6216
6217            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6218            // are envelope_size bytes.
6219            let cur_offset: usize = (1 - 1) * envelope_size;
6220
6221            // Zero reserved fields.
6222            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6223
6224            // Safety:
6225            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6226            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6227            //   envelope_size bytes, there is always sufficient room.
6228            fidl::encoding::encode_in_envelope_optional::<HeapType, D>(
6229                self.heap.as_ref().map(<HeapType as fidl::encoding::ValueTypeMarker>::borrow),
6230                encoder,
6231                offset + cur_offset,
6232                depth,
6233            )?;
6234
6235            _prev_end_offset = cur_offset + envelope_size;
6236            if 2 > max_ordinal {
6237                return Ok(());
6238            }
6239
6240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6241            // are envelope_size bytes.
6242            let cur_offset: usize = (2 - 1) * envelope_size;
6243
6244            // Zero reserved fields.
6245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6246
6247            // Safety:
6248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6250            //   envelope_size bytes, there is always sufficient room.
6251            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6252                self.dynamic_protection_ranges
6253                    .as_ref()
6254                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6255                encoder,
6256                offset + cur_offset,
6257                depth,
6258            )?;
6259
6260            _prev_end_offset = cur_offset + envelope_size;
6261            if 3 > max_ordinal {
6262                return Ok(());
6263            }
6264
6265            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6266            // are envelope_size bytes.
6267            let cur_offset: usize = (3 - 1) * envelope_size;
6268
6269            // Zero reserved fields.
6270            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6271
6272            // Safety:
6273            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6274            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6275            //   envelope_size bytes, there is always sufficient room.
6276            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6277                self.protected_range_granularity
6278                    .as_ref()
6279                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6280                encoder,
6281                offset + cur_offset,
6282                depth,
6283            )?;
6284
6285            _prev_end_offset = cur_offset + envelope_size;
6286            if 4 > max_ordinal {
6287                return Ok(());
6288            }
6289
6290            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6291            // are envelope_size bytes.
6292            let cur_offset: usize = (4 - 1) * envelope_size;
6293
6294            // Zero reserved fields.
6295            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6296
6297            // Safety:
6298            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6299            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6300            //   envelope_size bytes, there is always sufficient room.
6301            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6302                self.max_protected_range_count
6303                    .as_ref()
6304                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6305                encoder,
6306                offset + cur_offset,
6307                depth,
6308            )?;
6309
6310            _prev_end_offset = cur_offset + envelope_size;
6311            if 5 > max_ordinal {
6312                return Ok(());
6313            }
6314
6315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6316            // are envelope_size bytes.
6317            let cur_offset: usize = (5 - 1) * envelope_size;
6318
6319            // Zero reserved fields.
6320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6321
6322            // Safety:
6323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6325            //   envelope_size bytes, there is always sufficient room.
6326            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6327                self.is_mod_protected_range_available
6328                    .as_ref()
6329                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6330                encoder,
6331                offset + cur_offset,
6332                depth,
6333            )?;
6334
6335            _prev_end_offset = cur_offset + envelope_size;
6336
6337            Ok(())
6338        }
6339    }
6340
6341    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapProperties {
6342        #[inline(always)]
6343        fn new_empty() -> Self {
6344            Self::default()
6345        }
6346
6347        unsafe fn decode(
6348            &mut self,
6349            decoder: &mut fidl::encoding::Decoder<'_, D>,
6350            offset: usize,
6351            mut depth: fidl::encoding::Depth,
6352        ) -> fidl::Result<()> {
6353            decoder.debug_check_bounds::<Self>(offset);
6354            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6355                None => return Err(fidl::Error::NotNullable),
6356                Some(len) => len,
6357            };
6358            // Calling decoder.out_of_line_offset(0) is not allowed.
6359            if len == 0 {
6360                return Ok(());
6361            };
6362            depth.increment()?;
6363            let envelope_size = 8;
6364            let bytes_len = len * envelope_size;
6365            let offset = decoder.out_of_line_offset(bytes_len)?;
6366            // Decode the envelope for each type.
6367            let mut _next_ordinal_to_read = 0;
6368            let mut next_offset = offset;
6369            let end_offset = offset + bytes_len;
6370            _next_ordinal_to_read += 1;
6371            if next_offset >= end_offset {
6372                return Ok(());
6373            }
6374
6375            // Decode unknown envelopes for gaps in ordinals.
6376            while _next_ordinal_to_read < 1 {
6377                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6378                _next_ordinal_to_read += 1;
6379                next_offset += envelope_size;
6380            }
6381
6382            let next_out_of_line = decoder.next_out_of_line();
6383            let handles_before = decoder.remaining_handles();
6384            if let Some((inlined, num_bytes, num_handles)) =
6385                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6386            {
6387                let member_inline_size =
6388                    <HeapType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6389                if inlined != (member_inline_size <= 4) {
6390                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6391                }
6392                let inner_offset;
6393                let mut inner_depth = depth.clone();
6394                if inlined {
6395                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6396                    inner_offset = next_offset;
6397                } else {
6398                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6399                    inner_depth.increment()?;
6400                }
6401                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(HeapType, D));
6402                fidl::decode!(HeapType, D, val_ref, decoder, inner_offset, inner_depth)?;
6403                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6404                {
6405                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6406                }
6407                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6408                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6409                }
6410            }
6411
6412            next_offset += envelope_size;
6413            _next_ordinal_to_read += 1;
6414            if next_offset >= end_offset {
6415                return Ok(());
6416            }
6417
6418            // Decode unknown envelopes for gaps in ordinals.
6419            while _next_ordinal_to_read < 2 {
6420                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6421                _next_ordinal_to_read += 1;
6422                next_offset += envelope_size;
6423            }
6424
6425            let next_out_of_line = decoder.next_out_of_line();
6426            let handles_before = decoder.remaining_handles();
6427            if let Some((inlined, num_bytes, num_handles)) =
6428                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6429            {
6430                let member_inline_size =
6431                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6432                if inlined != (member_inline_size <= 4) {
6433                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6434                }
6435                let inner_offset;
6436                let mut inner_depth = depth.clone();
6437                if inlined {
6438                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6439                    inner_offset = next_offset;
6440                } else {
6441                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6442                    inner_depth.increment()?;
6443                }
6444                let val_ref =
6445                    self.dynamic_protection_ranges.get_or_insert_with(|| fidl::new_empty!(bool, D));
6446                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6447                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6448                {
6449                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6450                }
6451                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6452                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6453                }
6454            }
6455
6456            next_offset += envelope_size;
6457            _next_ordinal_to_read += 1;
6458            if next_offset >= end_offset {
6459                return Ok(());
6460            }
6461
6462            // Decode unknown envelopes for gaps in ordinals.
6463            while _next_ordinal_to_read < 3 {
6464                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6465                _next_ordinal_to_read += 1;
6466                next_offset += envelope_size;
6467            }
6468
6469            let next_out_of_line = decoder.next_out_of_line();
6470            let handles_before = decoder.remaining_handles();
6471            if let Some((inlined, num_bytes, num_handles)) =
6472                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6473            {
6474                let member_inline_size =
6475                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6476                if inlined != (member_inline_size <= 4) {
6477                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6478                }
6479                let inner_offset;
6480                let mut inner_depth = depth.clone();
6481                if inlined {
6482                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6483                    inner_offset = next_offset;
6484                } else {
6485                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6486                    inner_depth.increment()?;
6487                }
6488                let val_ref = self
6489                    .protected_range_granularity
6490                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
6491                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6492                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6493                {
6494                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6495                }
6496                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6497                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6498                }
6499            }
6500
6501            next_offset += envelope_size;
6502            _next_ordinal_to_read += 1;
6503            if next_offset >= end_offset {
6504                return Ok(());
6505            }
6506
6507            // Decode unknown envelopes for gaps in ordinals.
6508            while _next_ordinal_to_read < 4 {
6509                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6510                _next_ordinal_to_read += 1;
6511                next_offset += envelope_size;
6512            }
6513
6514            let next_out_of_line = decoder.next_out_of_line();
6515            let handles_before = decoder.remaining_handles();
6516            if let Some((inlined, num_bytes, num_handles)) =
6517                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6518            {
6519                let member_inline_size =
6520                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6521                if inlined != (member_inline_size <= 4) {
6522                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6523                }
6524                let inner_offset;
6525                let mut inner_depth = depth.clone();
6526                if inlined {
6527                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6528                    inner_offset = next_offset;
6529                } else {
6530                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6531                    inner_depth.increment()?;
6532                }
6533                let val_ref =
6534                    self.max_protected_range_count.get_or_insert_with(|| fidl::new_empty!(u64, D));
6535                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6536                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6537                {
6538                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6539                }
6540                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6541                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6542                }
6543            }
6544
6545            next_offset += envelope_size;
6546            _next_ordinal_to_read += 1;
6547            if next_offset >= end_offset {
6548                return Ok(());
6549            }
6550
6551            // Decode unknown envelopes for gaps in ordinals.
6552            while _next_ordinal_to_read < 5 {
6553                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6554                _next_ordinal_to_read += 1;
6555                next_offset += envelope_size;
6556            }
6557
6558            let next_out_of_line = decoder.next_out_of_line();
6559            let handles_before = decoder.remaining_handles();
6560            if let Some((inlined, num_bytes, num_handles)) =
6561                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6562            {
6563                let member_inline_size =
6564                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6565                if inlined != (member_inline_size <= 4) {
6566                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6567                }
6568                let inner_offset;
6569                let mut inner_depth = depth.clone();
6570                if inlined {
6571                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6572                    inner_offset = next_offset;
6573                } else {
6574                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6575                    inner_depth.increment()?;
6576                }
6577                let val_ref = self
6578                    .is_mod_protected_range_available
6579                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
6580                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6581                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6582                {
6583                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6584                }
6585                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6586                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6587                }
6588            }
6589
6590            next_offset += envelope_size;
6591
6592            // Decode the remaining unknown envelopes.
6593            while next_offset < end_offset {
6594                _next_ordinal_to_read += 1;
6595                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6596                next_offset += envelope_size;
6597            }
6598
6599            Ok(())
6600        }
6601    }
6602
6603    impl SecureHeapRange {
6604        #[inline(always)]
6605        fn max_ordinal_present(&self) -> u64 {
6606            if let Some(_) = self.size_bytes {
6607                return 2;
6608            }
6609            if let Some(_) = self.physical_address {
6610                return 1;
6611            }
6612            0
6613        }
6614    }
6615
6616    impl fidl::encoding::ValueTypeMarker for SecureHeapRange {
6617        type Borrowed<'a> = &'a Self;
6618        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6619            value
6620        }
6621    }
6622
6623    unsafe impl fidl::encoding::TypeMarker for SecureHeapRange {
6624        type Owned = Self;
6625
6626        #[inline(always)]
6627        fn inline_align(_context: fidl::encoding::Context) -> usize {
6628            8
6629        }
6630
6631        #[inline(always)]
6632        fn inline_size(_context: fidl::encoding::Context) -> usize {
6633            16
6634        }
6635    }
6636
6637    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapRange, D>
6638        for &SecureHeapRange
6639    {
6640        unsafe fn encode(
6641            self,
6642            encoder: &mut fidl::encoding::Encoder<'_, D>,
6643            offset: usize,
6644            mut depth: fidl::encoding::Depth,
6645        ) -> fidl::Result<()> {
6646            encoder.debug_check_bounds::<SecureHeapRange>(offset);
6647            // Vector header
6648            let max_ordinal: u64 = self.max_ordinal_present();
6649            encoder.write_num(max_ordinal, offset);
6650            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6651            // Calling encoder.out_of_line_offset(0) is not allowed.
6652            if max_ordinal == 0 {
6653                return Ok(());
6654            }
6655            depth.increment()?;
6656            let envelope_size = 8;
6657            let bytes_len = max_ordinal as usize * envelope_size;
6658            #[allow(unused_variables)]
6659            let offset = encoder.out_of_line_offset(bytes_len);
6660            let mut _prev_end_offset: usize = 0;
6661            if 1 > max_ordinal {
6662                return Ok(());
6663            }
6664
6665            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6666            // are envelope_size bytes.
6667            let cur_offset: usize = (1 - 1) * envelope_size;
6668
6669            // Zero reserved fields.
6670            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6671
6672            // Safety:
6673            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6674            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6675            //   envelope_size bytes, there is always sufficient room.
6676            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6677                self.physical_address
6678                    .as_ref()
6679                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6680                encoder,
6681                offset + cur_offset,
6682                depth,
6683            )?;
6684
6685            _prev_end_offset = cur_offset + envelope_size;
6686            if 2 > max_ordinal {
6687                return Ok(());
6688            }
6689
6690            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6691            // are envelope_size bytes.
6692            let cur_offset: usize = (2 - 1) * envelope_size;
6693
6694            // Zero reserved fields.
6695            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6696
6697            // Safety:
6698            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6699            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6700            //   envelope_size bytes, there is always sufficient room.
6701            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6702                self.size_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6703                encoder,
6704                offset + cur_offset,
6705                depth,
6706            )?;
6707
6708            _prev_end_offset = cur_offset + envelope_size;
6709
6710            Ok(())
6711        }
6712    }
6713
6714    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapRange {
6715        #[inline(always)]
6716        fn new_empty() -> Self {
6717            Self::default()
6718        }
6719
6720        unsafe fn decode(
6721            &mut self,
6722            decoder: &mut fidl::encoding::Decoder<'_, D>,
6723            offset: usize,
6724            mut depth: fidl::encoding::Depth,
6725        ) -> fidl::Result<()> {
6726            decoder.debug_check_bounds::<Self>(offset);
6727            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6728                None => return Err(fidl::Error::NotNullable),
6729                Some(len) => len,
6730            };
6731            // Calling decoder.out_of_line_offset(0) is not allowed.
6732            if len == 0 {
6733                return Ok(());
6734            };
6735            depth.increment()?;
6736            let envelope_size = 8;
6737            let bytes_len = len * envelope_size;
6738            let offset = decoder.out_of_line_offset(bytes_len)?;
6739            // Decode the envelope for each type.
6740            let mut _next_ordinal_to_read = 0;
6741            let mut next_offset = offset;
6742            let end_offset = offset + bytes_len;
6743            _next_ordinal_to_read += 1;
6744            if next_offset >= end_offset {
6745                return Ok(());
6746            }
6747
6748            // Decode unknown envelopes for gaps in ordinals.
6749            while _next_ordinal_to_read < 1 {
6750                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6751                _next_ordinal_to_read += 1;
6752                next_offset += envelope_size;
6753            }
6754
6755            let next_out_of_line = decoder.next_out_of_line();
6756            let handles_before = decoder.remaining_handles();
6757            if let Some((inlined, num_bytes, num_handles)) =
6758                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6759            {
6760                let member_inline_size =
6761                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6762                if inlined != (member_inline_size <= 4) {
6763                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6764                }
6765                let inner_offset;
6766                let mut inner_depth = depth.clone();
6767                if inlined {
6768                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6769                    inner_offset = next_offset;
6770                } else {
6771                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6772                    inner_depth.increment()?;
6773                }
6774                let val_ref = self.physical_address.get_or_insert_with(|| fidl::new_empty!(u64, D));
6775                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6776                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6777                {
6778                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6779                }
6780                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6781                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6782                }
6783            }
6784
6785            next_offset += envelope_size;
6786            _next_ordinal_to_read += 1;
6787            if next_offset >= end_offset {
6788                return Ok(());
6789            }
6790
6791            // Decode unknown envelopes for gaps in ordinals.
6792            while _next_ordinal_to_read < 2 {
6793                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6794                _next_ordinal_to_read += 1;
6795                next_offset += envelope_size;
6796            }
6797
6798            let next_out_of_line = decoder.next_out_of_line();
6799            let handles_before = decoder.remaining_handles();
6800            if let Some((inlined, num_bytes, num_handles)) =
6801                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6802            {
6803                let member_inline_size =
6804                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6805                if inlined != (member_inline_size <= 4) {
6806                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6807                }
6808                let inner_offset;
6809                let mut inner_depth = depth.clone();
6810                if inlined {
6811                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6812                    inner_offset = next_offset;
6813                } else {
6814                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6815                    inner_depth.increment()?;
6816                }
6817                let val_ref = self.size_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
6818                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6819                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6820                {
6821                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6822                }
6823                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6824                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6825                }
6826            }
6827
6828            next_offset += envelope_size;
6829
6830            // Decode the remaining unknown envelopes.
6831            while next_offset < end_offset {
6832                _next_ordinal_to_read += 1;
6833                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6834                next_offset += envelope_size;
6835            }
6836
6837            Ok(())
6838        }
6839    }
6840
6841    impl SecureHeapsAndRanges {
6842        #[inline(always)]
6843        fn max_ordinal_present(&self) -> u64 {
6844            if let Some(_) = self.heaps {
6845                return 1;
6846            }
6847            0
6848        }
6849    }
6850
6851    impl fidl::encoding::ValueTypeMarker for SecureHeapsAndRanges {
6852        type Borrowed<'a> = &'a Self;
6853        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6854            value
6855        }
6856    }
6857
6858    unsafe impl fidl::encoding::TypeMarker for SecureHeapsAndRanges {
6859        type Owned = Self;
6860
6861        #[inline(always)]
6862        fn inline_align(_context: fidl::encoding::Context) -> usize {
6863            8
6864        }
6865
6866        #[inline(always)]
6867        fn inline_size(_context: fidl::encoding::Context) -> usize {
6868            16
6869        }
6870    }
6871
6872    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapsAndRanges, D>
6873        for &SecureHeapsAndRanges
6874    {
6875        unsafe fn encode(
6876            self,
6877            encoder: &mut fidl::encoding::Encoder<'_, D>,
6878            offset: usize,
6879            mut depth: fidl::encoding::Depth,
6880        ) -> fidl::Result<()> {
6881            encoder.debug_check_bounds::<SecureHeapsAndRanges>(offset);
6882            // Vector header
6883            let max_ordinal: u64 = self.max_ordinal_present();
6884            encoder.write_num(max_ordinal, offset);
6885            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6886            // Calling encoder.out_of_line_offset(0) is not allowed.
6887            if max_ordinal == 0 {
6888                return Ok(());
6889            }
6890            depth.increment()?;
6891            let envelope_size = 8;
6892            let bytes_len = max_ordinal as usize * envelope_size;
6893            #[allow(unused_variables)]
6894            let offset = encoder.out_of_line_offset(bytes_len);
6895            let mut _prev_end_offset: usize = 0;
6896            if 1 > max_ordinal {
6897                return Ok(());
6898            }
6899
6900            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6901            // are envelope_size bytes.
6902            let cur_offset: usize = (1 - 1) * envelope_size;
6903
6904            // Zero reserved fields.
6905            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6906
6907            // Safety:
6908            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6909            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6910            //   envelope_size bytes, there is always sufficient room.
6911            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SecureHeapAndRanges, 32>, D>(
6912            self.heaps.as_ref().map(<fidl::encoding::Vector<SecureHeapAndRanges, 32> as fidl::encoding::ValueTypeMarker>::borrow),
6913            encoder, offset + cur_offset, depth
6914        )?;
6915
6916            _prev_end_offset = cur_offset + envelope_size;
6917
6918            Ok(())
6919        }
6920    }
6921
6922    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapsAndRanges {
6923        #[inline(always)]
6924        fn new_empty() -> Self {
6925            Self::default()
6926        }
6927
6928        unsafe fn decode(
6929            &mut self,
6930            decoder: &mut fidl::encoding::Decoder<'_, D>,
6931            offset: usize,
6932            mut depth: fidl::encoding::Depth,
6933        ) -> fidl::Result<()> {
6934            decoder.debug_check_bounds::<Self>(offset);
6935            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6936                None => return Err(fidl::Error::NotNullable),
6937                Some(len) => len,
6938            };
6939            // Calling decoder.out_of_line_offset(0) is not allowed.
6940            if len == 0 {
6941                return Ok(());
6942            };
6943            depth.increment()?;
6944            let envelope_size = 8;
6945            let bytes_len = len * envelope_size;
6946            let offset = decoder.out_of_line_offset(bytes_len)?;
6947            // Decode the envelope for each type.
6948            let mut _next_ordinal_to_read = 0;
6949            let mut next_offset = offset;
6950            let end_offset = offset + bytes_len;
6951            _next_ordinal_to_read += 1;
6952            if next_offset >= end_offset {
6953                return Ok(());
6954            }
6955
6956            // Decode unknown envelopes for gaps in ordinals.
6957            while _next_ordinal_to_read < 1 {
6958                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6959                _next_ordinal_to_read += 1;
6960                next_offset += envelope_size;
6961            }
6962
6963            let next_out_of_line = decoder.next_out_of_line();
6964            let handles_before = decoder.remaining_handles();
6965            if let Some((inlined, num_bytes, num_handles)) =
6966                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6967            {
6968                let member_inline_size = <fidl::encoding::Vector<SecureHeapAndRanges, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6969                if inlined != (member_inline_size <= 4) {
6970                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6971                }
6972                let inner_offset;
6973                let mut inner_depth = depth.clone();
6974                if inlined {
6975                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6976                    inner_offset = next_offset;
6977                } else {
6978                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6979                    inner_depth.increment()?;
6980                }
6981                let val_ref = self.heaps.get_or_insert_with(
6982                    || fidl::new_empty!(fidl::encoding::Vector<SecureHeapAndRanges, 32>, D),
6983                );
6984                fidl::decode!(fidl::encoding::Vector<SecureHeapAndRanges, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
6985                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6986                {
6987                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6988                }
6989                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6990                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6991                }
6992            }
6993
6994            next_offset += envelope_size;
6995
6996            // Decode the remaining unknown envelopes.
6997            while next_offset < end_offset {
6998                _next_ordinal_to_read += 1;
6999                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7000                next_offset += envelope_size;
7001            }
7002
7003            Ok(())
7004        }
7005    }
7006}