fidl_fuchsia_sysmem__common/
fidl_fuchsia_sysmem__common.rs

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