Skip to main content

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