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