fidl_fuchsia_sysmem2__common/
fidl_fuchsia_sysmem2__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 CPU_USAGE_READ: u32 = 1;
12
13pub const CPU_USAGE_READ_OFTEN: u32 = 2;
14
15pub const CPU_USAGE_WRITE: u32 = 4;
16
17pub const CPU_USAGE_WRITE_OFTEN: u32 = 8;
18
19pub const DISPLAY_USAGE_CURSOR: u32 = 2;
20
21pub const DISPLAY_USAGE_LAYER: u32 = 1;
22
23/// The max length in bytes of the `name` request field in
24/// [`fuchsia.sysmem2/Allocator.SetDebugClientInfo`] and
25/// [`fuchsia.sysmem2/Node.SetDebugClientInfo`].
26pub const MAX_CLIENT_NAME_LENGTH: i32 = 256;
27
28/// The maximum size of
29/// [`fuchsia.sysmem2/BufferCollectionConstraints.image_format_constraints`].
30pub const MAX_COUNT_BUFFER_COLLECTION_CONSTRAINTS_IMAGE_FORMAT_CONSTRAINTS: u32 = 64;
31
32/// The maximum entries that can be in the
33/// [`fuchsia.sysmem2/BufferCollectionInfo.buffers`] field.
34pub const MAX_COUNT_BUFFER_COLLECTION_INFO_BUFFERS: u32 = 128;
35
36/// The maximum size of
37/// [`fuchsia.sysmem2/BufferMemoryConstraints.permitted_heaps`].
38pub const MAX_COUNT_BUFFER_MEMORY_CONSTRAINTS_PERMITTED_HEAPS: u32 = 64;
39
40/// The maximum number of token children of an OR group that can be created per
41/// call to [`fuchsia.sysmem2/BufferCollectionTokenGroup.CreateChildrenSync`].
42///
43/// Actually creating this many children isn't recommended in most typical
44/// scenarios, but isn't prevented, for testing reasons, and just in case an
45/// unusual scenario needs it. Mitigation of potentially high time complexity in
46/// sysmem will limit the actual number of group child combinations considered
47/// in aggregation attempts to a separate maximum that is not settable via
48/// sysmem protocols. The maximum number of total nodes in a sysmem token tree
49/// is limited to a separate maximum that is not settable via these protocols.
50pub const MAX_COUNT_CREATE_CHILDREN: i32 = 64;
51
52pub const MAX_COUNT_DUPLICATES: u32 = 64;
53
54/// The maximum size of [`fuchsia.sysmem2/ImageFormatConstraints.color_spaces`].
55pub const MAX_COUNT_IMAGE_FORMAT_CONSTRAINTS_COLOR_SPACES: u32 = 32;
56
57/// The maximum size of
58/// [`fuchsia.sysmem2/ImageFormatConstraints.pixel_format_and_modifiers`].
59pub const MAX_COUNT_PIXEL_FORMAT_AND_MODIFIERS: u32 = 64;
60
61pub const MAX_HEAPS_COUNT: u32 = 32;
62
63pub const MAX_RANGES_COUNT: u32 = 128;
64
65pub const NONE_USAGE: u32 = 1;
66
67pub const NONE_USAGE_PERMIT_ALLOCATION: u32 = 2;
68
69pub const VIDEO_USAGE_CAPTURE: u32 = 8;
70
71pub const VIDEO_USAGE_DECRYPTOR_OUTPUT: u32 = 16;
72
73pub const VIDEO_USAGE_HW_DECODER: u32 = 1;
74
75pub const VIDEO_USAGE_HW_DECODER_INTERNAL: u32 = 32;
76
77pub const VIDEO_USAGE_HW_ENCODER: u32 = 2;
78
79pub const VULKAN_BUFFER_USAGE_INDEX_BUFFER: u32 = 4194304;
80
81pub const VULKAN_BUFFER_USAGE_INDIRECT_BUFFER: u32 = 16777216;
82
83pub const VULKAN_BUFFER_USAGE_STORAGE_BUFFER: u32 = 2097152;
84
85pub const VULKAN_BUFFER_USAGE_STORAGE_TEXEL_BUFFER: u32 = 524288;
86
87pub const VULKAN_BUFFER_USAGE_TRANSFER_DST: u32 = 131072;
88
89pub const VULKAN_BUFFER_USAGE_TRANSFER_SRC: u32 = 65536;
90
91pub const VULKAN_BUFFER_USAGE_UNIFORM_BUFFER: u32 = 1048576;
92
93pub const VULKAN_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER: u32 = 262144;
94
95pub const VULKAN_BUFFER_USAGE_VERTEX_BUFFER: u32 = 8388608;
96
97pub const VULKAN_IMAGE_USAGE_COLOR_ATTACHMENT: u32 = 16;
98
99pub const VULKAN_IMAGE_USAGE_INPUT_ATTACHMENT: u32 = 128;
100
101pub const VULKAN_IMAGE_USAGE_SAMPLED: u32 = 4;
102
103pub const VULKAN_IMAGE_USAGE_STENCIL_ATTACHMENT: u32 = 32;
104
105pub const VULKAN_IMAGE_USAGE_STORAGE: u32 = 8;
106
107pub const VULKAN_IMAGE_USAGE_TRANSFER_DST: u32 = 2;
108
109pub const VULKAN_IMAGE_USAGE_TRANSFER_SRC: u32 = 1;
110
111pub const VULKAN_IMAGE_USAGE_TRANSIENT_ATTACHMENT: u32 = 64;
112
113/// `INACCESSIBLE` is only for cases where there is no CPU access to the
114/// buffers.
115///
116/// Device-local memory that isn't reachable from the CPU is `CoherencyDomain`
117/// `INACCESSIBLE`, even if it's possible to cause a device (physical or
118/// virtual) to copy the data from the `INACCESSIBLE` buffers to buffers that
119/// are visible to the CPU. In other words, INACCESSIBLE does not imply secure,
120/// but secure implies INACCESSIBLE.
121///
122/// `CPU` means producers must ensure that a consumer can read the produced data
123/// with the CPU without the consumer needing to do additional cache ops not
124/// already performed (as needed) by the producer.
125///
126/// `RAM` means producers must ensure that the produced data is entirely present
127/// in RAM, without any dirty CPU cache lines, and a consumer must invalidate
128/// (or flush and invalidate, typically) the CPU cache before reading data with
129/// the CPU. The `RAM` domain can be faster than the `CPU` domain when all
130/// access is via HW DMA, since in that case no CPU cache ops are required,
131/// since no participant is actually reading/writing using the CPU.
132#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
133pub enum CoherencyDomain {
134    Cpu,
135    Ram,
136    Inaccessible,
137    #[doc(hidden)]
138    __SourceBreaking {
139        unknown_ordinal: u32,
140    },
141}
142
143/// Pattern that matches an unknown `CoherencyDomain` member.
144#[macro_export]
145macro_rules! CoherencyDomainUnknown {
146    () => {
147        _
148    };
149}
150
151impl CoherencyDomain {
152    #[inline]
153    pub fn from_primitive(prim: u32) -> Option<Self> {
154        match prim {
155            0 => Some(Self::Cpu),
156            1 => Some(Self::Ram),
157            2 => Some(Self::Inaccessible),
158            _ => None,
159        }
160    }
161
162    #[inline]
163    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
164        match prim {
165            0 => Self::Cpu,
166            1 => Self::Ram,
167            2 => Self::Inaccessible,
168            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
169        }
170    }
171
172    #[inline]
173    pub fn unknown() -> Self {
174        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
175    }
176
177    #[inline]
178    pub const fn into_primitive(self) -> u32 {
179        match self {
180            Self::Cpu => 0,
181            Self::Ram => 1,
182            Self::Inaccessible => 2,
183            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
184        }
185    }
186
187    #[inline]
188    pub fn is_unknown(&self) -> bool {
189        match self {
190            Self::__SourceBreaking { unknown_ordinal: _ } => true,
191            _ => false,
192        }
193    }
194}
195
196/// Regardless of which error code, any client retries should be very limited in
197/// number, if any.
198///
199/// A Error value should never be stored in a zx_status_t, since positive values
200/// in zx_status_t are deprecated.
201#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
202pub enum Error {
203    /// This is not a valid error value in this error enum. The server will
204    /// never send this value as a failure code. This value is not treated as
205    /// "success". In some languages, a locally default-initialized Error
206    /// instance will have this value until it is initialized with a valid
207    /// positive error code.
208    Invalid,
209    /// Unspecified error.
210    ///
211    /// This error code is used when no other error code applies, and the error
212    /// is probably not due to problematic messages sent to the server via the
213    /// channel delivering this error.
214    ///
215    /// This error should be handled by the client as a generic error.
216    ///
217    /// As one example, this error is used when a different client channel has
218    /// closed from the client end unexpectedly (without sending
219    /// [`fuchsia.sysmem2/Node.Release`] first), thereby causing failure of any
220    /// nodes in the same tree or sub-tree. In this usage, the main thing that's
221    /// relevant is it isn't the receiving client's "fault" - no reason to be
222    /// more specific since there's probably nothing the receiving client could
223    /// do about the error, at least not directly.
224    ///
225    /// As another example, this error can be used if a syscall that is normally
226    /// expected to succeed fails unexpectedly, and there's no identified reason
227    /// to "blame" the client.
228    ///
229    /// A client should never require / depend on a particular cause of error
230    /// continuing to result in UNSPECIFIED, as any particular error cause can
231    /// potentially start resulting in a more specific error code in future.
232    Unspecified,
233    /// A required field wasn't set or a specified value was invalid. See the
234    /// log for more info.
235    ///
236    /// This is also used when a message is received from the client in the
237    /// wrong order or in some way inconsistent with protocol rules.
238    ProtocolDeviation,
239    /// A client-specified object or ID was not found.
240    NotFound,
241    /// The object handle doesn't have sufficient rights to perform the request.
242    HandleAccessDenied,
243    /// The allocation could not be satisfied due to lack of available memory.
244    ///
245    /// The memory exhaustion can be specific to the heap that was selected
246    /// during constraints aggregation, so in some cases, this error can happen
247    /// despite normal system RAM not being near exhaustion, depending on
248    /// configured and selected heap(s).
249    NoMemory,
250    /// The request is valid but cannot be satisfied, perhaps due to hardware
251    /// limitations. This happens if participants involved in this allocation
252    /// have incompatible constraints (empty intersection, roughly speaking).
253    /// See the log for more info. In cases where a participant could
254    /// potentially be treated as optional, see [`BufferCollectionTokenGroup`].
255    ///
256    /// This can also happen if there aren't enough buffers in a pre-existing
257    /// collection to satisfy an additional token (including sub-tree of derived
258    /// tokens) created with [`fuchsia.sysmem2/BufferCollection.AttachToken`].
259    ///
260    /// This can also happen if a client's node is under a group and a different
261    /// group child is selected instead.
262    ConstraintsIntersectionEmpty,
263    /// Allocation hasn't been attempted yet. Calling
264    /// [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`] would
265    /// (likely) block.
266    Pending,
267    /// Too many `BufferCollectionTokenGroup` child token selection combinations
268    /// exist and were considered, causing sysmem to give up on allocating
269    /// rather than enumerate the rest.
270    TooManyGroupChildCombinations,
271    #[doc(hidden)]
272    __SourceBreaking { unknown_ordinal: u32 },
273}
274
275/// Pattern that matches an unknown `Error` member.
276#[macro_export]
277macro_rules! ErrorUnknown {
278    () => {
279        _
280    };
281}
282
283impl Error {
284    #[inline]
285    pub fn from_primitive(prim: u32) -> Option<Self> {
286        match prim {
287            0 => Some(Self::Invalid),
288            1 => Some(Self::Unspecified),
289            2 => Some(Self::ProtocolDeviation),
290            3 => Some(Self::NotFound),
291            4 => Some(Self::HandleAccessDenied),
292            5 => Some(Self::NoMemory),
293            6 => Some(Self::ConstraintsIntersectionEmpty),
294            7 => Some(Self::Pending),
295            8 => Some(Self::TooManyGroupChildCombinations),
296            _ => None,
297        }
298    }
299
300    #[inline]
301    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
302        match prim {
303            0 => Self::Invalid,
304            1 => Self::Unspecified,
305            2 => Self::ProtocolDeviation,
306            3 => Self::NotFound,
307            4 => Self::HandleAccessDenied,
308            5 => Self::NoMemory,
309            6 => Self::ConstraintsIntersectionEmpty,
310            7 => Self::Pending,
311            8 => Self::TooManyGroupChildCombinations,
312            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
313        }
314    }
315
316    #[inline]
317    pub fn unknown() -> Self {
318        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
319    }
320
321    #[inline]
322    pub const fn into_primitive(self) -> u32 {
323        match self {
324            Self::Invalid => 0,
325            Self::Unspecified => 1,
326            Self::ProtocolDeviation => 2,
327            Self::NotFound => 3,
328            Self::HandleAccessDenied => 4,
329            Self::NoMemory => 5,
330            Self::ConstraintsIntersectionEmpty => 6,
331            Self::Pending => 7,
332            Self::TooManyGroupChildCombinations => 8,
333            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
334        }
335    }
336
337    #[inline]
338    pub fn is_unknown(&self) -> bool {
339        match self {
340            Self::__SourceBreaking { unknown_ordinal: _ } => true,
341            _ => false,
342        }
343    }
344}
345
346#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
347pub struct PixelFormatAndModifier {
348    /// When specified by a participant in a message to sysmem, this can be any
349    /// `PixelFormat` value that's acceptable to the participant. Specifying
350    /// `kInvalid` is not permitted.
351    ///
352    /// The participant can specify [`fuchsia.images2/PixelFormat.DO_NOT_CARE`]
353    /// if the participant needs to specify `ImageFormatConstraints` without
354    /// constraining the `pixel_format`.
355    pub pixel_format: fidl_fuchsia_images2__common::PixelFormat,
356    /// The participant can specify
357    /// [`fuchsia.images2/PixelFormatModifier.DO_NOT_CARE`] if the participant
358    /// needs to specify `ImageFormatConstraints` without constraining the
359    /// `pixel_format_modifier`.
360    pub pixel_format_modifier: fidl_fuchsia_images2__common::PixelFormatModifier,
361}
362
363impl fidl::Persistable for PixelFormatAndModifier {}
364
365#[derive(Clone, Debug, Default, PartialEq)]
366pub struct AllocatorSetDebugClientInfoRequest {
367    pub name: Option<String>,
368    pub id: Option<u64>,
369    #[doc(hidden)]
370    pub __source_breaking: fidl::marker::SourceBreaking,
371}
372
373impl fidl::Persistable for AllocatorSetDebugClientInfoRequest {}
374
375#[derive(Clone, Debug, Default, PartialEq)]
376pub struct AllocatorValidateBufferCollectionTokenRequest {
377    pub token_server_koid: Option<u64>,
378    #[doc(hidden)]
379    pub __source_breaking: fidl::marker::SourceBreaking,
380}
381
382impl fidl::Persistable for AllocatorValidateBufferCollectionTokenRequest {}
383
384#[derive(Clone, Debug, Default, PartialEq)]
385pub struct AllocatorValidateBufferCollectionTokenResponse {
386    pub is_known: Option<bool>,
387    #[doc(hidden)]
388    pub __source_breaking: fidl::marker::SourceBreaking,
389}
390
391impl fidl::Persistable for AllocatorValidateBufferCollectionTokenResponse {}
392
393/// Constraints on allocated buffers and, optionally, constraints on images
394/// stored in the buffers. These constraints can be specified per-participant.
395/// The sysmem service implements aggregation of constraints from multiple
396/// participants.
397#[derive(Clone, Debug, Default, PartialEq)]
398pub struct BufferCollectionConstraints {
399    /// The `usage` is a hint to sysmem to potentially help choose a more
400    /// optimal [`fuchsia.images2/PixelFormat`] and/or `pixel_format_modifier`
401    /// when multiple compatible options exist.
402    ///
403    /// When aggregating [`fuchsia.sysmem2/BufferCollectionConstraints`], these
404    /// values bitwise-OR.
405    ///
406    /// At least one `usage` bit must be specified (however, it's permitted for
407    /// a [`fuchsia.sysmem2/BufferCollection.SetConstraints`] request to have
408    /// the request `constraints` field not set, in which case `kNoneUsage` is
409    /// the default, along with no constraints from the participant).
410    ///
411    /// When `kNoneUsage` is specified it must be the only set bit, and no VMOs
412    /// will be sent in response to
413    /// [`fuchsia.sysmem2/BufferCollection.WaitForAllBuffersAllocated`].
414    pub usage: Option<BufferUsage>,
415    /// Per-participant number of buffers that the participant may concurrently
416    /// hold for its exclusive use for more than a transient duration (camp on).
417    /// In this context, a "transient" duration is the time it takes to finish
418    /// running a small amount of non-blocking code that finishes transfering
419    /// away ownership of the buffer. Things like reading from storage, waiting
420    /// on hardware that isn't already known to be done, or doing things like
421    /// frame encode or decode are not considered transient durations, even if
422    /// they might sometimes complete quickly.
423    ///
424    /// For example, a video decoder would specify (at least) the maximum number
425    /// of reference frames + 1 frame currently being decoded into. But not 1
426    /// more for the code that runs async and quickly to deliver a previously
427    /// decoded frame, even though that frame can potentially be owned for a
428    /// transient duration concurrent with decode of the next frame.
429    ///
430    /// A participant must not camp on more buffers than specified here (except
431    /// for a transient duration) else processing may get stuck.
432    ///
433    /// When aggregating BufferCollectionConstraints, these values add.
434    ///
435    /// In testing scenarios, camping on more buffers than this for any
436    /// significant duration (one screen refresh period is "significant" in this
437    /// context) may (ideally will) be flagged as a failure.  In testing
438    /// scenarios, the participant may not be provided with more buffers than
439    /// this concurrently.
440    pub min_buffer_count_for_camping: Option<u32>,
441    /// Per-participant minimum number of buffers that are needed for slack
442    /// reasons, for better overlap of processing / better performance.
443    ///
444    /// When aggregating `BufferCollectionConstraints`, these values add.
445    ///
446    /// A participant should typically specify 0 or 1 here - typically 0 is
447    /// appropriate if `min_buffer_count_for_camping` is already enough to keep
448    /// the participant busy 100% of the time when the participant is slightly
449    /// behind, while 1 can be appropriate if 1 more buffer than strictly needed
450    /// for min-camping reasons gives enough slack to stay busy 100% of the time
451    /// (when slightly behind, vs. lower % without the extra buffer).
452    ///
453    /// In testing scenarios, this field may be forced to 0, and all
454    /// participants are expected to continue to work without getting stuck. If
455    /// a buffer is needed for forward progress reasons, that buffer should be
456    /// accounted for in `min_buffer_count_for_camping`.
457    pub min_buffer_count_for_dedicated_slack: Option<u32>,
458    /// Similar to `min_buffer_count_for_dedicated_slack`, except when
459    /// aggregating these values max (instead of add). The value here is not
460    /// shared with any participant's `min_buffer_count_for_dedicated_slack`.
461    ///
462    /// A participant can specify > 0 here if a participant would like to ensure
463    /// there's some slack overall, but doesn't need that slack to be dedicated.
464    ///
465    /// The choice whether to use `min_buffer_count_for_dedicated_slack` or
466    /// `min_buffer_count_for_shared_slack` (or both) will typically be about
467    /// the degree to which the extra slack improves performance.
468    ///
469    /// In testing scenarios, this field may be forced to 0, and all
470    /// participants are expected to continue to work without getting stuck. If
471    /// a buffer is needed for forward progress reasons, that buffer should be
472    /// accounted for in `min_buffer_count_for_camping`.
473    pub min_buffer_count_for_shared_slack: Option<u32>,
474    /// A particularly-picky participant may unfortunately need to demand a
475    /// tight range of `buffer_count`, or even a specific `buffer_count`. This
476    /// field should remain 0 unless a participant really must set this field to
477    /// constrain the overall `BufferCollectionInfo.buffer_count`. Any such
478    /// participant should still fill out the min_buffer_count_for_* fields as
479    /// appropriate.
480    ///
481    /// If this field is un-set, the logical `min_buffer_count` is 0.
482    pub min_buffer_count: Option<u32>,
483    /// A particularly-picky participant may unfortunately need to demand a
484    /// tight range of `buffer_count`, or even a specific `buffer_count`. This
485    /// field should remain 0 unless a participant really must set this field to
486    /// constrain the overall `BufferCollectionInfo.buffer_count`. Any such
487    /// participant should still fill out the min_buffer_count_for_* fields.
488    ///
489    /// If this field is un-set, the logical `max_buffer_count` is 0xFFFFFFFF.
490    pub max_buffer_count: Option<u32>,
491    /// Optional constraints on `BufferCollectionSettings.buffer_settings`.
492    ///
493    /// A participant that intends to set `image_format_constraints` will
494    /// typically specify the minimum buffer size implicitly via
495    /// `image_format_constraints`, and possibly specify only the max buffer
496    /// size via `buffer_memory_constraints`.
497    ///
498    /// If un-set, the client is specifying "don't care" re. any buffer memory
499    /// constraints.
500    pub buffer_memory_constraints: Option<BufferMemoryConstraints>,
501    /// Optional constraints on the image format parameters of an image stored
502    /// in a buffer of the collection. This includes
503    /// [`fuchsia.images2/PixelFormat`] and `pixel_format_modifier` (for tiling
504    /// and the like). These constraints can be specified separately per
505    /// `pixel_format` `pixel_format_modifier` pair. Duplicated `pixel_format`
506    /// `pixel_format_modifier` pairs aren't permitted.
507    ///
508    /// When aggregating, only `pixel_format` `pixel_format_modifier` pairs that
509    /// are specified by all participants with non-zero
510    /// `image_format_constraints` size (and non-null)
511    /// BufferCollectionConstraints) are retained.
512    ///
513    /// A participant can specify `pixel_format`
514    /// [`fuchsia.images2/PixelFormat.DO_NOT_CARE`] and/or
515    /// `pixel_format_modifier`
516    /// [`fuchsia.images2/PixelFormatModifier.DO_NOT_CARE`] to permit any value
517    /// to be selected, but at least one participant must specify a specific
518    /// format for overall allocation to succeed.
519    ///
520    /// In a SetConstraints message, un-set or zero length means no image format
521    /// constraints; a raw buffer can be allocated if no other participants
522    /// specify any `image_format_constraints` entries.
523    pub image_format_constraints: Option<Vec<ImageFormatConstraints>>,
524    #[doc(hidden)]
525    pub __source_breaking: fidl::marker::SourceBreaking,
526}
527
528impl fidl::Persistable for BufferCollectionConstraints {}
529
530#[derive(Clone, Debug, Default, PartialEq)]
531pub struct BufferCollectionTokenDuplicateSyncRequest {
532    pub rights_attenuation_masks: Option<Vec<fidl::Rights>>,
533    #[doc(hidden)]
534    pub __source_breaking: fidl::marker::SourceBreaking,
535}
536
537impl fidl::Persistable for BufferCollectionTokenDuplicateSyncRequest {}
538
539#[derive(Clone, Debug, Default, PartialEq)]
540pub struct BufferCollectionTokenGroupCreateChildrenSyncRequest {
541    pub rights_attenuation_masks: Option<Vec<fidl::Rights>>,
542    #[doc(hidden)]
543    pub __source_breaking: fidl::marker::SourceBreaking,
544}
545
546impl fidl::Persistable for BufferCollectionTokenGroupCreateChildrenSyncRequest {}
547
548#[derive(Clone, Debug, Default, PartialEq)]
549pub struct BufferMemoryConstraints {
550    /// un-set is treated as 1
551    pub min_size_bytes: Option<u64>,
552    /// un-set is treated as 0xFFFFFFFFFFFFFFFF.
553    pub max_size_bytes: Option<u64>,
554    /// When false, physical pages of a buffer VMO can be non-contiguous. When
555    /// true, physical pages of a buffer VMO must be sequentially contiguous. A
556    /// client that doesn't require physically contiguous VMOs must still accept
557    /// physically contiguous VMOs or "physical" VMOs.
558    pub physically_contiguous_required: Option<bool>,
559    /// If true, the participant requires secure memory.
560    ///
561    /// When aggregating `BufferCollectionConstraints`, these values boolean-OR.
562    pub secure_required: Option<bool>,
563    /// When true (or when `BufferMemoryConstraints` is not present), the
564    /// participant is ok with sysmem selecting the CPU domain.
565    ///
566    /// If the CPU domain is selected, participants must ensure the CPU can read
567    /// or write data to the buffer without cache operations outside of the
568    /// participant.
569    ///
570    /// In other words, if a producer participant DMAs data directly to RAM on a
571    /// non-cache-coherent architecture such as arm, the producer must ensure
572    /// the CPU cache is clean wrt. the buffer before the DMA write, and
573    /// invalidate the CPU cache after the DMA write and before indicating that
574    /// the buffer is ready to any other participant. If a consumer participant
575    /// DMAs data directly from RAM on a non-cache-coherent architecture such as
576    /// arm, the consumer must flush the CPU cache wrt the buffer before the DMA
577    /// read.
578    ///
579    /// CPU-only participants that don't do any DMA can just write and read the
580    /// buffers (when they should) without needing to do any CPU cache ops.
581    pub cpu_domain_supported: Option<bool>,
582    /// When true, the participant is ok with sysmem selecting the RAM domain.
583    ///
584    /// If the RAM domain is selected, producer data must be available in RAM
585    /// (with CPU cache state such that the RAM data won't get corrupted by a
586    /// dirty CPU cache line writing incorrect data to RAM), and a consumer
587    /// reading using the CPU must invalidate CPU cache before reading (the
588    /// producer doesn't guarantee zero stale "clean" cache lines).
589    ///
590    /// In other words, if a producer participant uses the CPU to write data on
591    /// a non-cache-coherent architecture such as arm, the producer must flush
592    /// the data to RAM before indicating to another participant that the buffer
593    /// is ready. If a consumer participant uses the CPU to read data on a
594    /// non-cache-coherent architecture such as arm, the participant must
595    /// invalidate (typically flush+invalidate with knowledge that no cache
596    /// lines are dirty) the CPU cache before reading the buffer.
597    ///
598    /// RAM-only participants that don't do any CPU accesses to a buffer can
599    /// just do DMA to/from the buffers (when they should) without needing to
600    /// do any CPU cache ops.
601    pub ram_domain_supported: Option<bool>,
602    /// When true, the participant is ok with sysmem selecting the INACCESSIBLE
603    /// domain.
604    ///
605    /// If the INACCESSIBLE domain is selected, CPU reads and writes of the data
606    /// are prevented. Attempts to read/write the data with the CPU may result
607    /// in UB and/or process termination.
608    ///
609    /// If the INACCESSIBLE domain is selected, participants must only operate
610    /// on the data using DMAs performed by HW, or platform-specific DMA-like
611    /// requests to a secure environment (which will do the needed CPU cache ops
612    /// similar to how a RAM domain participant would operate).
613    ///
614    /// Secure heaps only support INACCESSIBLE domain, and will fail allocation
615    /// if any participant with `BufferUsage` other than `NONE_USAGE` does not
616    /// set inaccessible_domain_supported to true.
617    ///
618    /// When the INACCESSIBLE domain is selected, participants (outside of
619    /// secure/DRM environments) should not attempt to map buffers, and should
620    /// not attempt to perform any CPU cache ops. In this respect, this domain
621    /// is similar to RAM domain with all participants only doing DMA and no
622    /// participant(s) doing CPU accesses.
623    pub inaccessible_domain_supported: Option<bool>,
624    /// Which heaps are acceptable to the participant. Participants that don't
625    /// care which heap memory is allocated on should leave this field un-set. A
626    /// secure heap is only selected if all participants explicitly indicate
627    /// that the secure heap is acceptable via `heap_permitted`, or specify
628    /// `NONE_USAGE`.
629    pub permitted_heaps: Option<Vec<Heap>>,
630    #[doc(hidden)]
631    pub __source_breaking: fidl::marker::SourceBreaking,
632}
633
634impl fidl::Persistable for BufferMemoryConstraints {}
635
636/// These are memory-related settings for all buffers of a buffer collection.
637#[derive(Clone, Debug, Default, PartialEq)]
638pub struct BufferMemorySettings {
639    /// This field will always be set by sysmem.
640    pub size_bytes: Option<u64>,
641    /// This field will always be set by sysmem.
642    pub is_physically_contiguous: Option<bool>,
643    /// This field will always be set by sysmem.
644    pub is_secure: Option<bool>,
645    /// This field will always be set by sysmem.
646    pub coherency_domain: Option<CoherencyDomain>,
647    /// The specific heap from which buffers are allocated.
648    ///
649    /// This field will always be set by sysmem.
650    pub heap: Option<Heap>,
651    #[doc(hidden)]
652    pub __source_breaking: fidl::marker::SourceBreaking,
653}
654
655impl fidl::Persistable for BufferMemorySettings {}
656
657/// Describes how a client will access the contents of a buffer.
658#[derive(Clone, Debug, Default, PartialEq)]
659pub struct BufferUsage {
660    /// If the client sets this field, the client should not set any other
661    /// fields in the same table instance. The only valid bit in this field is
662    /// `NONE_USAGE` which must be set if this field is set. The point of this
663    /// field and the one bit set in this field is to essentially prove that the
664    /// client really means they aren't going to use the buffers, so don't need
665    /// any VMOs (didn't just fail to fill out the table).
666    pub none: Option<u32>,
667    /// If set, holds CPU usage bits. See `CPU_USAGE_*` flags in usages.fidl.
668    pub cpu: Option<u32>,
669    /// If set, holds vulkan usage bits. See `VULKAN_IMAGE_*` and
670    /// `VULKAN_BUFFER_*` bits in usages.fidl. The `VULKAN_USAGE_*` bit
671    /// definitions/names are deprecated.
672    pub vulkan: Option<u32>,
673    /// If set, holds display usage bits. See `DISPLAY_USAGE_*` bits in
674    /// usages.fidl.
675    pub display: Option<u32>,
676    /// If set, holds video usage bits. See `VIDEO_USAGE_*` bits in usages.fidl.
677    pub video: Option<u32>,
678    #[doc(hidden)]
679    pub __source_breaking: fidl::marker::SourceBreaking,
680}
681
682impl fidl::Persistable for BufferUsage {}
683
684/// This type is fidl::Persist()'ed in the sysmem_config.persistent_fidl file
685/// within the sysmem domain config by the assembly tool, and read by the sysmem
686/// driver.
687///
688/// Normally json[5] would be preferable for config, but we generate this config
689/// in rust using FIDL types (to avoid repetition and to take advantage of FIDL
690/// rust codegen), and there's no json schema for FIDL types.
691///
692/// Currently there is no mechanism to change anything in this config at runtime
693/// or from boot to boot. This config is static per run of the assembly tool.
694///
695/// See src/lib/assembly/config_schema/src/platform_config/sysmem_config.rs for
696/// aspects of sysmem config which are specified directly inline in board info
697/// or assembly platform config. The two parts of sysmem config don't
698/// (currently) overlap. The config here is for aspects of sysmem config which
699/// would be too verbose for direct inclusion in board info or assembly platform
700/// config. In addition, some/most of the pixel format cost entries are
701/// programmatically generated (as of this comment).
702///
703/// Prior to aggregation by assembly tool, there are multiple .persistent_fidl
704/// files each storing its own Config instance. The board info and assembly
705/// platform config lists the input persistent_fidl files, with board info
706/// logically before assembly platform config. The overall list of files is
707/// processed, which allows later files to override/replace info in prior files.
708///
709/// Because this type is only intended for use with persistent fidl, where the
710/// length of a serialized instance isn't bounded, we don't bound the internal
711/// vector element counts.
712#[derive(Clone, Debug, Default, PartialEq)]
713pub struct Config {
714    /// This is the ordered list of FormatCost entries which will be considered
715    /// by sysmem when breaking ties among formats supported by all participants
716    /// of a buffer collection.
717    ///
718    /// During config aggregation, if a later entry has matching FormatCostKey,
719    /// the earlier entry is omitted/removed. This allows later files to
720    /// override entries in earlier files, and allows files specified in
721    /// assembly platform config to override entries in files specified in the
722    /// board info.
723    ///
724    /// This vector will normally not have any two entries with matching
725    /// pixel_format, pixel_format_modifier, and buffer_usage_bits in the Config
726    /// instance loaded from sysmem_config.persistent_fidl by sysmem. If somehow
727    /// two entries do match in those fields, sysmem can ignore all but one of
728    /// the entries chosen arbitrarily.
729    pub format_costs: Option<Vec<FormatCostEntry>>,
730    #[doc(hidden)]
731    pub __source_breaking: fidl::marker::SourceBreaking,
732}
733
734impl fidl::Persistable for Config {}
735
736#[derive(Clone, Debug, Default, PartialEq)]
737pub struct DynamicSecureHeap {
738    pub heap: Option<Heap>,
739    #[doc(hidden)]
740    pub __source_breaking: fidl::marker::SourceBreaking,
741}
742
743impl fidl::Persistable for DynamicSecureHeap {}
744
745/// A FormatCostEntry can be used to influence which PixelFormatAndModifier is
746/// chosen for a buffer collection, optionally taking BufferUsage into account.
747///
748/// The default cost is f32::MAX, so any specified cost with a non-MAX value
749/// will prefer the specified format over any formats that don't have any
750/// FormatCost entry.
751///
752/// Entries which have the same pixel_format, pixel_format_modifier, and
753/// required_usage_bits as a previous entry will override that previous entry.
754/// For matching purposes, an absent pixel_format_modifier matches LINEAR, and
755/// an absent required_buffer_usage_bits matches all-0 usage bits.
756///
757/// Board info sysmem_defaults entries are logically before platform sysmem
758/// entries.
759///
760/// Sysmem uses the resulting aggregated list of FormatCostEntry(s) when
761/// breaking ties among the set of formats which are supported by all
762/// participants of a buffer collection. For each mutually-supported format,
763/// entries with non-matching format are ignored, and entries with extra
764/// buffer_usage_bits set are ignored. Among the remaining entries, the entry
765/// with the most usage bits in common with the aggregated participant usages is
766/// selected to determine the cost (if a tie, the later entry wins). Then the
767/// format with the lowest cost is chosen. If it's still a tie (equal cost), the
768/// tie is broken arbitrarily but not randomly.
769///
770/// This is not intended as a mechanism to disallow selection of a format that
771/// is supported by all participants of a buffer collection. If a participant
772/// claims support for a format but fails to handle that format correctly, it
773/// should be fixed to handle that format correctly or changed to stop claiming
774/// support for that format.
775///
776/// This mechanism is intended to influence format selection toward more
777/// efficient formats with better performance, lower memory bandwidth usage,
778/// etc, for a given set of usage bits, taking into account quirks that may be
779/// unique to a given board or overall platform config.
780#[derive(Clone, Debug, Default, PartialEq)]
781pub struct FormatCostEntry {
782    /// Must be set. If two entries have logically equal key (after field
783    /// defaults are applied), the later entry will override the earlier entry.
784    pub key: Option<FormatCostKey>,
785    /// Must be set. Lower costs win, but see also FormatCostKey fields re.
786    /// filtering entries by format and usage bits first.
787    ///
788    /// When two entries (each with format supported by all the participants of
789    /// a buffer collection) have different costs, the lower cost entry (and its
790    /// format) is chosen.
791    ///
792    /// For non-test scenarios, only use cost values > 0.0 (typically at least
793    /// 1.0 as of this comment), with 0.0 and negative values reserved for
794    /// testing.
795    pub cost: Option<f32>,
796    #[doc(hidden)]
797    pub __source_breaking: fidl::marker::SourceBreaking,
798}
799
800impl fidl::Persistable for FormatCostEntry {}
801
802/// Entries which have the same pixel_format, pixel_format_modifier, and
803/// required_usage_bits as a previous entry will override that previous entry.
804/// For matching purposes, an absent pixel_format_modifier matches LINEAR, and
805/// an absent required_buffer_usage_bits matches all-0 usage bits.
806#[derive(Clone, Debug, Default, PartialEq)]
807pub struct FormatCostKey {
808    /// The pixel_format and pixel_format_modifier are the format to which this
809    /// FormatCost entry applies.
810    ///
811    /// Must be set.
812    pub pixel_format: Option<fidl_fuchsia_images2__common::PixelFormat>,
813    /// The pixel_format and pixel_format_modifier are the format to which this
814    /// FormatCost entry applies.
815    ///
816    /// Un-set is equivalent to LINEAR.
817    pub pixel_format_modifier: Option<fidl_fuchsia_images2__common::PixelFormatModifier>,
818    /// If set, this entry is only considered if the buffer collection has at
819    /// least these usage bits set.
820    ///
821    /// The buffer collection has an aggregated BufferUsage which is the union
822    /// of per-participant BufferUsage bits. FormatCost entries with additional
823    /// set bits are ignored. Among the rest, the one with matching format and
824    /// the most usage bits set determines the cost of that format for that
825    /// buffer collection.
826    ///
827    /// Then the lowest-cost format is chosen for that buffer collection among
828    /// the formats that are mutually suppored by all the participants of that
829    /// buffer collection.
830    ///
831    /// The main intent of this field is to allow "waving off" a format that
832    /// works, but doesn't perform well, for a particular combination of usages.
833    /// In that case the cost can be set high when the problematic combination
834    /// of usage bits is set. The format will still be chosen if this format is
835    /// the only mutually-supported format among the participants of the buffer
836    /// collection.
837    ///
838    /// Un-set is equivalent to zero usage bits set, meaning the entry applies
839    /// to the format unless another entry with more specific usage applies.
840    ///
841    /// It can be reasonable in some cases for all entries to omit this field,
842    /// when/if format selection based on format cost alone, ignoring usage, is
843    /// sufficient.
844    pub buffer_usage_bits: Option<BufferUsage>,
845    #[doc(hidden)]
846    pub __source_breaking: fidl::marker::SourceBreaking,
847}
848
849impl fidl::Persistable for FormatCostKey {}
850
851/// This is the root of the persistent fidl in a format costs file. The format
852/// costs files are read by the assembly tool and merged into the single
853/// sysmem_config.persistent_fidl file in the sysmem domain config (see Config
854/// above).
855///
856/// Normally json[5] would be preferable for config, but we generate this config
857/// in rust using FIDL types (to avoid repetition and to take advantage of FIDL
858/// rust codegen), and there's no json schema for FIDL types.
859///
860/// While the resulting sysmem_config.persistent_fidl is a single file that can
861/// contain multiple aspects of sysmem config, in contrast a format costs file
862/// contains only format costs. We don't mind having more separate files during
863/// the build, but it's nice to get sysmem's domain config down to a single file
864/// on-device.
865#[derive(Clone, Debug, Default, PartialEq)]
866pub struct FormatCosts {
867    /// This is a chunk of entries that'll end up in
868    /// ['fuchsia.sysmem2.Config.format_costs'] (see above) unless overriden by
869    /// later entries (either in this same vector or in later-processed files
870    /// during aggregation by the assembly tool).
871    pub format_costs: Option<Vec<FormatCostEntry>>,
872    #[doc(hidden)]
873    pub __source_breaking: fidl::marker::SourceBreaking,
874}
875
876impl fidl::Persistable for FormatCosts {}
877
878/// A reference to a heap instance.
879///
880/// A given heap instance can have more than one `Heap` which can be used to
881/// refer to the heap instance. Comparing `Heap` tables without knowledge of
882/// these `Heap` aliases is not a reliable way to determine if two `Heap` tables
883/// refer to the same heap (matching means yes, but not matching means maybe).
884/// Allowing heap aliases makes renaming `Heap.type`(s) easier.
885#[derive(Clone, Debug, Default, PartialEq)]
886pub struct Heap {
887    /// The type of the heap, specified using a bind string defined per the
888    /// schema and mechanism described in comments in the
889    /// fuchsia.sysmem.heap.bind file.
890    ///
891    /// Examples:
892    /// * "fuchsia.sysmem.heap.HEAP_TYPE.SYSTEM_RAM"
893    /// * "fuchsia.goldfish.platform.sysmem.heap.HEAP_TYPE.HOST_VISIBLE"
894    pub heap_type: Option<String>,
895    /// The uint64 id of the heap. This is only required to be unique per (type,
896    /// boot) tuple. In other words, a given heap id is only meaningful within
897    /// the current boot of the machine (not across boots), and only within the
898    /// `Heap.type`.
899    ///
900    /// For `Heap.type`(s) that refer to a singleton heap, a participant
901    /// specifying the singleton heap in
902    /// [`fuchsia.sysmem2.BufferMemoryConstraints.permitted_heaps`] can leave
903    /// this field un-set, or set it to zero. Sysmem will always fill out this
904    /// field for the heap indicated in
905    /// [`fuchsia.sysmem2.BufferMemmorySettings.heap`] (for a singleton heap the
906    /// `id` field will be set to 0 by sysmem).
907    pub id: Option<u64>,
908    #[doc(hidden)]
909    pub __source_breaking: fidl::marker::SourceBreaking,
910}
911
912impl fidl::Persistable for Heap {}
913
914/// Describes constraints on layout of image data in buffers.
915#[derive(Clone, Debug, Default, PartialEq)]
916pub struct ImageFormatConstraints {
917    /// The [`fuchsia.images2/PixelFormat`] for which the following constraints
918    /// apply.
919    ///
920    /// The `pixel_format` and `pixel_format_modifier` fields together are
921    /// treated by the server as one additional `pixel_format_and_modifiers`
922    /// entry.
923    ///
924    /// A participant may have more than one
925    /// [`fuchsia.sysmem2/PixelFormatAndModifier`] that's supported.
926    ///
927    /// * If image constraints are the same for different
928    ///   `PixelFormatAndModifier`s, the participant may list additional
929    ///   `PixelFormatAndModifier`s for which the constraints apply in the
930    ///   `pixel_format_and_modifiers` field. This reduces the overall number of
931    ///   `ImageFormatConstraints` that need to be sent, without changing the
932    ///   meaning (vs for example sending a bunch of separate
933    ///   `ImageFormatConstraints` that only differ by the `pixel_format` and
934    ///   `pixel_format_modifier` which overall specify the same list of
935    ///   `PixelFormatAndModifier`s).
936    /// * If image constraints differ for different `PixelFormatAndModifier`s,
937    ///   the participant can convey this using a separate
938    ///   `ImageFormatConstraints` entry in `image_format_constraints` for each
939    ///   set of `PixelFormatAndModifier`s that have different image
940    ///   constraints.
941    /// * It's ok for a participant to have two `image_format_constraints`
942    ///   entries that only differ in their pixel_format_and_modifiers, but this
943    ///   is isn't the most compact way to represent that situation since the
944    ///   two entries could be combined by specifying two
945    ///   `PixelFormatAndModifier`s within a single `ImageFormatConstraints`.
946    ///
947    /// It's not uncommon for the other fields of `ImageFormatConstraints` to
948    /// vary by `pixel_format` or by `pixel_format_modifier` - for example for a
949    /// linear format to support smaller max size than a tiled format.
950    ///
951    /// See also
952    /// [`fuchsia.sysmem2/ImageFormatConstraints.pixel_format_and_modifiers`].
953    ///
954    /// Thie field must be set to a value other than
955    /// [`fuchsia.images2/PixelFormat.INVALID`] unless
956    /// `pixel_format_and_modifiers` is non-empty. In other words, there must be
957    /// at least one `PixelFormatAndModifier` per `ImageFormatConstraints`. If
958    /// `pixel_format_modifier` is set, this field must also be set.
959    ///
960    /// The participant can specify [`fuchsia.images2/PixelFormat.DO_NOT_CARE`]
961    /// if the participant needs to specify `ImageFormatConstraints` without
962    /// constraining the `pixel_format`.
963    pub pixel_format: Option<fidl_fuchsia_images2__common::PixelFormat>,
964    /// The pixel format modifier for which the following constraints apply.
965    ///
966    /// The `pixel_format` and `pixel_format_modifier` fields together are
967    /// treated by the server as one additional `pixel_format_and_modifiers`
968    /// entry.
969    ///
970    /// This is a [`fuchsia.images2/PixelFormatModifier`] that's acceptable to
971    /// the participant in combination with the `pixel_format`.
972    ///
973    /// See also `pixel_format_and_modifiers`.
974    ///
975    /// If `pixel_format` is set but `pixel_format_modifier` is un-set, the
976    /// default depends on other fields:
977    ///
978    /// * If `pixel_format` is [`fuchsia.images2/PixelFormat.DO_NOT_CARE`], the
979    ///   pixel format modifier is implicitly
980    ///   [`fuchsia.images2/PixelFormatModifier.DO_NOT_CARE`].
981    /// * else if `BufferCollectionConstraints.usage` isn't `NONE`, the pixel
982    ///   format modifier is implicitly
983    ///   [`fuchsia.images2/PixelFormatModifier.LINEAR`].
984    /// * else the pixel format modifier is implicitly
985    ///   [`fuchsia.images2/PixelFormatModifier.DO_NOT_CARE`].
986    pub pixel_format_modifier: Option<fidl_fuchsia_images2__common::PixelFormatModifier>,
987    /// Empty is an error. Duplicate entries are an error. Arbitrary ordering is
988    /// not an error.
989    ///
990    /// The client can specify a single entry
991    /// [`fuchsia.sysmem2/ColorSpace.DO_NOT_CARE`] if the client doesn't want to
992    /// constrain which `ColorSpace` is chosen. At least one participant must
993    /// specify at least one `ColorSpace` value other than
994    /// `ColorSpace.DO_NOT_CARE`, or allocation will fail.
995    pub color_spaces: Option<Vec<fidl_fuchsia_images2__common::ColorSpace>>,
996    /// Minimum permitted size in pixels.
997    ///
998    /// For example a video decoder participant may set this field to the
999    /// minimum size that might potentially be specified by a stream. In
1000    /// contrast, `required_min_size` would be set to the current size specified
1001    /// by the stream. While `min_size` aggregates by taking the max,
1002    /// `required_min_size` aggregates by taking the min.
1003    ///
1004    /// When sending to sysmem, this field can be un-set if the participant is
1005    /// prepared to deal with the smallest possible non-zero image layout
1006    /// limited only by the constraints implicitly imposed by the `pixel_format`
1007    /// and `pixel_format_modifier`. Or this field can be set to the actual
1008    /// minimum size the participant can handle.
1009    ///
1010    /// Producers should set `min_size` and set both width and height to the
1011    /// actual non-zero smallest width and height that the producer might
1012    /// generate. For example, a video decoder can set the size of a single
1013    /// macroblock here.
1014    ///
1015    /// When receiving from sysmem, this field will always be set, and neither
1016    /// width nor height will be 0, because at least one participant must
1017    /// specify a non-zero minimum size (where both width and height aren't
1018    /// zero).
1019    ///
1020    /// See also `required_min_size`.
1021    pub min_size: Option<fidl_fuchsia_math__common::SizeU>,
1022    /// Maximum size in pixels. For example Scenic may set this field (directly
1023    /// or via sub-participants) to the maximum size that can be composited.
1024    ///
1025    /// Sending to sysmem, un-set is treated as 0xFFFFFFFF, 0xFFFFFFFF.
1026    ///
1027    /// Receiving from sysmem, this field will always be set. For width and
1028    /// height separately, if there is no enforced max, that sub-field will be
1029    /// 0xFFFFFFFF.
1030    ///
1031    /// See also `required_max_size`.
1032    pub max_size: Option<fidl_fuchsia_math__common::SizeU>,
1033    /// The minimum number of bytes per row, including any padding beyond the
1034    /// last image data in a row.
1035    ///
1036    /// This is sometimes called the "stride in bytes" or the "line to line
1037    /// offset". For single-plane formats, this is the number of bytes per row
1038    /// of pixels. For multi-plane formats, this is the number of bytes per row
1039    /// of samples in plane 0 (for example, the number of bytes per row of luma
1040    /// samples in the case of a multi-plane YUV format). For multi-plane
1041    /// formats, the bytes per row in planes other than plane 0 is format
1042    /// specific, but always a specific relationship to the plane 0 bytes per
1043    /// row.
1044    ///
1045    /// When sending `ImageFormatConstraints` to sysmem, setting this field is
1046    /// optional. Not setting this field is recommended unless the participant
1047    /// needs to force the `bytes_per_row` to be larger than the minimum value
1048    /// implied by `min_size.width`, the "stride bytes per width pixel" of the
1049    /// `pixel_format` plus `pixel_format_modifier` (see also
1050    /// `ImageFormatStrideBytesPerWidthPixel`), and `bytes_per_row_divisor`.
1051    ///
1052    /// When this structure is received from sysmem, this field will always be
1053    /// set (when the parent structure is present), and will always be at least
1054    /// the value implied by `min_size.width`, the "stride bytes per width
1055    /// pixel" of the `pixel_format` plus `pixel_format_modifier`, and
1056    /// `bytes_per_row_divisor`.
1057    ///
1058    /// Some producer participants may prefer to simply set
1059    /// `ImageFormat.bytes_per_row` to
1060    /// `ImageFormatConstraints.min_bytes_per_row` since sysmem is guaranteeing
1061    /// that `min_bytes_per_row` is compatible with an image of width
1062    /// `min_size.width`. However, producer participants that need to have
1063    /// `size.width` > `min_size.width` can get a corresponding
1064    /// `min_bytes_per_row` from `ImageFormatMinimumRowBytes` (in C++), or can
1065    /// just calculate the `bytes_per_row` directly.
1066    pub min_bytes_per_row: Option<u32>,
1067    /// The maximum number of bytes per row, including any padding beyond the
1068    /// last image data in a row.
1069    ///
1070    /// When sent to sysmem, must be >= the value implied by `max_size.width`,
1071    /// "stride bytes per width pixel", and `bytes_per_row_divisor`, or
1072    /// constraints aggregation will fail. Un-set means the participant doesn't
1073    /// need/want to set a strict max.
1074    ///
1075    /// Sending to sysmem, un-set is treated as 0xFFFFFFFF.
1076    ///
1077    /// When received from sysmem, this field will always be set. If the max is
1078    /// effectively infinite, the value will be 0xFFFFFFFF (not zero).
1079    pub max_bytes_per_row: Option<u32>,
1080    /// The maximum number of pixels.
1081    ///
1082    /// The max image area in pixels is limited indirectly via
1083    /// [`fuchsia.sysmem/BufferMemoryConstraints.max_size_bytes`] and the
1084    /// resulting [`fuchsia.sysmem/BufferSettings.size_bytes`], and can also be
1085    /// enforced directly via this field.
1086    ///
1087    /// In contrast to the [`fuchsia.sysmem2/ImageFormatConstraints.max_size`]
1088    /// field which limits width and height separately, this field limits the
1089    /// total number of pixels.
1090    ///
1091    /// In contrast to
1092    /// [`fuchsia.sysmem/BufferMemoryConstraints.max_size_bytes`], this field
1093    /// doesn't limit the number of non-pixel padding bytes after each row of
1094    /// pixels, and doesn't limit the number of non-pixel bytes in the case of
1095    /// tiled `pixel_format_modifier`.
1096    ///
1097    /// Very narrow or very short image aspect ratios can have worse performance
1098    /// per pixel in comparison to more typical aspect ratios. Padding and/or
1099    /// memory bandwidth overheads tend to increase for extreme aspect ratios.
1100    /// Participants can indicate lack of support for very narrow or very short
1101    /// dimensions using ['fuchsia.sysmem/ImageFormatConstraints.min_size`].
1102    ///
1103    /// Sending to sysmem, un-set is treated as 0xFFFFFFFF.
1104    ///
1105    /// Receiving from sysmem, this field will always be set, and can be set to
1106    /// 0xFFFFFFFF.
1107    pub max_width_times_height: Option<u64>,
1108    /// Alignment requirements on the image `size`.
1109    ///
1110    /// * `size.width % size_alignment.width` must be 0.
1111    /// * `size.height % size_alignment.height` must be 0.
1112    ///
1113    /// Un-set is treated as 1, 1.
1114    pub size_alignment: Option<fidl_fuchsia_math__common::SizeU>,
1115    /// Alignment requirements on `display_rect`.
1116    ///
1117    /// * `display_rect.x % display_rect_alignment.width` must be 0.
1118    /// * `display_rect.y % display_rect_alignment.height` must be 0.
1119    /// * `display_rect.width % display_rect_alignment.width` must be 0.
1120    /// * `display_rect.height % display_rect_alignment.height` must be 0.
1121    ///
1122    /// Un-set is treated as 1, 1.
1123    pub display_rect_alignment: Option<fidl_fuchsia_math__common::SizeU>,
1124    /// These fields can be used to ensure the aggregated constraints have
1125    /// `min_size` and `max_size` such that both `required_min_size` and
1126    /// `required_max_size` (and anything in between that satisfies alignment
1127    /// requirements) are permitted values of `ImageFormat.size`.
1128    ///
1129    /// For example, a producer video decoder doesn't want to constrain the
1130    /// allowed `ImageFormat.size`, as a compressed stream can change dimensions
1131    /// mid-stream, but the producer video decoder needs to ensure that the
1132    /// aggregated constraints allow for at least the current dimensions of
1133    /// uncompressed frames at the current position in the stream.
1134    ///
1135    /// As another example, an initiator that's intending to decode video may
1136    /// know what the maximum expected size of frames in the stream(s) can be,
1137    /// so by setting `required_max_size`, can ensure that the allocated buffers
1138    /// are large enough to support that max `size`. In addition on successful
1139    /// allocation the initiator also knows that the consumer participants are
1140    /// ok with receiving up to that max `size`.
1141    ///
1142    /// It's much more common for a producer or initiator to set these fields
1143    /// than for a consumer to set these fields.
1144    ///
1145    /// While `min_size` and `max_size` aggregate by effectively taking the
1146    /// intersection, the `required_min_size` and `required_max_size` aggregate
1147    /// by effectively taking the union.
1148    ///
1149    /// This field aggregates by taking the min per component, and
1150    /// required_max_size aggregates by taking the max per component.
1151    ///
1152    /// Un-set is treated as 0xFFFFFFFF, 0xFFFFFFFF.
1153    pub required_min_size: Option<fidl_fuchsia_math__common::SizeU>,
1154    /// See also `required_min_size`. Un-set is treated as 0, 0.
1155    pub required_max_size: Option<fidl_fuchsia_math__common::SizeU>,
1156    /// `fuchsia_images2.ImageFormat.bytes_per_row % bytes_per_row_divisor` must
1157    /// be 0. Un-set is treated as 1.
1158    ///
1159    /// Prefer to use `require_bytes_per_row_at_pixel_boundary` when the intent
1160    /// is to ensure that `bytes_per_row' will be a multiple of the pixel size
1161    /// in bytes.
1162    ///
1163    /// Prefer to use `size_alignment.width` when the intent is to ensure that
1164    /// the width in pixels is aligned. In contrast, this field can specify that
1165    /// the "stride in bytes" (byte offset from start of image to start of row n
1166    /// minus byte offset from start of image to start of row n-1, with result
1167    /// in bytes) needs to be aligned to the specified number of bytes. For
1168    /// example, when `PixelFormat.BGR24` (24 bit color; 3 bytes per pixel) is
1169    /// used, it's not uncommon for a participant to need each row of pixels to
1170    /// start at a 4 byte aligned offset from the start of the image, which can
1171    /// imply some padding bytes at the end of each row of pixels, before the
1172    /// start of the next row of pixels.
1173    ///
1174    /// While any value of `bytes_per_row_divisor` could instead be enforced by
1175    /// setting `size_alignment.width` to the least-common-multiple of the
1176    /// "stride bytes per width pixel" and the stride alignment requirement,
1177    /// enforcing the stride alignment requirement that way can lead to more
1178    /// padding than necessary (implying larger buffer than necessary), and can
1179    /// also result in a "fake" `size.width`; this field exists to avoid that
1180    /// situation. Instead, the stride alignment requirement in bytes is
1181    /// specified directly here.
1182    pub bytes_per_row_divisor: Option<u32>,
1183    /// `vmo_usable_start % start_offset_divisor` must be 0. Un-set is treated
1184    /// as 1.
1185    ///
1186    /// Producer participants are discouraged from setting non-zero image start
1187    /// offset (from the buffer base) unless actually required, as not all
1188    /// participants correctly handle non-zero image start offset.
1189    pub start_offset_divisor: Option<u32>,
1190    /// The (additional) [`fuchsia.sysmem2/PixelFormatAndModifier`]s for which
1191    /// the following constraints apply.
1192    ///
1193    /// As a non-limiting example, if a participant only wants to set a single
1194    /// `PixelFormatAndModifier` for this
1195    /// [`fuchsia.sysmem2/ImageFormatConstraints`], the participant can either
1196    /// (a) use `pixel_format` and `pixel_format_modifier` fields to specify the
1197    /// fields of the one `PixelFormatAndModifier` and leave
1198    /// `pixel_format_and_modifiers` un-set, or (b) leave `pixel_format` and
1199    /// `pixel_format_modifier` fields un-set and put the one
1200    /// `PixelFormatAndModifier` in `pixel_format_and_modifiers`.
1201    ///
1202    /// If `pixel_format` is set, the server will take pixel_format and
1203    /// pixel_format_modifier fields (un-setting them in the process), pack them
1204    /// into a `PixelFormatAndModifier`, and move it into this vector as one
1205    /// additional entry, with an overall size limit of
1206    /// `MAX_COUNT_PIXEL_FORMAT_AND_MODIFIERS + 1`.
1207    ///
1208    /// After the server moves `pixel_format`, `pixel_format_modifier` into one
1209    /// additional entry in this vector, this vector must not be empty. When the
1210    /// resulting list has more than 1 item, the entries in this vector are
1211    /// equivalent to (shorthand for) listing (size) separate
1212    /// `ImageFormatConstraints` entries, one per `pixel_format_and_modifiers`
1213    /// entry, each with one `PixelFormatAndModifier`, where all the separate
1214    /// `ImageFormatConstraints` entries have the same constraints (compared
1215    /// field by field, not including `pixel_format`, `pixel_format_modifier`,
1216    /// or `pixel_format_and_modifiers` fields).
1217    ///
1218    /// In `SetConstraints` message, each entry specifies a
1219    /// `PixelFormatAndModifier` which is acceptable to the participant
1220    /// (assuming the following constraints fields are also satisfied).
1221    ///
1222    /// In the response to `WaitForAllBuffersAllocated`, this field will be
1223    /// un-set and the one chosen `PixelFormatAndModifier` will be indicated
1224    /// using the `pixel_format` and `pixel_format_modifier` fields.
1225    ///
1226    /// All the `PixelFormatAndModifiers` in a `SetConstraints` message from a
1227    /// participant must be unique across all the entries under
1228    /// `image_format_constraints`. If
1229    /// [`fuchsia.images2/PixelFormat.DO_NOT_CARE`] is used in an entry, there
1230    /// must not be any other entry (considering all the entries under
1231    /// `image_format_constraints`) with matching `pixel_format_modifier`. If
1232    /// [`fuchsia.images2/PixelFormatModifier.DO_NOT_CARE`] is used, there must
1233    /// not be any other entry (considering all the entries under
1234    /// `image_format_constraints`) with matching `pixel_format`.
1235    ///
1236    /// A `PixelFormatAndModifier` value with either
1237    /// [`fuchsia.images2/PixelFormat.DO_NOT_CARE`] or
1238    /// [`fuchsia.images2/PixelFormatModifier.DO_NOT_CARE`] (but not both, for
1239    /// purposes of this example) can be combined with a
1240    /// `PixelFormatAndModifier` from a separate participant with the other
1241    /// field indicating "do not care", resulting in a complete
1242    /// `PixelFormatAndModifier` that can succeed allocation. However, at least
1243    /// for now, it's not permitted for a single participant to specify two
1244    /// separate `PixelFormatAndModifier` values which have "do not care" in
1245    /// different fields. This does not prohibit a single
1246    /// `PixelFormatAndModifier` with both `PixelFormat.DO_NOT_CARE` and
1247    /// `PixelFormatModifier.DO_NOT_CARE` (which is only a single
1248    /// `PixelFormatAndModifier` value). If a client really needs to specify
1249    /// some constraints relevant to `pixel_format`(s) with
1250    /// `pixel_format_modifier` `DO_NOT_CARE`, and other constraints relevant to
1251    /// `pixel_format_modifier`(s) with `pixel_format` `DO_NOT_CARE`, the client
1252    /// can do so by duplicating the token and using/driving two separate
1253    /// participants.
1254    ///
1255    /// See also `pixel_format` for more comments relevant to multiple
1256    /// `PixelFormatAndModifier`s in a single `ImageFormatConstraints`.
1257    pub pixel_format_and_modifiers: Option<Vec<PixelFormatAndModifier>>,
1258    /// Iff set and true, bytes_per_row_divisor in the resulting
1259    /// ImageFormatConstraints is guaranteed to be a value which requires
1260    /// bytes_per_row to be an integral number of pixels. This can result in
1261    /// more padding at the end of each row than when this field is not set to
1262    /// true, but ensures that the stride can be expressed as an integral number
1263    /// of pixels.
1264    ///
1265    /// For example, if the chosen `PixelFormat` is `B8G8R8`, if this field is
1266    /// set to true, the resulting bytes_per_row_divisor will be a multiple of
1267    /// 3. In this example, if another participant sets `bytes_per_row_divisor`
1268    /// to 4, the resulting `bytes_per_row_divisor` will be a multiple of 12.
1269    pub require_bytes_per_row_at_pixel_boundary: Option<bool>,
1270    /// If unset, any A channel of any format in this ImageFormatConstraints is
1271    /// is ignored or not ignored according to semantics conveyed out of band.
1272    ///
1273    /// If set to false, the A channel of any format in this
1274    /// ImageFormatConstraints is arbitrary values that don't mean anything.
1275    /// Producers don't need to ensure any particular values in the A channel
1276    /// and consumers should ignore the A channel. This is the same thing as
1277    /// calling the 'A' channel 'X' instead.
1278    ///
1279    /// If set to true, the A channel of any format in this
1280    /// ImageFormatConstraints is set to meaningful values. A producer should
1281    /// fill out the A values, and a consumer should pay attention to the A
1282    /// values as appropriate.
1283    ///
1284    /// If set values of this field don't match for the same pixel format and
1285    /// modifier, that format and modifier will be eliminated from
1286    /// consideration.
1287    ///
1288    /// A participant that knows that the semantics of the A channel are
1289    /// conveyed via out of band means can leave this field un-set, even if the
1290    /// out of band means is already known to specify alpha present or not
1291    /// present, but in this situation it's also ok to fill out this field for
1292    /// informational / debugging purposes.
1293    ///
1294    /// If no participant sets this field, the default is un-set.
1295    ///
1296    /// If the format chosen for allocation doesn't have an A channel, this
1297    /// field will be un-set in the allocation result.
1298    pub is_alpha_present: Option<bool>,
1299    #[doc(hidden)]
1300    pub __source_breaking: fidl::marker::SourceBreaking,
1301}
1302
1303impl fidl::Persistable for ImageFormatConstraints {}
1304
1305#[derive(Clone, Debug, Default, PartialEq)]
1306pub struct NodeSetDebugClientInfoRequest {
1307    pub name: Option<String>,
1308    pub id: Option<u64>,
1309    #[doc(hidden)]
1310    pub __source_breaking: fidl::marker::SourceBreaking,
1311}
1312
1313impl fidl::Persistable for NodeSetDebugClientInfoRequest {}
1314
1315#[derive(Clone, Debug, Default, PartialEq)]
1316pub struct NodeSetDebugTimeoutLogDeadlineRequest {
1317    pub deadline: Option<i64>,
1318    #[doc(hidden)]
1319    pub __source_breaking: fidl::marker::SourceBreaking,
1320}
1321
1322impl fidl::Persistable for NodeSetDebugTimeoutLogDeadlineRequest {}
1323
1324#[derive(Clone, Debug, Default, PartialEq)]
1325pub struct NodeSetNameRequest {
1326    pub priority: Option<u32>,
1327    pub name: Option<String>,
1328    #[doc(hidden)]
1329    pub __source_breaking: fidl::marker::SourceBreaking,
1330}
1331
1332impl fidl::Persistable for NodeSetNameRequest {}
1333
1334#[derive(Clone, Debug, Default, PartialEq)]
1335pub struct NodeGetBufferCollectionIdResponse {
1336    pub buffer_collection_id: Option<u64>,
1337    #[doc(hidden)]
1338    pub __source_breaking: fidl::marker::SourceBreaking,
1339}
1340
1341impl fidl::Persistable for NodeGetBufferCollectionIdResponse {}
1342
1343#[derive(Clone, Debug, Default, PartialEq)]
1344pub struct NodeIsAlternateForResponse {
1345    pub is_alternate: Option<bool>,
1346    #[doc(hidden)]
1347    pub __source_breaking: fidl::marker::SourceBreaking,
1348}
1349
1350impl fidl::Persistable for NodeIsAlternateForResponse {}
1351
1352#[derive(Clone, Debug, Default, PartialEq)]
1353pub struct SecureHeapAndRange {
1354    pub heap: Option<Heap>,
1355    pub range: Option<SecureHeapRange>,
1356    #[doc(hidden)]
1357    pub __source_breaking: fidl::marker::SourceBreaking,
1358}
1359
1360impl fidl::Persistable for SecureHeapAndRange {}
1361
1362#[derive(Clone, Debug, Default, PartialEq)]
1363pub struct SecureHeapAndRangeModification {
1364    pub heap: Option<Heap>,
1365    pub old_range: Option<SecureHeapRange>,
1366    pub new_range: Option<SecureHeapRange>,
1367    #[doc(hidden)]
1368    pub __source_breaking: fidl::marker::SourceBreaking,
1369}
1370
1371impl fidl::Persistable for SecureHeapAndRangeModification {}
1372
1373#[derive(Clone, Debug, Default, PartialEq)]
1374pub struct SecureHeapAndRanges {
1375    /// This is which secure/protected heap.
1376    pub heap: Option<Heap>,
1377    /// The list of physical ranges.  This list must be sorted by
1378    /// physical_address (lower first), and must not have any overlapping
1379    /// ranges.  Ranges that are directly adjacent are allowed (not
1380    /// overlapping).
1381    pub ranges: Option<Vec<SecureHeapRange>>,
1382    #[doc(hidden)]
1383    pub __source_breaking: fidl::marker::SourceBreaking,
1384}
1385
1386impl fidl::Persistable for SecureHeapAndRanges {}
1387
1388#[derive(Clone, Debug, Default, PartialEq)]
1389pub struct SecureHeapProperties {
1390    /// The Heap is repeated here for convenience.
1391    pub heap: Option<Heap>,
1392    /// If true, more than one call to SetPhysicalSecureHeap() for the same
1393    /// heap is allowed.  If false, only one SetPhyscialSecureHeap() call is
1394    /// allowed, and no calls to DeleteSecureHeapPhysicalRange() or
1395    /// ModifySecureHeapPhysicalRange() are allowed.  Even when this is false,
1396    /// the SecureMem server (driver) is still responsible for de-protecting
1397    /// just before warm reboot if protected ranges would not otherwise be
1398    /// cleaned up during a warm reboot.
1399    pub dynamic_protection_ranges: Option<bool>,
1400    /// The granularity of protection ranges.  If the granularity of start is
1401    /// different than granularity of end or length, then this is the max
1402    /// granularity value among those values.
1403    ///
1404    /// This must be a power of 2.  The client must not request ranges that
1405    /// specify smaller granularity.
1406    ///
1407    /// This must be at least zx_system_page_size() even if the HW can do
1408    /// smaller granularity.
1409    pub protected_range_granularity: Option<u32>,
1410    /// The SecureMem server should not count reserved ranges that the SecureMem
1411    /// server uses internally to get from range set A to range set B, if the
1412    /// SecureMem server needs to do any emulation of that sort.  Normally such
1413    /// emulation by the SecureMem server is unnecessary.  If any ranges are
1414    /// reserved by the SecureMem server, those reserved ranges are not
1415    /// available for use by the SecureMem client.
1416    ///
1417    /// If the number of ranges is limited only by available memory, it's ok for
1418    /// the SecureMem server to report 0xFFFFFFFFFFFFFFFF for this value.  The
1419    /// field must still be set.  As usual, the SecureMem server should ensure
1420    /// that SetPhysicalSecureHeapRanges() succeeds or fails atomically (either
1421    /// fully updates or rolls back before completing).
1422    pub max_protected_range_count: Option<u64>,
1423    /// Iff true, ModifySecureHeapPhysicalRange() is implemented.  Calling
1424    /// ModifySecureHeapPhysicalRange() when is_mod_protected_range_available
1425    /// is false is prohibited.  Don't attempt to detect availability of
1426    /// ModifySecureHeapPhysicalRange() by calling it to see if it fails; it
1427    /// may ZX_PANIC().
1428    pub is_mod_protected_range_available: Option<bool>,
1429    #[doc(hidden)]
1430    pub __source_breaking: fidl::marker::SourceBreaking,
1431}
1432
1433impl fidl::Persistable for SecureHeapProperties {}
1434
1435#[derive(Clone, Debug, Default, PartialEq)]
1436pub struct SecureHeapRange {
1437    /// Must be aligned to at least heap_range_granularity.
1438    pub physical_address: Option<u64>,
1439    /// Must be aligned to at least heap_range_granularity.
1440    pub size_bytes: Option<u64>,
1441    #[doc(hidden)]
1442    pub __source_breaking: fidl::marker::SourceBreaking,
1443}
1444
1445impl fidl::Persistable for SecureHeapRange {}
1446
1447#[derive(Clone, Debug, Default, PartialEq)]
1448pub struct SecureMemAddSecureHeapPhysicalRangeRequest {
1449    pub heap_range: Option<SecureHeapAndRange>,
1450    #[doc(hidden)]
1451    pub __source_breaking: fidl::marker::SourceBreaking,
1452}
1453
1454impl fidl::Persistable for SecureMemAddSecureHeapPhysicalRangeRequest {}
1455
1456#[derive(Clone, Debug, Default, PartialEq)]
1457pub struct SecureMemDeleteSecureHeapPhysicalRangeRequest {
1458    pub heap_range: Option<SecureHeapAndRange>,
1459    #[doc(hidden)]
1460    pub __source_breaking: fidl::marker::SourceBreaking,
1461}
1462
1463impl fidl::Persistable for SecureMemDeleteSecureHeapPhysicalRangeRequest {}
1464
1465#[derive(Clone, Debug, Default, PartialEq)]
1466pub struct SecureMemGetPhysicalSecureHeapPropertiesRequest {
1467    pub entire_heap: Option<SecureHeapAndRange>,
1468    #[doc(hidden)]
1469    pub __source_breaking: fidl::marker::SourceBreaking,
1470}
1471
1472impl fidl::Persistable for SecureMemGetPhysicalSecureHeapPropertiesRequest {}
1473
1474#[derive(Clone, Debug, Default, PartialEq)]
1475pub struct SecureMemModifySecureHeapPhysicalRangeRequest {
1476    pub range_modification: Option<SecureHeapAndRangeModification>,
1477    #[doc(hidden)]
1478    pub __source_breaking: fidl::marker::SourceBreaking,
1479}
1480
1481impl fidl::Persistable for SecureMemModifySecureHeapPhysicalRangeRequest {}
1482
1483#[derive(Clone, Debug, Default, PartialEq)]
1484pub struct SecureMemZeroSubRangeRequest {
1485    pub is_covering_range_explicit: Option<bool>,
1486    pub heap_range: Option<SecureHeapAndRange>,
1487    #[doc(hidden)]
1488    pub __source_breaking: fidl::marker::SourceBreaking,
1489}
1490
1491impl fidl::Persistable for SecureMemZeroSubRangeRequest {}
1492
1493#[derive(Clone, Debug, Default, PartialEq)]
1494pub struct SecureMemGetDynamicSecureHeapsResponse {
1495    pub heaps: Option<Vec<DynamicSecureHeap>>,
1496    #[doc(hidden)]
1497    pub __source_breaking: fidl::marker::SourceBreaking,
1498}
1499
1500impl fidl::Persistable for SecureMemGetDynamicSecureHeapsResponse {}
1501
1502#[derive(Clone, Debug, Default, PartialEq)]
1503pub struct SecureMemGetPhysicalSecureHeapPropertiesResponse {
1504    pub properties: Option<SecureHeapProperties>,
1505    #[doc(hidden)]
1506    pub __source_breaking: fidl::marker::SourceBreaking,
1507}
1508
1509impl fidl::Persistable for SecureMemGetPhysicalSecureHeapPropertiesResponse {}
1510
1511#[derive(Clone, Debug, Default, PartialEq)]
1512pub struct SecureMemGetPhysicalSecureHeapsResponse {
1513    pub heaps: Option<Vec<SecureHeapAndRanges>>,
1514    #[doc(hidden)]
1515    pub __source_breaking: fidl::marker::SourceBreaking,
1516}
1517
1518impl fidl::Persistable for SecureMemGetPhysicalSecureHeapsResponse {}
1519
1520/// These settings and constraints apply to all the buffers in the collection.
1521#[derive(Clone, Debug, Default, PartialEq)]
1522pub struct SingleBufferSettings {
1523    /// This field will always be set by sysmem.
1524    pub buffer_settings: Option<BufferMemorySettings>,
1525    /// Buffers holding data that is not uncompressed image data will not have
1526    /// this field set.  Buffers holding data that is uncompressed image data
1527    /// _may_ have this field set.
1528    ///
1529    /// At least for now, changing the PixelFormat requires re-allocating
1530    /// buffers.
1531    ///
1532    /// If un-set, there are no image format constraints.
1533    pub image_format_constraints: Option<ImageFormatConstraints>,
1534    #[doc(hidden)]
1535    pub __source_breaking: fidl::marker::SourceBreaking,
1536}
1537
1538impl fidl::Persistable for SingleBufferSettings {}
1539
1540mod internal {
1541    use super::*;
1542    unsafe impl fidl::encoding::TypeMarker for CoherencyDomain {
1543        type Owned = Self;
1544
1545        #[inline(always)]
1546        fn inline_align(_context: fidl::encoding::Context) -> usize {
1547            std::mem::align_of::<u32>()
1548        }
1549
1550        #[inline(always)]
1551        fn inline_size(_context: fidl::encoding::Context) -> usize {
1552            std::mem::size_of::<u32>()
1553        }
1554
1555        #[inline(always)]
1556        fn encode_is_copy() -> bool {
1557            false
1558        }
1559
1560        #[inline(always)]
1561        fn decode_is_copy() -> bool {
1562            false
1563        }
1564    }
1565
1566    impl fidl::encoding::ValueTypeMarker for CoherencyDomain {
1567        type Borrowed<'a> = Self;
1568        #[inline(always)]
1569        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1570            *value
1571        }
1572    }
1573
1574    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1575        for CoherencyDomain
1576    {
1577        #[inline]
1578        unsafe fn encode(
1579            self,
1580            encoder: &mut fidl::encoding::Encoder<'_, D>,
1581            offset: usize,
1582            _depth: fidl::encoding::Depth,
1583        ) -> fidl::Result<()> {
1584            encoder.debug_check_bounds::<Self>(offset);
1585            encoder.write_num(self.into_primitive(), offset);
1586            Ok(())
1587        }
1588    }
1589
1590    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CoherencyDomain {
1591        #[inline(always)]
1592        fn new_empty() -> Self {
1593            Self::unknown()
1594        }
1595
1596        #[inline]
1597        unsafe fn decode(
1598            &mut self,
1599            decoder: &mut fidl::encoding::Decoder<'_, D>,
1600            offset: usize,
1601            _depth: fidl::encoding::Depth,
1602        ) -> fidl::Result<()> {
1603            decoder.debug_check_bounds::<Self>(offset);
1604            let prim = decoder.read_num::<u32>(offset);
1605
1606            *self = Self::from_primitive_allow_unknown(prim);
1607            Ok(())
1608        }
1609    }
1610    unsafe impl fidl::encoding::TypeMarker for Error {
1611        type Owned = Self;
1612
1613        #[inline(always)]
1614        fn inline_align(_context: fidl::encoding::Context) -> usize {
1615            std::mem::align_of::<u32>()
1616        }
1617
1618        #[inline(always)]
1619        fn inline_size(_context: fidl::encoding::Context) -> usize {
1620            std::mem::size_of::<u32>()
1621        }
1622
1623        #[inline(always)]
1624        fn encode_is_copy() -> bool {
1625            false
1626        }
1627
1628        #[inline(always)]
1629        fn decode_is_copy() -> bool {
1630            false
1631        }
1632    }
1633
1634    impl fidl::encoding::ValueTypeMarker for Error {
1635        type Borrowed<'a> = Self;
1636        #[inline(always)]
1637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1638            *value
1639        }
1640    }
1641
1642    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
1643        #[inline]
1644        unsafe fn encode(
1645            self,
1646            encoder: &mut fidl::encoding::Encoder<'_, D>,
1647            offset: usize,
1648            _depth: fidl::encoding::Depth,
1649        ) -> fidl::Result<()> {
1650            encoder.debug_check_bounds::<Self>(offset);
1651            encoder.write_num(self.into_primitive(), offset);
1652            Ok(())
1653        }
1654    }
1655
1656    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
1657        #[inline(always)]
1658        fn new_empty() -> Self {
1659            Self::unknown()
1660        }
1661
1662        #[inline]
1663        unsafe fn decode(
1664            &mut self,
1665            decoder: &mut fidl::encoding::Decoder<'_, D>,
1666            offset: usize,
1667            _depth: fidl::encoding::Depth,
1668        ) -> fidl::Result<()> {
1669            decoder.debug_check_bounds::<Self>(offset);
1670            let prim = decoder.read_num::<u32>(offset);
1671
1672            *self = Self::from_primitive_allow_unknown(prim);
1673            Ok(())
1674        }
1675    }
1676
1677    impl fidl::encoding::ValueTypeMarker for PixelFormatAndModifier {
1678        type Borrowed<'a> = &'a Self;
1679        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1680            value
1681        }
1682    }
1683
1684    unsafe impl fidl::encoding::TypeMarker for PixelFormatAndModifier {
1685        type Owned = Self;
1686
1687        #[inline(always)]
1688        fn inline_align(_context: fidl::encoding::Context) -> usize {
1689            8
1690        }
1691
1692        #[inline(always)]
1693        fn inline_size(_context: fidl::encoding::Context) -> usize {
1694            16
1695        }
1696    }
1697
1698    unsafe impl<D: fidl::encoding::ResourceDialect>
1699        fidl::encoding::Encode<PixelFormatAndModifier, D> for &PixelFormatAndModifier
1700    {
1701        #[inline]
1702        unsafe fn encode(
1703            self,
1704            encoder: &mut fidl::encoding::Encoder<'_, D>,
1705            offset: usize,
1706            _depth: fidl::encoding::Depth,
1707        ) -> fidl::Result<()> {
1708            encoder.debug_check_bounds::<PixelFormatAndModifier>(offset);
1709            // Delegate to tuple encoding.
1710            fidl::encoding::Encode::<PixelFormatAndModifier, D>::encode(
1711                (
1712                    <fidl_fuchsia_images2__common::PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
1713                    <fidl_fuchsia_images2__common::PixelFormatModifier as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format_modifier),
1714                ),
1715                encoder, offset, _depth
1716            )
1717        }
1718    }
1719    unsafe impl<
1720            D: fidl::encoding::ResourceDialect,
1721            T0: fidl::encoding::Encode<fidl_fuchsia_images2__common::PixelFormat, D>,
1722            T1: fidl::encoding::Encode<fidl_fuchsia_images2__common::PixelFormatModifier, D>,
1723        > fidl::encoding::Encode<PixelFormatAndModifier, D> for (T0, T1)
1724    {
1725        #[inline]
1726        unsafe fn encode(
1727            self,
1728            encoder: &mut fidl::encoding::Encoder<'_, D>,
1729            offset: usize,
1730            depth: fidl::encoding::Depth,
1731        ) -> fidl::Result<()> {
1732            encoder.debug_check_bounds::<PixelFormatAndModifier>(offset);
1733            // Zero out padding regions. There's no need to apply masks
1734            // because the unmasked parts will be overwritten by fields.
1735            unsafe {
1736                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1737                (ptr as *mut u64).write_unaligned(0);
1738            }
1739            // Write the fields.
1740            self.0.encode(encoder, offset + 0, depth)?;
1741            self.1.encode(encoder, offset + 8, depth)?;
1742            Ok(())
1743        }
1744    }
1745
1746    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1747        for PixelFormatAndModifier
1748    {
1749        #[inline(always)]
1750        fn new_empty() -> Self {
1751            Self {
1752                pixel_format: fidl::new_empty!(fidl_fuchsia_images2__common::PixelFormat, D),
1753                pixel_format_modifier: fidl::new_empty!(
1754                    fidl_fuchsia_images2__common::PixelFormatModifier,
1755                    D
1756                ),
1757            }
1758        }
1759
1760        #[inline]
1761        unsafe fn decode(
1762            &mut self,
1763            decoder: &mut fidl::encoding::Decoder<'_, D>,
1764            offset: usize,
1765            _depth: fidl::encoding::Depth,
1766        ) -> fidl::Result<()> {
1767            decoder.debug_check_bounds::<Self>(offset);
1768            // Verify that padding bytes are zero.
1769            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1770            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1771            let mask = 0xffffffff00000000u64;
1772            let maskedval = padval & mask;
1773            if maskedval != 0 {
1774                return Err(fidl::Error::NonZeroPadding {
1775                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1776                });
1777            }
1778            fidl::decode!(
1779                fidl_fuchsia_images2__common::PixelFormat,
1780                D,
1781                &mut self.pixel_format,
1782                decoder,
1783                offset + 0,
1784                _depth
1785            )?;
1786            fidl::decode!(
1787                fidl_fuchsia_images2__common::PixelFormatModifier,
1788                D,
1789                &mut self.pixel_format_modifier,
1790                decoder,
1791                offset + 8,
1792                _depth
1793            )?;
1794            Ok(())
1795        }
1796    }
1797
1798    impl AllocatorSetDebugClientInfoRequest {
1799        #[inline(always)]
1800        fn max_ordinal_present(&self) -> u64 {
1801            if let Some(_) = self.id {
1802                return 2;
1803            }
1804            if let Some(_) = self.name {
1805                return 1;
1806            }
1807            0
1808        }
1809    }
1810
1811    impl fidl::encoding::ValueTypeMarker for AllocatorSetDebugClientInfoRequest {
1812        type Borrowed<'a> = &'a Self;
1813        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1814            value
1815        }
1816    }
1817
1818    unsafe impl fidl::encoding::TypeMarker for AllocatorSetDebugClientInfoRequest {
1819        type Owned = Self;
1820
1821        #[inline(always)]
1822        fn inline_align(_context: fidl::encoding::Context) -> usize {
1823            8
1824        }
1825
1826        #[inline(always)]
1827        fn inline_size(_context: fidl::encoding::Context) -> usize {
1828            16
1829        }
1830    }
1831
1832    unsafe impl<D: fidl::encoding::ResourceDialect>
1833        fidl::encoding::Encode<AllocatorSetDebugClientInfoRequest, D>
1834        for &AllocatorSetDebugClientInfoRequest
1835    {
1836        unsafe fn encode(
1837            self,
1838            encoder: &mut fidl::encoding::Encoder<'_, D>,
1839            offset: usize,
1840            mut depth: fidl::encoding::Depth,
1841        ) -> fidl::Result<()> {
1842            encoder.debug_check_bounds::<AllocatorSetDebugClientInfoRequest>(offset);
1843            // Vector header
1844            let max_ordinal: u64 = self.max_ordinal_present();
1845            encoder.write_num(max_ordinal, offset);
1846            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1847            // Calling encoder.out_of_line_offset(0) is not allowed.
1848            if max_ordinal == 0 {
1849                return Ok(());
1850            }
1851            depth.increment()?;
1852            let envelope_size = 8;
1853            let bytes_len = max_ordinal as usize * envelope_size;
1854            #[allow(unused_variables)]
1855            let offset = encoder.out_of_line_offset(bytes_len);
1856            let mut _prev_end_offset: usize = 0;
1857            if 1 > max_ordinal {
1858                return Ok(());
1859            }
1860
1861            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1862            // are envelope_size bytes.
1863            let cur_offset: usize = (1 - 1) * envelope_size;
1864
1865            // Zero reserved fields.
1866            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1867
1868            // Safety:
1869            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1870            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1871            //   envelope_size bytes, there is always sufficient room.
1872            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
1873                self.name.as_ref().map(
1874                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
1875                ),
1876                encoder,
1877                offset + cur_offset,
1878                depth,
1879            )?;
1880
1881            _prev_end_offset = cur_offset + envelope_size;
1882            if 2 > max_ordinal {
1883                return Ok(());
1884            }
1885
1886            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1887            // are envelope_size bytes.
1888            let cur_offset: usize = (2 - 1) * envelope_size;
1889
1890            // Zero reserved fields.
1891            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1892
1893            // Safety:
1894            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1895            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1896            //   envelope_size bytes, there is always sufficient room.
1897            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1898                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1899                encoder,
1900                offset + cur_offset,
1901                depth,
1902            )?;
1903
1904            _prev_end_offset = cur_offset + envelope_size;
1905
1906            Ok(())
1907        }
1908    }
1909
1910    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1911        for AllocatorSetDebugClientInfoRequest
1912    {
1913        #[inline(always)]
1914        fn new_empty() -> Self {
1915            Self::default()
1916        }
1917
1918        unsafe fn decode(
1919            &mut self,
1920            decoder: &mut fidl::encoding::Decoder<'_, D>,
1921            offset: usize,
1922            mut depth: fidl::encoding::Depth,
1923        ) -> fidl::Result<()> {
1924            decoder.debug_check_bounds::<Self>(offset);
1925            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1926                None => return Err(fidl::Error::NotNullable),
1927                Some(len) => len,
1928            };
1929            // Calling decoder.out_of_line_offset(0) is not allowed.
1930            if len == 0 {
1931                return Ok(());
1932            };
1933            depth.increment()?;
1934            let envelope_size = 8;
1935            let bytes_len = len * envelope_size;
1936            let offset = decoder.out_of_line_offset(bytes_len)?;
1937            // Decode the envelope for each type.
1938            let mut _next_ordinal_to_read = 0;
1939            let mut next_offset = offset;
1940            let end_offset = offset + bytes_len;
1941            _next_ordinal_to_read += 1;
1942            if next_offset >= end_offset {
1943                return Ok(());
1944            }
1945
1946            // Decode unknown envelopes for gaps in ordinals.
1947            while _next_ordinal_to_read < 1 {
1948                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1949                _next_ordinal_to_read += 1;
1950                next_offset += envelope_size;
1951            }
1952
1953            let next_out_of_line = decoder.next_out_of_line();
1954            let handles_before = decoder.remaining_handles();
1955            if let Some((inlined, num_bytes, num_handles)) =
1956                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1957            {
1958                let member_inline_size =
1959                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
1960                        decoder.context,
1961                    );
1962                if inlined != (member_inline_size <= 4) {
1963                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1964                }
1965                let inner_offset;
1966                let mut inner_depth = depth.clone();
1967                if inlined {
1968                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1969                    inner_offset = next_offset;
1970                } else {
1971                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1972                    inner_depth.increment()?;
1973                }
1974                let val_ref = self
1975                    .name
1976                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
1977                fidl::decode!(
1978                    fidl::encoding::BoundedString<256>,
1979                    D,
1980                    val_ref,
1981                    decoder,
1982                    inner_offset,
1983                    inner_depth
1984                )?;
1985                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1986                {
1987                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1988                }
1989                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1990                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1991                }
1992            }
1993
1994            next_offset += envelope_size;
1995            _next_ordinal_to_read += 1;
1996            if next_offset >= end_offset {
1997                return Ok(());
1998            }
1999
2000            // Decode unknown envelopes for gaps in ordinals.
2001            while _next_ordinal_to_read < 2 {
2002                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2003                _next_ordinal_to_read += 1;
2004                next_offset += envelope_size;
2005            }
2006
2007            let next_out_of_line = decoder.next_out_of_line();
2008            let handles_before = decoder.remaining_handles();
2009            if let Some((inlined, num_bytes, num_handles)) =
2010                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2011            {
2012                let member_inline_size =
2013                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2014                if inlined != (member_inline_size <= 4) {
2015                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2016                }
2017                let inner_offset;
2018                let mut inner_depth = depth.clone();
2019                if inlined {
2020                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2021                    inner_offset = next_offset;
2022                } else {
2023                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2024                    inner_depth.increment()?;
2025                }
2026                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
2027                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2028                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2029                {
2030                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2031                }
2032                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2033                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2034                }
2035            }
2036
2037            next_offset += envelope_size;
2038
2039            // Decode the remaining unknown envelopes.
2040            while next_offset < end_offset {
2041                _next_ordinal_to_read += 1;
2042                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2043                next_offset += envelope_size;
2044            }
2045
2046            Ok(())
2047        }
2048    }
2049
2050    impl AllocatorValidateBufferCollectionTokenRequest {
2051        #[inline(always)]
2052        fn max_ordinal_present(&self) -> u64 {
2053            if let Some(_) = self.token_server_koid {
2054                return 1;
2055            }
2056            0
2057        }
2058    }
2059
2060    impl fidl::encoding::ValueTypeMarker for AllocatorValidateBufferCollectionTokenRequest {
2061        type Borrowed<'a> = &'a Self;
2062        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2063            value
2064        }
2065    }
2066
2067    unsafe impl fidl::encoding::TypeMarker for AllocatorValidateBufferCollectionTokenRequest {
2068        type Owned = Self;
2069
2070        #[inline(always)]
2071        fn inline_align(_context: fidl::encoding::Context) -> usize {
2072            8
2073        }
2074
2075        #[inline(always)]
2076        fn inline_size(_context: fidl::encoding::Context) -> usize {
2077            16
2078        }
2079    }
2080
2081    unsafe impl<D: fidl::encoding::ResourceDialect>
2082        fidl::encoding::Encode<AllocatorValidateBufferCollectionTokenRequest, D>
2083        for &AllocatorValidateBufferCollectionTokenRequest
2084    {
2085        unsafe fn encode(
2086            self,
2087            encoder: &mut fidl::encoding::Encoder<'_, D>,
2088            offset: usize,
2089            mut depth: fidl::encoding::Depth,
2090        ) -> fidl::Result<()> {
2091            encoder.debug_check_bounds::<AllocatorValidateBufferCollectionTokenRequest>(offset);
2092            // Vector header
2093            let max_ordinal: u64 = self.max_ordinal_present();
2094            encoder.write_num(max_ordinal, offset);
2095            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2096            // Calling encoder.out_of_line_offset(0) is not allowed.
2097            if max_ordinal == 0 {
2098                return Ok(());
2099            }
2100            depth.increment()?;
2101            let envelope_size = 8;
2102            let bytes_len = max_ordinal as usize * envelope_size;
2103            #[allow(unused_variables)]
2104            let offset = encoder.out_of_line_offset(bytes_len);
2105            let mut _prev_end_offset: usize = 0;
2106            if 1 > max_ordinal {
2107                return Ok(());
2108            }
2109
2110            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2111            // are envelope_size bytes.
2112            let cur_offset: usize = (1 - 1) * envelope_size;
2113
2114            // Zero reserved fields.
2115            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2116
2117            // Safety:
2118            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2119            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2120            //   envelope_size bytes, there is always sufficient room.
2121            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2122                self.token_server_koid
2123                    .as_ref()
2124                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2125                encoder,
2126                offset + cur_offset,
2127                depth,
2128            )?;
2129
2130            _prev_end_offset = cur_offset + envelope_size;
2131
2132            Ok(())
2133        }
2134    }
2135
2136    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2137        for AllocatorValidateBufferCollectionTokenRequest
2138    {
2139        #[inline(always)]
2140        fn new_empty() -> Self {
2141            Self::default()
2142        }
2143
2144        unsafe fn decode(
2145            &mut self,
2146            decoder: &mut fidl::encoding::Decoder<'_, D>,
2147            offset: usize,
2148            mut depth: fidl::encoding::Depth,
2149        ) -> fidl::Result<()> {
2150            decoder.debug_check_bounds::<Self>(offset);
2151            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2152                None => return Err(fidl::Error::NotNullable),
2153                Some(len) => len,
2154            };
2155            // Calling decoder.out_of_line_offset(0) is not allowed.
2156            if len == 0 {
2157                return Ok(());
2158            };
2159            depth.increment()?;
2160            let envelope_size = 8;
2161            let bytes_len = len * envelope_size;
2162            let offset = decoder.out_of_line_offset(bytes_len)?;
2163            // Decode the envelope for each type.
2164            let mut _next_ordinal_to_read = 0;
2165            let mut next_offset = offset;
2166            let end_offset = offset + bytes_len;
2167            _next_ordinal_to_read += 1;
2168            if next_offset >= end_offset {
2169                return Ok(());
2170            }
2171
2172            // Decode unknown envelopes for gaps in ordinals.
2173            while _next_ordinal_to_read < 1 {
2174                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2175                _next_ordinal_to_read += 1;
2176                next_offset += envelope_size;
2177            }
2178
2179            let next_out_of_line = decoder.next_out_of_line();
2180            let handles_before = decoder.remaining_handles();
2181            if let Some((inlined, num_bytes, num_handles)) =
2182                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2183            {
2184                let member_inline_size =
2185                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2186                if inlined != (member_inline_size <= 4) {
2187                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2188                }
2189                let inner_offset;
2190                let mut inner_depth = depth.clone();
2191                if inlined {
2192                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2193                    inner_offset = next_offset;
2194                } else {
2195                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2196                    inner_depth.increment()?;
2197                }
2198                let val_ref =
2199                    self.token_server_koid.get_or_insert_with(|| fidl::new_empty!(u64, D));
2200                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2201                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2202                {
2203                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2204                }
2205                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2206                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2207                }
2208            }
2209
2210            next_offset += envelope_size;
2211
2212            // Decode the remaining unknown envelopes.
2213            while next_offset < end_offset {
2214                _next_ordinal_to_read += 1;
2215                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2216                next_offset += envelope_size;
2217            }
2218
2219            Ok(())
2220        }
2221    }
2222
2223    impl AllocatorValidateBufferCollectionTokenResponse {
2224        #[inline(always)]
2225        fn max_ordinal_present(&self) -> u64 {
2226            if let Some(_) = self.is_known {
2227                return 1;
2228            }
2229            0
2230        }
2231    }
2232
2233    impl fidl::encoding::ValueTypeMarker for AllocatorValidateBufferCollectionTokenResponse {
2234        type Borrowed<'a> = &'a Self;
2235        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2236            value
2237        }
2238    }
2239
2240    unsafe impl fidl::encoding::TypeMarker for AllocatorValidateBufferCollectionTokenResponse {
2241        type Owned = Self;
2242
2243        #[inline(always)]
2244        fn inline_align(_context: fidl::encoding::Context) -> usize {
2245            8
2246        }
2247
2248        #[inline(always)]
2249        fn inline_size(_context: fidl::encoding::Context) -> usize {
2250            16
2251        }
2252    }
2253
2254    unsafe impl<D: fidl::encoding::ResourceDialect>
2255        fidl::encoding::Encode<AllocatorValidateBufferCollectionTokenResponse, D>
2256        for &AllocatorValidateBufferCollectionTokenResponse
2257    {
2258        unsafe fn encode(
2259            self,
2260            encoder: &mut fidl::encoding::Encoder<'_, D>,
2261            offset: usize,
2262            mut depth: fidl::encoding::Depth,
2263        ) -> fidl::Result<()> {
2264            encoder.debug_check_bounds::<AllocatorValidateBufferCollectionTokenResponse>(offset);
2265            // Vector header
2266            let max_ordinal: u64 = self.max_ordinal_present();
2267            encoder.write_num(max_ordinal, offset);
2268            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2269            // Calling encoder.out_of_line_offset(0) is not allowed.
2270            if max_ordinal == 0 {
2271                return Ok(());
2272            }
2273            depth.increment()?;
2274            let envelope_size = 8;
2275            let bytes_len = max_ordinal as usize * envelope_size;
2276            #[allow(unused_variables)]
2277            let offset = encoder.out_of_line_offset(bytes_len);
2278            let mut _prev_end_offset: usize = 0;
2279            if 1 > max_ordinal {
2280                return Ok(());
2281            }
2282
2283            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2284            // are envelope_size bytes.
2285            let cur_offset: usize = (1 - 1) * envelope_size;
2286
2287            // Zero reserved fields.
2288            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2289
2290            // Safety:
2291            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2292            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2293            //   envelope_size bytes, there is always sufficient room.
2294            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2295                self.is_known.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2296                encoder,
2297                offset + cur_offset,
2298                depth,
2299            )?;
2300
2301            _prev_end_offset = cur_offset + envelope_size;
2302
2303            Ok(())
2304        }
2305    }
2306
2307    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2308        for AllocatorValidateBufferCollectionTokenResponse
2309    {
2310        #[inline(always)]
2311        fn new_empty() -> Self {
2312            Self::default()
2313        }
2314
2315        unsafe fn decode(
2316            &mut self,
2317            decoder: &mut fidl::encoding::Decoder<'_, D>,
2318            offset: usize,
2319            mut depth: fidl::encoding::Depth,
2320        ) -> fidl::Result<()> {
2321            decoder.debug_check_bounds::<Self>(offset);
2322            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2323                None => return Err(fidl::Error::NotNullable),
2324                Some(len) => len,
2325            };
2326            // Calling decoder.out_of_line_offset(0) is not allowed.
2327            if len == 0 {
2328                return Ok(());
2329            };
2330            depth.increment()?;
2331            let envelope_size = 8;
2332            let bytes_len = len * envelope_size;
2333            let offset = decoder.out_of_line_offset(bytes_len)?;
2334            // Decode the envelope for each type.
2335            let mut _next_ordinal_to_read = 0;
2336            let mut next_offset = offset;
2337            let end_offset = offset + bytes_len;
2338            _next_ordinal_to_read += 1;
2339            if next_offset >= end_offset {
2340                return Ok(());
2341            }
2342
2343            // Decode unknown envelopes for gaps in ordinals.
2344            while _next_ordinal_to_read < 1 {
2345                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2346                _next_ordinal_to_read += 1;
2347                next_offset += envelope_size;
2348            }
2349
2350            let next_out_of_line = decoder.next_out_of_line();
2351            let handles_before = decoder.remaining_handles();
2352            if let Some((inlined, num_bytes, num_handles)) =
2353                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2354            {
2355                let member_inline_size =
2356                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2357                if inlined != (member_inline_size <= 4) {
2358                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2359                }
2360                let inner_offset;
2361                let mut inner_depth = depth.clone();
2362                if inlined {
2363                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2364                    inner_offset = next_offset;
2365                } else {
2366                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2367                    inner_depth.increment()?;
2368                }
2369                let val_ref = self.is_known.get_or_insert_with(|| fidl::new_empty!(bool, D));
2370                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2371                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2372                {
2373                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2374                }
2375                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2376                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2377                }
2378            }
2379
2380            next_offset += envelope_size;
2381
2382            // Decode the remaining unknown envelopes.
2383            while next_offset < end_offset {
2384                _next_ordinal_to_read += 1;
2385                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2386                next_offset += envelope_size;
2387            }
2388
2389            Ok(())
2390        }
2391    }
2392
2393    impl BufferCollectionConstraints {
2394        #[inline(always)]
2395        fn max_ordinal_present(&self) -> u64 {
2396            if let Some(_) = self.image_format_constraints {
2397                return 8;
2398            }
2399            if let Some(_) = self.buffer_memory_constraints {
2400                return 7;
2401            }
2402            if let Some(_) = self.max_buffer_count {
2403                return 6;
2404            }
2405            if let Some(_) = self.min_buffer_count {
2406                return 5;
2407            }
2408            if let Some(_) = self.min_buffer_count_for_shared_slack {
2409                return 4;
2410            }
2411            if let Some(_) = self.min_buffer_count_for_dedicated_slack {
2412                return 3;
2413            }
2414            if let Some(_) = self.min_buffer_count_for_camping {
2415                return 2;
2416            }
2417            if let Some(_) = self.usage {
2418                return 1;
2419            }
2420            0
2421        }
2422    }
2423
2424    impl fidl::encoding::ValueTypeMarker for BufferCollectionConstraints {
2425        type Borrowed<'a> = &'a Self;
2426        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2427            value
2428        }
2429    }
2430
2431    unsafe impl fidl::encoding::TypeMarker for BufferCollectionConstraints {
2432        type Owned = Self;
2433
2434        #[inline(always)]
2435        fn inline_align(_context: fidl::encoding::Context) -> usize {
2436            8
2437        }
2438
2439        #[inline(always)]
2440        fn inline_size(_context: fidl::encoding::Context) -> usize {
2441            16
2442        }
2443    }
2444
2445    unsafe impl<D: fidl::encoding::ResourceDialect>
2446        fidl::encoding::Encode<BufferCollectionConstraints, D> for &BufferCollectionConstraints
2447    {
2448        unsafe fn encode(
2449            self,
2450            encoder: &mut fidl::encoding::Encoder<'_, D>,
2451            offset: usize,
2452            mut depth: fidl::encoding::Depth,
2453        ) -> fidl::Result<()> {
2454            encoder.debug_check_bounds::<BufferCollectionConstraints>(offset);
2455            // Vector header
2456            let max_ordinal: u64 = self.max_ordinal_present();
2457            encoder.write_num(max_ordinal, offset);
2458            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2459            // Calling encoder.out_of_line_offset(0) is not allowed.
2460            if max_ordinal == 0 {
2461                return Ok(());
2462            }
2463            depth.increment()?;
2464            let envelope_size = 8;
2465            let bytes_len = max_ordinal as usize * envelope_size;
2466            #[allow(unused_variables)]
2467            let offset = encoder.out_of_line_offset(bytes_len);
2468            let mut _prev_end_offset: usize = 0;
2469            if 1 > max_ordinal {
2470                return Ok(());
2471            }
2472
2473            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2474            // are envelope_size bytes.
2475            let cur_offset: usize = (1 - 1) * envelope_size;
2476
2477            // Zero reserved fields.
2478            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2479
2480            // Safety:
2481            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2482            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2483            //   envelope_size bytes, there is always sufficient room.
2484            fidl::encoding::encode_in_envelope_optional::<BufferUsage, D>(
2485                self.usage.as_ref().map(<BufferUsage as fidl::encoding::ValueTypeMarker>::borrow),
2486                encoder,
2487                offset + cur_offset,
2488                depth,
2489            )?;
2490
2491            _prev_end_offset = cur_offset + envelope_size;
2492            if 2 > max_ordinal {
2493                return Ok(());
2494            }
2495
2496            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2497            // are envelope_size bytes.
2498            let cur_offset: usize = (2 - 1) * envelope_size;
2499
2500            // Zero reserved fields.
2501            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2502
2503            // Safety:
2504            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2505            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2506            //   envelope_size bytes, there is always sufficient room.
2507            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2508                self.min_buffer_count_for_camping
2509                    .as_ref()
2510                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2511                encoder,
2512                offset + cur_offset,
2513                depth,
2514            )?;
2515
2516            _prev_end_offset = cur_offset + envelope_size;
2517            if 3 > max_ordinal {
2518                return Ok(());
2519            }
2520
2521            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2522            // are envelope_size bytes.
2523            let cur_offset: usize = (3 - 1) * envelope_size;
2524
2525            // Zero reserved fields.
2526            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2527
2528            // Safety:
2529            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2530            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2531            //   envelope_size bytes, there is always sufficient room.
2532            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2533                self.min_buffer_count_for_dedicated_slack
2534                    .as_ref()
2535                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2536                encoder,
2537                offset + cur_offset,
2538                depth,
2539            )?;
2540
2541            _prev_end_offset = cur_offset + envelope_size;
2542            if 4 > max_ordinal {
2543                return Ok(());
2544            }
2545
2546            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2547            // are envelope_size bytes.
2548            let cur_offset: usize = (4 - 1) * envelope_size;
2549
2550            // Zero reserved fields.
2551            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2552
2553            // Safety:
2554            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2555            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2556            //   envelope_size bytes, there is always sufficient room.
2557            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2558                self.min_buffer_count_for_shared_slack
2559                    .as_ref()
2560                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2561                encoder,
2562                offset + cur_offset,
2563                depth,
2564            )?;
2565
2566            _prev_end_offset = cur_offset + envelope_size;
2567            if 5 > max_ordinal {
2568                return Ok(());
2569            }
2570
2571            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2572            // are envelope_size bytes.
2573            let cur_offset: usize = (5 - 1) * envelope_size;
2574
2575            // Zero reserved fields.
2576            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2577
2578            // Safety:
2579            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2580            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2581            //   envelope_size bytes, there is always sufficient room.
2582            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2583                self.min_buffer_count
2584                    .as_ref()
2585                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2586                encoder,
2587                offset + cur_offset,
2588                depth,
2589            )?;
2590
2591            _prev_end_offset = cur_offset + envelope_size;
2592            if 6 > max_ordinal {
2593                return Ok(());
2594            }
2595
2596            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2597            // are envelope_size bytes.
2598            let cur_offset: usize = (6 - 1) * envelope_size;
2599
2600            // Zero reserved fields.
2601            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2602
2603            // Safety:
2604            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2605            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2606            //   envelope_size bytes, there is always sufficient room.
2607            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2608                self.max_buffer_count
2609                    .as_ref()
2610                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2611                encoder,
2612                offset + cur_offset,
2613                depth,
2614            )?;
2615
2616            _prev_end_offset = cur_offset + envelope_size;
2617            if 7 > max_ordinal {
2618                return Ok(());
2619            }
2620
2621            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2622            // are envelope_size bytes.
2623            let cur_offset: usize = (7 - 1) * envelope_size;
2624
2625            // Zero reserved fields.
2626            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2627
2628            // Safety:
2629            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2630            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2631            //   envelope_size bytes, there is always sufficient room.
2632            fidl::encoding::encode_in_envelope_optional::<BufferMemoryConstraints, D>(
2633                self.buffer_memory_constraints
2634                    .as_ref()
2635                    .map(<BufferMemoryConstraints as fidl::encoding::ValueTypeMarker>::borrow),
2636                encoder,
2637                offset + cur_offset,
2638                depth,
2639            )?;
2640
2641            _prev_end_offset = cur_offset + envelope_size;
2642            if 8 > max_ordinal {
2643                return Ok(());
2644            }
2645
2646            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2647            // are envelope_size bytes.
2648            let cur_offset: usize = (8 - 1) * envelope_size;
2649
2650            // Zero reserved fields.
2651            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2652
2653            // Safety:
2654            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2655            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2656            //   envelope_size bytes, there is always sufficient room.
2657            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ImageFormatConstraints, 64>, D>(
2658            self.image_format_constraints.as_ref().map(<fidl::encoding::Vector<ImageFormatConstraints, 64> as fidl::encoding::ValueTypeMarker>::borrow),
2659            encoder, offset + cur_offset, depth
2660        )?;
2661
2662            _prev_end_offset = cur_offset + envelope_size;
2663
2664            Ok(())
2665        }
2666    }
2667
2668    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2669        for BufferCollectionConstraints
2670    {
2671        #[inline(always)]
2672        fn new_empty() -> Self {
2673            Self::default()
2674        }
2675
2676        unsafe fn decode(
2677            &mut self,
2678            decoder: &mut fidl::encoding::Decoder<'_, D>,
2679            offset: usize,
2680            mut depth: fidl::encoding::Depth,
2681        ) -> fidl::Result<()> {
2682            decoder.debug_check_bounds::<Self>(offset);
2683            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2684                None => return Err(fidl::Error::NotNullable),
2685                Some(len) => len,
2686            };
2687            // Calling decoder.out_of_line_offset(0) is not allowed.
2688            if len == 0 {
2689                return Ok(());
2690            };
2691            depth.increment()?;
2692            let envelope_size = 8;
2693            let bytes_len = len * envelope_size;
2694            let offset = decoder.out_of_line_offset(bytes_len)?;
2695            // Decode the envelope for each type.
2696            let mut _next_ordinal_to_read = 0;
2697            let mut next_offset = offset;
2698            let end_offset = offset + bytes_len;
2699            _next_ordinal_to_read += 1;
2700            if next_offset >= end_offset {
2701                return Ok(());
2702            }
2703
2704            // Decode unknown envelopes for gaps in ordinals.
2705            while _next_ordinal_to_read < 1 {
2706                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2707                _next_ordinal_to_read += 1;
2708                next_offset += envelope_size;
2709            }
2710
2711            let next_out_of_line = decoder.next_out_of_line();
2712            let handles_before = decoder.remaining_handles();
2713            if let Some((inlined, num_bytes, num_handles)) =
2714                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2715            {
2716                let member_inline_size =
2717                    <BufferUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2718                if inlined != (member_inline_size <= 4) {
2719                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2720                }
2721                let inner_offset;
2722                let mut inner_depth = depth.clone();
2723                if inlined {
2724                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2725                    inner_offset = next_offset;
2726                } else {
2727                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2728                    inner_depth.increment()?;
2729                }
2730                let val_ref = self.usage.get_or_insert_with(|| fidl::new_empty!(BufferUsage, D));
2731                fidl::decode!(BufferUsage, D, val_ref, decoder, inner_offset, inner_depth)?;
2732                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2733                {
2734                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2735                }
2736                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2737                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2738                }
2739            }
2740
2741            next_offset += envelope_size;
2742            _next_ordinal_to_read += 1;
2743            if next_offset >= end_offset {
2744                return Ok(());
2745            }
2746
2747            // Decode unknown envelopes for gaps in ordinals.
2748            while _next_ordinal_to_read < 2 {
2749                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2750                _next_ordinal_to_read += 1;
2751                next_offset += envelope_size;
2752            }
2753
2754            let next_out_of_line = decoder.next_out_of_line();
2755            let handles_before = decoder.remaining_handles();
2756            if let Some((inlined, num_bytes, num_handles)) =
2757                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2758            {
2759                let member_inline_size =
2760                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2761                if inlined != (member_inline_size <= 4) {
2762                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2763                }
2764                let inner_offset;
2765                let mut inner_depth = depth.clone();
2766                if inlined {
2767                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2768                    inner_offset = next_offset;
2769                } else {
2770                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2771                    inner_depth.increment()?;
2772                }
2773                let val_ref = self
2774                    .min_buffer_count_for_camping
2775                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
2776                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2777                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2778                {
2779                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2780                }
2781                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2782                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2783                }
2784            }
2785
2786            next_offset += envelope_size;
2787            _next_ordinal_to_read += 1;
2788            if next_offset >= end_offset {
2789                return Ok(());
2790            }
2791
2792            // Decode unknown envelopes for gaps in ordinals.
2793            while _next_ordinal_to_read < 3 {
2794                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2795                _next_ordinal_to_read += 1;
2796                next_offset += envelope_size;
2797            }
2798
2799            let next_out_of_line = decoder.next_out_of_line();
2800            let handles_before = decoder.remaining_handles();
2801            if let Some((inlined, num_bytes, num_handles)) =
2802                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2803            {
2804                let member_inline_size =
2805                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2806                if inlined != (member_inline_size <= 4) {
2807                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2808                }
2809                let inner_offset;
2810                let mut inner_depth = depth.clone();
2811                if inlined {
2812                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2813                    inner_offset = next_offset;
2814                } else {
2815                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2816                    inner_depth.increment()?;
2817                }
2818                let val_ref = self
2819                    .min_buffer_count_for_dedicated_slack
2820                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
2821                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2822                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2823                {
2824                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2825                }
2826                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2827                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2828                }
2829            }
2830
2831            next_offset += envelope_size;
2832            _next_ordinal_to_read += 1;
2833            if next_offset >= end_offset {
2834                return Ok(());
2835            }
2836
2837            // Decode unknown envelopes for gaps in ordinals.
2838            while _next_ordinal_to_read < 4 {
2839                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2840                _next_ordinal_to_read += 1;
2841                next_offset += envelope_size;
2842            }
2843
2844            let next_out_of_line = decoder.next_out_of_line();
2845            let handles_before = decoder.remaining_handles();
2846            if let Some((inlined, num_bytes, num_handles)) =
2847                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2848            {
2849                let member_inline_size =
2850                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2851                if inlined != (member_inline_size <= 4) {
2852                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2853                }
2854                let inner_offset;
2855                let mut inner_depth = depth.clone();
2856                if inlined {
2857                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2858                    inner_offset = next_offset;
2859                } else {
2860                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2861                    inner_depth.increment()?;
2862                }
2863                let val_ref = self
2864                    .min_buffer_count_for_shared_slack
2865                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
2866                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2868                {
2869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2870                }
2871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2873                }
2874            }
2875
2876            next_offset += envelope_size;
2877            _next_ordinal_to_read += 1;
2878            if next_offset >= end_offset {
2879                return Ok(());
2880            }
2881
2882            // Decode unknown envelopes for gaps in ordinals.
2883            while _next_ordinal_to_read < 5 {
2884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2885                _next_ordinal_to_read += 1;
2886                next_offset += envelope_size;
2887            }
2888
2889            let next_out_of_line = decoder.next_out_of_line();
2890            let handles_before = decoder.remaining_handles();
2891            if let Some((inlined, num_bytes, num_handles)) =
2892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2893            {
2894                let member_inline_size =
2895                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2896                if inlined != (member_inline_size <= 4) {
2897                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2898                }
2899                let inner_offset;
2900                let mut inner_depth = depth.clone();
2901                if inlined {
2902                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2903                    inner_offset = next_offset;
2904                } else {
2905                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2906                    inner_depth.increment()?;
2907                }
2908                let val_ref = self.min_buffer_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
2909                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2910                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2911                {
2912                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2913                }
2914                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2915                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2916                }
2917            }
2918
2919            next_offset += envelope_size;
2920            _next_ordinal_to_read += 1;
2921            if next_offset >= end_offset {
2922                return Ok(());
2923            }
2924
2925            // Decode unknown envelopes for gaps in ordinals.
2926            while _next_ordinal_to_read < 6 {
2927                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2928                _next_ordinal_to_read += 1;
2929                next_offset += envelope_size;
2930            }
2931
2932            let next_out_of_line = decoder.next_out_of_line();
2933            let handles_before = decoder.remaining_handles();
2934            if let Some((inlined, num_bytes, num_handles)) =
2935                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2936            {
2937                let member_inline_size =
2938                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2939                if inlined != (member_inline_size <= 4) {
2940                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2941                }
2942                let inner_offset;
2943                let mut inner_depth = depth.clone();
2944                if inlined {
2945                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2946                    inner_offset = next_offset;
2947                } else {
2948                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2949                    inner_depth.increment()?;
2950                }
2951                let val_ref = self.max_buffer_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
2952                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2953                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2954                {
2955                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2956                }
2957                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2958                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2959                }
2960            }
2961
2962            next_offset += envelope_size;
2963            _next_ordinal_to_read += 1;
2964            if next_offset >= end_offset {
2965                return Ok(());
2966            }
2967
2968            // Decode unknown envelopes for gaps in ordinals.
2969            while _next_ordinal_to_read < 7 {
2970                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2971                _next_ordinal_to_read += 1;
2972                next_offset += envelope_size;
2973            }
2974
2975            let next_out_of_line = decoder.next_out_of_line();
2976            let handles_before = decoder.remaining_handles();
2977            if let Some((inlined, num_bytes, num_handles)) =
2978                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2979            {
2980                let member_inline_size =
2981                    <BufferMemoryConstraints as fidl::encoding::TypeMarker>::inline_size(
2982                        decoder.context,
2983                    );
2984                if inlined != (member_inline_size <= 4) {
2985                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2986                }
2987                let inner_offset;
2988                let mut inner_depth = depth.clone();
2989                if inlined {
2990                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2991                    inner_offset = next_offset;
2992                } else {
2993                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2994                    inner_depth.increment()?;
2995                }
2996                let val_ref = self
2997                    .buffer_memory_constraints
2998                    .get_or_insert_with(|| fidl::new_empty!(BufferMemoryConstraints, D));
2999                fidl::decode!(
3000                    BufferMemoryConstraints,
3001                    D,
3002                    val_ref,
3003                    decoder,
3004                    inner_offset,
3005                    inner_depth
3006                )?;
3007                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3008                {
3009                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3010                }
3011                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3012                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3013                }
3014            }
3015
3016            next_offset += envelope_size;
3017            _next_ordinal_to_read += 1;
3018            if next_offset >= end_offset {
3019                return Ok(());
3020            }
3021
3022            // Decode unknown envelopes for gaps in ordinals.
3023            while _next_ordinal_to_read < 8 {
3024                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3025                _next_ordinal_to_read += 1;
3026                next_offset += envelope_size;
3027            }
3028
3029            let next_out_of_line = decoder.next_out_of_line();
3030            let handles_before = decoder.remaining_handles();
3031            if let Some((inlined, num_bytes, num_handles)) =
3032                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3033            {
3034                let member_inline_size = <fidl::encoding::Vector<ImageFormatConstraints, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3035                if inlined != (member_inline_size <= 4) {
3036                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3037                }
3038                let inner_offset;
3039                let mut inner_depth = depth.clone();
3040                if inlined {
3041                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3042                    inner_offset = next_offset;
3043                } else {
3044                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3045                    inner_depth.increment()?;
3046                }
3047                let val_ref = self.image_format_constraints.get_or_insert_with(
3048                    || fidl::new_empty!(fidl::encoding::Vector<ImageFormatConstraints, 64>, D),
3049                );
3050                fidl::decode!(fidl::encoding::Vector<ImageFormatConstraints, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
3051                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3052                {
3053                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3054                }
3055                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3056                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3057                }
3058            }
3059
3060            next_offset += envelope_size;
3061
3062            // Decode the remaining unknown envelopes.
3063            while next_offset < end_offset {
3064                _next_ordinal_to_read += 1;
3065                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3066                next_offset += envelope_size;
3067            }
3068
3069            Ok(())
3070        }
3071    }
3072
3073    impl BufferCollectionTokenDuplicateSyncRequest {
3074        #[inline(always)]
3075        fn max_ordinal_present(&self) -> u64 {
3076            if let Some(_) = self.rights_attenuation_masks {
3077                return 1;
3078            }
3079            0
3080        }
3081    }
3082
3083    impl fidl::encoding::ValueTypeMarker for BufferCollectionTokenDuplicateSyncRequest {
3084        type Borrowed<'a> = &'a Self;
3085        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3086            value
3087        }
3088    }
3089
3090    unsafe impl fidl::encoding::TypeMarker for BufferCollectionTokenDuplicateSyncRequest {
3091        type Owned = Self;
3092
3093        #[inline(always)]
3094        fn inline_align(_context: fidl::encoding::Context) -> usize {
3095            8
3096        }
3097
3098        #[inline(always)]
3099        fn inline_size(_context: fidl::encoding::Context) -> usize {
3100            16
3101        }
3102    }
3103
3104    unsafe impl<D: fidl::encoding::ResourceDialect>
3105        fidl::encoding::Encode<BufferCollectionTokenDuplicateSyncRequest, D>
3106        for &BufferCollectionTokenDuplicateSyncRequest
3107    {
3108        unsafe fn encode(
3109            self,
3110            encoder: &mut fidl::encoding::Encoder<'_, D>,
3111            offset: usize,
3112            mut depth: fidl::encoding::Depth,
3113        ) -> fidl::Result<()> {
3114            encoder.debug_check_bounds::<BufferCollectionTokenDuplicateSyncRequest>(offset);
3115            // Vector header
3116            let max_ordinal: u64 = self.max_ordinal_present();
3117            encoder.write_num(max_ordinal, offset);
3118            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3119            // Calling encoder.out_of_line_offset(0) is not allowed.
3120            if max_ordinal == 0 {
3121                return Ok(());
3122            }
3123            depth.increment()?;
3124            let envelope_size = 8;
3125            let bytes_len = max_ordinal as usize * envelope_size;
3126            #[allow(unused_variables)]
3127            let offset = encoder.out_of_line_offset(bytes_len);
3128            let mut _prev_end_offset: usize = 0;
3129            if 1 > max_ordinal {
3130                return Ok(());
3131            }
3132
3133            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3134            // are envelope_size bytes.
3135            let cur_offset: usize = (1 - 1) * envelope_size;
3136
3137            // Zero reserved fields.
3138            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3139
3140            // Safety:
3141            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3142            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3143            //   envelope_size bytes, there is always sufficient room.
3144            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::Rights, 64>, D>(
3145            self.rights_attenuation_masks.as_ref().map(<fidl::encoding::Vector<fidl::Rights, 64> as fidl::encoding::ValueTypeMarker>::borrow),
3146            encoder, offset + cur_offset, depth
3147        )?;
3148
3149            _prev_end_offset = cur_offset + envelope_size;
3150
3151            Ok(())
3152        }
3153    }
3154
3155    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3156        for BufferCollectionTokenDuplicateSyncRequest
3157    {
3158        #[inline(always)]
3159        fn new_empty() -> Self {
3160            Self::default()
3161        }
3162
3163        unsafe fn decode(
3164            &mut self,
3165            decoder: &mut fidl::encoding::Decoder<'_, D>,
3166            offset: usize,
3167            mut depth: fidl::encoding::Depth,
3168        ) -> fidl::Result<()> {
3169            decoder.debug_check_bounds::<Self>(offset);
3170            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3171                None => return Err(fidl::Error::NotNullable),
3172                Some(len) => len,
3173            };
3174            // Calling decoder.out_of_line_offset(0) is not allowed.
3175            if len == 0 {
3176                return Ok(());
3177            };
3178            depth.increment()?;
3179            let envelope_size = 8;
3180            let bytes_len = len * envelope_size;
3181            let offset = decoder.out_of_line_offset(bytes_len)?;
3182            // Decode the envelope for each type.
3183            let mut _next_ordinal_to_read = 0;
3184            let mut next_offset = offset;
3185            let end_offset = offset + bytes_len;
3186            _next_ordinal_to_read += 1;
3187            if next_offset >= end_offset {
3188                return Ok(());
3189            }
3190
3191            // Decode unknown envelopes for gaps in ordinals.
3192            while _next_ordinal_to_read < 1 {
3193                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3194                _next_ordinal_to_read += 1;
3195                next_offset += envelope_size;
3196            }
3197
3198            let next_out_of_line = decoder.next_out_of_line();
3199            let handles_before = decoder.remaining_handles();
3200            if let Some((inlined, num_bytes, num_handles)) =
3201                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3202            {
3203                let member_inline_size = <fidl::encoding::Vector<fidl::Rights, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3204                if inlined != (member_inline_size <= 4) {
3205                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3206                }
3207                let inner_offset;
3208                let mut inner_depth = depth.clone();
3209                if inlined {
3210                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3211                    inner_offset = next_offset;
3212                } else {
3213                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3214                    inner_depth.increment()?;
3215                }
3216                let val_ref = self.rights_attenuation_masks.get_or_insert_with(
3217                    || fidl::new_empty!(fidl::encoding::Vector<fidl::Rights, 64>, D),
3218                );
3219                fidl::decode!(fidl::encoding::Vector<fidl::Rights, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
3220                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3221                {
3222                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3223                }
3224                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3225                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3226                }
3227            }
3228
3229            next_offset += envelope_size;
3230
3231            // Decode the remaining unknown envelopes.
3232            while next_offset < end_offset {
3233                _next_ordinal_to_read += 1;
3234                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3235                next_offset += envelope_size;
3236            }
3237
3238            Ok(())
3239        }
3240    }
3241
3242    impl BufferCollectionTokenGroupCreateChildrenSyncRequest {
3243        #[inline(always)]
3244        fn max_ordinal_present(&self) -> u64 {
3245            if let Some(_) = self.rights_attenuation_masks {
3246                return 1;
3247            }
3248            0
3249        }
3250    }
3251
3252    impl fidl::encoding::ValueTypeMarker for BufferCollectionTokenGroupCreateChildrenSyncRequest {
3253        type Borrowed<'a> = &'a Self;
3254        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3255            value
3256        }
3257    }
3258
3259    unsafe impl fidl::encoding::TypeMarker for BufferCollectionTokenGroupCreateChildrenSyncRequest {
3260        type Owned = Self;
3261
3262        #[inline(always)]
3263        fn inline_align(_context: fidl::encoding::Context) -> usize {
3264            8
3265        }
3266
3267        #[inline(always)]
3268        fn inline_size(_context: fidl::encoding::Context) -> usize {
3269            16
3270        }
3271    }
3272
3273    unsafe impl<D: fidl::encoding::ResourceDialect>
3274        fidl::encoding::Encode<BufferCollectionTokenGroupCreateChildrenSyncRequest, D>
3275        for &BufferCollectionTokenGroupCreateChildrenSyncRequest
3276    {
3277        unsafe fn encode(
3278            self,
3279            encoder: &mut fidl::encoding::Encoder<'_, D>,
3280            offset: usize,
3281            mut depth: fidl::encoding::Depth,
3282        ) -> fidl::Result<()> {
3283            encoder
3284                .debug_check_bounds::<BufferCollectionTokenGroupCreateChildrenSyncRequest>(offset);
3285            // Vector header
3286            let max_ordinal: u64 = self.max_ordinal_present();
3287            encoder.write_num(max_ordinal, offset);
3288            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3289            // Calling encoder.out_of_line_offset(0) is not allowed.
3290            if max_ordinal == 0 {
3291                return Ok(());
3292            }
3293            depth.increment()?;
3294            let envelope_size = 8;
3295            let bytes_len = max_ordinal as usize * envelope_size;
3296            #[allow(unused_variables)]
3297            let offset = encoder.out_of_line_offset(bytes_len);
3298            let mut _prev_end_offset: usize = 0;
3299            if 1 > max_ordinal {
3300                return Ok(());
3301            }
3302
3303            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3304            // are envelope_size bytes.
3305            let cur_offset: usize = (1 - 1) * envelope_size;
3306
3307            // Zero reserved fields.
3308            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3309
3310            // Safety:
3311            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3312            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3313            //   envelope_size bytes, there is always sufficient room.
3314            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl::Rights, 64>, D>(
3315            self.rights_attenuation_masks.as_ref().map(<fidl::encoding::Vector<fidl::Rights, 64> as fidl::encoding::ValueTypeMarker>::borrow),
3316            encoder, offset + cur_offset, depth
3317        )?;
3318
3319            _prev_end_offset = cur_offset + envelope_size;
3320
3321            Ok(())
3322        }
3323    }
3324
3325    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3326        for BufferCollectionTokenGroupCreateChildrenSyncRequest
3327    {
3328        #[inline(always)]
3329        fn new_empty() -> Self {
3330            Self::default()
3331        }
3332
3333        unsafe fn decode(
3334            &mut self,
3335            decoder: &mut fidl::encoding::Decoder<'_, D>,
3336            offset: usize,
3337            mut depth: fidl::encoding::Depth,
3338        ) -> fidl::Result<()> {
3339            decoder.debug_check_bounds::<Self>(offset);
3340            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3341                None => return Err(fidl::Error::NotNullable),
3342                Some(len) => len,
3343            };
3344            // Calling decoder.out_of_line_offset(0) is not allowed.
3345            if len == 0 {
3346                return Ok(());
3347            };
3348            depth.increment()?;
3349            let envelope_size = 8;
3350            let bytes_len = len * envelope_size;
3351            let offset = decoder.out_of_line_offset(bytes_len)?;
3352            // Decode the envelope for each type.
3353            let mut _next_ordinal_to_read = 0;
3354            let mut next_offset = offset;
3355            let end_offset = offset + bytes_len;
3356            _next_ordinal_to_read += 1;
3357            if next_offset >= end_offset {
3358                return Ok(());
3359            }
3360
3361            // Decode unknown envelopes for gaps in ordinals.
3362            while _next_ordinal_to_read < 1 {
3363                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3364                _next_ordinal_to_read += 1;
3365                next_offset += envelope_size;
3366            }
3367
3368            let next_out_of_line = decoder.next_out_of_line();
3369            let handles_before = decoder.remaining_handles();
3370            if let Some((inlined, num_bytes, num_handles)) =
3371                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3372            {
3373                let member_inline_size = <fidl::encoding::Vector<fidl::Rights, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3374                if inlined != (member_inline_size <= 4) {
3375                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3376                }
3377                let inner_offset;
3378                let mut inner_depth = depth.clone();
3379                if inlined {
3380                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3381                    inner_offset = next_offset;
3382                } else {
3383                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3384                    inner_depth.increment()?;
3385                }
3386                let val_ref = self.rights_attenuation_masks.get_or_insert_with(
3387                    || fidl::new_empty!(fidl::encoding::Vector<fidl::Rights, 64>, D),
3388                );
3389                fidl::decode!(fidl::encoding::Vector<fidl::Rights, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
3390                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3391                {
3392                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3393                }
3394                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3395                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3396                }
3397            }
3398
3399            next_offset += envelope_size;
3400
3401            // Decode the remaining unknown envelopes.
3402            while next_offset < end_offset {
3403                _next_ordinal_to_read += 1;
3404                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3405                next_offset += envelope_size;
3406            }
3407
3408            Ok(())
3409        }
3410    }
3411
3412    impl BufferMemoryConstraints {
3413        #[inline(always)]
3414        fn max_ordinal_present(&self) -> u64 {
3415            if let Some(_) = self.permitted_heaps {
3416                return 8;
3417            }
3418            if let Some(_) = self.inaccessible_domain_supported {
3419                return 7;
3420            }
3421            if let Some(_) = self.ram_domain_supported {
3422                return 6;
3423            }
3424            if let Some(_) = self.cpu_domain_supported {
3425                return 5;
3426            }
3427            if let Some(_) = self.secure_required {
3428                return 4;
3429            }
3430            if let Some(_) = self.physically_contiguous_required {
3431                return 3;
3432            }
3433            if let Some(_) = self.max_size_bytes {
3434                return 2;
3435            }
3436            if let Some(_) = self.min_size_bytes {
3437                return 1;
3438            }
3439            0
3440        }
3441    }
3442
3443    impl fidl::encoding::ValueTypeMarker for BufferMemoryConstraints {
3444        type Borrowed<'a> = &'a Self;
3445        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3446            value
3447        }
3448    }
3449
3450    unsafe impl fidl::encoding::TypeMarker for BufferMemoryConstraints {
3451        type Owned = Self;
3452
3453        #[inline(always)]
3454        fn inline_align(_context: fidl::encoding::Context) -> usize {
3455            8
3456        }
3457
3458        #[inline(always)]
3459        fn inline_size(_context: fidl::encoding::Context) -> usize {
3460            16
3461        }
3462    }
3463
3464    unsafe impl<D: fidl::encoding::ResourceDialect>
3465        fidl::encoding::Encode<BufferMemoryConstraints, D> for &BufferMemoryConstraints
3466    {
3467        unsafe fn encode(
3468            self,
3469            encoder: &mut fidl::encoding::Encoder<'_, D>,
3470            offset: usize,
3471            mut depth: fidl::encoding::Depth,
3472        ) -> fidl::Result<()> {
3473            encoder.debug_check_bounds::<BufferMemoryConstraints>(offset);
3474            // Vector header
3475            let max_ordinal: u64 = self.max_ordinal_present();
3476            encoder.write_num(max_ordinal, offset);
3477            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3478            // Calling encoder.out_of_line_offset(0) is not allowed.
3479            if max_ordinal == 0 {
3480                return Ok(());
3481            }
3482            depth.increment()?;
3483            let envelope_size = 8;
3484            let bytes_len = max_ordinal as usize * envelope_size;
3485            #[allow(unused_variables)]
3486            let offset = encoder.out_of_line_offset(bytes_len);
3487            let mut _prev_end_offset: usize = 0;
3488            if 1 > max_ordinal {
3489                return Ok(());
3490            }
3491
3492            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3493            // are envelope_size bytes.
3494            let cur_offset: usize = (1 - 1) * envelope_size;
3495
3496            // Zero reserved fields.
3497            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3498
3499            // Safety:
3500            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3501            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3502            //   envelope_size bytes, there is always sufficient room.
3503            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3504                self.min_size_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3505                encoder,
3506                offset + cur_offset,
3507                depth,
3508            )?;
3509
3510            _prev_end_offset = cur_offset + envelope_size;
3511            if 2 > max_ordinal {
3512                return Ok(());
3513            }
3514
3515            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3516            // are envelope_size bytes.
3517            let cur_offset: usize = (2 - 1) * envelope_size;
3518
3519            // Zero reserved fields.
3520            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3521
3522            // Safety:
3523            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3524            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3525            //   envelope_size bytes, there is always sufficient room.
3526            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3527                self.max_size_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3528                encoder,
3529                offset + cur_offset,
3530                depth,
3531            )?;
3532
3533            _prev_end_offset = cur_offset + envelope_size;
3534            if 3 > max_ordinal {
3535                return Ok(());
3536            }
3537
3538            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3539            // are envelope_size bytes.
3540            let cur_offset: usize = (3 - 1) * envelope_size;
3541
3542            // Zero reserved fields.
3543            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3544
3545            // Safety:
3546            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3547            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3548            //   envelope_size bytes, there is always sufficient room.
3549            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3550                self.physically_contiguous_required
3551                    .as_ref()
3552                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3553                encoder,
3554                offset + cur_offset,
3555                depth,
3556            )?;
3557
3558            _prev_end_offset = cur_offset + envelope_size;
3559            if 4 > max_ordinal {
3560                return Ok(());
3561            }
3562
3563            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3564            // are envelope_size bytes.
3565            let cur_offset: usize = (4 - 1) * envelope_size;
3566
3567            // Zero reserved fields.
3568            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3569
3570            // Safety:
3571            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3572            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3573            //   envelope_size bytes, there is always sufficient room.
3574            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3575                self.secure_required
3576                    .as_ref()
3577                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3578                encoder,
3579                offset + cur_offset,
3580                depth,
3581            )?;
3582
3583            _prev_end_offset = cur_offset + envelope_size;
3584            if 5 > max_ordinal {
3585                return Ok(());
3586            }
3587
3588            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3589            // are envelope_size bytes.
3590            let cur_offset: usize = (5 - 1) * envelope_size;
3591
3592            // Zero reserved fields.
3593            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3594
3595            // Safety:
3596            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3597            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3598            //   envelope_size bytes, there is always sufficient room.
3599            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3600                self.cpu_domain_supported
3601                    .as_ref()
3602                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3603                encoder,
3604                offset + cur_offset,
3605                depth,
3606            )?;
3607
3608            _prev_end_offset = cur_offset + envelope_size;
3609            if 6 > max_ordinal {
3610                return Ok(());
3611            }
3612
3613            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3614            // are envelope_size bytes.
3615            let cur_offset: usize = (6 - 1) * envelope_size;
3616
3617            // Zero reserved fields.
3618            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3619
3620            // Safety:
3621            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3622            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3623            //   envelope_size bytes, there is always sufficient room.
3624            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3625                self.ram_domain_supported
3626                    .as_ref()
3627                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3628                encoder,
3629                offset + cur_offset,
3630                depth,
3631            )?;
3632
3633            _prev_end_offset = cur_offset + envelope_size;
3634            if 7 > max_ordinal {
3635                return Ok(());
3636            }
3637
3638            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3639            // are envelope_size bytes.
3640            let cur_offset: usize = (7 - 1) * envelope_size;
3641
3642            // Zero reserved fields.
3643            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3644
3645            // Safety:
3646            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3647            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3648            //   envelope_size bytes, there is always sufficient room.
3649            fidl::encoding::encode_in_envelope_optional::<bool, D>(
3650                self.inaccessible_domain_supported
3651                    .as_ref()
3652                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3653                encoder,
3654                offset + cur_offset,
3655                depth,
3656            )?;
3657
3658            _prev_end_offset = cur_offset + envelope_size;
3659            if 8 > max_ordinal {
3660                return Ok(());
3661            }
3662
3663            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3664            // are envelope_size bytes.
3665            let cur_offset: usize = (8 - 1) * envelope_size;
3666
3667            // Zero reserved fields.
3668            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3669
3670            // Safety:
3671            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3672            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3673            //   envelope_size bytes, there is always sufficient room.
3674            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<Heap, 64>, D>(
3675                self.permitted_heaps.as_ref().map(
3676                    <fidl::encoding::Vector<Heap, 64> as fidl::encoding::ValueTypeMarker>::borrow,
3677                ),
3678                encoder,
3679                offset + cur_offset,
3680                depth,
3681            )?;
3682
3683            _prev_end_offset = cur_offset + envelope_size;
3684
3685            Ok(())
3686        }
3687    }
3688
3689    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3690        for BufferMemoryConstraints
3691    {
3692        #[inline(always)]
3693        fn new_empty() -> Self {
3694            Self::default()
3695        }
3696
3697        unsafe fn decode(
3698            &mut self,
3699            decoder: &mut fidl::encoding::Decoder<'_, D>,
3700            offset: usize,
3701            mut depth: fidl::encoding::Depth,
3702        ) -> fidl::Result<()> {
3703            decoder.debug_check_bounds::<Self>(offset);
3704            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3705                None => return Err(fidl::Error::NotNullable),
3706                Some(len) => len,
3707            };
3708            // Calling decoder.out_of_line_offset(0) is not allowed.
3709            if len == 0 {
3710                return Ok(());
3711            };
3712            depth.increment()?;
3713            let envelope_size = 8;
3714            let bytes_len = len * envelope_size;
3715            let offset = decoder.out_of_line_offset(bytes_len)?;
3716            // Decode the envelope for each type.
3717            let mut _next_ordinal_to_read = 0;
3718            let mut next_offset = offset;
3719            let end_offset = offset + bytes_len;
3720            _next_ordinal_to_read += 1;
3721            if next_offset >= end_offset {
3722                return Ok(());
3723            }
3724
3725            // Decode unknown envelopes for gaps in ordinals.
3726            while _next_ordinal_to_read < 1 {
3727                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3728                _next_ordinal_to_read += 1;
3729                next_offset += envelope_size;
3730            }
3731
3732            let next_out_of_line = decoder.next_out_of_line();
3733            let handles_before = decoder.remaining_handles();
3734            if let Some((inlined, num_bytes, num_handles)) =
3735                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3736            {
3737                let member_inline_size =
3738                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3739                if inlined != (member_inline_size <= 4) {
3740                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3741                }
3742                let inner_offset;
3743                let mut inner_depth = depth.clone();
3744                if inlined {
3745                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3746                    inner_offset = next_offset;
3747                } else {
3748                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3749                    inner_depth.increment()?;
3750                }
3751                let val_ref = self.min_size_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
3752                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3753                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3754                {
3755                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3756                }
3757                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3758                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3759                }
3760            }
3761
3762            next_offset += envelope_size;
3763            _next_ordinal_to_read += 1;
3764            if next_offset >= end_offset {
3765                return Ok(());
3766            }
3767
3768            // Decode unknown envelopes for gaps in ordinals.
3769            while _next_ordinal_to_read < 2 {
3770                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3771                _next_ordinal_to_read += 1;
3772                next_offset += envelope_size;
3773            }
3774
3775            let next_out_of_line = decoder.next_out_of_line();
3776            let handles_before = decoder.remaining_handles();
3777            if let Some((inlined, num_bytes, num_handles)) =
3778                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3779            {
3780                let member_inline_size =
3781                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3782                if inlined != (member_inline_size <= 4) {
3783                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3784                }
3785                let inner_offset;
3786                let mut inner_depth = depth.clone();
3787                if inlined {
3788                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3789                    inner_offset = next_offset;
3790                } else {
3791                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3792                    inner_depth.increment()?;
3793                }
3794                let val_ref = self.max_size_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
3795                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3796                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3797                {
3798                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3799                }
3800                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3801                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3802                }
3803            }
3804
3805            next_offset += envelope_size;
3806            _next_ordinal_to_read += 1;
3807            if next_offset >= end_offset {
3808                return Ok(());
3809            }
3810
3811            // Decode unknown envelopes for gaps in ordinals.
3812            while _next_ordinal_to_read < 3 {
3813                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3814                _next_ordinal_to_read += 1;
3815                next_offset += envelope_size;
3816            }
3817
3818            let next_out_of_line = decoder.next_out_of_line();
3819            let handles_before = decoder.remaining_handles();
3820            if let Some((inlined, num_bytes, num_handles)) =
3821                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3822            {
3823                let member_inline_size =
3824                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3825                if inlined != (member_inline_size <= 4) {
3826                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3827                }
3828                let inner_offset;
3829                let mut inner_depth = depth.clone();
3830                if inlined {
3831                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3832                    inner_offset = next_offset;
3833                } else {
3834                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3835                    inner_depth.increment()?;
3836                }
3837                let val_ref = self
3838                    .physically_contiguous_required
3839                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
3840                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3841                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3842                {
3843                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3844                }
3845                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3846                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3847                }
3848            }
3849
3850            next_offset += envelope_size;
3851            _next_ordinal_to_read += 1;
3852            if next_offset >= end_offset {
3853                return Ok(());
3854            }
3855
3856            // Decode unknown envelopes for gaps in ordinals.
3857            while _next_ordinal_to_read < 4 {
3858                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3859                _next_ordinal_to_read += 1;
3860                next_offset += envelope_size;
3861            }
3862
3863            let next_out_of_line = decoder.next_out_of_line();
3864            let handles_before = decoder.remaining_handles();
3865            if let Some((inlined, num_bytes, num_handles)) =
3866                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3867            {
3868                let member_inline_size =
3869                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3870                if inlined != (member_inline_size <= 4) {
3871                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3872                }
3873                let inner_offset;
3874                let mut inner_depth = depth.clone();
3875                if inlined {
3876                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3877                    inner_offset = next_offset;
3878                } else {
3879                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3880                    inner_depth.increment()?;
3881                }
3882                let val_ref = self.secure_required.get_or_insert_with(|| fidl::new_empty!(bool, D));
3883                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3884                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3885                {
3886                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3887                }
3888                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3889                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3890                }
3891            }
3892
3893            next_offset += envelope_size;
3894            _next_ordinal_to_read += 1;
3895            if next_offset >= end_offset {
3896                return Ok(());
3897            }
3898
3899            // Decode unknown envelopes for gaps in ordinals.
3900            while _next_ordinal_to_read < 5 {
3901                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3902                _next_ordinal_to_read += 1;
3903                next_offset += envelope_size;
3904            }
3905
3906            let next_out_of_line = decoder.next_out_of_line();
3907            let handles_before = decoder.remaining_handles();
3908            if let Some((inlined, num_bytes, num_handles)) =
3909                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3910            {
3911                let member_inline_size =
3912                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3913                if inlined != (member_inline_size <= 4) {
3914                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3915                }
3916                let inner_offset;
3917                let mut inner_depth = depth.clone();
3918                if inlined {
3919                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3920                    inner_offset = next_offset;
3921                } else {
3922                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3923                    inner_depth.increment()?;
3924                }
3925                let val_ref =
3926                    self.cpu_domain_supported.get_or_insert_with(|| fidl::new_empty!(bool, D));
3927                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3928                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3929                {
3930                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3931                }
3932                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3933                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3934                }
3935            }
3936
3937            next_offset += envelope_size;
3938            _next_ordinal_to_read += 1;
3939            if next_offset >= end_offset {
3940                return Ok(());
3941            }
3942
3943            // Decode unknown envelopes for gaps in ordinals.
3944            while _next_ordinal_to_read < 6 {
3945                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3946                _next_ordinal_to_read += 1;
3947                next_offset += envelope_size;
3948            }
3949
3950            let next_out_of_line = decoder.next_out_of_line();
3951            let handles_before = decoder.remaining_handles();
3952            if let Some((inlined, num_bytes, num_handles)) =
3953                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3954            {
3955                let member_inline_size =
3956                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3957                if inlined != (member_inline_size <= 4) {
3958                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3959                }
3960                let inner_offset;
3961                let mut inner_depth = depth.clone();
3962                if inlined {
3963                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3964                    inner_offset = next_offset;
3965                } else {
3966                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3967                    inner_depth.increment()?;
3968                }
3969                let val_ref =
3970                    self.ram_domain_supported.get_or_insert_with(|| fidl::new_empty!(bool, D));
3971                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3972                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3973                {
3974                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3975                }
3976                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3977                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3978                }
3979            }
3980
3981            next_offset += envelope_size;
3982            _next_ordinal_to_read += 1;
3983            if next_offset >= end_offset {
3984                return Ok(());
3985            }
3986
3987            // Decode unknown envelopes for gaps in ordinals.
3988            while _next_ordinal_to_read < 7 {
3989                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3990                _next_ordinal_to_read += 1;
3991                next_offset += envelope_size;
3992            }
3993
3994            let next_out_of_line = decoder.next_out_of_line();
3995            let handles_before = decoder.remaining_handles();
3996            if let Some((inlined, num_bytes, num_handles)) =
3997                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3998            {
3999                let member_inline_size =
4000                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4001                if inlined != (member_inline_size <= 4) {
4002                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4003                }
4004                let inner_offset;
4005                let mut inner_depth = depth.clone();
4006                if inlined {
4007                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4008                    inner_offset = next_offset;
4009                } else {
4010                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4011                    inner_depth.increment()?;
4012                }
4013                let val_ref = self
4014                    .inaccessible_domain_supported
4015                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
4016                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4017                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4018                {
4019                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4020                }
4021                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4022                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4023                }
4024            }
4025
4026            next_offset += envelope_size;
4027            _next_ordinal_to_read += 1;
4028            if next_offset >= end_offset {
4029                return Ok(());
4030            }
4031
4032            // Decode unknown envelopes for gaps in ordinals.
4033            while _next_ordinal_to_read < 8 {
4034                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4035                _next_ordinal_to_read += 1;
4036                next_offset += envelope_size;
4037            }
4038
4039            let next_out_of_line = decoder.next_out_of_line();
4040            let handles_before = decoder.remaining_handles();
4041            if let Some((inlined, num_bytes, num_handles)) =
4042                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4043            {
4044                let member_inline_size =
4045                    <fidl::encoding::Vector<Heap, 64> as fidl::encoding::TypeMarker>::inline_size(
4046                        decoder.context,
4047                    );
4048                if inlined != (member_inline_size <= 4) {
4049                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4050                }
4051                let inner_offset;
4052                let mut inner_depth = depth.clone();
4053                if inlined {
4054                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4055                    inner_offset = next_offset;
4056                } else {
4057                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4058                    inner_depth.increment()?;
4059                }
4060                let val_ref = self
4061                    .permitted_heaps
4062                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<Heap, 64>, D));
4063                fidl::decode!(fidl::encoding::Vector<Heap, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
4064                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4065                {
4066                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4067                }
4068                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4069                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4070                }
4071            }
4072
4073            next_offset += envelope_size;
4074
4075            // Decode the remaining unknown envelopes.
4076            while next_offset < end_offset {
4077                _next_ordinal_to_read += 1;
4078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4079                next_offset += envelope_size;
4080            }
4081
4082            Ok(())
4083        }
4084    }
4085
4086    impl BufferMemorySettings {
4087        #[inline(always)]
4088        fn max_ordinal_present(&self) -> u64 {
4089            if let Some(_) = self.heap {
4090                return 5;
4091            }
4092            if let Some(_) = self.coherency_domain {
4093                return 4;
4094            }
4095            if let Some(_) = self.is_secure {
4096                return 3;
4097            }
4098            if let Some(_) = self.is_physically_contiguous {
4099                return 2;
4100            }
4101            if let Some(_) = self.size_bytes {
4102                return 1;
4103            }
4104            0
4105        }
4106    }
4107
4108    impl fidl::encoding::ValueTypeMarker for BufferMemorySettings {
4109        type Borrowed<'a> = &'a Self;
4110        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4111            value
4112        }
4113    }
4114
4115    unsafe impl fidl::encoding::TypeMarker for BufferMemorySettings {
4116        type Owned = Self;
4117
4118        #[inline(always)]
4119        fn inline_align(_context: fidl::encoding::Context) -> usize {
4120            8
4121        }
4122
4123        #[inline(always)]
4124        fn inline_size(_context: fidl::encoding::Context) -> usize {
4125            16
4126        }
4127    }
4128
4129    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BufferMemorySettings, D>
4130        for &BufferMemorySettings
4131    {
4132        unsafe fn encode(
4133            self,
4134            encoder: &mut fidl::encoding::Encoder<'_, D>,
4135            offset: usize,
4136            mut depth: fidl::encoding::Depth,
4137        ) -> fidl::Result<()> {
4138            encoder.debug_check_bounds::<BufferMemorySettings>(offset);
4139            // Vector header
4140            let max_ordinal: u64 = self.max_ordinal_present();
4141            encoder.write_num(max_ordinal, offset);
4142            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4143            // Calling encoder.out_of_line_offset(0) is not allowed.
4144            if max_ordinal == 0 {
4145                return Ok(());
4146            }
4147            depth.increment()?;
4148            let envelope_size = 8;
4149            let bytes_len = max_ordinal as usize * envelope_size;
4150            #[allow(unused_variables)]
4151            let offset = encoder.out_of_line_offset(bytes_len);
4152            let mut _prev_end_offset: usize = 0;
4153            if 1 > max_ordinal {
4154                return Ok(());
4155            }
4156
4157            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4158            // are envelope_size bytes.
4159            let cur_offset: usize = (1 - 1) * envelope_size;
4160
4161            // Zero reserved fields.
4162            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4163
4164            // Safety:
4165            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4166            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4167            //   envelope_size bytes, there is always sufficient room.
4168            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4169                self.size_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4170                encoder,
4171                offset + cur_offset,
4172                depth,
4173            )?;
4174
4175            _prev_end_offset = cur_offset + envelope_size;
4176            if 2 > max_ordinal {
4177                return Ok(());
4178            }
4179
4180            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4181            // are envelope_size bytes.
4182            let cur_offset: usize = (2 - 1) * envelope_size;
4183
4184            // Zero reserved fields.
4185            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4186
4187            // Safety:
4188            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4189            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4190            //   envelope_size bytes, there is always sufficient room.
4191            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4192                self.is_physically_contiguous
4193                    .as_ref()
4194                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4195                encoder,
4196                offset + cur_offset,
4197                depth,
4198            )?;
4199
4200            _prev_end_offset = cur_offset + envelope_size;
4201            if 3 > max_ordinal {
4202                return Ok(());
4203            }
4204
4205            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4206            // are envelope_size bytes.
4207            let cur_offset: usize = (3 - 1) * envelope_size;
4208
4209            // Zero reserved fields.
4210            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4211
4212            // Safety:
4213            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4214            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4215            //   envelope_size bytes, there is always sufficient room.
4216            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4217                self.is_secure.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4218                encoder,
4219                offset + cur_offset,
4220                depth,
4221            )?;
4222
4223            _prev_end_offset = cur_offset + envelope_size;
4224            if 4 > max_ordinal {
4225                return Ok(());
4226            }
4227
4228            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4229            // are envelope_size bytes.
4230            let cur_offset: usize = (4 - 1) * envelope_size;
4231
4232            // Zero reserved fields.
4233            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4234
4235            // Safety:
4236            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4237            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4238            //   envelope_size bytes, there is always sufficient room.
4239            fidl::encoding::encode_in_envelope_optional::<CoherencyDomain, D>(
4240                self.coherency_domain
4241                    .as_ref()
4242                    .map(<CoherencyDomain as fidl::encoding::ValueTypeMarker>::borrow),
4243                encoder,
4244                offset + cur_offset,
4245                depth,
4246            )?;
4247
4248            _prev_end_offset = cur_offset + envelope_size;
4249            if 5 > max_ordinal {
4250                return Ok(());
4251            }
4252
4253            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4254            // are envelope_size bytes.
4255            let cur_offset: usize = (5 - 1) * envelope_size;
4256
4257            // Zero reserved fields.
4258            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4259
4260            // Safety:
4261            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4262            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4263            //   envelope_size bytes, there is always sufficient room.
4264            fidl::encoding::encode_in_envelope_optional::<Heap, D>(
4265                self.heap.as_ref().map(<Heap as fidl::encoding::ValueTypeMarker>::borrow),
4266                encoder,
4267                offset + cur_offset,
4268                depth,
4269            )?;
4270
4271            _prev_end_offset = cur_offset + envelope_size;
4272
4273            Ok(())
4274        }
4275    }
4276
4277    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferMemorySettings {
4278        #[inline(always)]
4279        fn new_empty() -> Self {
4280            Self::default()
4281        }
4282
4283        unsafe fn decode(
4284            &mut self,
4285            decoder: &mut fidl::encoding::Decoder<'_, D>,
4286            offset: usize,
4287            mut depth: fidl::encoding::Depth,
4288        ) -> fidl::Result<()> {
4289            decoder.debug_check_bounds::<Self>(offset);
4290            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4291                None => return Err(fidl::Error::NotNullable),
4292                Some(len) => len,
4293            };
4294            // Calling decoder.out_of_line_offset(0) is not allowed.
4295            if len == 0 {
4296                return Ok(());
4297            };
4298            depth.increment()?;
4299            let envelope_size = 8;
4300            let bytes_len = len * envelope_size;
4301            let offset = decoder.out_of_line_offset(bytes_len)?;
4302            // Decode the envelope for each type.
4303            let mut _next_ordinal_to_read = 0;
4304            let mut next_offset = offset;
4305            let end_offset = offset + bytes_len;
4306            _next_ordinal_to_read += 1;
4307            if next_offset >= end_offset {
4308                return Ok(());
4309            }
4310
4311            // Decode unknown envelopes for gaps in ordinals.
4312            while _next_ordinal_to_read < 1 {
4313                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4314                _next_ordinal_to_read += 1;
4315                next_offset += envelope_size;
4316            }
4317
4318            let next_out_of_line = decoder.next_out_of_line();
4319            let handles_before = decoder.remaining_handles();
4320            if let Some((inlined, num_bytes, num_handles)) =
4321                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4322            {
4323                let member_inline_size =
4324                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4325                if inlined != (member_inline_size <= 4) {
4326                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4327                }
4328                let inner_offset;
4329                let mut inner_depth = depth.clone();
4330                if inlined {
4331                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4332                    inner_offset = next_offset;
4333                } else {
4334                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4335                    inner_depth.increment()?;
4336                }
4337                let val_ref = self.size_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
4338                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4339                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4340                {
4341                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4342                }
4343                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4344                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4345                }
4346            }
4347
4348            next_offset += envelope_size;
4349            _next_ordinal_to_read += 1;
4350            if next_offset >= end_offset {
4351                return Ok(());
4352            }
4353
4354            // Decode unknown envelopes for gaps in ordinals.
4355            while _next_ordinal_to_read < 2 {
4356                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4357                _next_ordinal_to_read += 1;
4358                next_offset += envelope_size;
4359            }
4360
4361            let next_out_of_line = decoder.next_out_of_line();
4362            let handles_before = decoder.remaining_handles();
4363            if let Some((inlined, num_bytes, num_handles)) =
4364                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4365            {
4366                let member_inline_size =
4367                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4368                if inlined != (member_inline_size <= 4) {
4369                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4370                }
4371                let inner_offset;
4372                let mut inner_depth = depth.clone();
4373                if inlined {
4374                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4375                    inner_offset = next_offset;
4376                } else {
4377                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4378                    inner_depth.increment()?;
4379                }
4380                let val_ref =
4381                    self.is_physically_contiguous.get_or_insert_with(|| fidl::new_empty!(bool, D));
4382                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4383                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4384                {
4385                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4386                }
4387                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4388                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4389                }
4390            }
4391
4392            next_offset += envelope_size;
4393            _next_ordinal_to_read += 1;
4394            if next_offset >= end_offset {
4395                return Ok(());
4396            }
4397
4398            // Decode unknown envelopes for gaps in ordinals.
4399            while _next_ordinal_to_read < 3 {
4400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4401                _next_ordinal_to_read += 1;
4402                next_offset += envelope_size;
4403            }
4404
4405            let next_out_of_line = decoder.next_out_of_line();
4406            let handles_before = decoder.remaining_handles();
4407            if let Some((inlined, num_bytes, num_handles)) =
4408                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4409            {
4410                let member_inline_size =
4411                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4412                if inlined != (member_inline_size <= 4) {
4413                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4414                }
4415                let inner_offset;
4416                let mut inner_depth = depth.clone();
4417                if inlined {
4418                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4419                    inner_offset = next_offset;
4420                } else {
4421                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4422                    inner_depth.increment()?;
4423                }
4424                let val_ref = self.is_secure.get_or_insert_with(|| fidl::new_empty!(bool, D));
4425                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4426                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4427                {
4428                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4429                }
4430                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4431                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4432                }
4433            }
4434
4435            next_offset += envelope_size;
4436            _next_ordinal_to_read += 1;
4437            if next_offset >= end_offset {
4438                return Ok(());
4439            }
4440
4441            // Decode unknown envelopes for gaps in ordinals.
4442            while _next_ordinal_to_read < 4 {
4443                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4444                _next_ordinal_to_read += 1;
4445                next_offset += envelope_size;
4446            }
4447
4448            let next_out_of_line = decoder.next_out_of_line();
4449            let handles_before = decoder.remaining_handles();
4450            if let Some((inlined, num_bytes, num_handles)) =
4451                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4452            {
4453                let member_inline_size =
4454                    <CoherencyDomain as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4455                if inlined != (member_inline_size <= 4) {
4456                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4457                }
4458                let inner_offset;
4459                let mut inner_depth = depth.clone();
4460                if inlined {
4461                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4462                    inner_offset = next_offset;
4463                } else {
4464                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4465                    inner_depth.increment()?;
4466                }
4467                let val_ref = self
4468                    .coherency_domain
4469                    .get_or_insert_with(|| fidl::new_empty!(CoherencyDomain, D));
4470                fidl::decode!(CoherencyDomain, D, val_ref, decoder, inner_offset, inner_depth)?;
4471                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4472                {
4473                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4474                }
4475                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4476                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4477                }
4478            }
4479
4480            next_offset += envelope_size;
4481            _next_ordinal_to_read += 1;
4482            if next_offset >= end_offset {
4483                return Ok(());
4484            }
4485
4486            // Decode unknown envelopes for gaps in ordinals.
4487            while _next_ordinal_to_read < 5 {
4488                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4489                _next_ordinal_to_read += 1;
4490                next_offset += envelope_size;
4491            }
4492
4493            let next_out_of_line = decoder.next_out_of_line();
4494            let handles_before = decoder.remaining_handles();
4495            if let Some((inlined, num_bytes, num_handles)) =
4496                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4497            {
4498                let member_inline_size =
4499                    <Heap as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4500                if inlined != (member_inline_size <= 4) {
4501                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4502                }
4503                let inner_offset;
4504                let mut inner_depth = depth.clone();
4505                if inlined {
4506                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4507                    inner_offset = next_offset;
4508                } else {
4509                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4510                    inner_depth.increment()?;
4511                }
4512                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(Heap, D));
4513                fidl::decode!(Heap, D, val_ref, decoder, inner_offset, inner_depth)?;
4514                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4515                {
4516                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4517                }
4518                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4519                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4520                }
4521            }
4522
4523            next_offset += envelope_size;
4524
4525            // Decode the remaining unknown envelopes.
4526            while next_offset < end_offset {
4527                _next_ordinal_to_read += 1;
4528                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4529                next_offset += envelope_size;
4530            }
4531
4532            Ok(())
4533        }
4534    }
4535
4536    impl BufferUsage {
4537        #[inline(always)]
4538        fn max_ordinal_present(&self) -> u64 {
4539            if let Some(_) = self.video {
4540                return 5;
4541            }
4542            if let Some(_) = self.display {
4543                return 4;
4544            }
4545            if let Some(_) = self.vulkan {
4546                return 3;
4547            }
4548            if let Some(_) = self.cpu {
4549                return 2;
4550            }
4551            if let Some(_) = self.none {
4552                return 1;
4553            }
4554            0
4555        }
4556    }
4557
4558    impl fidl::encoding::ValueTypeMarker for BufferUsage {
4559        type Borrowed<'a> = &'a Self;
4560        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4561            value
4562        }
4563    }
4564
4565    unsafe impl fidl::encoding::TypeMarker for BufferUsage {
4566        type Owned = Self;
4567
4568        #[inline(always)]
4569        fn inline_align(_context: fidl::encoding::Context) -> usize {
4570            8
4571        }
4572
4573        #[inline(always)]
4574        fn inline_size(_context: fidl::encoding::Context) -> usize {
4575            16
4576        }
4577    }
4578
4579    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BufferUsage, D>
4580        for &BufferUsage
4581    {
4582        unsafe fn encode(
4583            self,
4584            encoder: &mut fidl::encoding::Encoder<'_, D>,
4585            offset: usize,
4586            mut depth: fidl::encoding::Depth,
4587        ) -> fidl::Result<()> {
4588            encoder.debug_check_bounds::<BufferUsage>(offset);
4589            // Vector header
4590            let max_ordinal: u64 = self.max_ordinal_present();
4591            encoder.write_num(max_ordinal, offset);
4592            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4593            // Calling encoder.out_of_line_offset(0) is not allowed.
4594            if max_ordinal == 0 {
4595                return Ok(());
4596            }
4597            depth.increment()?;
4598            let envelope_size = 8;
4599            let bytes_len = max_ordinal as usize * envelope_size;
4600            #[allow(unused_variables)]
4601            let offset = encoder.out_of_line_offset(bytes_len);
4602            let mut _prev_end_offset: usize = 0;
4603            if 1 > max_ordinal {
4604                return Ok(());
4605            }
4606
4607            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4608            // are envelope_size bytes.
4609            let cur_offset: usize = (1 - 1) * envelope_size;
4610
4611            // Zero reserved fields.
4612            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4613
4614            // Safety:
4615            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4616            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4617            //   envelope_size bytes, there is always sufficient room.
4618            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4619                self.none.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4620                encoder,
4621                offset + cur_offset,
4622                depth,
4623            )?;
4624
4625            _prev_end_offset = cur_offset + envelope_size;
4626            if 2 > max_ordinal {
4627                return Ok(());
4628            }
4629
4630            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4631            // are envelope_size bytes.
4632            let cur_offset: usize = (2 - 1) * envelope_size;
4633
4634            // Zero reserved fields.
4635            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4636
4637            // Safety:
4638            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4639            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4640            //   envelope_size bytes, there is always sufficient room.
4641            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4642                self.cpu.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4643                encoder,
4644                offset + cur_offset,
4645                depth,
4646            )?;
4647
4648            _prev_end_offset = cur_offset + envelope_size;
4649            if 3 > max_ordinal {
4650                return Ok(());
4651            }
4652
4653            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4654            // are envelope_size bytes.
4655            let cur_offset: usize = (3 - 1) * envelope_size;
4656
4657            // Zero reserved fields.
4658            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4659
4660            // Safety:
4661            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4662            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4663            //   envelope_size bytes, there is always sufficient room.
4664            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4665                self.vulkan.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4666                encoder,
4667                offset + cur_offset,
4668                depth,
4669            )?;
4670
4671            _prev_end_offset = cur_offset + envelope_size;
4672            if 4 > max_ordinal {
4673                return Ok(());
4674            }
4675
4676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4677            // are envelope_size bytes.
4678            let cur_offset: usize = (4 - 1) * envelope_size;
4679
4680            // Zero reserved fields.
4681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4682
4683            // Safety:
4684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4686            //   envelope_size bytes, there is always sufficient room.
4687            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4688                self.display.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4689                encoder,
4690                offset + cur_offset,
4691                depth,
4692            )?;
4693
4694            _prev_end_offset = cur_offset + envelope_size;
4695            if 5 > max_ordinal {
4696                return Ok(());
4697            }
4698
4699            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4700            // are envelope_size bytes.
4701            let cur_offset: usize = (5 - 1) * envelope_size;
4702
4703            // Zero reserved fields.
4704            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4705
4706            // Safety:
4707            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4708            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4709            //   envelope_size bytes, there is always sufficient room.
4710            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4711                self.video.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4712                encoder,
4713                offset + cur_offset,
4714                depth,
4715            )?;
4716
4717            _prev_end_offset = cur_offset + envelope_size;
4718
4719            Ok(())
4720        }
4721    }
4722
4723    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferUsage {
4724        #[inline(always)]
4725        fn new_empty() -> Self {
4726            Self::default()
4727        }
4728
4729        unsafe fn decode(
4730            &mut self,
4731            decoder: &mut fidl::encoding::Decoder<'_, D>,
4732            offset: usize,
4733            mut depth: fidl::encoding::Depth,
4734        ) -> fidl::Result<()> {
4735            decoder.debug_check_bounds::<Self>(offset);
4736            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4737                None => return Err(fidl::Error::NotNullable),
4738                Some(len) => len,
4739            };
4740            // Calling decoder.out_of_line_offset(0) is not allowed.
4741            if len == 0 {
4742                return Ok(());
4743            };
4744            depth.increment()?;
4745            let envelope_size = 8;
4746            let bytes_len = len * envelope_size;
4747            let offset = decoder.out_of_line_offset(bytes_len)?;
4748            // Decode the envelope for each type.
4749            let mut _next_ordinal_to_read = 0;
4750            let mut next_offset = offset;
4751            let end_offset = offset + bytes_len;
4752            _next_ordinal_to_read += 1;
4753            if next_offset >= end_offset {
4754                return Ok(());
4755            }
4756
4757            // Decode unknown envelopes for gaps in ordinals.
4758            while _next_ordinal_to_read < 1 {
4759                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4760                _next_ordinal_to_read += 1;
4761                next_offset += envelope_size;
4762            }
4763
4764            let next_out_of_line = decoder.next_out_of_line();
4765            let handles_before = decoder.remaining_handles();
4766            if let Some((inlined, num_bytes, num_handles)) =
4767                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4768            {
4769                let member_inline_size =
4770                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4771                if inlined != (member_inline_size <= 4) {
4772                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4773                }
4774                let inner_offset;
4775                let mut inner_depth = depth.clone();
4776                if inlined {
4777                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4778                    inner_offset = next_offset;
4779                } else {
4780                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4781                    inner_depth.increment()?;
4782                }
4783                let val_ref = self.none.get_or_insert_with(|| fidl::new_empty!(u32, D));
4784                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4785                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4786                {
4787                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4788                }
4789                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4790                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4791                }
4792            }
4793
4794            next_offset += envelope_size;
4795            _next_ordinal_to_read += 1;
4796            if next_offset >= end_offset {
4797                return Ok(());
4798            }
4799
4800            // Decode unknown envelopes for gaps in ordinals.
4801            while _next_ordinal_to_read < 2 {
4802                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4803                _next_ordinal_to_read += 1;
4804                next_offset += envelope_size;
4805            }
4806
4807            let next_out_of_line = decoder.next_out_of_line();
4808            let handles_before = decoder.remaining_handles();
4809            if let Some((inlined, num_bytes, num_handles)) =
4810                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4811            {
4812                let member_inline_size =
4813                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4814                if inlined != (member_inline_size <= 4) {
4815                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4816                }
4817                let inner_offset;
4818                let mut inner_depth = depth.clone();
4819                if inlined {
4820                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4821                    inner_offset = next_offset;
4822                } else {
4823                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4824                    inner_depth.increment()?;
4825                }
4826                let val_ref = self.cpu.get_or_insert_with(|| fidl::new_empty!(u32, D));
4827                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4828                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4829                {
4830                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4831                }
4832                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4833                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4834                }
4835            }
4836
4837            next_offset += envelope_size;
4838            _next_ordinal_to_read += 1;
4839            if next_offset >= end_offset {
4840                return Ok(());
4841            }
4842
4843            // Decode unknown envelopes for gaps in ordinals.
4844            while _next_ordinal_to_read < 3 {
4845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4846                _next_ordinal_to_read += 1;
4847                next_offset += envelope_size;
4848            }
4849
4850            let next_out_of_line = decoder.next_out_of_line();
4851            let handles_before = decoder.remaining_handles();
4852            if let Some((inlined, num_bytes, num_handles)) =
4853                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4854            {
4855                let member_inline_size =
4856                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4857                if inlined != (member_inline_size <= 4) {
4858                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4859                }
4860                let inner_offset;
4861                let mut inner_depth = depth.clone();
4862                if inlined {
4863                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4864                    inner_offset = next_offset;
4865                } else {
4866                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4867                    inner_depth.increment()?;
4868                }
4869                let val_ref = self.vulkan.get_or_insert_with(|| fidl::new_empty!(u32, D));
4870                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4871                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4872                {
4873                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4874                }
4875                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4876                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4877                }
4878            }
4879
4880            next_offset += envelope_size;
4881            _next_ordinal_to_read += 1;
4882            if next_offset >= end_offset {
4883                return Ok(());
4884            }
4885
4886            // Decode unknown envelopes for gaps in ordinals.
4887            while _next_ordinal_to_read < 4 {
4888                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4889                _next_ordinal_to_read += 1;
4890                next_offset += envelope_size;
4891            }
4892
4893            let next_out_of_line = decoder.next_out_of_line();
4894            let handles_before = decoder.remaining_handles();
4895            if let Some((inlined, num_bytes, num_handles)) =
4896                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4897            {
4898                let member_inline_size =
4899                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4900                if inlined != (member_inline_size <= 4) {
4901                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4902                }
4903                let inner_offset;
4904                let mut inner_depth = depth.clone();
4905                if inlined {
4906                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4907                    inner_offset = next_offset;
4908                } else {
4909                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4910                    inner_depth.increment()?;
4911                }
4912                let val_ref = self.display.get_or_insert_with(|| fidl::new_empty!(u32, D));
4913                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4914                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4915                {
4916                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4917                }
4918                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4919                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4920                }
4921            }
4922
4923            next_offset += envelope_size;
4924            _next_ordinal_to_read += 1;
4925            if next_offset >= end_offset {
4926                return Ok(());
4927            }
4928
4929            // Decode unknown envelopes for gaps in ordinals.
4930            while _next_ordinal_to_read < 5 {
4931                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4932                _next_ordinal_to_read += 1;
4933                next_offset += envelope_size;
4934            }
4935
4936            let next_out_of_line = decoder.next_out_of_line();
4937            let handles_before = decoder.remaining_handles();
4938            if let Some((inlined, num_bytes, num_handles)) =
4939                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4940            {
4941                let member_inline_size =
4942                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4943                if inlined != (member_inline_size <= 4) {
4944                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4945                }
4946                let inner_offset;
4947                let mut inner_depth = depth.clone();
4948                if inlined {
4949                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4950                    inner_offset = next_offset;
4951                } else {
4952                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4953                    inner_depth.increment()?;
4954                }
4955                let val_ref = self.video.get_or_insert_with(|| fidl::new_empty!(u32, D));
4956                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4957                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4958                {
4959                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4960                }
4961                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4962                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4963                }
4964            }
4965
4966            next_offset += envelope_size;
4967
4968            // Decode the remaining unknown envelopes.
4969            while next_offset < end_offset {
4970                _next_ordinal_to_read += 1;
4971                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4972                next_offset += envelope_size;
4973            }
4974
4975            Ok(())
4976        }
4977    }
4978
4979    impl Config {
4980        #[inline(always)]
4981        fn max_ordinal_present(&self) -> u64 {
4982            if let Some(_) = self.format_costs {
4983                return 1;
4984            }
4985            0
4986        }
4987    }
4988
4989    impl fidl::encoding::ValueTypeMarker for Config {
4990        type Borrowed<'a> = &'a Self;
4991        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4992            value
4993        }
4994    }
4995
4996    unsafe impl fidl::encoding::TypeMarker for Config {
4997        type Owned = Self;
4998
4999        #[inline(always)]
5000        fn inline_align(_context: fidl::encoding::Context) -> usize {
5001            8
5002        }
5003
5004        #[inline(always)]
5005        fn inline_size(_context: fidl::encoding::Context) -> usize {
5006            16
5007        }
5008    }
5009
5010    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
5011        unsafe fn encode(
5012            self,
5013            encoder: &mut fidl::encoding::Encoder<'_, D>,
5014            offset: usize,
5015            mut depth: fidl::encoding::Depth,
5016        ) -> fidl::Result<()> {
5017            encoder.debug_check_bounds::<Config>(offset);
5018            // Vector header
5019            let max_ordinal: u64 = self.max_ordinal_present();
5020            encoder.write_num(max_ordinal, offset);
5021            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5022            // Calling encoder.out_of_line_offset(0) is not allowed.
5023            if max_ordinal == 0 {
5024                return Ok(());
5025            }
5026            depth.increment()?;
5027            let envelope_size = 8;
5028            let bytes_len = max_ordinal as usize * envelope_size;
5029            #[allow(unused_variables)]
5030            let offset = encoder.out_of_line_offset(bytes_len);
5031            let mut _prev_end_offset: usize = 0;
5032            if 1 > max_ordinal {
5033                return Ok(());
5034            }
5035
5036            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5037            // are envelope_size bytes.
5038            let cur_offset: usize = (1 - 1) * envelope_size;
5039
5040            // Zero reserved fields.
5041            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5042
5043            // Safety:
5044            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5045            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5046            //   envelope_size bytes, there is always sufficient room.
5047            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<FormatCostEntry>, D>(
5048            self.format_costs.as_ref().map(<fidl::encoding::UnboundedVector<FormatCostEntry> as fidl::encoding::ValueTypeMarker>::borrow),
5049            encoder, offset + cur_offset, depth
5050        )?;
5051
5052            _prev_end_offset = cur_offset + envelope_size;
5053
5054            Ok(())
5055        }
5056    }
5057
5058    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
5059        #[inline(always)]
5060        fn new_empty() -> Self {
5061            Self::default()
5062        }
5063
5064        unsafe fn decode(
5065            &mut self,
5066            decoder: &mut fidl::encoding::Decoder<'_, D>,
5067            offset: usize,
5068            mut depth: fidl::encoding::Depth,
5069        ) -> fidl::Result<()> {
5070            decoder.debug_check_bounds::<Self>(offset);
5071            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5072                None => return Err(fidl::Error::NotNullable),
5073                Some(len) => len,
5074            };
5075            // Calling decoder.out_of_line_offset(0) is not allowed.
5076            if len == 0 {
5077                return Ok(());
5078            };
5079            depth.increment()?;
5080            let envelope_size = 8;
5081            let bytes_len = len * envelope_size;
5082            let offset = decoder.out_of_line_offset(bytes_len)?;
5083            // Decode the envelope for each type.
5084            let mut _next_ordinal_to_read = 0;
5085            let mut next_offset = offset;
5086            let end_offset = offset + bytes_len;
5087            _next_ordinal_to_read += 1;
5088            if next_offset >= end_offset {
5089                return Ok(());
5090            }
5091
5092            // Decode unknown envelopes for gaps in ordinals.
5093            while _next_ordinal_to_read < 1 {
5094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5095                _next_ordinal_to_read += 1;
5096                next_offset += envelope_size;
5097            }
5098
5099            let next_out_of_line = decoder.next_out_of_line();
5100            let handles_before = decoder.remaining_handles();
5101            if let Some((inlined, num_bytes, num_handles)) =
5102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5103            {
5104                let member_inline_size = <fidl::encoding::UnboundedVector<FormatCostEntry> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5105                if inlined != (member_inline_size <= 4) {
5106                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5107                }
5108                let inner_offset;
5109                let mut inner_depth = depth.clone();
5110                if inlined {
5111                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5112                    inner_offset = next_offset;
5113                } else {
5114                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5115                    inner_depth.increment()?;
5116                }
5117                let val_ref = self.format_costs.get_or_insert_with(|| {
5118                    fidl::new_empty!(fidl::encoding::UnboundedVector<FormatCostEntry>, D)
5119                });
5120                fidl::decode!(
5121                    fidl::encoding::UnboundedVector<FormatCostEntry>,
5122                    D,
5123                    val_ref,
5124                    decoder,
5125                    inner_offset,
5126                    inner_depth
5127                )?;
5128                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5129                {
5130                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5131                }
5132                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5133                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5134                }
5135            }
5136
5137            next_offset += envelope_size;
5138
5139            // Decode the remaining unknown envelopes.
5140            while next_offset < end_offset {
5141                _next_ordinal_to_read += 1;
5142                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5143                next_offset += envelope_size;
5144            }
5145
5146            Ok(())
5147        }
5148    }
5149
5150    impl DynamicSecureHeap {
5151        #[inline(always)]
5152        fn max_ordinal_present(&self) -> u64 {
5153            if let Some(_) = self.heap {
5154                return 1;
5155            }
5156            0
5157        }
5158    }
5159
5160    impl fidl::encoding::ValueTypeMarker for DynamicSecureHeap {
5161        type Borrowed<'a> = &'a Self;
5162        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5163            value
5164        }
5165    }
5166
5167    unsafe impl fidl::encoding::TypeMarker for DynamicSecureHeap {
5168        type Owned = Self;
5169
5170        #[inline(always)]
5171        fn inline_align(_context: fidl::encoding::Context) -> usize {
5172            8
5173        }
5174
5175        #[inline(always)]
5176        fn inline_size(_context: fidl::encoding::Context) -> usize {
5177            16
5178        }
5179    }
5180
5181    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DynamicSecureHeap, D>
5182        for &DynamicSecureHeap
5183    {
5184        unsafe fn encode(
5185            self,
5186            encoder: &mut fidl::encoding::Encoder<'_, D>,
5187            offset: usize,
5188            mut depth: fidl::encoding::Depth,
5189        ) -> fidl::Result<()> {
5190            encoder.debug_check_bounds::<DynamicSecureHeap>(offset);
5191            // Vector header
5192            let max_ordinal: u64 = self.max_ordinal_present();
5193            encoder.write_num(max_ordinal, offset);
5194            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5195            // Calling encoder.out_of_line_offset(0) is not allowed.
5196            if max_ordinal == 0 {
5197                return Ok(());
5198            }
5199            depth.increment()?;
5200            let envelope_size = 8;
5201            let bytes_len = max_ordinal as usize * envelope_size;
5202            #[allow(unused_variables)]
5203            let offset = encoder.out_of_line_offset(bytes_len);
5204            let mut _prev_end_offset: usize = 0;
5205            if 1 > max_ordinal {
5206                return Ok(());
5207            }
5208
5209            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5210            // are envelope_size bytes.
5211            let cur_offset: usize = (1 - 1) * envelope_size;
5212
5213            // Zero reserved fields.
5214            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5215
5216            // Safety:
5217            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5218            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5219            //   envelope_size bytes, there is always sufficient room.
5220            fidl::encoding::encode_in_envelope_optional::<Heap, D>(
5221                self.heap.as_ref().map(<Heap as fidl::encoding::ValueTypeMarker>::borrow),
5222                encoder,
5223                offset + cur_offset,
5224                depth,
5225            )?;
5226
5227            _prev_end_offset = cur_offset + envelope_size;
5228
5229            Ok(())
5230        }
5231    }
5232
5233    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DynamicSecureHeap {
5234        #[inline(always)]
5235        fn new_empty() -> Self {
5236            Self::default()
5237        }
5238
5239        unsafe fn decode(
5240            &mut self,
5241            decoder: &mut fidl::encoding::Decoder<'_, D>,
5242            offset: usize,
5243            mut depth: fidl::encoding::Depth,
5244        ) -> fidl::Result<()> {
5245            decoder.debug_check_bounds::<Self>(offset);
5246            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5247                None => return Err(fidl::Error::NotNullable),
5248                Some(len) => len,
5249            };
5250            // Calling decoder.out_of_line_offset(0) is not allowed.
5251            if len == 0 {
5252                return Ok(());
5253            };
5254            depth.increment()?;
5255            let envelope_size = 8;
5256            let bytes_len = len * envelope_size;
5257            let offset = decoder.out_of_line_offset(bytes_len)?;
5258            // Decode the envelope for each type.
5259            let mut _next_ordinal_to_read = 0;
5260            let mut next_offset = offset;
5261            let end_offset = offset + bytes_len;
5262            _next_ordinal_to_read += 1;
5263            if next_offset >= end_offset {
5264                return Ok(());
5265            }
5266
5267            // Decode unknown envelopes for gaps in ordinals.
5268            while _next_ordinal_to_read < 1 {
5269                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5270                _next_ordinal_to_read += 1;
5271                next_offset += envelope_size;
5272            }
5273
5274            let next_out_of_line = decoder.next_out_of_line();
5275            let handles_before = decoder.remaining_handles();
5276            if let Some((inlined, num_bytes, num_handles)) =
5277                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5278            {
5279                let member_inline_size =
5280                    <Heap as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5281                if inlined != (member_inline_size <= 4) {
5282                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5283                }
5284                let inner_offset;
5285                let mut inner_depth = depth.clone();
5286                if inlined {
5287                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5288                    inner_offset = next_offset;
5289                } else {
5290                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5291                    inner_depth.increment()?;
5292                }
5293                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(Heap, D));
5294                fidl::decode!(Heap, D, val_ref, decoder, inner_offset, inner_depth)?;
5295                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5296                {
5297                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5298                }
5299                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5300                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5301                }
5302            }
5303
5304            next_offset += envelope_size;
5305
5306            // Decode the remaining unknown envelopes.
5307            while next_offset < end_offset {
5308                _next_ordinal_to_read += 1;
5309                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5310                next_offset += envelope_size;
5311            }
5312
5313            Ok(())
5314        }
5315    }
5316
5317    impl FormatCostEntry {
5318        #[inline(always)]
5319        fn max_ordinal_present(&self) -> u64 {
5320            if let Some(_) = self.cost {
5321                return 2;
5322            }
5323            if let Some(_) = self.key {
5324                return 1;
5325            }
5326            0
5327        }
5328    }
5329
5330    impl fidl::encoding::ValueTypeMarker for FormatCostEntry {
5331        type Borrowed<'a> = &'a Self;
5332        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5333            value
5334        }
5335    }
5336
5337    unsafe impl fidl::encoding::TypeMarker for FormatCostEntry {
5338        type Owned = Self;
5339
5340        #[inline(always)]
5341        fn inline_align(_context: fidl::encoding::Context) -> usize {
5342            8
5343        }
5344
5345        #[inline(always)]
5346        fn inline_size(_context: fidl::encoding::Context) -> usize {
5347            16
5348        }
5349    }
5350
5351    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FormatCostEntry, D>
5352        for &FormatCostEntry
5353    {
5354        unsafe fn encode(
5355            self,
5356            encoder: &mut fidl::encoding::Encoder<'_, D>,
5357            offset: usize,
5358            mut depth: fidl::encoding::Depth,
5359        ) -> fidl::Result<()> {
5360            encoder.debug_check_bounds::<FormatCostEntry>(offset);
5361            // Vector header
5362            let max_ordinal: u64 = self.max_ordinal_present();
5363            encoder.write_num(max_ordinal, offset);
5364            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5365            // Calling encoder.out_of_line_offset(0) is not allowed.
5366            if max_ordinal == 0 {
5367                return Ok(());
5368            }
5369            depth.increment()?;
5370            let envelope_size = 8;
5371            let bytes_len = max_ordinal as usize * envelope_size;
5372            #[allow(unused_variables)]
5373            let offset = encoder.out_of_line_offset(bytes_len);
5374            let mut _prev_end_offset: usize = 0;
5375            if 1 > max_ordinal {
5376                return Ok(());
5377            }
5378
5379            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5380            // are envelope_size bytes.
5381            let cur_offset: usize = (1 - 1) * envelope_size;
5382
5383            // Zero reserved fields.
5384            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5385
5386            // Safety:
5387            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5388            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5389            //   envelope_size bytes, there is always sufficient room.
5390            fidl::encoding::encode_in_envelope_optional::<FormatCostKey, D>(
5391                self.key.as_ref().map(<FormatCostKey as fidl::encoding::ValueTypeMarker>::borrow),
5392                encoder,
5393                offset + cur_offset,
5394                depth,
5395            )?;
5396
5397            _prev_end_offset = cur_offset + envelope_size;
5398            if 2 > max_ordinal {
5399                return Ok(());
5400            }
5401
5402            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5403            // are envelope_size bytes.
5404            let cur_offset: usize = (2 - 1) * envelope_size;
5405
5406            // Zero reserved fields.
5407            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5408
5409            // Safety:
5410            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5411            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5412            //   envelope_size bytes, there is always sufficient room.
5413            fidl::encoding::encode_in_envelope_optional::<f32, D>(
5414                self.cost.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
5415                encoder,
5416                offset + cur_offset,
5417                depth,
5418            )?;
5419
5420            _prev_end_offset = cur_offset + envelope_size;
5421
5422            Ok(())
5423        }
5424    }
5425
5426    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FormatCostEntry {
5427        #[inline(always)]
5428        fn new_empty() -> Self {
5429            Self::default()
5430        }
5431
5432        unsafe fn decode(
5433            &mut self,
5434            decoder: &mut fidl::encoding::Decoder<'_, D>,
5435            offset: usize,
5436            mut depth: fidl::encoding::Depth,
5437        ) -> fidl::Result<()> {
5438            decoder.debug_check_bounds::<Self>(offset);
5439            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5440                None => return Err(fidl::Error::NotNullable),
5441                Some(len) => len,
5442            };
5443            // Calling decoder.out_of_line_offset(0) is not allowed.
5444            if len == 0 {
5445                return Ok(());
5446            };
5447            depth.increment()?;
5448            let envelope_size = 8;
5449            let bytes_len = len * envelope_size;
5450            let offset = decoder.out_of_line_offset(bytes_len)?;
5451            // Decode the envelope for each type.
5452            let mut _next_ordinal_to_read = 0;
5453            let mut next_offset = offset;
5454            let end_offset = offset + bytes_len;
5455            _next_ordinal_to_read += 1;
5456            if next_offset >= end_offset {
5457                return Ok(());
5458            }
5459
5460            // Decode unknown envelopes for gaps in ordinals.
5461            while _next_ordinal_to_read < 1 {
5462                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5463                _next_ordinal_to_read += 1;
5464                next_offset += envelope_size;
5465            }
5466
5467            let next_out_of_line = decoder.next_out_of_line();
5468            let handles_before = decoder.remaining_handles();
5469            if let Some((inlined, num_bytes, num_handles)) =
5470                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5471            {
5472                let member_inline_size =
5473                    <FormatCostKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5474                if inlined != (member_inline_size <= 4) {
5475                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5476                }
5477                let inner_offset;
5478                let mut inner_depth = depth.clone();
5479                if inlined {
5480                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5481                    inner_offset = next_offset;
5482                } else {
5483                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5484                    inner_depth.increment()?;
5485                }
5486                let val_ref = self.key.get_or_insert_with(|| fidl::new_empty!(FormatCostKey, D));
5487                fidl::decode!(FormatCostKey, D, val_ref, decoder, inner_offset, inner_depth)?;
5488                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5489                {
5490                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5491                }
5492                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5493                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5494                }
5495            }
5496
5497            next_offset += envelope_size;
5498            _next_ordinal_to_read += 1;
5499            if next_offset >= end_offset {
5500                return Ok(());
5501            }
5502
5503            // Decode unknown envelopes for gaps in ordinals.
5504            while _next_ordinal_to_read < 2 {
5505                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5506                _next_ordinal_to_read += 1;
5507                next_offset += envelope_size;
5508            }
5509
5510            let next_out_of_line = decoder.next_out_of_line();
5511            let handles_before = decoder.remaining_handles();
5512            if let Some((inlined, num_bytes, num_handles)) =
5513                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5514            {
5515                let member_inline_size =
5516                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5517                if inlined != (member_inline_size <= 4) {
5518                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5519                }
5520                let inner_offset;
5521                let mut inner_depth = depth.clone();
5522                if inlined {
5523                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5524                    inner_offset = next_offset;
5525                } else {
5526                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5527                    inner_depth.increment()?;
5528                }
5529                let val_ref = self.cost.get_or_insert_with(|| fidl::new_empty!(f32, D));
5530                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
5531                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5532                {
5533                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5534                }
5535                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5536                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5537                }
5538            }
5539
5540            next_offset += envelope_size;
5541
5542            // Decode the remaining unknown envelopes.
5543            while next_offset < end_offset {
5544                _next_ordinal_to_read += 1;
5545                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5546                next_offset += envelope_size;
5547            }
5548
5549            Ok(())
5550        }
5551    }
5552
5553    impl FormatCostKey {
5554        #[inline(always)]
5555        fn max_ordinal_present(&self) -> u64 {
5556            if let Some(_) = self.buffer_usage_bits {
5557                return 3;
5558            }
5559            if let Some(_) = self.pixel_format_modifier {
5560                return 2;
5561            }
5562            if let Some(_) = self.pixel_format {
5563                return 1;
5564            }
5565            0
5566        }
5567    }
5568
5569    impl fidl::encoding::ValueTypeMarker for FormatCostKey {
5570        type Borrowed<'a> = &'a Self;
5571        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5572            value
5573        }
5574    }
5575
5576    unsafe impl fidl::encoding::TypeMarker for FormatCostKey {
5577        type Owned = Self;
5578
5579        #[inline(always)]
5580        fn inline_align(_context: fidl::encoding::Context) -> usize {
5581            8
5582        }
5583
5584        #[inline(always)]
5585        fn inline_size(_context: fidl::encoding::Context) -> usize {
5586            16
5587        }
5588    }
5589
5590    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FormatCostKey, D>
5591        for &FormatCostKey
5592    {
5593        unsafe fn encode(
5594            self,
5595            encoder: &mut fidl::encoding::Encoder<'_, D>,
5596            offset: usize,
5597            mut depth: fidl::encoding::Depth,
5598        ) -> fidl::Result<()> {
5599            encoder.debug_check_bounds::<FormatCostKey>(offset);
5600            // Vector header
5601            let max_ordinal: u64 = self.max_ordinal_present();
5602            encoder.write_num(max_ordinal, offset);
5603            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5604            // Calling encoder.out_of_line_offset(0) is not allowed.
5605            if max_ordinal == 0 {
5606                return Ok(());
5607            }
5608            depth.increment()?;
5609            let envelope_size = 8;
5610            let bytes_len = max_ordinal as usize * envelope_size;
5611            #[allow(unused_variables)]
5612            let offset = encoder.out_of_line_offset(bytes_len);
5613            let mut _prev_end_offset: usize = 0;
5614            if 1 > max_ordinal {
5615                return Ok(());
5616            }
5617
5618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5619            // are envelope_size bytes.
5620            let cur_offset: usize = (1 - 1) * envelope_size;
5621
5622            // Zero reserved fields.
5623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5624
5625            // Safety:
5626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5628            //   envelope_size bytes, there is always sufficient room.
5629            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_images2__common::PixelFormat, D>(
5630            self.pixel_format.as_ref().map(<fidl_fuchsia_images2__common::PixelFormat as fidl::encoding::ValueTypeMarker>::borrow),
5631            encoder, offset + cur_offset, depth
5632        )?;
5633
5634            _prev_end_offset = cur_offset + envelope_size;
5635            if 2 > max_ordinal {
5636                return Ok(());
5637            }
5638
5639            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5640            // are envelope_size bytes.
5641            let cur_offset: usize = (2 - 1) * envelope_size;
5642
5643            // Zero reserved fields.
5644            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5645
5646            // Safety:
5647            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5648            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5649            //   envelope_size bytes, there is always sufficient room.
5650            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_images2__common::PixelFormatModifier, D>(
5651            self.pixel_format_modifier.as_ref().map(<fidl_fuchsia_images2__common::PixelFormatModifier as fidl::encoding::ValueTypeMarker>::borrow),
5652            encoder, offset + cur_offset, depth
5653        )?;
5654
5655            _prev_end_offset = cur_offset + envelope_size;
5656            if 3 > max_ordinal {
5657                return Ok(());
5658            }
5659
5660            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5661            // are envelope_size bytes.
5662            let cur_offset: usize = (3 - 1) * envelope_size;
5663
5664            // Zero reserved fields.
5665            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5666
5667            // Safety:
5668            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5669            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5670            //   envelope_size bytes, there is always sufficient room.
5671            fidl::encoding::encode_in_envelope_optional::<BufferUsage, D>(
5672                self.buffer_usage_bits
5673                    .as_ref()
5674                    .map(<BufferUsage as fidl::encoding::ValueTypeMarker>::borrow),
5675                encoder,
5676                offset + cur_offset,
5677                depth,
5678            )?;
5679
5680            _prev_end_offset = cur_offset + envelope_size;
5681
5682            Ok(())
5683        }
5684    }
5685
5686    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FormatCostKey {
5687        #[inline(always)]
5688        fn new_empty() -> Self {
5689            Self::default()
5690        }
5691
5692        unsafe fn decode(
5693            &mut self,
5694            decoder: &mut fidl::encoding::Decoder<'_, D>,
5695            offset: usize,
5696            mut depth: fidl::encoding::Depth,
5697        ) -> fidl::Result<()> {
5698            decoder.debug_check_bounds::<Self>(offset);
5699            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5700                None => return Err(fidl::Error::NotNullable),
5701                Some(len) => len,
5702            };
5703            // Calling decoder.out_of_line_offset(0) is not allowed.
5704            if len == 0 {
5705                return Ok(());
5706            };
5707            depth.increment()?;
5708            let envelope_size = 8;
5709            let bytes_len = len * envelope_size;
5710            let offset = decoder.out_of_line_offset(bytes_len)?;
5711            // Decode the envelope for each type.
5712            let mut _next_ordinal_to_read = 0;
5713            let mut next_offset = offset;
5714            let end_offset = offset + bytes_len;
5715            _next_ordinal_to_read += 1;
5716            if next_offset >= end_offset {
5717                return Ok(());
5718            }
5719
5720            // Decode unknown envelopes for gaps in ordinals.
5721            while _next_ordinal_to_read < 1 {
5722                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5723                _next_ordinal_to_read += 1;
5724                next_offset += envelope_size;
5725            }
5726
5727            let next_out_of_line = decoder.next_out_of_line();
5728            let handles_before = decoder.remaining_handles();
5729            if let Some((inlined, num_bytes, num_handles)) =
5730                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5731            {
5732                let member_inline_size = <fidl_fuchsia_images2__common::PixelFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5733                if inlined != (member_inline_size <= 4) {
5734                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5735                }
5736                let inner_offset;
5737                let mut inner_depth = depth.clone();
5738                if inlined {
5739                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5740                    inner_offset = next_offset;
5741                } else {
5742                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5743                    inner_depth.increment()?;
5744                }
5745                let val_ref = self.pixel_format.get_or_insert_with(|| {
5746                    fidl::new_empty!(fidl_fuchsia_images2__common::PixelFormat, D)
5747                });
5748                fidl::decode!(
5749                    fidl_fuchsia_images2__common::PixelFormat,
5750                    D,
5751                    val_ref,
5752                    decoder,
5753                    inner_offset,
5754                    inner_depth
5755                )?;
5756                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5757                {
5758                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5759                }
5760                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5761                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5762                }
5763            }
5764
5765            next_offset += envelope_size;
5766            _next_ordinal_to_read += 1;
5767            if next_offset >= end_offset {
5768                return Ok(());
5769            }
5770
5771            // Decode unknown envelopes for gaps in ordinals.
5772            while _next_ordinal_to_read < 2 {
5773                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5774                _next_ordinal_to_read += 1;
5775                next_offset += envelope_size;
5776            }
5777
5778            let next_out_of_line = decoder.next_out_of_line();
5779            let handles_before = decoder.remaining_handles();
5780            if let Some((inlined, num_bytes, num_handles)) =
5781                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5782            {
5783                let member_inline_size = <fidl_fuchsia_images2__common::PixelFormatModifier as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5784                if inlined != (member_inline_size <= 4) {
5785                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5786                }
5787                let inner_offset;
5788                let mut inner_depth = depth.clone();
5789                if inlined {
5790                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5791                    inner_offset = next_offset;
5792                } else {
5793                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5794                    inner_depth.increment()?;
5795                }
5796                let val_ref = self.pixel_format_modifier.get_or_insert_with(|| {
5797                    fidl::new_empty!(fidl_fuchsia_images2__common::PixelFormatModifier, D)
5798                });
5799                fidl::decode!(
5800                    fidl_fuchsia_images2__common::PixelFormatModifier,
5801                    D,
5802                    val_ref,
5803                    decoder,
5804                    inner_offset,
5805                    inner_depth
5806                )?;
5807                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5808                {
5809                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5810                }
5811                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5812                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5813                }
5814            }
5815
5816            next_offset += envelope_size;
5817            _next_ordinal_to_read += 1;
5818            if next_offset >= end_offset {
5819                return Ok(());
5820            }
5821
5822            // Decode unknown envelopes for gaps in ordinals.
5823            while _next_ordinal_to_read < 3 {
5824                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5825                _next_ordinal_to_read += 1;
5826                next_offset += envelope_size;
5827            }
5828
5829            let next_out_of_line = decoder.next_out_of_line();
5830            let handles_before = decoder.remaining_handles();
5831            if let Some((inlined, num_bytes, num_handles)) =
5832                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5833            {
5834                let member_inline_size =
5835                    <BufferUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5836                if inlined != (member_inline_size <= 4) {
5837                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5838                }
5839                let inner_offset;
5840                let mut inner_depth = depth.clone();
5841                if inlined {
5842                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5843                    inner_offset = next_offset;
5844                } else {
5845                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5846                    inner_depth.increment()?;
5847                }
5848                let val_ref =
5849                    self.buffer_usage_bits.get_or_insert_with(|| fidl::new_empty!(BufferUsage, D));
5850                fidl::decode!(BufferUsage, D, val_ref, decoder, inner_offset, inner_depth)?;
5851                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5852                {
5853                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5854                }
5855                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5856                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5857                }
5858            }
5859
5860            next_offset += envelope_size;
5861
5862            // Decode the remaining unknown envelopes.
5863            while next_offset < end_offset {
5864                _next_ordinal_to_read += 1;
5865                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5866                next_offset += envelope_size;
5867            }
5868
5869            Ok(())
5870        }
5871    }
5872
5873    impl FormatCosts {
5874        #[inline(always)]
5875        fn max_ordinal_present(&self) -> u64 {
5876            if let Some(_) = self.format_costs {
5877                return 1;
5878            }
5879            0
5880        }
5881    }
5882
5883    impl fidl::encoding::ValueTypeMarker for FormatCosts {
5884        type Borrowed<'a> = &'a Self;
5885        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5886            value
5887        }
5888    }
5889
5890    unsafe impl fidl::encoding::TypeMarker for FormatCosts {
5891        type Owned = Self;
5892
5893        #[inline(always)]
5894        fn inline_align(_context: fidl::encoding::Context) -> usize {
5895            8
5896        }
5897
5898        #[inline(always)]
5899        fn inline_size(_context: fidl::encoding::Context) -> usize {
5900            16
5901        }
5902    }
5903
5904    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FormatCosts, D>
5905        for &FormatCosts
5906    {
5907        unsafe fn encode(
5908            self,
5909            encoder: &mut fidl::encoding::Encoder<'_, D>,
5910            offset: usize,
5911            mut depth: fidl::encoding::Depth,
5912        ) -> fidl::Result<()> {
5913            encoder.debug_check_bounds::<FormatCosts>(offset);
5914            // Vector header
5915            let max_ordinal: u64 = self.max_ordinal_present();
5916            encoder.write_num(max_ordinal, offset);
5917            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5918            // Calling encoder.out_of_line_offset(0) is not allowed.
5919            if max_ordinal == 0 {
5920                return Ok(());
5921            }
5922            depth.increment()?;
5923            let envelope_size = 8;
5924            let bytes_len = max_ordinal as usize * envelope_size;
5925            #[allow(unused_variables)]
5926            let offset = encoder.out_of_line_offset(bytes_len);
5927            let mut _prev_end_offset: usize = 0;
5928            if 1 > max_ordinal {
5929                return Ok(());
5930            }
5931
5932            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5933            // are envelope_size bytes.
5934            let cur_offset: usize = (1 - 1) * envelope_size;
5935
5936            // Zero reserved fields.
5937            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5938
5939            // Safety:
5940            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5941            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5942            //   envelope_size bytes, there is always sufficient room.
5943            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<FormatCostEntry>, D>(
5944            self.format_costs.as_ref().map(<fidl::encoding::UnboundedVector<FormatCostEntry> as fidl::encoding::ValueTypeMarker>::borrow),
5945            encoder, offset + cur_offset, depth
5946        )?;
5947
5948            _prev_end_offset = cur_offset + envelope_size;
5949
5950            Ok(())
5951        }
5952    }
5953
5954    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FormatCosts {
5955        #[inline(always)]
5956        fn new_empty() -> Self {
5957            Self::default()
5958        }
5959
5960        unsafe fn decode(
5961            &mut self,
5962            decoder: &mut fidl::encoding::Decoder<'_, D>,
5963            offset: usize,
5964            mut depth: fidl::encoding::Depth,
5965        ) -> fidl::Result<()> {
5966            decoder.debug_check_bounds::<Self>(offset);
5967            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5968                None => return Err(fidl::Error::NotNullable),
5969                Some(len) => len,
5970            };
5971            // Calling decoder.out_of_line_offset(0) is not allowed.
5972            if len == 0 {
5973                return Ok(());
5974            };
5975            depth.increment()?;
5976            let envelope_size = 8;
5977            let bytes_len = len * envelope_size;
5978            let offset = decoder.out_of_line_offset(bytes_len)?;
5979            // Decode the envelope for each type.
5980            let mut _next_ordinal_to_read = 0;
5981            let mut next_offset = offset;
5982            let end_offset = offset + bytes_len;
5983            _next_ordinal_to_read += 1;
5984            if next_offset >= end_offset {
5985                return Ok(());
5986            }
5987
5988            // Decode unknown envelopes for gaps in ordinals.
5989            while _next_ordinal_to_read < 1 {
5990                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5991                _next_ordinal_to_read += 1;
5992                next_offset += envelope_size;
5993            }
5994
5995            let next_out_of_line = decoder.next_out_of_line();
5996            let handles_before = decoder.remaining_handles();
5997            if let Some((inlined, num_bytes, num_handles)) =
5998                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5999            {
6000                let member_inline_size = <fidl::encoding::UnboundedVector<FormatCostEntry> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6001                if inlined != (member_inline_size <= 4) {
6002                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6003                }
6004                let inner_offset;
6005                let mut inner_depth = depth.clone();
6006                if inlined {
6007                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6008                    inner_offset = next_offset;
6009                } else {
6010                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6011                    inner_depth.increment()?;
6012                }
6013                let val_ref = self.format_costs.get_or_insert_with(|| {
6014                    fidl::new_empty!(fidl::encoding::UnboundedVector<FormatCostEntry>, D)
6015                });
6016                fidl::decode!(
6017                    fidl::encoding::UnboundedVector<FormatCostEntry>,
6018                    D,
6019                    val_ref,
6020                    decoder,
6021                    inner_offset,
6022                    inner_depth
6023                )?;
6024                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6025                {
6026                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6027                }
6028                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6029                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6030                }
6031            }
6032
6033            next_offset += envelope_size;
6034
6035            // Decode the remaining unknown envelopes.
6036            while next_offset < end_offset {
6037                _next_ordinal_to_read += 1;
6038                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6039                next_offset += envelope_size;
6040            }
6041
6042            Ok(())
6043        }
6044    }
6045
6046    impl Heap {
6047        #[inline(always)]
6048        fn max_ordinal_present(&self) -> u64 {
6049            if let Some(_) = self.id {
6050                return 2;
6051            }
6052            if let Some(_) = self.heap_type {
6053                return 1;
6054            }
6055            0
6056        }
6057    }
6058
6059    impl fidl::encoding::ValueTypeMarker for Heap {
6060        type Borrowed<'a> = &'a Self;
6061        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6062            value
6063        }
6064    }
6065
6066    unsafe impl fidl::encoding::TypeMarker for Heap {
6067        type Owned = Self;
6068
6069        #[inline(always)]
6070        fn inline_align(_context: fidl::encoding::Context) -> usize {
6071            8
6072        }
6073
6074        #[inline(always)]
6075        fn inline_size(_context: fidl::encoding::Context) -> usize {
6076            16
6077        }
6078    }
6079
6080    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Heap, D> for &Heap {
6081        unsafe fn encode(
6082            self,
6083            encoder: &mut fidl::encoding::Encoder<'_, D>,
6084            offset: usize,
6085            mut depth: fidl::encoding::Depth,
6086        ) -> fidl::Result<()> {
6087            encoder.debug_check_bounds::<Heap>(offset);
6088            // Vector header
6089            let max_ordinal: u64 = self.max_ordinal_present();
6090            encoder.write_num(max_ordinal, offset);
6091            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6092            // Calling encoder.out_of_line_offset(0) is not allowed.
6093            if max_ordinal == 0 {
6094                return Ok(());
6095            }
6096            depth.increment()?;
6097            let envelope_size = 8;
6098            let bytes_len = max_ordinal as usize * envelope_size;
6099            #[allow(unused_variables)]
6100            let offset = encoder.out_of_line_offset(bytes_len);
6101            let mut _prev_end_offset: usize = 0;
6102            if 1 > max_ordinal {
6103                return Ok(());
6104            }
6105
6106            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6107            // are envelope_size bytes.
6108            let cur_offset: usize = (1 - 1) * envelope_size;
6109
6110            // Zero reserved fields.
6111            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6112
6113            // Safety:
6114            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6115            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6116            //   envelope_size bytes, there is always sufficient room.
6117            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<128>, D>(
6118                self.heap_type.as_ref().map(
6119                    <fidl::encoding::BoundedString<128> as fidl::encoding::ValueTypeMarker>::borrow,
6120                ),
6121                encoder,
6122                offset + cur_offset,
6123                depth,
6124            )?;
6125
6126            _prev_end_offset = cur_offset + envelope_size;
6127            if 2 > max_ordinal {
6128                return Ok(());
6129            }
6130
6131            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6132            // are envelope_size bytes.
6133            let cur_offset: usize = (2 - 1) * envelope_size;
6134
6135            // Zero reserved fields.
6136            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6137
6138            // Safety:
6139            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6140            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6141            //   envelope_size bytes, there is always sufficient room.
6142            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6143                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6144                encoder,
6145                offset + cur_offset,
6146                depth,
6147            )?;
6148
6149            _prev_end_offset = cur_offset + envelope_size;
6150
6151            Ok(())
6152        }
6153    }
6154
6155    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Heap {
6156        #[inline(always)]
6157        fn new_empty() -> Self {
6158            Self::default()
6159        }
6160
6161        unsafe fn decode(
6162            &mut self,
6163            decoder: &mut fidl::encoding::Decoder<'_, D>,
6164            offset: usize,
6165            mut depth: fidl::encoding::Depth,
6166        ) -> fidl::Result<()> {
6167            decoder.debug_check_bounds::<Self>(offset);
6168            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6169                None => return Err(fidl::Error::NotNullable),
6170                Some(len) => len,
6171            };
6172            // Calling decoder.out_of_line_offset(0) is not allowed.
6173            if len == 0 {
6174                return Ok(());
6175            };
6176            depth.increment()?;
6177            let envelope_size = 8;
6178            let bytes_len = len * envelope_size;
6179            let offset = decoder.out_of_line_offset(bytes_len)?;
6180            // Decode the envelope for each type.
6181            let mut _next_ordinal_to_read = 0;
6182            let mut next_offset = offset;
6183            let end_offset = offset + bytes_len;
6184            _next_ordinal_to_read += 1;
6185            if next_offset >= end_offset {
6186                return Ok(());
6187            }
6188
6189            // Decode unknown envelopes for gaps in ordinals.
6190            while _next_ordinal_to_read < 1 {
6191                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6192                _next_ordinal_to_read += 1;
6193                next_offset += envelope_size;
6194            }
6195
6196            let next_out_of_line = decoder.next_out_of_line();
6197            let handles_before = decoder.remaining_handles();
6198            if let Some((inlined, num_bytes, num_handles)) =
6199                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6200            {
6201                let member_inline_size =
6202                    <fidl::encoding::BoundedString<128> as fidl::encoding::TypeMarker>::inline_size(
6203                        decoder.context,
6204                    );
6205                if inlined != (member_inline_size <= 4) {
6206                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6207                }
6208                let inner_offset;
6209                let mut inner_depth = depth.clone();
6210                if inlined {
6211                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6212                    inner_offset = next_offset;
6213                } else {
6214                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6215                    inner_depth.increment()?;
6216                }
6217                let val_ref = self
6218                    .heap_type
6219                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<128>, D));
6220                fidl::decode!(
6221                    fidl::encoding::BoundedString<128>,
6222                    D,
6223                    val_ref,
6224                    decoder,
6225                    inner_offset,
6226                    inner_depth
6227                )?;
6228                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6229                {
6230                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6231                }
6232                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6233                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6234                }
6235            }
6236
6237            next_offset += envelope_size;
6238            _next_ordinal_to_read += 1;
6239            if next_offset >= end_offset {
6240                return Ok(());
6241            }
6242
6243            // Decode unknown envelopes for gaps in ordinals.
6244            while _next_ordinal_to_read < 2 {
6245                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6246                _next_ordinal_to_read += 1;
6247                next_offset += envelope_size;
6248            }
6249
6250            let next_out_of_line = decoder.next_out_of_line();
6251            let handles_before = decoder.remaining_handles();
6252            if let Some((inlined, num_bytes, num_handles)) =
6253                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6254            {
6255                let member_inline_size =
6256                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6257                if inlined != (member_inline_size <= 4) {
6258                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6259                }
6260                let inner_offset;
6261                let mut inner_depth = depth.clone();
6262                if inlined {
6263                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6264                    inner_offset = next_offset;
6265                } else {
6266                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6267                    inner_depth.increment()?;
6268                }
6269                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
6270                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6271                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6272                {
6273                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6274                }
6275                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6276                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6277                }
6278            }
6279
6280            next_offset += envelope_size;
6281
6282            // Decode the remaining unknown envelopes.
6283            while next_offset < end_offset {
6284                _next_ordinal_to_read += 1;
6285                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6286                next_offset += envelope_size;
6287            }
6288
6289            Ok(())
6290        }
6291    }
6292
6293    impl ImageFormatConstraints {
6294        #[inline(always)]
6295        fn max_ordinal_present(&self) -> u64 {
6296            if let Some(_) = self.is_alpha_present {
6297                return 17;
6298            }
6299            if let Some(_) = self.require_bytes_per_row_at_pixel_boundary {
6300                return 16;
6301            }
6302            if let Some(_) = self.pixel_format_and_modifiers {
6303                return 15;
6304            }
6305            if let Some(_) = self.start_offset_divisor {
6306                return 14;
6307            }
6308            if let Some(_) = self.bytes_per_row_divisor {
6309                return 13;
6310            }
6311            if let Some(_) = self.required_max_size {
6312                return 12;
6313            }
6314            if let Some(_) = self.required_min_size {
6315                return 11;
6316            }
6317            if let Some(_) = self.display_rect_alignment {
6318                return 10;
6319            }
6320            if let Some(_) = self.size_alignment {
6321                return 9;
6322            }
6323            if let Some(_) = self.max_width_times_height {
6324                return 8;
6325            }
6326            if let Some(_) = self.max_bytes_per_row {
6327                return 7;
6328            }
6329            if let Some(_) = self.min_bytes_per_row {
6330                return 6;
6331            }
6332            if let Some(_) = self.max_size {
6333                return 5;
6334            }
6335            if let Some(_) = self.min_size {
6336                return 4;
6337            }
6338            if let Some(_) = self.color_spaces {
6339                return 3;
6340            }
6341            if let Some(_) = self.pixel_format_modifier {
6342                return 2;
6343            }
6344            if let Some(_) = self.pixel_format {
6345                return 1;
6346            }
6347            0
6348        }
6349    }
6350
6351    impl fidl::encoding::ValueTypeMarker for ImageFormatConstraints {
6352        type Borrowed<'a> = &'a Self;
6353        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6354            value
6355        }
6356    }
6357
6358    unsafe impl fidl::encoding::TypeMarker for ImageFormatConstraints {
6359        type Owned = Self;
6360
6361        #[inline(always)]
6362        fn inline_align(_context: fidl::encoding::Context) -> usize {
6363            8
6364        }
6365
6366        #[inline(always)]
6367        fn inline_size(_context: fidl::encoding::Context) -> usize {
6368            16
6369        }
6370    }
6371
6372    unsafe impl<D: fidl::encoding::ResourceDialect>
6373        fidl::encoding::Encode<ImageFormatConstraints, D> for &ImageFormatConstraints
6374    {
6375        unsafe fn encode(
6376            self,
6377            encoder: &mut fidl::encoding::Encoder<'_, D>,
6378            offset: usize,
6379            mut depth: fidl::encoding::Depth,
6380        ) -> fidl::Result<()> {
6381            encoder.debug_check_bounds::<ImageFormatConstraints>(offset);
6382            // Vector header
6383            let max_ordinal: u64 = self.max_ordinal_present();
6384            encoder.write_num(max_ordinal, offset);
6385            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6386            // Calling encoder.out_of_line_offset(0) is not allowed.
6387            if max_ordinal == 0 {
6388                return Ok(());
6389            }
6390            depth.increment()?;
6391            let envelope_size = 8;
6392            let bytes_len = max_ordinal as usize * envelope_size;
6393            #[allow(unused_variables)]
6394            let offset = encoder.out_of_line_offset(bytes_len);
6395            let mut _prev_end_offset: usize = 0;
6396            if 1 > max_ordinal {
6397                return Ok(());
6398            }
6399
6400            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6401            // are envelope_size bytes.
6402            let cur_offset: usize = (1 - 1) * envelope_size;
6403
6404            // Zero reserved fields.
6405            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6406
6407            // Safety:
6408            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6409            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6410            //   envelope_size bytes, there is always sufficient room.
6411            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_images2__common::PixelFormat, D>(
6412            self.pixel_format.as_ref().map(<fidl_fuchsia_images2__common::PixelFormat as fidl::encoding::ValueTypeMarker>::borrow),
6413            encoder, offset + cur_offset, depth
6414        )?;
6415
6416            _prev_end_offset = cur_offset + envelope_size;
6417            if 2 > max_ordinal {
6418                return Ok(());
6419            }
6420
6421            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6422            // are envelope_size bytes.
6423            let cur_offset: usize = (2 - 1) * envelope_size;
6424
6425            // Zero reserved fields.
6426            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6427
6428            // Safety:
6429            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6430            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6431            //   envelope_size bytes, there is always sufficient room.
6432            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_images2__common::PixelFormatModifier, D>(
6433            self.pixel_format_modifier.as_ref().map(<fidl_fuchsia_images2__common::PixelFormatModifier as fidl::encoding::ValueTypeMarker>::borrow),
6434            encoder, offset + cur_offset, depth
6435        )?;
6436
6437            _prev_end_offset = cur_offset + envelope_size;
6438            if 3 > max_ordinal {
6439                return Ok(());
6440            }
6441
6442            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6443            // are envelope_size bytes.
6444            let cur_offset: usize = (3 - 1) * envelope_size;
6445
6446            // Zero reserved fields.
6447            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6448
6449            // Safety:
6450            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6451            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6452            //   envelope_size bytes, there is always sufficient room.
6453            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_images2__common::ColorSpace, 32>, D>(
6454            self.color_spaces.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_images2__common::ColorSpace, 32> as fidl::encoding::ValueTypeMarker>::borrow),
6455            encoder, offset + cur_offset, depth
6456        )?;
6457
6458            _prev_end_offset = cur_offset + envelope_size;
6459            if 4 > max_ordinal {
6460                return Ok(());
6461            }
6462
6463            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6464            // are envelope_size bytes.
6465            let cur_offset: usize = (4 - 1) * envelope_size;
6466
6467            // Zero reserved fields.
6468            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6469
6470            // Safety:
6471            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6472            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6473            //   envelope_size bytes, there is always sufficient room.
6474            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
6475                self.min_size.as_ref().map(
6476                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
6477                ),
6478                encoder,
6479                offset + cur_offset,
6480                depth,
6481            )?;
6482
6483            _prev_end_offset = cur_offset + envelope_size;
6484            if 5 > max_ordinal {
6485                return Ok(());
6486            }
6487
6488            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6489            // are envelope_size bytes.
6490            let cur_offset: usize = (5 - 1) * envelope_size;
6491
6492            // Zero reserved fields.
6493            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6494
6495            // Safety:
6496            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6497            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6498            //   envelope_size bytes, there is always sufficient room.
6499            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
6500                self.max_size.as_ref().map(
6501                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
6502                ),
6503                encoder,
6504                offset + cur_offset,
6505                depth,
6506            )?;
6507
6508            _prev_end_offset = cur_offset + envelope_size;
6509            if 6 > max_ordinal {
6510                return Ok(());
6511            }
6512
6513            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6514            // are envelope_size bytes.
6515            let cur_offset: usize = (6 - 1) * envelope_size;
6516
6517            // Zero reserved fields.
6518            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6519
6520            // Safety:
6521            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6522            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6523            //   envelope_size bytes, there is always sufficient room.
6524            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6525                self.min_bytes_per_row
6526                    .as_ref()
6527                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6528                encoder,
6529                offset + cur_offset,
6530                depth,
6531            )?;
6532
6533            _prev_end_offset = cur_offset + envelope_size;
6534            if 7 > max_ordinal {
6535                return Ok(());
6536            }
6537
6538            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6539            // are envelope_size bytes.
6540            let cur_offset: usize = (7 - 1) * envelope_size;
6541
6542            // Zero reserved fields.
6543            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6544
6545            // Safety:
6546            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6547            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6548            //   envelope_size bytes, there is always sufficient room.
6549            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6550                self.max_bytes_per_row
6551                    .as_ref()
6552                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6553                encoder,
6554                offset + cur_offset,
6555                depth,
6556            )?;
6557
6558            _prev_end_offset = cur_offset + envelope_size;
6559            if 8 > max_ordinal {
6560                return Ok(());
6561            }
6562
6563            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6564            // are envelope_size bytes.
6565            let cur_offset: usize = (8 - 1) * envelope_size;
6566
6567            // Zero reserved fields.
6568            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6569
6570            // Safety:
6571            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6572            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6573            //   envelope_size bytes, there is always sufficient room.
6574            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6575                self.max_width_times_height
6576                    .as_ref()
6577                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6578                encoder,
6579                offset + cur_offset,
6580                depth,
6581            )?;
6582
6583            _prev_end_offset = cur_offset + envelope_size;
6584            if 9 > max_ordinal {
6585                return Ok(());
6586            }
6587
6588            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6589            // are envelope_size bytes.
6590            let cur_offset: usize = (9 - 1) * envelope_size;
6591
6592            // Zero reserved fields.
6593            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6594
6595            // Safety:
6596            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6597            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6598            //   envelope_size bytes, there is always sufficient room.
6599            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
6600                self.size_alignment.as_ref().map(
6601                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
6602                ),
6603                encoder,
6604                offset + cur_offset,
6605                depth,
6606            )?;
6607
6608            _prev_end_offset = cur_offset + envelope_size;
6609            if 10 > max_ordinal {
6610                return Ok(());
6611            }
6612
6613            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6614            // are envelope_size bytes.
6615            let cur_offset: usize = (10 - 1) * envelope_size;
6616
6617            // Zero reserved fields.
6618            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6619
6620            // Safety:
6621            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6622            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6623            //   envelope_size bytes, there is always sufficient room.
6624            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
6625                self.display_rect_alignment.as_ref().map(
6626                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
6627                ),
6628                encoder,
6629                offset + cur_offset,
6630                depth,
6631            )?;
6632
6633            _prev_end_offset = cur_offset + envelope_size;
6634            if 11 > max_ordinal {
6635                return Ok(());
6636            }
6637
6638            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6639            // are envelope_size bytes.
6640            let cur_offset: usize = (11 - 1) * envelope_size;
6641
6642            // Zero reserved fields.
6643            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6644
6645            // Safety:
6646            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6647            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6648            //   envelope_size bytes, there is always sufficient room.
6649            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
6650                self.required_min_size.as_ref().map(
6651                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
6652                ),
6653                encoder,
6654                offset + cur_offset,
6655                depth,
6656            )?;
6657
6658            _prev_end_offset = cur_offset + envelope_size;
6659            if 12 > max_ordinal {
6660                return Ok(());
6661            }
6662
6663            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6664            // are envelope_size bytes.
6665            let cur_offset: usize = (12 - 1) * envelope_size;
6666
6667            // Zero reserved fields.
6668            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6669
6670            // Safety:
6671            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6672            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6673            //   envelope_size bytes, there is always sufficient room.
6674            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::SizeU, D>(
6675                self.required_max_size.as_ref().map(
6676                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::ValueTypeMarker>::borrow,
6677                ),
6678                encoder,
6679                offset + cur_offset,
6680                depth,
6681            )?;
6682
6683            _prev_end_offset = cur_offset + envelope_size;
6684            if 13 > max_ordinal {
6685                return Ok(());
6686            }
6687
6688            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6689            // are envelope_size bytes.
6690            let cur_offset: usize = (13 - 1) * envelope_size;
6691
6692            // Zero reserved fields.
6693            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6694
6695            // Safety:
6696            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6697            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6698            //   envelope_size bytes, there is always sufficient room.
6699            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6700                self.bytes_per_row_divisor
6701                    .as_ref()
6702                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6703                encoder,
6704                offset + cur_offset,
6705                depth,
6706            )?;
6707
6708            _prev_end_offset = cur_offset + envelope_size;
6709            if 14 > max_ordinal {
6710                return Ok(());
6711            }
6712
6713            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6714            // are envelope_size bytes.
6715            let cur_offset: usize = (14 - 1) * envelope_size;
6716
6717            // Zero reserved fields.
6718            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6719
6720            // Safety:
6721            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6722            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6723            //   envelope_size bytes, there is always sufficient room.
6724            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6725                self.start_offset_divisor
6726                    .as_ref()
6727                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6728                encoder,
6729                offset + cur_offset,
6730                depth,
6731            )?;
6732
6733            _prev_end_offset = cur_offset + envelope_size;
6734            if 15 > max_ordinal {
6735                return Ok(());
6736            }
6737
6738            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6739            // are envelope_size bytes.
6740            let cur_offset: usize = (15 - 1) * envelope_size;
6741
6742            // Zero reserved fields.
6743            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6744
6745            // Safety:
6746            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6747            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6748            //   envelope_size bytes, there is always sufficient room.
6749            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<PixelFormatAndModifier, 64>, D>(
6750            self.pixel_format_and_modifiers.as_ref().map(<fidl::encoding::Vector<PixelFormatAndModifier, 64> as fidl::encoding::ValueTypeMarker>::borrow),
6751            encoder, offset + cur_offset, depth
6752        )?;
6753
6754            _prev_end_offset = cur_offset + envelope_size;
6755            if 16 > max_ordinal {
6756                return Ok(());
6757            }
6758
6759            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6760            // are envelope_size bytes.
6761            let cur_offset: usize = (16 - 1) * envelope_size;
6762
6763            // Zero reserved fields.
6764            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6765
6766            // Safety:
6767            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6768            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6769            //   envelope_size bytes, there is always sufficient room.
6770            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6771                self.require_bytes_per_row_at_pixel_boundary
6772                    .as_ref()
6773                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6774                encoder,
6775                offset + cur_offset,
6776                depth,
6777            )?;
6778
6779            _prev_end_offset = cur_offset + envelope_size;
6780            if 17 > max_ordinal {
6781                return Ok(());
6782            }
6783
6784            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6785            // are envelope_size bytes.
6786            let cur_offset: usize = (17 - 1) * envelope_size;
6787
6788            // Zero reserved fields.
6789            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6790
6791            // Safety:
6792            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6793            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6794            //   envelope_size bytes, there is always sufficient room.
6795            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6796                self.is_alpha_present
6797                    .as_ref()
6798                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6799                encoder,
6800                offset + cur_offset,
6801                depth,
6802            )?;
6803
6804            _prev_end_offset = cur_offset + envelope_size;
6805
6806            Ok(())
6807        }
6808    }
6809
6810    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6811        for ImageFormatConstraints
6812    {
6813        #[inline(always)]
6814        fn new_empty() -> Self {
6815            Self::default()
6816        }
6817
6818        unsafe fn decode(
6819            &mut self,
6820            decoder: &mut fidl::encoding::Decoder<'_, D>,
6821            offset: usize,
6822            mut depth: fidl::encoding::Depth,
6823        ) -> fidl::Result<()> {
6824            decoder.debug_check_bounds::<Self>(offset);
6825            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6826                None => return Err(fidl::Error::NotNullable),
6827                Some(len) => len,
6828            };
6829            // Calling decoder.out_of_line_offset(0) is not allowed.
6830            if len == 0 {
6831                return Ok(());
6832            };
6833            depth.increment()?;
6834            let envelope_size = 8;
6835            let bytes_len = len * envelope_size;
6836            let offset = decoder.out_of_line_offset(bytes_len)?;
6837            // Decode the envelope for each type.
6838            let mut _next_ordinal_to_read = 0;
6839            let mut next_offset = offset;
6840            let end_offset = offset + bytes_len;
6841            _next_ordinal_to_read += 1;
6842            if next_offset >= end_offset {
6843                return Ok(());
6844            }
6845
6846            // Decode unknown envelopes for gaps in ordinals.
6847            while _next_ordinal_to_read < 1 {
6848                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6849                _next_ordinal_to_read += 1;
6850                next_offset += envelope_size;
6851            }
6852
6853            let next_out_of_line = decoder.next_out_of_line();
6854            let handles_before = decoder.remaining_handles();
6855            if let Some((inlined, num_bytes, num_handles)) =
6856                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6857            {
6858                let member_inline_size = <fidl_fuchsia_images2__common::PixelFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6859                if inlined != (member_inline_size <= 4) {
6860                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6861                }
6862                let inner_offset;
6863                let mut inner_depth = depth.clone();
6864                if inlined {
6865                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6866                    inner_offset = next_offset;
6867                } else {
6868                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6869                    inner_depth.increment()?;
6870                }
6871                let val_ref = self.pixel_format.get_or_insert_with(|| {
6872                    fidl::new_empty!(fidl_fuchsia_images2__common::PixelFormat, D)
6873                });
6874                fidl::decode!(
6875                    fidl_fuchsia_images2__common::PixelFormat,
6876                    D,
6877                    val_ref,
6878                    decoder,
6879                    inner_offset,
6880                    inner_depth
6881                )?;
6882                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6883                {
6884                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6885                }
6886                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6887                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6888                }
6889            }
6890
6891            next_offset += envelope_size;
6892            _next_ordinal_to_read += 1;
6893            if next_offset >= end_offset {
6894                return Ok(());
6895            }
6896
6897            // Decode unknown envelopes for gaps in ordinals.
6898            while _next_ordinal_to_read < 2 {
6899                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6900                _next_ordinal_to_read += 1;
6901                next_offset += envelope_size;
6902            }
6903
6904            let next_out_of_line = decoder.next_out_of_line();
6905            let handles_before = decoder.remaining_handles();
6906            if let Some((inlined, num_bytes, num_handles)) =
6907                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6908            {
6909                let member_inline_size = <fidl_fuchsia_images2__common::PixelFormatModifier as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6910                if inlined != (member_inline_size <= 4) {
6911                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6912                }
6913                let inner_offset;
6914                let mut inner_depth = depth.clone();
6915                if inlined {
6916                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6917                    inner_offset = next_offset;
6918                } else {
6919                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6920                    inner_depth.increment()?;
6921                }
6922                let val_ref = self.pixel_format_modifier.get_or_insert_with(|| {
6923                    fidl::new_empty!(fidl_fuchsia_images2__common::PixelFormatModifier, D)
6924                });
6925                fidl::decode!(
6926                    fidl_fuchsia_images2__common::PixelFormatModifier,
6927                    D,
6928                    val_ref,
6929                    decoder,
6930                    inner_offset,
6931                    inner_depth
6932                )?;
6933                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6934                {
6935                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6936                }
6937                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6938                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6939                }
6940            }
6941
6942            next_offset += envelope_size;
6943            _next_ordinal_to_read += 1;
6944            if next_offset >= end_offset {
6945                return Ok(());
6946            }
6947
6948            // Decode unknown envelopes for gaps in ordinals.
6949            while _next_ordinal_to_read < 3 {
6950                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6951                _next_ordinal_to_read += 1;
6952                next_offset += envelope_size;
6953            }
6954
6955            let next_out_of_line = decoder.next_out_of_line();
6956            let handles_before = decoder.remaining_handles();
6957            if let Some((inlined, num_bytes, num_handles)) =
6958                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6959            {
6960                let member_inline_size = <fidl::encoding::Vector<
6961                    fidl_fuchsia_images2__common::ColorSpace,
6962                    32,
6963                > as fidl::encoding::TypeMarker>::inline_size(
6964                    decoder.context
6965                );
6966                if inlined != (member_inline_size <= 4) {
6967                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6968                }
6969                let inner_offset;
6970                let mut inner_depth = depth.clone();
6971                if inlined {
6972                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6973                    inner_offset = next_offset;
6974                } else {
6975                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6976                    inner_depth.increment()?;
6977                }
6978                let val_ref =
6979                self.color_spaces.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_images2__common::ColorSpace, 32>, D));
6980                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_images2__common::ColorSpace, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
6981                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6982                {
6983                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6984                }
6985                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6986                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6987                }
6988            }
6989
6990            next_offset += envelope_size;
6991            _next_ordinal_to_read += 1;
6992            if next_offset >= end_offset {
6993                return Ok(());
6994            }
6995
6996            // Decode unknown envelopes for gaps in ordinals.
6997            while _next_ordinal_to_read < 4 {
6998                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6999                _next_ordinal_to_read += 1;
7000                next_offset += envelope_size;
7001            }
7002
7003            let next_out_of_line = decoder.next_out_of_line();
7004            let handles_before = decoder.remaining_handles();
7005            if let Some((inlined, num_bytes, num_handles)) =
7006                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7007            {
7008                let member_inline_size =
7009                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
7010                        decoder.context,
7011                    );
7012                if inlined != (member_inline_size <= 4) {
7013                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7014                }
7015                let inner_offset;
7016                let mut inner_depth = depth.clone();
7017                if inlined {
7018                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7019                    inner_offset = next_offset;
7020                } else {
7021                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7022                    inner_depth.increment()?;
7023                }
7024                let val_ref = self
7025                    .min_size
7026                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
7027                fidl::decode!(
7028                    fidl_fuchsia_math__common::SizeU,
7029                    D,
7030                    val_ref,
7031                    decoder,
7032                    inner_offset,
7033                    inner_depth
7034                )?;
7035                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7036                {
7037                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7038                }
7039                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7040                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7041                }
7042            }
7043
7044            next_offset += envelope_size;
7045            _next_ordinal_to_read += 1;
7046            if next_offset >= end_offset {
7047                return Ok(());
7048            }
7049
7050            // Decode unknown envelopes for gaps in ordinals.
7051            while _next_ordinal_to_read < 5 {
7052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7053                _next_ordinal_to_read += 1;
7054                next_offset += envelope_size;
7055            }
7056
7057            let next_out_of_line = decoder.next_out_of_line();
7058            let handles_before = decoder.remaining_handles();
7059            if let Some((inlined, num_bytes, num_handles)) =
7060                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7061            {
7062                let member_inline_size =
7063                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
7064                        decoder.context,
7065                    );
7066                if inlined != (member_inline_size <= 4) {
7067                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7068                }
7069                let inner_offset;
7070                let mut inner_depth = depth.clone();
7071                if inlined {
7072                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7073                    inner_offset = next_offset;
7074                } else {
7075                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7076                    inner_depth.increment()?;
7077                }
7078                let val_ref = self
7079                    .max_size
7080                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
7081                fidl::decode!(
7082                    fidl_fuchsia_math__common::SizeU,
7083                    D,
7084                    val_ref,
7085                    decoder,
7086                    inner_offset,
7087                    inner_depth
7088                )?;
7089                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7090                {
7091                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7092                }
7093                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7094                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7095                }
7096            }
7097
7098            next_offset += envelope_size;
7099            _next_ordinal_to_read += 1;
7100            if next_offset >= end_offset {
7101                return Ok(());
7102            }
7103
7104            // Decode unknown envelopes for gaps in ordinals.
7105            while _next_ordinal_to_read < 6 {
7106                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7107                _next_ordinal_to_read += 1;
7108                next_offset += envelope_size;
7109            }
7110
7111            let next_out_of_line = decoder.next_out_of_line();
7112            let handles_before = decoder.remaining_handles();
7113            if let Some((inlined, num_bytes, num_handles)) =
7114                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7115            {
7116                let member_inline_size =
7117                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7118                if inlined != (member_inline_size <= 4) {
7119                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7120                }
7121                let inner_offset;
7122                let mut inner_depth = depth.clone();
7123                if inlined {
7124                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7125                    inner_offset = next_offset;
7126                } else {
7127                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7128                    inner_depth.increment()?;
7129                }
7130                let val_ref =
7131                    self.min_bytes_per_row.get_or_insert_with(|| fidl::new_empty!(u32, D));
7132                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7133                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7134                {
7135                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7136                }
7137                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7138                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7139                }
7140            }
7141
7142            next_offset += envelope_size;
7143            _next_ordinal_to_read += 1;
7144            if next_offset >= end_offset {
7145                return Ok(());
7146            }
7147
7148            // Decode unknown envelopes for gaps in ordinals.
7149            while _next_ordinal_to_read < 7 {
7150                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7151                _next_ordinal_to_read += 1;
7152                next_offset += envelope_size;
7153            }
7154
7155            let next_out_of_line = decoder.next_out_of_line();
7156            let handles_before = decoder.remaining_handles();
7157            if let Some((inlined, num_bytes, num_handles)) =
7158                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7159            {
7160                let member_inline_size =
7161                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7162                if inlined != (member_inline_size <= 4) {
7163                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7164                }
7165                let inner_offset;
7166                let mut inner_depth = depth.clone();
7167                if inlined {
7168                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7169                    inner_offset = next_offset;
7170                } else {
7171                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7172                    inner_depth.increment()?;
7173                }
7174                let val_ref =
7175                    self.max_bytes_per_row.get_or_insert_with(|| fidl::new_empty!(u32, D));
7176                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7177                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7178                {
7179                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7180                }
7181                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7182                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7183                }
7184            }
7185
7186            next_offset += envelope_size;
7187            _next_ordinal_to_read += 1;
7188            if next_offset >= end_offset {
7189                return Ok(());
7190            }
7191
7192            // Decode unknown envelopes for gaps in ordinals.
7193            while _next_ordinal_to_read < 8 {
7194                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7195                _next_ordinal_to_read += 1;
7196                next_offset += envelope_size;
7197            }
7198
7199            let next_out_of_line = decoder.next_out_of_line();
7200            let handles_before = decoder.remaining_handles();
7201            if let Some((inlined, num_bytes, num_handles)) =
7202                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7203            {
7204                let member_inline_size =
7205                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7206                if inlined != (member_inline_size <= 4) {
7207                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7208                }
7209                let inner_offset;
7210                let mut inner_depth = depth.clone();
7211                if inlined {
7212                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7213                    inner_offset = next_offset;
7214                } else {
7215                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7216                    inner_depth.increment()?;
7217                }
7218                let val_ref =
7219                    self.max_width_times_height.get_or_insert_with(|| fidl::new_empty!(u64, D));
7220                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
7221                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7222                {
7223                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7224                }
7225                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7226                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7227                }
7228            }
7229
7230            next_offset += envelope_size;
7231            _next_ordinal_to_read += 1;
7232            if next_offset >= end_offset {
7233                return Ok(());
7234            }
7235
7236            // Decode unknown envelopes for gaps in ordinals.
7237            while _next_ordinal_to_read < 9 {
7238                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7239                _next_ordinal_to_read += 1;
7240                next_offset += envelope_size;
7241            }
7242
7243            let next_out_of_line = decoder.next_out_of_line();
7244            let handles_before = decoder.remaining_handles();
7245            if let Some((inlined, num_bytes, num_handles)) =
7246                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7247            {
7248                let member_inline_size =
7249                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
7250                        decoder.context,
7251                    );
7252                if inlined != (member_inline_size <= 4) {
7253                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7254                }
7255                let inner_offset;
7256                let mut inner_depth = depth.clone();
7257                if inlined {
7258                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7259                    inner_offset = next_offset;
7260                } else {
7261                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7262                    inner_depth.increment()?;
7263                }
7264                let val_ref = self
7265                    .size_alignment
7266                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
7267                fidl::decode!(
7268                    fidl_fuchsia_math__common::SizeU,
7269                    D,
7270                    val_ref,
7271                    decoder,
7272                    inner_offset,
7273                    inner_depth
7274                )?;
7275                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7276                {
7277                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7278                }
7279                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7280                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7281                }
7282            }
7283
7284            next_offset += envelope_size;
7285            _next_ordinal_to_read += 1;
7286            if next_offset >= end_offset {
7287                return Ok(());
7288            }
7289
7290            // Decode unknown envelopes for gaps in ordinals.
7291            while _next_ordinal_to_read < 10 {
7292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7293                _next_ordinal_to_read += 1;
7294                next_offset += envelope_size;
7295            }
7296
7297            let next_out_of_line = decoder.next_out_of_line();
7298            let handles_before = decoder.remaining_handles();
7299            if let Some((inlined, num_bytes, num_handles)) =
7300                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7301            {
7302                let member_inline_size =
7303                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
7304                        decoder.context,
7305                    );
7306                if inlined != (member_inline_size <= 4) {
7307                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7308                }
7309                let inner_offset;
7310                let mut inner_depth = depth.clone();
7311                if inlined {
7312                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7313                    inner_offset = next_offset;
7314                } else {
7315                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7316                    inner_depth.increment()?;
7317                }
7318                let val_ref = self
7319                    .display_rect_alignment
7320                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
7321                fidl::decode!(
7322                    fidl_fuchsia_math__common::SizeU,
7323                    D,
7324                    val_ref,
7325                    decoder,
7326                    inner_offset,
7327                    inner_depth
7328                )?;
7329                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7330                {
7331                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7332                }
7333                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7334                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7335                }
7336            }
7337
7338            next_offset += envelope_size;
7339            _next_ordinal_to_read += 1;
7340            if next_offset >= end_offset {
7341                return Ok(());
7342            }
7343
7344            // Decode unknown envelopes for gaps in ordinals.
7345            while _next_ordinal_to_read < 11 {
7346                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7347                _next_ordinal_to_read += 1;
7348                next_offset += envelope_size;
7349            }
7350
7351            let next_out_of_line = decoder.next_out_of_line();
7352            let handles_before = decoder.remaining_handles();
7353            if let Some((inlined, num_bytes, num_handles)) =
7354                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7355            {
7356                let member_inline_size =
7357                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
7358                        decoder.context,
7359                    );
7360                if inlined != (member_inline_size <= 4) {
7361                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7362                }
7363                let inner_offset;
7364                let mut inner_depth = depth.clone();
7365                if inlined {
7366                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7367                    inner_offset = next_offset;
7368                } else {
7369                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7370                    inner_depth.increment()?;
7371                }
7372                let val_ref = self
7373                    .required_min_size
7374                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
7375                fidl::decode!(
7376                    fidl_fuchsia_math__common::SizeU,
7377                    D,
7378                    val_ref,
7379                    decoder,
7380                    inner_offset,
7381                    inner_depth
7382                )?;
7383                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7384                {
7385                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7386                }
7387                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7388                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7389                }
7390            }
7391
7392            next_offset += envelope_size;
7393            _next_ordinal_to_read += 1;
7394            if next_offset >= end_offset {
7395                return Ok(());
7396            }
7397
7398            // Decode unknown envelopes for gaps in ordinals.
7399            while _next_ordinal_to_read < 12 {
7400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7401                _next_ordinal_to_read += 1;
7402                next_offset += envelope_size;
7403            }
7404
7405            let next_out_of_line = decoder.next_out_of_line();
7406            let handles_before = decoder.remaining_handles();
7407            if let Some((inlined, num_bytes, num_handles)) =
7408                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7409            {
7410                let member_inline_size =
7411                    <fidl_fuchsia_math__common::SizeU as fidl::encoding::TypeMarker>::inline_size(
7412                        decoder.context,
7413                    );
7414                if inlined != (member_inline_size <= 4) {
7415                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7416                }
7417                let inner_offset;
7418                let mut inner_depth = depth.clone();
7419                if inlined {
7420                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7421                    inner_offset = next_offset;
7422                } else {
7423                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7424                    inner_depth.increment()?;
7425                }
7426                let val_ref = self
7427                    .required_max_size
7428                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::SizeU, D));
7429                fidl::decode!(
7430                    fidl_fuchsia_math__common::SizeU,
7431                    D,
7432                    val_ref,
7433                    decoder,
7434                    inner_offset,
7435                    inner_depth
7436                )?;
7437                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7438                {
7439                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7440                }
7441                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7442                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7443                }
7444            }
7445
7446            next_offset += envelope_size;
7447            _next_ordinal_to_read += 1;
7448            if next_offset >= end_offset {
7449                return Ok(());
7450            }
7451
7452            // Decode unknown envelopes for gaps in ordinals.
7453            while _next_ordinal_to_read < 13 {
7454                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7455                _next_ordinal_to_read += 1;
7456                next_offset += envelope_size;
7457            }
7458
7459            let next_out_of_line = decoder.next_out_of_line();
7460            let handles_before = decoder.remaining_handles();
7461            if let Some((inlined, num_bytes, num_handles)) =
7462                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7463            {
7464                let member_inline_size =
7465                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7466                if inlined != (member_inline_size <= 4) {
7467                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7468                }
7469                let inner_offset;
7470                let mut inner_depth = depth.clone();
7471                if inlined {
7472                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7473                    inner_offset = next_offset;
7474                } else {
7475                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7476                    inner_depth.increment()?;
7477                }
7478                let val_ref =
7479                    self.bytes_per_row_divisor.get_or_insert_with(|| fidl::new_empty!(u32, D));
7480                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7481                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7482                {
7483                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7484                }
7485                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7486                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7487                }
7488            }
7489
7490            next_offset += envelope_size;
7491            _next_ordinal_to_read += 1;
7492            if next_offset >= end_offset {
7493                return Ok(());
7494            }
7495
7496            // Decode unknown envelopes for gaps in ordinals.
7497            while _next_ordinal_to_read < 14 {
7498                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7499                _next_ordinal_to_read += 1;
7500                next_offset += envelope_size;
7501            }
7502
7503            let next_out_of_line = decoder.next_out_of_line();
7504            let handles_before = decoder.remaining_handles();
7505            if let Some((inlined, num_bytes, num_handles)) =
7506                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7507            {
7508                let member_inline_size =
7509                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7510                if inlined != (member_inline_size <= 4) {
7511                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7512                }
7513                let inner_offset;
7514                let mut inner_depth = depth.clone();
7515                if inlined {
7516                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7517                    inner_offset = next_offset;
7518                } else {
7519                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7520                    inner_depth.increment()?;
7521                }
7522                let val_ref =
7523                    self.start_offset_divisor.get_or_insert_with(|| fidl::new_empty!(u32, D));
7524                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
7525                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7526                {
7527                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7528                }
7529                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7530                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7531                }
7532            }
7533
7534            next_offset += envelope_size;
7535            _next_ordinal_to_read += 1;
7536            if next_offset >= end_offset {
7537                return Ok(());
7538            }
7539
7540            // Decode unknown envelopes for gaps in ordinals.
7541            while _next_ordinal_to_read < 15 {
7542                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7543                _next_ordinal_to_read += 1;
7544                next_offset += envelope_size;
7545            }
7546
7547            let next_out_of_line = decoder.next_out_of_line();
7548            let handles_before = decoder.remaining_handles();
7549            if let Some((inlined, num_bytes, num_handles)) =
7550                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7551            {
7552                let member_inline_size = <fidl::encoding::Vector<PixelFormatAndModifier, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7553                if inlined != (member_inline_size <= 4) {
7554                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7555                }
7556                let inner_offset;
7557                let mut inner_depth = depth.clone();
7558                if inlined {
7559                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7560                    inner_offset = next_offset;
7561                } else {
7562                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7563                    inner_depth.increment()?;
7564                }
7565                let val_ref = self.pixel_format_and_modifiers.get_or_insert_with(
7566                    || fidl::new_empty!(fidl::encoding::Vector<PixelFormatAndModifier, 64>, D),
7567                );
7568                fidl::decode!(fidl::encoding::Vector<PixelFormatAndModifier, 64>, D, val_ref, decoder, inner_offset, inner_depth)?;
7569                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7570                {
7571                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7572                }
7573                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7574                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7575                }
7576            }
7577
7578            next_offset += envelope_size;
7579            _next_ordinal_to_read += 1;
7580            if next_offset >= end_offset {
7581                return Ok(());
7582            }
7583
7584            // Decode unknown envelopes for gaps in ordinals.
7585            while _next_ordinal_to_read < 16 {
7586                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7587                _next_ordinal_to_read += 1;
7588                next_offset += envelope_size;
7589            }
7590
7591            let next_out_of_line = decoder.next_out_of_line();
7592            let handles_before = decoder.remaining_handles();
7593            if let Some((inlined, num_bytes, num_handles)) =
7594                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7595            {
7596                let member_inline_size =
7597                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7598                if inlined != (member_inline_size <= 4) {
7599                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7600                }
7601                let inner_offset;
7602                let mut inner_depth = depth.clone();
7603                if inlined {
7604                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7605                    inner_offset = next_offset;
7606                } else {
7607                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7608                    inner_depth.increment()?;
7609                }
7610                let val_ref = self
7611                    .require_bytes_per_row_at_pixel_boundary
7612                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
7613                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7614                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7615                {
7616                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7617                }
7618                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7619                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7620                }
7621            }
7622
7623            next_offset += envelope_size;
7624            _next_ordinal_to_read += 1;
7625            if next_offset >= end_offset {
7626                return Ok(());
7627            }
7628
7629            // Decode unknown envelopes for gaps in ordinals.
7630            while _next_ordinal_to_read < 17 {
7631                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7632                _next_ordinal_to_read += 1;
7633                next_offset += envelope_size;
7634            }
7635
7636            let next_out_of_line = decoder.next_out_of_line();
7637            let handles_before = decoder.remaining_handles();
7638            if let Some((inlined, num_bytes, num_handles)) =
7639                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7640            {
7641                let member_inline_size =
7642                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7643                if inlined != (member_inline_size <= 4) {
7644                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7645                }
7646                let inner_offset;
7647                let mut inner_depth = depth.clone();
7648                if inlined {
7649                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7650                    inner_offset = next_offset;
7651                } else {
7652                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7653                    inner_depth.increment()?;
7654                }
7655                let val_ref =
7656                    self.is_alpha_present.get_or_insert_with(|| fidl::new_empty!(bool, D));
7657                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7658                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7659                {
7660                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7661                }
7662                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7663                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7664                }
7665            }
7666
7667            next_offset += envelope_size;
7668
7669            // Decode the remaining unknown envelopes.
7670            while next_offset < end_offset {
7671                _next_ordinal_to_read += 1;
7672                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7673                next_offset += envelope_size;
7674            }
7675
7676            Ok(())
7677        }
7678    }
7679
7680    impl NodeSetDebugClientInfoRequest {
7681        #[inline(always)]
7682        fn max_ordinal_present(&self) -> u64 {
7683            if let Some(_) = self.id {
7684                return 2;
7685            }
7686            if let Some(_) = self.name {
7687                return 1;
7688            }
7689            0
7690        }
7691    }
7692
7693    impl fidl::encoding::ValueTypeMarker for NodeSetDebugClientInfoRequest {
7694        type Borrowed<'a> = &'a Self;
7695        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7696            value
7697        }
7698    }
7699
7700    unsafe impl fidl::encoding::TypeMarker for NodeSetDebugClientInfoRequest {
7701        type Owned = Self;
7702
7703        #[inline(always)]
7704        fn inline_align(_context: fidl::encoding::Context) -> usize {
7705            8
7706        }
7707
7708        #[inline(always)]
7709        fn inline_size(_context: fidl::encoding::Context) -> usize {
7710            16
7711        }
7712    }
7713
7714    unsafe impl<D: fidl::encoding::ResourceDialect>
7715        fidl::encoding::Encode<NodeSetDebugClientInfoRequest, D>
7716        for &NodeSetDebugClientInfoRequest
7717    {
7718        unsafe fn encode(
7719            self,
7720            encoder: &mut fidl::encoding::Encoder<'_, D>,
7721            offset: usize,
7722            mut depth: fidl::encoding::Depth,
7723        ) -> fidl::Result<()> {
7724            encoder.debug_check_bounds::<NodeSetDebugClientInfoRequest>(offset);
7725            // Vector header
7726            let max_ordinal: u64 = self.max_ordinal_present();
7727            encoder.write_num(max_ordinal, offset);
7728            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7729            // Calling encoder.out_of_line_offset(0) is not allowed.
7730            if max_ordinal == 0 {
7731                return Ok(());
7732            }
7733            depth.increment()?;
7734            let envelope_size = 8;
7735            let bytes_len = max_ordinal as usize * envelope_size;
7736            #[allow(unused_variables)]
7737            let offset = encoder.out_of_line_offset(bytes_len);
7738            let mut _prev_end_offset: usize = 0;
7739            if 1 > max_ordinal {
7740                return Ok(());
7741            }
7742
7743            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7744            // are envelope_size bytes.
7745            let cur_offset: usize = (1 - 1) * envelope_size;
7746
7747            // Zero reserved fields.
7748            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7749
7750            // Safety:
7751            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7752            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7753            //   envelope_size bytes, there is always sufficient room.
7754            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<256>, D>(
7755                self.name.as_ref().map(
7756                    <fidl::encoding::BoundedString<256> as fidl::encoding::ValueTypeMarker>::borrow,
7757                ),
7758                encoder,
7759                offset + cur_offset,
7760                depth,
7761            )?;
7762
7763            _prev_end_offset = cur_offset + envelope_size;
7764            if 2 > max_ordinal {
7765                return Ok(());
7766            }
7767
7768            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7769            // are envelope_size bytes.
7770            let cur_offset: usize = (2 - 1) * envelope_size;
7771
7772            // Zero reserved fields.
7773            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7774
7775            // Safety:
7776            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7777            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7778            //   envelope_size bytes, there is always sufficient room.
7779            fidl::encoding::encode_in_envelope_optional::<u64, D>(
7780                self.id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
7781                encoder,
7782                offset + cur_offset,
7783                depth,
7784            )?;
7785
7786            _prev_end_offset = cur_offset + envelope_size;
7787
7788            Ok(())
7789        }
7790    }
7791
7792    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7793        for NodeSetDebugClientInfoRequest
7794    {
7795        #[inline(always)]
7796        fn new_empty() -> Self {
7797            Self::default()
7798        }
7799
7800        unsafe fn decode(
7801            &mut self,
7802            decoder: &mut fidl::encoding::Decoder<'_, D>,
7803            offset: usize,
7804            mut depth: fidl::encoding::Depth,
7805        ) -> fidl::Result<()> {
7806            decoder.debug_check_bounds::<Self>(offset);
7807            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7808                None => return Err(fidl::Error::NotNullable),
7809                Some(len) => len,
7810            };
7811            // Calling decoder.out_of_line_offset(0) is not allowed.
7812            if len == 0 {
7813                return Ok(());
7814            };
7815            depth.increment()?;
7816            let envelope_size = 8;
7817            let bytes_len = len * envelope_size;
7818            let offset = decoder.out_of_line_offset(bytes_len)?;
7819            // Decode the envelope for each type.
7820            let mut _next_ordinal_to_read = 0;
7821            let mut next_offset = offset;
7822            let end_offset = offset + bytes_len;
7823            _next_ordinal_to_read += 1;
7824            if next_offset >= end_offset {
7825                return Ok(());
7826            }
7827
7828            // Decode unknown envelopes for gaps in ordinals.
7829            while _next_ordinal_to_read < 1 {
7830                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7831                _next_ordinal_to_read += 1;
7832                next_offset += envelope_size;
7833            }
7834
7835            let next_out_of_line = decoder.next_out_of_line();
7836            let handles_before = decoder.remaining_handles();
7837            if let Some((inlined, num_bytes, num_handles)) =
7838                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7839            {
7840                let member_inline_size =
7841                    <fidl::encoding::BoundedString<256> as fidl::encoding::TypeMarker>::inline_size(
7842                        decoder.context,
7843                    );
7844                if inlined != (member_inline_size <= 4) {
7845                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7846                }
7847                let inner_offset;
7848                let mut inner_depth = depth.clone();
7849                if inlined {
7850                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7851                    inner_offset = next_offset;
7852                } else {
7853                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7854                    inner_depth.increment()?;
7855                }
7856                let val_ref = self
7857                    .name
7858                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<256>, D));
7859                fidl::decode!(
7860                    fidl::encoding::BoundedString<256>,
7861                    D,
7862                    val_ref,
7863                    decoder,
7864                    inner_offset,
7865                    inner_depth
7866                )?;
7867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7868                {
7869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7870                }
7871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7873                }
7874            }
7875
7876            next_offset += envelope_size;
7877            _next_ordinal_to_read += 1;
7878            if next_offset >= end_offset {
7879                return Ok(());
7880            }
7881
7882            // Decode unknown envelopes for gaps in ordinals.
7883            while _next_ordinal_to_read < 2 {
7884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7885                _next_ordinal_to_read += 1;
7886                next_offset += envelope_size;
7887            }
7888
7889            let next_out_of_line = decoder.next_out_of_line();
7890            let handles_before = decoder.remaining_handles();
7891            if let Some((inlined, num_bytes, num_handles)) =
7892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7893            {
7894                let member_inline_size =
7895                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7896                if inlined != (member_inline_size <= 4) {
7897                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7898                }
7899                let inner_offset;
7900                let mut inner_depth = depth.clone();
7901                if inlined {
7902                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7903                    inner_offset = next_offset;
7904                } else {
7905                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7906                    inner_depth.increment()?;
7907                }
7908                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u64, D));
7909                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
7910                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7911                {
7912                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7913                }
7914                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7915                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7916                }
7917            }
7918
7919            next_offset += envelope_size;
7920
7921            // Decode the remaining unknown envelopes.
7922            while next_offset < end_offset {
7923                _next_ordinal_to_read += 1;
7924                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7925                next_offset += envelope_size;
7926            }
7927
7928            Ok(())
7929        }
7930    }
7931
7932    impl NodeSetDebugTimeoutLogDeadlineRequest {
7933        #[inline(always)]
7934        fn max_ordinal_present(&self) -> u64 {
7935            if let Some(_) = self.deadline {
7936                return 1;
7937            }
7938            0
7939        }
7940    }
7941
7942    impl fidl::encoding::ValueTypeMarker for NodeSetDebugTimeoutLogDeadlineRequest {
7943        type Borrowed<'a> = &'a Self;
7944        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7945            value
7946        }
7947    }
7948
7949    unsafe impl fidl::encoding::TypeMarker for NodeSetDebugTimeoutLogDeadlineRequest {
7950        type Owned = Self;
7951
7952        #[inline(always)]
7953        fn inline_align(_context: fidl::encoding::Context) -> usize {
7954            8
7955        }
7956
7957        #[inline(always)]
7958        fn inline_size(_context: fidl::encoding::Context) -> usize {
7959            16
7960        }
7961    }
7962
7963    unsafe impl<D: fidl::encoding::ResourceDialect>
7964        fidl::encoding::Encode<NodeSetDebugTimeoutLogDeadlineRequest, D>
7965        for &NodeSetDebugTimeoutLogDeadlineRequest
7966    {
7967        unsafe fn encode(
7968            self,
7969            encoder: &mut fidl::encoding::Encoder<'_, D>,
7970            offset: usize,
7971            mut depth: fidl::encoding::Depth,
7972        ) -> fidl::Result<()> {
7973            encoder.debug_check_bounds::<NodeSetDebugTimeoutLogDeadlineRequest>(offset);
7974            // Vector header
7975            let max_ordinal: u64 = self.max_ordinal_present();
7976            encoder.write_num(max_ordinal, offset);
7977            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7978            // Calling encoder.out_of_line_offset(0) is not allowed.
7979            if max_ordinal == 0 {
7980                return Ok(());
7981            }
7982            depth.increment()?;
7983            let envelope_size = 8;
7984            let bytes_len = max_ordinal as usize * envelope_size;
7985            #[allow(unused_variables)]
7986            let offset = encoder.out_of_line_offset(bytes_len);
7987            let mut _prev_end_offset: usize = 0;
7988            if 1 > max_ordinal {
7989                return Ok(());
7990            }
7991
7992            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7993            // are envelope_size bytes.
7994            let cur_offset: usize = (1 - 1) * envelope_size;
7995
7996            // Zero reserved fields.
7997            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7998
7999            // Safety:
8000            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8001            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8002            //   envelope_size bytes, there is always sufficient room.
8003            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8004                self.deadline.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8005                encoder,
8006                offset + cur_offset,
8007                depth,
8008            )?;
8009
8010            _prev_end_offset = cur_offset + envelope_size;
8011
8012            Ok(())
8013        }
8014    }
8015
8016    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8017        for NodeSetDebugTimeoutLogDeadlineRequest
8018    {
8019        #[inline(always)]
8020        fn new_empty() -> Self {
8021            Self::default()
8022        }
8023
8024        unsafe fn decode(
8025            &mut self,
8026            decoder: &mut fidl::encoding::Decoder<'_, D>,
8027            offset: usize,
8028            mut depth: fidl::encoding::Depth,
8029        ) -> fidl::Result<()> {
8030            decoder.debug_check_bounds::<Self>(offset);
8031            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8032                None => return Err(fidl::Error::NotNullable),
8033                Some(len) => len,
8034            };
8035            // Calling decoder.out_of_line_offset(0) is not allowed.
8036            if len == 0 {
8037                return Ok(());
8038            };
8039            depth.increment()?;
8040            let envelope_size = 8;
8041            let bytes_len = len * envelope_size;
8042            let offset = decoder.out_of_line_offset(bytes_len)?;
8043            // Decode the envelope for each type.
8044            let mut _next_ordinal_to_read = 0;
8045            let mut next_offset = offset;
8046            let end_offset = offset + bytes_len;
8047            _next_ordinal_to_read += 1;
8048            if next_offset >= end_offset {
8049                return Ok(());
8050            }
8051
8052            // Decode unknown envelopes for gaps in ordinals.
8053            while _next_ordinal_to_read < 1 {
8054                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8055                _next_ordinal_to_read += 1;
8056                next_offset += envelope_size;
8057            }
8058
8059            let next_out_of_line = decoder.next_out_of_line();
8060            let handles_before = decoder.remaining_handles();
8061            if let Some((inlined, num_bytes, num_handles)) =
8062                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8063            {
8064                let member_inline_size =
8065                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8066                if inlined != (member_inline_size <= 4) {
8067                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8068                }
8069                let inner_offset;
8070                let mut inner_depth = depth.clone();
8071                if inlined {
8072                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8073                    inner_offset = next_offset;
8074                } else {
8075                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8076                    inner_depth.increment()?;
8077                }
8078                let val_ref = self.deadline.get_or_insert_with(|| fidl::new_empty!(i64, D));
8079                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8081                {
8082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8083                }
8084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8086                }
8087            }
8088
8089            next_offset += envelope_size;
8090
8091            // Decode the remaining unknown envelopes.
8092            while next_offset < end_offset {
8093                _next_ordinal_to_read += 1;
8094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8095                next_offset += envelope_size;
8096            }
8097
8098            Ok(())
8099        }
8100    }
8101
8102    impl NodeSetNameRequest {
8103        #[inline(always)]
8104        fn max_ordinal_present(&self) -> u64 {
8105            if let Some(_) = self.name {
8106                return 2;
8107            }
8108            if let Some(_) = self.priority {
8109                return 1;
8110            }
8111            0
8112        }
8113    }
8114
8115    impl fidl::encoding::ValueTypeMarker for NodeSetNameRequest {
8116        type Borrowed<'a> = &'a Self;
8117        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8118            value
8119        }
8120    }
8121
8122    unsafe impl fidl::encoding::TypeMarker for NodeSetNameRequest {
8123        type Owned = Self;
8124
8125        #[inline(always)]
8126        fn inline_align(_context: fidl::encoding::Context) -> usize {
8127            8
8128        }
8129
8130        #[inline(always)]
8131        fn inline_size(_context: fidl::encoding::Context) -> usize {
8132            16
8133        }
8134    }
8135
8136    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NodeSetNameRequest, D>
8137        for &NodeSetNameRequest
8138    {
8139        unsafe fn encode(
8140            self,
8141            encoder: &mut fidl::encoding::Encoder<'_, D>,
8142            offset: usize,
8143            mut depth: fidl::encoding::Depth,
8144        ) -> fidl::Result<()> {
8145            encoder.debug_check_bounds::<NodeSetNameRequest>(offset);
8146            // Vector header
8147            let max_ordinal: u64 = self.max_ordinal_present();
8148            encoder.write_num(max_ordinal, offset);
8149            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8150            // Calling encoder.out_of_line_offset(0) is not allowed.
8151            if max_ordinal == 0 {
8152                return Ok(());
8153            }
8154            depth.increment()?;
8155            let envelope_size = 8;
8156            let bytes_len = max_ordinal as usize * envelope_size;
8157            #[allow(unused_variables)]
8158            let offset = encoder.out_of_line_offset(bytes_len);
8159            let mut _prev_end_offset: usize = 0;
8160            if 1 > max_ordinal {
8161                return Ok(());
8162            }
8163
8164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8165            // are envelope_size bytes.
8166            let cur_offset: usize = (1 - 1) * envelope_size;
8167
8168            // Zero reserved fields.
8169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8170
8171            // Safety:
8172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8174            //   envelope_size bytes, there is always sufficient room.
8175            fidl::encoding::encode_in_envelope_optional::<u32, D>(
8176                self.priority.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
8177                encoder,
8178                offset + cur_offset,
8179                depth,
8180            )?;
8181
8182            _prev_end_offset = cur_offset + envelope_size;
8183            if 2 > max_ordinal {
8184                return Ok(());
8185            }
8186
8187            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8188            // are envelope_size bytes.
8189            let cur_offset: usize = (2 - 1) * envelope_size;
8190
8191            // Zero reserved fields.
8192            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8193
8194            // Safety:
8195            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8196            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8197            //   envelope_size bytes, there is always sufficient room.
8198            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<64>, D>(
8199                self.name.as_ref().map(
8200                    <fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow,
8201                ),
8202                encoder,
8203                offset + cur_offset,
8204                depth,
8205            )?;
8206
8207            _prev_end_offset = cur_offset + envelope_size;
8208
8209            Ok(())
8210        }
8211    }
8212
8213    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NodeSetNameRequest {
8214        #[inline(always)]
8215        fn new_empty() -> Self {
8216            Self::default()
8217        }
8218
8219        unsafe fn decode(
8220            &mut self,
8221            decoder: &mut fidl::encoding::Decoder<'_, D>,
8222            offset: usize,
8223            mut depth: fidl::encoding::Depth,
8224        ) -> fidl::Result<()> {
8225            decoder.debug_check_bounds::<Self>(offset);
8226            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8227                None => return Err(fidl::Error::NotNullable),
8228                Some(len) => len,
8229            };
8230            // Calling decoder.out_of_line_offset(0) is not allowed.
8231            if len == 0 {
8232                return Ok(());
8233            };
8234            depth.increment()?;
8235            let envelope_size = 8;
8236            let bytes_len = len * envelope_size;
8237            let offset = decoder.out_of_line_offset(bytes_len)?;
8238            // Decode the envelope for each type.
8239            let mut _next_ordinal_to_read = 0;
8240            let mut next_offset = offset;
8241            let end_offset = offset + bytes_len;
8242            _next_ordinal_to_read += 1;
8243            if next_offset >= end_offset {
8244                return Ok(());
8245            }
8246
8247            // Decode unknown envelopes for gaps in ordinals.
8248            while _next_ordinal_to_read < 1 {
8249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8250                _next_ordinal_to_read += 1;
8251                next_offset += envelope_size;
8252            }
8253
8254            let next_out_of_line = decoder.next_out_of_line();
8255            let handles_before = decoder.remaining_handles();
8256            if let Some((inlined, num_bytes, num_handles)) =
8257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8258            {
8259                let member_inline_size =
8260                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8261                if inlined != (member_inline_size <= 4) {
8262                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8263                }
8264                let inner_offset;
8265                let mut inner_depth = depth.clone();
8266                if inlined {
8267                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8268                    inner_offset = next_offset;
8269                } else {
8270                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8271                    inner_depth.increment()?;
8272                }
8273                let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(u32, D));
8274                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
8275                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8276                {
8277                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8278                }
8279                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8280                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8281                }
8282            }
8283
8284            next_offset += envelope_size;
8285            _next_ordinal_to_read += 1;
8286            if next_offset >= end_offset {
8287                return Ok(());
8288            }
8289
8290            // Decode unknown envelopes for gaps in ordinals.
8291            while _next_ordinal_to_read < 2 {
8292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8293                _next_ordinal_to_read += 1;
8294                next_offset += envelope_size;
8295            }
8296
8297            let next_out_of_line = decoder.next_out_of_line();
8298            let handles_before = decoder.remaining_handles();
8299            if let Some((inlined, num_bytes, num_handles)) =
8300                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8301            {
8302                let member_inline_size =
8303                    <fidl::encoding::BoundedString<64> as fidl::encoding::TypeMarker>::inline_size(
8304                        decoder.context,
8305                    );
8306                if inlined != (member_inline_size <= 4) {
8307                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8308                }
8309                let inner_offset;
8310                let mut inner_depth = depth.clone();
8311                if inlined {
8312                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8313                    inner_offset = next_offset;
8314                } else {
8315                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8316                    inner_depth.increment()?;
8317                }
8318                let val_ref = self
8319                    .name
8320                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<64>, D));
8321                fidl::decode!(
8322                    fidl::encoding::BoundedString<64>,
8323                    D,
8324                    val_ref,
8325                    decoder,
8326                    inner_offset,
8327                    inner_depth
8328                )?;
8329                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8330                {
8331                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8332                }
8333                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8334                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8335                }
8336            }
8337
8338            next_offset += envelope_size;
8339
8340            // Decode the remaining unknown envelopes.
8341            while next_offset < end_offset {
8342                _next_ordinal_to_read += 1;
8343                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8344                next_offset += envelope_size;
8345            }
8346
8347            Ok(())
8348        }
8349    }
8350
8351    impl NodeGetBufferCollectionIdResponse {
8352        #[inline(always)]
8353        fn max_ordinal_present(&self) -> u64 {
8354            if let Some(_) = self.buffer_collection_id {
8355                return 1;
8356            }
8357            0
8358        }
8359    }
8360
8361    impl fidl::encoding::ValueTypeMarker for NodeGetBufferCollectionIdResponse {
8362        type Borrowed<'a> = &'a Self;
8363        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8364            value
8365        }
8366    }
8367
8368    unsafe impl fidl::encoding::TypeMarker for NodeGetBufferCollectionIdResponse {
8369        type Owned = Self;
8370
8371        #[inline(always)]
8372        fn inline_align(_context: fidl::encoding::Context) -> usize {
8373            8
8374        }
8375
8376        #[inline(always)]
8377        fn inline_size(_context: fidl::encoding::Context) -> usize {
8378            16
8379        }
8380    }
8381
8382    unsafe impl<D: fidl::encoding::ResourceDialect>
8383        fidl::encoding::Encode<NodeGetBufferCollectionIdResponse, D>
8384        for &NodeGetBufferCollectionIdResponse
8385    {
8386        unsafe fn encode(
8387            self,
8388            encoder: &mut fidl::encoding::Encoder<'_, D>,
8389            offset: usize,
8390            mut depth: fidl::encoding::Depth,
8391        ) -> fidl::Result<()> {
8392            encoder.debug_check_bounds::<NodeGetBufferCollectionIdResponse>(offset);
8393            // Vector header
8394            let max_ordinal: u64 = self.max_ordinal_present();
8395            encoder.write_num(max_ordinal, offset);
8396            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8397            // Calling encoder.out_of_line_offset(0) is not allowed.
8398            if max_ordinal == 0 {
8399                return Ok(());
8400            }
8401            depth.increment()?;
8402            let envelope_size = 8;
8403            let bytes_len = max_ordinal as usize * envelope_size;
8404            #[allow(unused_variables)]
8405            let offset = encoder.out_of_line_offset(bytes_len);
8406            let mut _prev_end_offset: usize = 0;
8407            if 1 > max_ordinal {
8408                return Ok(());
8409            }
8410
8411            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8412            // are envelope_size bytes.
8413            let cur_offset: usize = (1 - 1) * envelope_size;
8414
8415            // Zero reserved fields.
8416            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8417
8418            // Safety:
8419            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8420            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8421            //   envelope_size bytes, there is always sufficient room.
8422            fidl::encoding::encode_in_envelope_optional::<u64, D>(
8423                self.buffer_collection_id
8424                    .as_ref()
8425                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
8426                encoder,
8427                offset + cur_offset,
8428                depth,
8429            )?;
8430
8431            _prev_end_offset = cur_offset + envelope_size;
8432
8433            Ok(())
8434        }
8435    }
8436
8437    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8438        for NodeGetBufferCollectionIdResponse
8439    {
8440        #[inline(always)]
8441        fn new_empty() -> Self {
8442            Self::default()
8443        }
8444
8445        unsafe fn decode(
8446            &mut self,
8447            decoder: &mut fidl::encoding::Decoder<'_, D>,
8448            offset: usize,
8449            mut depth: fidl::encoding::Depth,
8450        ) -> fidl::Result<()> {
8451            decoder.debug_check_bounds::<Self>(offset);
8452            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8453                None => return Err(fidl::Error::NotNullable),
8454                Some(len) => len,
8455            };
8456            // Calling decoder.out_of_line_offset(0) is not allowed.
8457            if len == 0 {
8458                return Ok(());
8459            };
8460            depth.increment()?;
8461            let envelope_size = 8;
8462            let bytes_len = len * envelope_size;
8463            let offset = decoder.out_of_line_offset(bytes_len)?;
8464            // Decode the envelope for each type.
8465            let mut _next_ordinal_to_read = 0;
8466            let mut next_offset = offset;
8467            let end_offset = offset + bytes_len;
8468            _next_ordinal_to_read += 1;
8469            if next_offset >= end_offset {
8470                return Ok(());
8471            }
8472
8473            // Decode unknown envelopes for gaps in ordinals.
8474            while _next_ordinal_to_read < 1 {
8475                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8476                _next_ordinal_to_read += 1;
8477                next_offset += envelope_size;
8478            }
8479
8480            let next_out_of_line = decoder.next_out_of_line();
8481            let handles_before = decoder.remaining_handles();
8482            if let Some((inlined, num_bytes, num_handles)) =
8483                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8484            {
8485                let member_inline_size =
8486                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8487                if inlined != (member_inline_size <= 4) {
8488                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8489                }
8490                let inner_offset;
8491                let mut inner_depth = depth.clone();
8492                if inlined {
8493                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8494                    inner_offset = next_offset;
8495                } else {
8496                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8497                    inner_depth.increment()?;
8498                }
8499                let val_ref =
8500                    self.buffer_collection_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
8501                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
8502                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8503                {
8504                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8505                }
8506                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8507                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8508                }
8509            }
8510
8511            next_offset += envelope_size;
8512
8513            // Decode the remaining unknown envelopes.
8514            while next_offset < end_offset {
8515                _next_ordinal_to_read += 1;
8516                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8517                next_offset += envelope_size;
8518            }
8519
8520            Ok(())
8521        }
8522    }
8523
8524    impl NodeIsAlternateForResponse {
8525        #[inline(always)]
8526        fn max_ordinal_present(&self) -> u64 {
8527            if let Some(_) = self.is_alternate {
8528                return 1;
8529            }
8530            0
8531        }
8532    }
8533
8534    impl fidl::encoding::ValueTypeMarker for NodeIsAlternateForResponse {
8535        type Borrowed<'a> = &'a Self;
8536        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8537            value
8538        }
8539    }
8540
8541    unsafe impl fidl::encoding::TypeMarker for NodeIsAlternateForResponse {
8542        type Owned = Self;
8543
8544        #[inline(always)]
8545        fn inline_align(_context: fidl::encoding::Context) -> usize {
8546            8
8547        }
8548
8549        #[inline(always)]
8550        fn inline_size(_context: fidl::encoding::Context) -> usize {
8551            16
8552        }
8553    }
8554
8555    unsafe impl<D: fidl::encoding::ResourceDialect>
8556        fidl::encoding::Encode<NodeIsAlternateForResponse, D> for &NodeIsAlternateForResponse
8557    {
8558        unsafe fn encode(
8559            self,
8560            encoder: &mut fidl::encoding::Encoder<'_, D>,
8561            offset: usize,
8562            mut depth: fidl::encoding::Depth,
8563        ) -> fidl::Result<()> {
8564            encoder.debug_check_bounds::<NodeIsAlternateForResponse>(offset);
8565            // Vector header
8566            let max_ordinal: u64 = self.max_ordinal_present();
8567            encoder.write_num(max_ordinal, offset);
8568            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8569            // Calling encoder.out_of_line_offset(0) is not allowed.
8570            if max_ordinal == 0 {
8571                return Ok(());
8572            }
8573            depth.increment()?;
8574            let envelope_size = 8;
8575            let bytes_len = max_ordinal as usize * envelope_size;
8576            #[allow(unused_variables)]
8577            let offset = encoder.out_of_line_offset(bytes_len);
8578            let mut _prev_end_offset: usize = 0;
8579            if 1 > max_ordinal {
8580                return Ok(());
8581            }
8582
8583            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8584            // are envelope_size bytes.
8585            let cur_offset: usize = (1 - 1) * envelope_size;
8586
8587            // Zero reserved fields.
8588            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8589
8590            // Safety:
8591            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8592            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8593            //   envelope_size bytes, there is always sufficient room.
8594            fidl::encoding::encode_in_envelope_optional::<bool, D>(
8595                self.is_alternate.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8596                encoder,
8597                offset + cur_offset,
8598                depth,
8599            )?;
8600
8601            _prev_end_offset = cur_offset + envelope_size;
8602
8603            Ok(())
8604        }
8605    }
8606
8607    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8608        for NodeIsAlternateForResponse
8609    {
8610        #[inline(always)]
8611        fn new_empty() -> Self {
8612            Self::default()
8613        }
8614
8615        unsafe fn decode(
8616            &mut self,
8617            decoder: &mut fidl::encoding::Decoder<'_, D>,
8618            offset: usize,
8619            mut depth: fidl::encoding::Depth,
8620        ) -> fidl::Result<()> {
8621            decoder.debug_check_bounds::<Self>(offset);
8622            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8623                None => return Err(fidl::Error::NotNullable),
8624                Some(len) => len,
8625            };
8626            // Calling decoder.out_of_line_offset(0) is not allowed.
8627            if len == 0 {
8628                return Ok(());
8629            };
8630            depth.increment()?;
8631            let envelope_size = 8;
8632            let bytes_len = len * envelope_size;
8633            let offset = decoder.out_of_line_offset(bytes_len)?;
8634            // Decode the envelope for each type.
8635            let mut _next_ordinal_to_read = 0;
8636            let mut next_offset = offset;
8637            let end_offset = offset + bytes_len;
8638            _next_ordinal_to_read += 1;
8639            if next_offset >= end_offset {
8640                return Ok(());
8641            }
8642
8643            // Decode unknown envelopes for gaps in ordinals.
8644            while _next_ordinal_to_read < 1 {
8645                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8646                _next_ordinal_to_read += 1;
8647                next_offset += envelope_size;
8648            }
8649
8650            let next_out_of_line = decoder.next_out_of_line();
8651            let handles_before = decoder.remaining_handles();
8652            if let Some((inlined, num_bytes, num_handles)) =
8653                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8654            {
8655                let member_inline_size =
8656                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8657                if inlined != (member_inline_size <= 4) {
8658                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8659                }
8660                let inner_offset;
8661                let mut inner_depth = depth.clone();
8662                if inlined {
8663                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8664                    inner_offset = next_offset;
8665                } else {
8666                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8667                    inner_depth.increment()?;
8668                }
8669                let val_ref = self.is_alternate.get_or_insert_with(|| fidl::new_empty!(bool, D));
8670                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8671                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8672                {
8673                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8674                }
8675                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8676                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8677                }
8678            }
8679
8680            next_offset += envelope_size;
8681
8682            // Decode the remaining unknown envelopes.
8683            while next_offset < end_offset {
8684                _next_ordinal_to_read += 1;
8685                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8686                next_offset += envelope_size;
8687            }
8688
8689            Ok(())
8690        }
8691    }
8692
8693    impl SecureHeapAndRange {
8694        #[inline(always)]
8695        fn max_ordinal_present(&self) -> u64 {
8696            if let Some(_) = self.range {
8697                return 2;
8698            }
8699            if let Some(_) = self.heap {
8700                return 1;
8701            }
8702            0
8703        }
8704    }
8705
8706    impl fidl::encoding::ValueTypeMarker for SecureHeapAndRange {
8707        type Borrowed<'a> = &'a Self;
8708        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8709            value
8710        }
8711    }
8712
8713    unsafe impl fidl::encoding::TypeMarker for SecureHeapAndRange {
8714        type Owned = Self;
8715
8716        #[inline(always)]
8717        fn inline_align(_context: fidl::encoding::Context) -> usize {
8718            8
8719        }
8720
8721        #[inline(always)]
8722        fn inline_size(_context: fidl::encoding::Context) -> usize {
8723            16
8724        }
8725    }
8726
8727    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapAndRange, D>
8728        for &SecureHeapAndRange
8729    {
8730        unsafe fn encode(
8731            self,
8732            encoder: &mut fidl::encoding::Encoder<'_, D>,
8733            offset: usize,
8734            mut depth: fidl::encoding::Depth,
8735        ) -> fidl::Result<()> {
8736            encoder.debug_check_bounds::<SecureHeapAndRange>(offset);
8737            // Vector header
8738            let max_ordinal: u64 = self.max_ordinal_present();
8739            encoder.write_num(max_ordinal, offset);
8740            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8741            // Calling encoder.out_of_line_offset(0) is not allowed.
8742            if max_ordinal == 0 {
8743                return Ok(());
8744            }
8745            depth.increment()?;
8746            let envelope_size = 8;
8747            let bytes_len = max_ordinal as usize * envelope_size;
8748            #[allow(unused_variables)]
8749            let offset = encoder.out_of_line_offset(bytes_len);
8750            let mut _prev_end_offset: usize = 0;
8751            if 1 > max_ordinal {
8752                return Ok(());
8753            }
8754
8755            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8756            // are envelope_size bytes.
8757            let cur_offset: usize = (1 - 1) * envelope_size;
8758
8759            // Zero reserved fields.
8760            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8761
8762            // Safety:
8763            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8764            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8765            //   envelope_size bytes, there is always sufficient room.
8766            fidl::encoding::encode_in_envelope_optional::<Heap, D>(
8767                self.heap.as_ref().map(<Heap as fidl::encoding::ValueTypeMarker>::borrow),
8768                encoder,
8769                offset + cur_offset,
8770                depth,
8771            )?;
8772
8773            _prev_end_offset = cur_offset + envelope_size;
8774            if 2 > max_ordinal {
8775                return Ok(());
8776            }
8777
8778            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8779            // are envelope_size bytes.
8780            let cur_offset: usize = (2 - 1) * envelope_size;
8781
8782            // Zero reserved fields.
8783            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8784
8785            // Safety:
8786            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8787            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8788            //   envelope_size bytes, there is always sufficient room.
8789            fidl::encoding::encode_in_envelope_optional::<SecureHeapRange, D>(
8790                self.range
8791                    .as_ref()
8792                    .map(<SecureHeapRange as fidl::encoding::ValueTypeMarker>::borrow),
8793                encoder,
8794                offset + cur_offset,
8795                depth,
8796            )?;
8797
8798            _prev_end_offset = cur_offset + envelope_size;
8799
8800            Ok(())
8801        }
8802    }
8803
8804    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapAndRange {
8805        #[inline(always)]
8806        fn new_empty() -> Self {
8807            Self::default()
8808        }
8809
8810        unsafe fn decode(
8811            &mut self,
8812            decoder: &mut fidl::encoding::Decoder<'_, D>,
8813            offset: usize,
8814            mut depth: fidl::encoding::Depth,
8815        ) -> fidl::Result<()> {
8816            decoder.debug_check_bounds::<Self>(offset);
8817            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8818                None => return Err(fidl::Error::NotNullable),
8819                Some(len) => len,
8820            };
8821            // Calling decoder.out_of_line_offset(0) is not allowed.
8822            if len == 0 {
8823                return Ok(());
8824            };
8825            depth.increment()?;
8826            let envelope_size = 8;
8827            let bytes_len = len * envelope_size;
8828            let offset = decoder.out_of_line_offset(bytes_len)?;
8829            // Decode the envelope for each type.
8830            let mut _next_ordinal_to_read = 0;
8831            let mut next_offset = offset;
8832            let end_offset = offset + bytes_len;
8833            _next_ordinal_to_read += 1;
8834            if next_offset >= end_offset {
8835                return Ok(());
8836            }
8837
8838            // Decode unknown envelopes for gaps in ordinals.
8839            while _next_ordinal_to_read < 1 {
8840                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8841                _next_ordinal_to_read += 1;
8842                next_offset += envelope_size;
8843            }
8844
8845            let next_out_of_line = decoder.next_out_of_line();
8846            let handles_before = decoder.remaining_handles();
8847            if let Some((inlined, num_bytes, num_handles)) =
8848                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8849            {
8850                let member_inline_size =
8851                    <Heap as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8852                if inlined != (member_inline_size <= 4) {
8853                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8854                }
8855                let inner_offset;
8856                let mut inner_depth = depth.clone();
8857                if inlined {
8858                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8859                    inner_offset = next_offset;
8860                } else {
8861                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8862                    inner_depth.increment()?;
8863                }
8864                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(Heap, D));
8865                fidl::decode!(Heap, D, val_ref, decoder, inner_offset, inner_depth)?;
8866                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8867                {
8868                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8869                }
8870                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8871                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8872                }
8873            }
8874
8875            next_offset += envelope_size;
8876            _next_ordinal_to_read += 1;
8877            if next_offset >= end_offset {
8878                return Ok(());
8879            }
8880
8881            // Decode unknown envelopes for gaps in ordinals.
8882            while _next_ordinal_to_read < 2 {
8883                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8884                _next_ordinal_to_read += 1;
8885                next_offset += envelope_size;
8886            }
8887
8888            let next_out_of_line = decoder.next_out_of_line();
8889            let handles_before = decoder.remaining_handles();
8890            if let Some((inlined, num_bytes, num_handles)) =
8891                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8892            {
8893                let member_inline_size =
8894                    <SecureHeapRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8895                if inlined != (member_inline_size <= 4) {
8896                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8897                }
8898                let inner_offset;
8899                let mut inner_depth = depth.clone();
8900                if inlined {
8901                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8902                    inner_offset = next_offset;
8903                } else {
8904                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8905                    inner_depth.increment()?;
8906                }
8907                let val_ref =
8908                    self.range.get_or_insert_with(|| fidl::new_empty!(SecureHeapRange, D));
8909                fidl::decode!(SecureHeapRange, D, val_ref, decoder, inner_offset, inner_depth)?;
8910                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8911                {
8912                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8913                }
8914                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8915                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8916                }
8917            }
8918
8919            next_offset += envelope_size;
8920
8921            // Decode the remaining unknown envelopes.
8922            while next_offset < end_offset {
8923                _next_ordinal_to_read += 1;
8924                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8925                next_offset += envelope_size;
8926            }
8927
8928            Ok(())
8929        }
8930    }
8931
8932    impl SecureHeapAndRangeModification {
8933        #[inline(always)]
8934        fn max_ordinal_present(&self) -> u64 {
8935            if let Some(_) = self.new_range {
8936                return 3;
8937            }
8938            if let Some(_) = self.old_range {
8939                return 2;
8940            }
8941            if let Some(_) = self.heap {
8942                return 1;
8943            }
8944            0
8945        }
8946    }
8947
8948    impl fidl::encoding::ValueTypeMarker for SecureHeapAndRangeModification {
8949        type Borrowed<'a> = &'a Self;
8950        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8951            value
8952        }
8953    }
8954
8955    unsafe impl fidl::encoding::TypeMarker for SecureHeapAndRangeModification {
8956        type Owned = Self;
8957
8958        #[inline(always)]
8959        fn inline_align(_context: fidl::encoding::Context) -> usize {
8960            8
8961        }
8962
8963        #[inline(always)]
8964        fn inline_size(_context: fidl::encoding::Context) -> usize {
8965            16
8966        }
8967    }
8968
8969    unsafe impl<D: fidl::encoding::ResourceDialect>
8970        fidl::encoding::Encode<SecureHeapAndRangeModification, D>
8971        for &SecureHeapAndRangeModification
8972    {
8973        unsafe fn encode(
8974            self,
8975            encoder: &mut fidl::encoding::Encoder<'_, D>,
8976            offset: usize,
8977            mut depth: fidl::encoding::Depth,
8978        ) -> fidl::Result<()> {
8979            encoder.debug_check_bounds::<SecureHeapAndRangeModification>(offset);
8980            // Vector header
8981            let max_ordinal: u64 = self.max_ordinal_present();
8982            encoder.write_num(max_ordinal, offset);
8983            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8984            // Calling encoder.out_of_line_offset(0) is not allowed.
8985            if max_ordinal == 0 {
8986                return Ok(());
8987            }
8988            depth.increment()?;
8989            let envelope_size = 8;
8990            let bytes_len = max_ordinal as usize * envelope_size;
8991            #[allow(unused_variables)]
8992            let offset = encoder.out_of_line_offset(bytes_len);
8993            let mut _prev_end_offset: usize = 0;
8994            if 1 > max_ordinal {
8995                return Ok(());
8996            }
8997
8998            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8999            // are envelope_size bytes.
9000            let cur_offset: usize = (1 - 1) * envelope_size;
9001
9002            // Zero reserved fields.
9003            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9004
9005            // Safety:
9006            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9007            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9008            //   envelope_size bytes, there is always sufficient room.
9009            fidl::encoding::encode_in_envelope_optional::<Heap, D>(
9010                self.heap.as_ref().map(<Heap as fidl::encoding::ValueTypeMarker>::borrow),
9011                encoder,
9012                offset + cur_offset,
9013                depth,
9014            )?;
9015
9016            _prev_end_offset = cur_offset + envelope_size;
9017            if 2 > max_ordinal {
9018                return Ok(());
9019            }
9020
9021            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9022            // are envelope_size bytes.
9023            let cur_offset: usize = (2 - 1) * envelope_size;
9024
9025            // Zero reserved fields.
9026            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9027
9028            // Safety:
9029            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9030            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9031            //   envelope_size bytes, there is always sufficient room.
9032            fidl::encoding::encode_in_envelope_optional::<SecureHeapRange, D>(
9033                self.old_range
9034                    .as_ref()
9035                    .map(<SecureHeapRange as fidl::encoding::ValueTypeMarker>::borrow),
9036                encoder,
9037                offset + cur_offset,
9038                depth,
9039            )?;
9040
9041            _prev_end_offset = cur_offset + envelope_size;
9042            if 3 > max_ordinal {
9043                return Ok(());
9044            }
9045
9046            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9047            // are envelope_size bytes.
9048            let cur_offset: usize = (3 - 1) * envelope_size;
9049
9050            // Zero reserved fields.
9051            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9052
9053            // Safety:
9054            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9055            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9056            //   envelope_size bytes, there is always sufficient room.
9057            fidl::encoding::encode_in_envelope_optional::<SecureHeapRange, D>(
9058                self.new_range
9059                    .as_ref()
9060                    .map(<SecureHeapRange as fidl::encoding::ValueTypeMarker>::borrow),
9061                encoder,
9062                offset + cur_offset,
9063                depth,
9064            )?;
9065
9066            _prev_end_offset = cur_offset + envelope_size;
9067
9068            Ok(())
9069        }
9070    }
9071
9072    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9073        for SecureHeapAndRangeModification
9074    {
9075        #[inline(always)]
9076        fn new_empty() -> Self {
9077            Self::default()
9078        }
9079
9080        unsafe fn decode(
9081            &mut self,
9082            decoder: &mut fidl::encoding::Decoder<'_, D>,
9083            offset: usize,
9084            mut depth: fidl::encoding::Depth,
9085        ) -> fidl::Result<()> {
9086            decoder.debug_check_bounds::<Self>(offset);
9087            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9088                None => return Err(fidl::Error::NotNullable),
9089                Some(len) => len,
9090            };
9091            // Calling decoder.out_of_line_offset(0) is not allowed.
9092            if len == 0 {
9093                return Ok(());
9094            };
9095            depth.increment()?;
9096            let envelope_size = 8;
9097            let bytes_len = len * envelope_size;
9098            let offset = decoder.out_of_line_offset(bytes_len)?;
9099            // Decode the envelope for each type.
9100            let mut _next_ordinal_to_read = 0;
9101            let mut next_offset = offset;
9102            let end_offset = offset + bytes_len;
9103            _next_ordinal_to_read += 1;
9104            if next_offset >= end_offset {
9105                return Ok(());
9106            }
9107
9108            // Decode unknown envelopes for gaps in ordinals.
9109            while _next_ordinal_to_read < 1 {
9110                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9111                _next_ordinal_to_read += 1;
9112                next_offset += envelope_size;
9113            }
9114
9115            let next_out_of_line = decoder.next_out_of_line();
9116            let handles_before = decoder.remaining_handles();
9117            if let Some((inlined, num_bytes, num_handles)) =
9118                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9119            {
9120                let member_inline_size =
9121                    <Heap as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9122                if inlined != (member_inline_size <= 4) {
9123                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9124                }
9125                let inner_offset;
9126                let mut inner_depth = depth.clone();
9127                if inlined {
9128                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9129                    inner_offset = next_offset;
9130                } else {
9131                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9132                    inner_depth.increment()?;
9133                }
9134                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(Heap, D));
9135                fidl::decode!(Heap, D, val_ref, decoder, inner_offset, inner_depth)?;
9136                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9137                {
9138                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9139                }
9140                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9141                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9142                }
9143            }
9144
9145            next_offset += envelope_size;
9146            _next_ordinal_to_read += 1;
9147            if next_offset >= end_offset {
9148                return Ok(());
9149            }
9150
9151            // Decode unknown envelopes for gaps in ordinals.
9152            while _next_ordinal_to_read < 2 {
9153                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9154                _next_ordinal_to_read += 1;
9155                next_offset += envelope_size;
9156            }
9157
9158            let next_out_of_line = decoder.next_out_of_line();
9159            let handles_before = decoder.remaining_handles();
9160            if let Some((inlined, num_bytes, num_handles)) =
9161                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9162            {
9163                let member_inline_size =
9164                    <SecureHeapRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9165                if inlined != (member_inline_size <= 4) {
9166                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9167                }
9168                let inner_offset;
9169                let mut inner_depth = depth.clone();
9170                if inlined {
9171                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9172                    inner_offset = next_offset;
9173                } else {
9174                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9175                    inner_depth.increment()?;
9176                }
9177                let val_ref =
9178                    self.old_range.get_or_insert_with(|| fidl::new_empty!(SecureHeapRange, D));
9179                fidl::decode!(SecureHeapRange, D, val_ref, decoder, inner_offset, inner_depth)?;
9180                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9181                {
9182                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9183                }
9184                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9185                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9186                }
9187            }
9188
9189            next_offset += envelope_size;
9190            _next_ordinal_to_read += 1;
9191            if next_offset >= end_offset {
9192                return Ok(());
9193            }
9194
9195            // Decode unknown envelopes for gaps in ordinals.
9196            while _next_ordinal_to_read < 3 {
9197                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9198                _next_ordinal_to_read += 1;
9199                next_offset += envelope_size;
9200            }
9201
9202            let next_out_of_line = decoder.next_out_of_line();
9203            let handles_before = decoder.remaining_handles();
9204            if let Some((inlined, num_bytes, num_handles)) =
9205                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9206            {
9207                let member_inline_size =
9208                    <SecureHeapRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9209                if inlined != (member_inline_size <= 4) {
9210                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9211                }
9212                let inner_offset;
9213                let mut inner_depth = depth.clone();
9214                if inlined {
9215                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9216                    inner_offset = next_offset;
9217                } else {
9218                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9219                    inner_depth.increment()?;
9220                }
9221                let val_ref =
9222                    self.new_range.get_or_insert_with(|| fidl::new_empty!(SecureHeapRange, D));
9223                fidl::decode!(SecureHeapRange, D, val_ref, decoder, inner_offset, inner_depth)?;
9224                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9225                {
9226                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9227                }
9228                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9229                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9230                }
9231            }
9232
9233            next_offset += envelope_size;
9234
9235            // Decode the remaining unknown envelopes.
9236            while next_offset < end_offset {
9237                _next_ordinal_to_read += 1;
9238                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9239                next_offset += envelope_size;
9240            }
9241
9242            Ok(())
9243        }
9244    }
9245
9246    impl SecureHeapAndRanges {
9247        #[inline(always)]
9248        fn max_ordinal_present(&self) -> u64 {
9249            if let Some(_) = self.ranges {
9250                return 2;
9251            }
9252            if let Some(_) = self.heap {
9253                return 1;
9254            }
9255            0
9256        }
9257    }
9258
9259    impl fidl::encoding::ValueTypeMarker for SecureHeapAndRanges {
9260        type Borrowed<'a> = &'a Self;
9261        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9262            value
9263        }
9264    }
9265
9266    unsafe impl fidl::encoding::TypeMarker for SecureHeapAndRanges {
9267        type Owned = Self;
9268
9269        #[inline(always)]
9270        fn inline_align(_context: fidl::encoding::Context) -> usize {
9271            8
9272        }
9273
9274        #[inline(always)]
9275        fn inline_size(_context: fidl::encoding::Context) -> usize {
9276            16
9277        }
9278    }
9279
9280    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapAndRanges, D>
9281        for &SecureHeapAndRanges
9282    {
9283        unsafe fn encode(
9284            self,
9285            encoder: &mut fidl::encoding::Encoder<'_, D>,
9286            offset: usize,
9287            mut depth: fidl::encoding::Depth,
9288        ) -> fidl::Result<()> {
9289            encoder.debug_check_bounds::<SecureHeapAndRanges>(offset);
9290            // Vector header
9291            let max_ordinal: u64 = self.max_ordinal_present();
9292            encoder.write_num(max_ordinal, offset);
9293            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9294            // Calling encoder.out_of_line_offset(0) is not allowed.
9295            if max_ordinal == 0 {
9296                return Ok(());
9297            }
9298            depth.increment()?;
9299            let envelope_size = 8;
9300            let bytes_len = max_ordinal as usize * envelope_size;
9301            #[allow(unused_variables)]
9302            let offset = encoder.out_of_line_offset(bytes_len);
9303            let mut _prev_end_offset: usize = 0;
9304            if 1 > max_ordinal {
9305                return Ok(());
9306            }
9307
9308            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9309            // are envelope_size bytes.
9310            let cur_offset: usize = (1 - 1) * envelope_size;
9311
9312            // Zero reserved fields.
9313            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9314
9315            // Safety:
9316            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9317            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9318            //   envelope_size bytes, there is always sufficient room.
9319            fidl::encoding::encode_in_envelope_optional::<Heap, D>(
9320                self.heap.as_ref().map(<Heap as fidl::encoding::ValueTypeMarker>::borrow),
9321                encoder,
9322                offset + cur_offset,
9323                depth,
9324            )?;
9325
9326            _prev_end_offset = cur_offset + envelope_size;
9327            if 2 > max_ordinal {
9328                return Ok(());
9329            }
9330
9331            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9332            // are envelope_size bytes.
9333            let cur_offset: usize = (2 - 1) * envelope_size;
9334
9335            // Zero reserved fields.
9336            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9337
9338            // Safety:
9339            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9340            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9341            //   envelope_size bytes, there is always sufficient room.
9342            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SecureHeapRange, 128>, D>(
9343            self.ranges.as_ref().map(<fidl::encoding::Vector<SecureHeapRange, 128> as fidl::encoding::ValueTypeMarker>::borrow),
9344            encoder, offset + cur_offset, depth
9345        )?;
9346
9347            _prev_end_offset = cur_offset + envelope_size;
9348
9349            Ok(())
9350        }
9351    }
9352
9353    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapAndRanges {
9354        #[inline(always)]
9355        fn new_empty() -> Self {
9356            Self::default()
9357        }
9358
9359        unsafe fn decode(
9360            &mut self,
9361            decoder: &mut fidl::encoding::Decoder<'_, D>,
9362            offset: usize,
9363            mut depth: fidl::encoding::Depth,
9364        ) -> fidl::Result<()> {
9365            decoder.debug_check_bounds::<Self>(offset);
9366            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9367                None => return Err(fidl::Error::NotNullable),
9368                Some(len) => len,
9369            };
9370            // Calling decoder.out_of_line_offset(0) is not allowed.
9371            if len == 0 {
9372                return Ok(());
9373            };
9374            depth.increment()?;
9375            let envelope_size = 8;
9376            let bytes_len = len * envelope_size;
9377            let offset = decoder.out_of_line_offset(bytes_len)?;
9378            // Decode the envelope for each type.
9379            let mut _next_ordinal_to_read = 0;
9380            let mut next_offset = offset;
9381            let end_offset = offset + bytes_len;
9382            _next_ordinal_to_read += 1;
9383            if next_offset >= end_offset {
9384                return Ok(());
9385            }
9386
9387            // Decode unknown envelopes for gaps in ordinals.
9388            while _next_ordinal_to_read < 1 {
9389                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9390                _next_ordinal_to_read += 1;
9391                next_offset += envelope_size;
9392            }
9393
9394            let next_out_of_line = decoder.next_out_of_line();
9395            let handles_before = decoder.remaining_handles();
9396            if let Some((inlined, num_bytes, num_handles)) =
9397                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9398            {
9399                let member_inline_size =
9400                    <Heap as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9401                if inlined != (member_inline_size <= 4) {
9402                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9403                }
9404                let inner_offset;
9405                let mut inner_depth = depth.clone();
9406                if inlined {
9407                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9408                    inner_offset = next_offset;
9409                } else {
9410                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9411                    inner_depth.increment()?;
9412                }
9413                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(Heap, D));
9414                fidl::decode!(Heap, D, val_ref, decoder, inner_offset, inner_depth)?;
9415                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9416                {
9417                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9418                }
9419                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9420                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9421                }
9422            }
9423
9424            next_offset += envelope_size;
9425            _next_ordinal_to_read += 1;
9426            if next_offset >= end_offset {
9427                return Ok(());
9428            }
9429
9430            // Decode unknown envelopes for gaps in ordinals.
9431            while _next_ordinal_to_read < 2 {
9432                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9433                _next_ordinal_to_read += 1;
9434                next_offset += envelope_size;
9435            }
9436
9437            let next_out_of_line = decoder.next_out_of_line();
9438            let handles_before = decoder.remaining_handles();
9439            if let Some((inlined, num_bytes, num_handles)) =
9440                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9441            {
9442                let member_inline_size = <fidl::encoding::Vector<SecureHeapRange, 128> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9443                if inlined != (member_inline_size <= 4) {
9444                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9445                }
9446                let inner_offset;
9447                let mut inner_depth = depth.clone();
9448                if inlined {
9449                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9450                    inner_offset = next_offset;
9451                } else {
9452                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9453                    inner_depth.increment()?;
9454                }
9455                let val_ref = self.ranges.get_or_insert_with(
9456                    || fidl::new_empty!(fidl::encoding::Vector<SecureHeapRange, 128>, D),
9457                );
9458                fidl::decode!(fidl::encoding::Vector<SecureHeapRange, 128>, D, val_ref, decoder, inner_offset, inner_depth)?;
9459                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9460                {
9461                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9462                }
9463                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9464                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9465                }
9466            }
9467
9468            next_offset += envelope_size;
9469
9470            // Decode the remaining unknown envelopes.
9471            while next_offset < end_offset {
9472                _next_ordinal_to_read += 1;
9473                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9474                next_offset += envelope_size;
9475            }
9476
9477            Ok(())
9478        }
9479    }
9480
9481    impl SecureHeapProperties {
9482        #[inline(always)]
9483        fn max_ordinal_present(&self) -> u64 {
9484            if let Some(_) = self.is_mod_protected_range_available {
9485                return 5;
9486            }
9487            if let Some(_) = self.max_protected_range_count {
9488                return 4;
9489            }
9490            if let Some(_) = self.protected_range_granularity {
9491                return 3;
9492            }
9493            if let Some(_) = self.dynamic_protection_ranges {
9494                return 2;
9495            }
9496            if let Some(_) = self.heap {
9497                return 1;
9498            }
9499            0
9500        }
9501    }
9502
9503    impl fidl::encoding::ValueTypeMarker for SecureHeapProperties {
9504        type Borrowed<'a> = &'a Self;
9505        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9506            value
9507        }
9508    }
9509
9510    unsafe impl fidl::encoding::TypeMarker for SecureHeapProperties {
9511        type Owned = Self;
9512
9513        #[inline(always)]
9514        fn inline_align(_context: fidl::encoding::Context) -> usize {
9515            8
9516        }
9517
9518        #[inline(always)]
9519        fn inline_size(_context: fidl::encoding::Context) -> usize {
9520            16
9521        }
9522    }
9523
9524    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapProperties, D>
9525        for &SecureHeapProperties
9526    {
9527        unsafe fn encode(
9528            self,
9529            encoder: &mut fidl::encoding::Encoder<'_, D>,
9530            offset: usize,
9531            mut depth: fidl::encoding::Depth,
9532        ) -> fidl::Result<()> {
9533            encoder.debug_check_bounds::<SecureHeapProperties>(offset);
9534            // Vector header
9535            let max_ordinal: u64 = self.max_ordinal_present();
9536            encoder.write_num(max_ordinal, offset);
9537            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9538            // Calling encoder.out_of_line_offset(0) is not allowed.
9539            if max_ordinal == 0 {
9540                return Ok(());
9541            }
9542            depth.increment()?;
9543            let envelope_size = 8;
9544            let bytes_len = max_ordinal as usize * envelope_size;
9545            #[allow(unused_variables)]
9546            let offset = encoder.out_of_line_offset(bytes_len);
9547            let mut _prev_end_offset: usize = 0;
9548            if 1 > max_ordinal {
9549                return Ok(());
9550            }
9551
9552            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9553            // are envelope_size bytes.
9554            let cur_offset: usize = (1 - 1) * envelope_size;
9555
9556            // Zero reserved fields.
9557            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9558
9559            // Safety:
9560            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9561            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9562            //   envelope_size bytes, there is always sufficient room.
9563            fidl::encoding::encode_in_envelope_optional::<Heap, D>(
9564                self.heap.as_ref().map(<Heap as fidl::encoding::ValueTypeMarker>::borrow),
9565                encoder,
9566                offset + cur_offset,
9567                depth,
9568            )?;
9569
9570            _prev_end_offset = cur_offset + envelope_size;
9571            if 2 > max_ordinal {
9572                return Ok(());
9573            }
9574
9575            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9576            // are envelope_size bytes.
9577            let cur_offset: usize = (2 - 1) * envelope_size;
9578
9579            // Zero reserved fields.
9580            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9581
9582            // Safety:
9583            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9584            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9585            //   envelope_size bytes, there is always sufficient room.
9586            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9587                self.dynamic_protection_ranges
9588                    .as_ref()
9589                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9590                encoder,
9591                offset + cur_offset,
9592                depth,
9593            )?;
9594
9595            _prev_end_offset = cur_offset + envelope_size;
9596            if 3 > max_ordinal {
9597                return Ok(());
9598            }
9599
9600            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9601            // are envelope_size bytes.
9602            let cur_offset: usize = (3 - 1) * envelope_size;
9603
9604            // Zero reserved fields.
9605            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9606
9607            // Safety:
9608            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9609            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9610            //   envelope_size bytes, there is always sufficient room.
9611            fidl::encoding::encode_in_envelope_optional::<u32, D>(
9612                self.protected_range_granularity
9613                    .as_ref()
9614                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9615                encoder,
9616                offset + cur_offset,
9617                depth,
9618            )?;
9619
9620            _prev_end_offset = cur_offset + envelope_size;
9621            if 4 > max_ordinal {
9622                return Ok(());
9623            }
9624
9625            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9626            // are envelope_size bytes.
9627            let cur_offset: usize = (4 - 1) * envelope_size;
9628
9629            // Zero reserved fields.
9630            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9631
9632            // Safety:
9633            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9634            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9635            //   envelope_size bytes, there is always sufficient room.
9636            fidl::encoding::encode_in_envelope_optional::<u64, D>(
9637                self.max_protected_range_count
9638                    .as_ref()
9639                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
9640                encoder,
9641                offset + cur_offset,
9642                depth,
9643            )?;
9644
9645            _prev_end_offset = cur_offset + envelope_size;
9646            if 5 > max_ordinal {
9647                return Ok(());
9648            }
9649
9650            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9651            // are envelope_size bytes.
9652            let cur_offset: usize = (5 - 1) * envelope_size;
9653
9654            // Zero reserved fields.
9655            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9656
9657            // Safety:
9658            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9659            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9660            //   envelope_size bytes, there is always sufficient room.
9661            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9662                self.is_mod_protected_range_available
9663                    .as_ref()
9664                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9665                encoder,
9666                offset + cur_offset,
9667                depth,
9668            )?;
9669
9670            _prev_end_offset = cur_offset + envelope_size;
9671
9672            Ok(())
9673        }
9674    }
9675
9676    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapProperties {
9677        #[inline(always)]
9678        fn new_empty() -> Self {
9679            Self::default()
9680        }
9681
9682        unsafe fn decode(
9683            &mut self,
9684            decoder: &mut fidl::encoding::Decoder<'_, D>,
9685            offset: usize,
9686            mut depth: fidl::encoding::Depth,
9687        ) -> fidl::Result<()> {
9688            decoder.debug_check_bounds::<Self>(offset);
9689            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9690                None => return Err(fidl::Error::NotNullable),
9691                Some(len) => len,
9692            };
9693            // Calling decoder.out_of_line_offset(0) is not allowed.
9694            if len == 0 {
9695                return Ok(());
9696            };
9697            depth.increment()?;
9698            let envelope_size = 8;
9699            let bytes_len = len * envelope_size;
9700            let offset = decoder.out_of_line_offset(bytes_len)?;
9701            // Decode the envelope for each type.
9702            let mut _next_ordinal_to_read = 0;
9703            let mut next_offset = offset;
9704            let end_offset = offset + bytes_len;
9705            _next_ordinal_to_read += 1;
9706            if next_offset >= end_offset {
9707                return Ok(());
9708            }
9709
9710            // Decode unknown envelopes for gaps in ordinals.
9711            while _next_ordinal_to_read < 1 {
9712                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9713                _next_ordinal_to_read += 1;
9714                next_offset += envelope_size;
9715            }
9716
9717            let next_out_of_line = decoder.next_out_of_line();
9718            let handles_before = decoder.remaining_handles();
9719            if let Some((inlined, num_bytes, num_handles)) =
9720                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9721            {
9722                let member_inline_size =
9723                    <Heap as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9724                if inlined != (member_inline_size <= 4) {
9725                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9726                }
9727                let inner_offset;
9728                let mut inner_depth = depth.clone();
9729                if inlined {
9730                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9731                    inner_offset = next_offset;
9732                } else {
9733                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9734                    inner_depth.increment()?;
9735                }
9736                let val_ref = self.heap.get_or_insert_with(|| fidl::new_empty!(Heap, D));
9737                fidl::decode!(Heap, D, val_ref, decoder, inner_offset, inner_depth)?;
9738                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9739                {
9740                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9741                }
9742                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9743                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9744                }
9745            }
9746
9747            next_offset += envelope_size;
9748            _next_ordinal_to_read += 1;
9749            if next_offset >= end_offset {
9750                return Ok(());
9751            }
9752
9753            // Decode unknown envelopes for gaps in ordinals.
9754            while _next_ordinal_to_read < 2 {
9755                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9756                _next_ordinal_to_read += 1;
9757                next_offset += envelope_size;
9758            }
9759
9760            let next_out_of_line = decoder.next_out_of_line();
9761            let handles_before = decoder.remaining_handles();
9762            if let Some((inlined, num_bytes, num_handles)) =
9763                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9764            {
9765                let member_inline_size =
9766                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9767                if inlined != (member_inline_size <= 4) {
9768                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9769                }
9770                let inner_offset;
9771                let mut inner_depth = depth.clone();
9772                if inlined {
9773                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9774                    inner_offset = next_offset;
9775                } else {
9776                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9777                    inner_depth.increment()?;
9778                }
9779                let val_ref =
9780                    self.dynamic_protection_ranges.get_or_insert_with(|| fidl::new_empty!(bool, D));
9781                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9782                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9783                {
9784                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9785                }
9786                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9787                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9788                }
9789            }
9790
9791            next_offset += envelope_size;
9792            _next_ordinal_to_read += 1;
9793            if next_offset >= end_offset {
9794                return Ok(());
9795            }
9796
9797            // Decode unknown envelopes for gaps in ordinals.
9798            while _next_ordinal_to_read < 3 {
9799                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9800                _next_ordinal_to_read += 1;
9801                next_offset += envelope_size;
9802            }
9803
9804            let next_out_of_line = decoder.next_out_of_line();
9805            let handles_before = decoder.remaining_handles();
9806            if let Some((inlined, num_bytes, num_handles)) =
9807                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9808            {
9809                let member_inline_size =
9810                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9811                if inlined != (member_inline_size <= 4) {
9812                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9813                }
9814                let inner_offset;
9815                let mut inner_depth = depth.clone();
9816                if inlined {
9817                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9818                    inner_offset = next_offset;
9819                } else {
9820                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9821                    inner_depth.increment()?;
9822                }
9823                let val_ref = self
9824                    .protected_range_granularity
9825                    .get_or_insert_with(|| fidl::new_empty!(u32, D));
9826                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
9827                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9828                {
9829                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9830                }
9831                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9832                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9833                }
9834            }
9835
9836            next_offset += envelope_size;
9837            _next_ordinal_to_read += 1;
9838            if next_offset >= end_offset {
9839                return Ok(());
9840            }
9841
9842            // Decode unknown envelopes for gaps in ordinals.
9843            while _next_ordinal_to_read < 4 {
9844                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9845                _next_ordinal_to_read += 1;
9846                next_offset += envelope_size;
9847            }
9848
9849            let next_out_of_line = decoder.next_out_of_line();
9850            let handles_before = decoder.remaining_handles();
9851            if let Some((inlined, num_bytes, num_handles)) =
9852                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9853            {
9854                let member_inline_size =
9855                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9856                if inlined != (member_inline_size <= 4) {
9857                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9858                }
9859                let inner_offset;
9860                let mut inner_depth = depth.clone();
9861                if inlined {
9862                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9863                    inner_offset = next_offset;
9864                } else {
9865                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9866                    inner_depth.increment()?;
9867                }
9868                let val_ref =
9869                    self.max_protected_range_count.get_or_insert_with(|| fidl::new_empty!(u64, D));
9870                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
9871                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9872                {
9873                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9874                }
9875                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9876                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9877                }
9878            }
9879
9880            next_offset += envelope_size;
9881            _next_ordinal_to_read += 1;
9882            if next_offset >= end_offset {
9883                return Ok(());
9884            }
9885
9886            // Decode unknown envelopes for gaps in ordinals.
9887            while _next_ordinal_to_read < 5 {
9888                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9889                _next_ordinal_to_read += 1;
9890                next_offset += envelope_size;
9891            }
9892
9893            let next_out_of_line = decoder.next_out_of_line();
9894            let handles_before = decoder.remaining_handles();
9895            if let Some((inlined, num_bytes, num_handles)) =
9896                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9897            {
9898                let member_inline_size =
9899                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9900                if inlined != (member_inline_size <= 4) {
9901                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9902                }
9903                let inner_offset;
9904                let mut inner_depth = depth.clone();
9905                if inlined {
9906                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9907                    inner_offset = next_offset;
9908                } else {
9909                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9910                    inner_depth.increment()?;
9911                }
9912                let val_ref = self
9913                    .is_mod_protected_range_available
9914                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
9915                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9916                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9917                {
9918                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9919                }
9920                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9921                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9922                }
9923            }
9924
9925            next_offset += envelope_size;
9926
9927            // Decode the remaining unknown envelopes.
9928            while next_offset < end_offset {
9929                _next_ordinal_to_read += 1;
9930                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9931                next_offset += envelope_size;
9932            }
9933
9934            Ok(())
9935        }
9936    }
9937
9938    impl SecureHeapRange {
9939        #[inline(always)]
9940        fn max_ordinal_present(&self) -> u64 {
9941            if let Some(_) = self.size_bytes {
9942                return 2;
9943            }
9944            if let Some(_) = self.physical_address {
9945                return 1;
9946            }
9947            0
9948        }
9949    }
9950
9951    impl fidl::encoding::ValueTypeMarker for SecureHeapRange {
9952        type Borrowed<'a> = &'a Self;
9953        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9954            value
9955        }
9956    }
9957
9958    unsafe impl fidl::encoding::TypeMarker for SecureHeapRange {
9959        type Owned = Self;
9960
9961        #[inline(always)]
9962        fn inline_align(_context: fidl::encoding::Context) -> usize {
9963            8
9964        }
9965
9966        #[inline(always)]
9967        fn inline_size(_context: fidl::encoding::Context) -> usize {
9968            16
9969        }
9970    }
9971
9972    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SecureHeapRange, D>
9973        for &SecureHeapRange
9974    {
9975        unsafe fn encode(
9976            self,
9977            encoder: &mut fidl::encoding::Encoder<'_, D>,
9978            offset: usize,
9979            mut depth: fidl::encoding::Depth,
9980        ) -> fidl::Result<()> {
9981            encoder.debug_check_bounds::<SecureHeapRange>(offset);
9982            // Vector header
9983            let max_ordinal: u64 = self.max_ordinal_present();
9984            encoder.write_num(max_ordinal, offset);
9985            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9986            // Calling encoder.out_of_line_offset(0) is not allowed.
9987            if max_ordinal == 0 {
9988                return Ok(());
9989            }
9990            depth.increment()?;
9991            let envelope_size = 8;
9992            let bytes_len = max_ordinal as usize * envelope_size;
9993            #[allow(unused_variables)]
9994            let offset = encoder.out_of_line_offset(bytes_len);
9995            let mut _prev_end_offset: usize = 0;
9996            if 1 > max_ordinal {
9997                return Ok(());
9998            }
9999
10000            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10001            // are envelope_size bytes.
10002            let cur_offset: usize = (1 - 1) * envelope_size;
10003
10004            // Zero reserved fields.
10005            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10006
10007            // Safety:
10008            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10009            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10010            //   envelope_size bytes, there is always sufficient room.
10011            fidl::encoding::encode_in_envelope_optional::<u64, D>(
10012                self.physical_address
10013                    .as_ref()
10014                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10015                encoder,
10016                offset + cur_offset,
10017                depth,
10018            )?;
10019
10020            _prev_end_offset = cur_offset + envelope_size;
10021            if 2 > max_ordinal {
10022                return Ok(());
10023            }
10024
10025            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10026            // are envelope_size bytes.
10027            let cur_offset: usize = (2 - 1) * envelope_size;
10028
10029            // Zero reserved fields.
10030            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10031
10032            // Safety:
10033            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10034            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10035            //   envelope_size bytes, there is always sufficient room.
10036            fidl::encoding::encode_in_envelope_optional::<u64, D>(
10037                self.size_bytes.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
10038                encoder,
10039                offset + cur_offset,
10040                depth,
10041            )?;
10042
10043            _prev_end_offset = cur_offset + envelope_size;
10044
10045            Ok(())
10046        }
10047    }
10048
10049    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SecureHeapRange {
10050        #[inline(always)]
10051        fn new_empty() -> Self {
10052            Self::default()
10053        }
10054
10055        unsafe fn decode(
10056            &mut self,
10057            decoder: &mut fidl::encoding::Decoder<'_, D>,
10058            offset: usize,
10059            mut depth: fidl::encoding::Depth,
10060        ) -> fidl::Result<()> {
10061            decoder.debug_check_bounds::<Self>(offset);
10062            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10063                None => return Err(fidl::Error::NotNullable),
10064                Some(len) => len,
10065            };
10066            // Calling decoder.out_of_line_offset(0) is not allowed.
10067            if len == 0 {
10068                return Ok(());
10069            };
10070            depth.increment()?;
10071            let envelope_size = 8;
10072            let bytes_len = len * envelope_size;
10073            let offset = decoder.out_of_line_offset(bytes_len)?;
10074            // Decode the envelope for each type.
10075            let mut _next_ordinal_to_read = 0;
10076            let mut next_offset = offset;
10077            let end_offset = offset + bytes_len;
10078            _next_ordinal_to_read += 1;
10079            if next_offset >= end_offset {
10080                return Ok(());
10081            }
10082
10083            // Decode unknown envelopes for gaps in ordinals.
10084            while _next_ordinal_to_read < 1 {
10085                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10086                _next_ordinal_to_read += 1;
10087                next_offset += envelope_size;
10088            }
10089
10090            let next_out_of_line = decoder.next_out_of_line();
10091            let handles_before = decoder.remaining_handles();
10092            if let Some((inlined, num_bytes, num_handles)) =
10093                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10094            {
10095                let member_inline_size =
10096                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10097                if inlined != (member_inline_size <= 4) {
10098                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10099                }
10100                let inner_offset;
10101                let mut inner_depth = depth.clone();
10102                if inlined {
10103                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10104                    inner_offset = next_offset;
10105                } else {
10106                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10107                    inner_depth.increment()?;
10108                }
10109                let val_ref = self.physical_address.get_or_insert_with(|| fidl::new_empty!(u64, D));
10110                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
10111                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10112                {
10113                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10114                }
10115                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10116                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10117                }
10118            }
10119
10120            next_offset += envelope_size;
10121            _next_ordinal_to_read += 1;
10122            if next_offset >= end_offset {
10123                return Ok(());
10124            }
10125
10126            // Decode unknown envelopes for gaps in ordinals.
10127            while _next_ordinal_to_read < 2 {
10128                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10129                _next_ordinal_to_read += 1;
10130                next_offset += envelope_size;
10131            }
10132
10133            let next_out_of_line = decoder.next_out_of_line();
10134            let handles_before = decoder.remaining_handles();
10135            if let Some((inlined, num_bytes, num_handles)) =
10136                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10137            {
10138                let member_inline_size =
10139                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10140                if inlined != (member_inline_size <= 4) {
10141                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10142                }
10143                let inner_offset;
10144                let mut inner_depth = depth.clone();
10145                if inlined {
10146                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10147                    inner_offset = next_offset;
10148                } else {
10149                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10150                    inner_depth.increment()?;
10151                }
10152                let val_ref = self.size_bytes.get_or_insert_with(|| fidl::new_empty!(u64, D));
10153                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
10154                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10155                {
10156                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10157                }
10158                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10159                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10160                }
10161            }
10162
10163            next_offset += envelope_size;
10164
10165            // Decode the remaining unknown envelopes.
10166            while next_offset < end_offset {
10167                _next_ordinal_to_read += 1;
10168                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10169                next_offset += envelope_size;
10170            }
10171
10172            Ok(())
10173        }
10174    }
10175
10176    impl SecureMemAddSecureHeapPhysicalRangeRequest {
10177        #[inline(always)]
10178        fn max_ordinal_present(&self) -> u64 {
10179            if let Some(_) = self.heap_range {
10180                return 1;
10181            }
10182            0
10183        }
10184    }
10185
10186    impl fidl::encoding::ValueTypeMarker for SecureMemAddSecureHeapPhysicalRangeRequest {
10187        type Borrowed<'a> = &'a Self;
10188        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10189            value
10190        }
10191    }
10192
10193    unsafe impl fidl::encoding::TypeMarker for SecureMemAddSecureHeapPhysicalRangeRequest {
10194        type Owned = Self;
10195
10196        #[inline(always)]
10197        fn inline_align(_context: fidl::encoding::Context) -> usize {
10198            8
10199        }
10200
10201        #[inline(always)]
10202        fn inline_size(_context: fidl::encoding::Context) -> usize {
10203            16
10204        }
10205    }
10206
10207    unsafe impl<D: fidl::encoding::ResourceDialect>
10208        fidl::encoding::Encode<SecureMemAddSecureHeapPhysicalRangeRequest, D>
10209        for &SecureMemAddSecureHeapPhysicalRangeRequest
10210    {
10211        unsafe fn encode(
10212            self,
10213            encoder: &mut fidl::encoding::Encoder<'_, D>,
10214            offset: usize,
10215            mut depth: fidl::encoding::Depth,
10216        ) -> fidl::Result<()> {
10217            encoder.debug_check_bounds::<SecureMemAddSecureHeapPhysicalRangeRequest>(offset);
10218            // Vector header
10219            let max_ordinal: u64 = self.max_ordinal_present();
10220            encoder.write_num(max_ordinal, offset);
10221            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10222            // Calling encoder.out_of_line_offset(0) is not allowed.
10223            if max_ordinal == 0 {
10224                return Ok(());
10225            }
10226            depth.increment()?;
10227            let envelope_size = 8;
10228            let bytes_len = max_ordinal as usize * envelope_size;
10229            #[allow(unused_variables)]
10230            let offset = encoder.out_of_line_offset(bytes_len);
10231            let mut _prev_end_offset: usize = 0;
10232            if 1 > max_ordinal {
10233                return Ok(());
10234            }
10235
10236            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10237            // are envelope_size bytes.
10238            let cur_offset: usize = (1 - 1) * envelope_size;
10239
10240            // Zero reserved fields.
10241            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10242
10243            // Safety:
10244            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10245            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10246            //   envelope_size bytes, there is always sufficient room.
10247            fidl::encoding::encode_in_envelope_optional::<SecureHeapAndRange, D>(
10248                self.heap_range
10249                    .as_ref()
10250                    .map(<SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow),
10251                encoder,
10252                offset + cur_offset,
10253                depth,
10254            )?;
10255
10256            _prev_end_offset = cur_offset + envelope_size;
10257
10258            Ok(())
10259        }
10260    }
10261
10262    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10263        for SecureMemAddSecureHeapPhysicalRangeRequest
10264    {
10265        #[inline(always)]
10266        fn new_empty() -> Self {
10267            Self::default()
10268        }
10269
10270        unsafe fn decode(
10271            &mut self,
10272            decoder: &mut fidl::encoding::Decoder<'_, D>,
10273            offset: usize,
10274            mut depth: fidl::encoding::Depth,
10275        ) -> fidl::Result<()> {
10276            decoder.debug_check_bounds::<Self>(offset);
10277            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10278                None => return Err(fidl::Error::NotNullable),
10279                Some(len) => len,
10280            };
10281            // Calling decoder.out_of_line_offset(0) is not allowed.
10282            if len == 0 {
10283                return Ok(());
10284            };
10285            depth.increment()?;
10286            let envelope_size = 8;
10287            let bytes_len = len * envelope_size;
10288            let offset = decoder.out_of_line_offset(bytes_len)?;
10289            // Decode the envelope for each type.
10290            let mut _next_ordinal_to_read = 0;
10291            let mut next_offset = offset;
10292            let end_offset = offset + bytes_len;
10293            _next_ordinal_to_read += 1;
10294            if next_offset >= end_offset {
10295                return Ok(());
10296            }
10297
10298            // Decode unknown envelopes for gaps in ordinals.
10299            while _next_ordinal_to_read < 1 {
10300                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10301                _next_ordinal_to_read += 1;
10302                next_offset += envelope_size;
10303            }
10304
10305            let next_out_of_line = decoder.next_out_of_line();
10306            let handles_before = decoder.remaining_handles();
10307            if let Some((inlined, num_bytes, num_handles)) =
10308                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10309            {
10310                let member_inline_size =
10311                    <SecureHeapAndRange as fidl::encoding::TypeMarker>::inline_size(
10312                        decoder.context,
10313                    );
10314                if inlined != (member_inline_size <= 4) {
10315                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10316                }
10317                let inner_offset;
10318                let mut inner_depth = depth.clone();
10319                if inlined {
10320                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10321                    inner_offset = next_offset;
10322                } else {
10323                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10324                    inner_depth.increment()?;
10325                }
10326                let val_ref =
10327                    self.heap_range.get_or_insert_with(|| fidl::new_empty!(SecureHeapAndRange, D));
10328                fidl::decode!(SecureHeapAndRange, D, val_ref, decoder, inner_offset, inner_depth)?;
10329                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10330                {
10331                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10332                }
10333                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10334                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10335                }
10336            }
10337
10338            next_offset += envelope_size;
10339
10340            // Decode the remaining unknown envelopes.
10341            while next_offset < end_offset {
10342                _next_ordinal_to_read += 1;
10343                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10344                next_offset += envelope_size;
10345            }
10346
10347            Ok(())
10348        }
10349    }
10350
10351    impl SecureMemDeleteSecureHeapPhysicalRangeRequest {
10352        #[inline(always)]
10353        fn max_ordinal_present(&self) -> u64 {
10354            if let Some(_) = self.heap_range {
10355                return 1;
10356            }
10357            0
10358        }
10359    }
10360
10361    impl fidl::encoding::ValueTypeMarker for SecureMemDeleteSecureHeapPhysicalRangeRequest {
10362        type Borrowed<'a> = &'a Self;
10363        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10364            value
10365        }
10366    }
10367
10368    unsafe impl fidl::encoding::TypeMarker for SecureMemDeleteSecureHeapPhysicalRangeRequest {
10369        type Owned = Self;
10370
10371        #[inline(always)]
10372        fn inline_align(_context: fidl::encoding::Context) -> usize {
10373            8
10374        }
10375
10376        #[inline(always)]
10377        fn inline_size(_context: fidl::encoding::Context) -> usize {
10378            16
10379        }
10380    }
10381
10382    unsafe impl<D: fidl::encoding::ResourceDialect>
10383        fidl::encoding::Encode<SecureMemDeleteSecureHeapPhysicalRangeRequest, D>
10384        for &SecureMemDeleteSecureHeapPhysicalRangeRequest
10385    {
10386        unsafe fn encode(
10387            self,
10388            encoder: &mut fidl::encoding::Encoder<'_, D>,
10389            offset: usize,
10390            mut depth: fidl::encoding::Depth,
10391        ) -> fidl::Result<()> {
10392            encoder.debug_check_bounds::<SecureMemDeleteSecureHeapPhysicalRangeRequest>(offset);
10393            // Vector header
10394            let max_ordinal: u64 = self.max_ordinal_present();
10395            encoder.write_num(max_ordinal, offset);
10396            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10397            // Calling encoder.out_of_line_offset(0) is not allowed.
10398            if max_ordinal == 0 {
10399                return Ok(());
10400            }
10401            depth.increment()?;
10402            let envelope_size = 8;
10403            let bytes_len = max_ordinal as usize * envelope_size;
10404            #[allow(unused_variables)]
10405            let offset = encoder.out_of_line_offset(bytes_len);
10406            let mut _prev_end_offset: usize = 0;
10407            if 1 > max_ordinal {
10408                return Ok(());
10409            }
10410
10411            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10412            // are envelope_size bytes.
10413            let cur_offset: usize = (1 - 1) * envelope_size;
10414
10415            // Zero reserved fields.
10416            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10417
10418            // Safety:
10419            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10420            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10421            //   envelope_size bytes, there is always sufficient room.
10422            fidl::encoding::encode_in_envelope_optional::<SecureHeapAndRange, D>(
10423                self.heap_range
10424                    .as_ref()
10425                    .map(<SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow),
10426                encoder,
10427                offset + cur_offset,
10428                depth,
10429            )?;
10430
10431            _prev_end_offset = cur_offset + envelope_size;
10432
10433            Ok(())
10434        }
10435    }
10436
10437    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10438        for SecureMemDeleteSecureHeapPhysicalRangeRequest
10439    {
10440        #[inline(always)]
10441        fn new_empty() -> Self {
10442            Self::default()
10443        }
10444
10445        unsafe fn decode(
10446            &mut self,
10447            decoder: &mut fidl::encoding::Decoder<'_, D>,
10448            offset: usize,
10449            mut depth: fidl::encoding::Depth,
10450        ) -> fidl::Result<()> {
10451            decoder.debug_check_bounds::<Self>(offset);
10452            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10453                None => return Err(fidl::Error::NotNullable),
10454                Some(len) => len,
10455            };
10456            // Calling decoder.out_of_line_offset(0) is not allowed.
10457            if len == 0 {
10458                return Ok(());
10459            };
10460            depth.increment()?;
10461            let envelope_size = 8;
10462            let bytes_len = len * envelope_size;
10463            let offset = decoder.out_of_line_offset(bytes_len)?;
10464            // Decode the envelope for each type.
10465            let mut _next_ordinal_to_read = 0;
10466            let mut next_offset = offset;
10467            let end_offset = offset + bytes_len;
10468            _next_ordinal_to_read += 1;
10469            if next_offset >= end_offset {
10470                return Ok(());
10471            }
10472
10473            // Decode unknown envelopes for gaps in ordinals.
10474            while _next_ordinal_to_read < 1 {
10475                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10476                _next_ordinal_to_read += 1;
10477                next_offset += envelope_size;
10478            }
10479
10480            let next_out_of_line = decoder.next_out_of_line();
10481            let handles_before = decoder.remaining_handles();
10482            if let Some((inlined, num_bytes, num_handles)) =
10483                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10484            {
10485                let member_inline_size =
10486                    <SecureHeapAndRange as fidl::encoding::TypeMarker>::inline_size(
10487                        decoder.context,
10488                    );
10489                if inlined != (member_inline_size <= 4) {
10490                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10491                }
10492                let inner_offset;
10493                let mut inner_depth = depth.clone();
10494                if inlined {
10495                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10496                    inner_offset = next_offset;
10497                } else {
10498                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10499                    inner_depth.increment()?;
10500                }
10501                let val_ref =
10502                    self.heap_range.get_or_insert_with(|| fidl::new_empty!(SecureHeapAndRange, D));
10503                fidl::decode!(SecureHeapAndRange, D, val_ref, decoder, inner_offset, inner_depth)?;
10504                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10505                {
10506                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10507                }
10508                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10509                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10510                }
10511            }
10512
10513            next_offset += envelope_size;
10514
10515            // Decode the remaining unknown envelopes.
10516            while next_offset < end_offset {
10517                _next_ordinal_to_read += 1;
10518                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10519                next_offset += envelope_size;
10520            }
10521
10522            Ok(())
10523        }
10524    }
10525
10526    impl SecureMemGetPhysicalSecureHeapPropertiesRequest {
10527        #[inline(always)]
10528        fn max_ordinal_present(&self) -> u64 {
10529            if let Some(_) = self.entire_heap {
10530                return 1;
10531            }
10532            0
10533        }
10534    }
10535
10536    impl fidl::encoding::ValueTypeMarker for SecureMemGetPhysicalSecureHeapPropertiesRequest {
10537        type Borrowed<'a> = &'a Self;
10538        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10539            value
10540        }
10541    }
10542
10543    unsafe impl fidl::encoding::TypeMarker for SecureMemGetPhysicalSecureHeapPropertiesRequest {
10544        type Owned = Self;
10545
10546        #[inline(always)]
10547        fn inline_align(_context: fidl::encoding::Context) -> usize {
10548            8
10549        }
10550
10551        #[inline(always)]
10552        fn inline_size(_context: fidl::encoding::Context) -> usize {
10553            16
10554        }
10555    }
10556
10557    unsafe impl<D: fidl::encoding::ResourceDialect>
10558        fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapPropertiesRequest, D>
10559        for &SecureMemGetPhysicalSecureHeapPropertiesRequest
10560    {
10561        unsafe fn encode(
10562            self,
10563            encoder: &mut fidl::encoding::Encoder<'_, D>,
10564            offset: usize,
10565            mut depth: fidl::encoding::Depth,
10566        ) -> fidl::Result<()> {
10567            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapPropertiesRequest>(offset);
10568            // Vector header
10569            let max_ordinal: u64 = self.max_ordinal_present();
10570            encoder.write_num(max_ordinal, offset);
10571            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10572            // Calling encoder.out_of_line_offset(0) is not allowed.
10573            if max_ordinal == 0 {
10574                return Ok(());
10575            }
10576            depth.increment()?;
10577            let envelope_size = 8;
10578            let bytes_len = max_ordinal as usize * envelope_size;
10579            #[allow(unused_variables)]
10580            let offset = encoder.out_of_line_offset(bytes_len);
10581            let mut _prev_end_offset: usize = 0;
10582            if 1 > max_ordinal {
10583                return Ok(());
10584            }
10585
10586            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10587            // are envelope_size bytes.
10588            let cur_offset: usize = (1 - 1) * envelope_size;
10589
10590            // Zero reserved fields.
10591            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10592
10593            // Safety:
10594            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10595            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10596            //   envelope_size bytes, there is always sufficient room.
10597            fidl::encoding::encode_in_envelope_optional::<SecureHeapAndRange, D>(
10598                self.entire_heap
10599                    .as_ref()
10600                    .map(<SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow),
10601                encoder,
10602                offset + cur_offset,
10603                depth,
10604            )?;
10605
10606            _prev_end_offset = cur_offset + envelope_size;
10607
10608            Ok(())
10609        }
10610    }
10611
10612    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10613        for SecureMemGetPhysicalSecureHeapPropertiesRequest
10614    {
10615        #[inline(always)]
10616        fn new_empty() -> Self {
10617            Self::default()
10618        }
10619
10620        unsafe fn decode(
10621            &mut self,
10622            decoder: &mut fidl::encoding::Decoder<'_, D>,
10623            offset: usize,
10624            mut depth: fidl::encoding::Depth,
10625        ) -> fidl::Result<()> {
10626            decoder.debug_check_bounds::<Self>(offset);
10627            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10628                None => return Err(fidl::Error::NotNullable),
10629                Some(len) => len,
10630            };
10631            // Calling decoder.out_of_line_offset(0) is not allowed.
10632            if len == 0 {
10633                return Ok(());
10634            };
10635            depth.increment()?;
10636            let envelope_size = 8;
10637            let bytes_len = len * envelope_size;
10638            let offset = decoder.out_of_line_offset(bytes_len)?;
10639            // Decode the envelope for each type.
10640            let mut _next_ordinal_to_read = 0;
10641            let mut next_offset = offset;
10642            let end_offset = offset + bytes_len;
10643            _next_ordinal_to_read += 1;
10644            if next_offset >= end_offset {
10645                return Ok(());
10646            }
10647
10648            // Decode unknown envelopes for gaps in ordinals.
10649            while _next_ordinal_to_read < 1 {
10650                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10651                _next_ordinal_to_read += 1;
10652                next_offset += envelope_size;
10653            }
10654
10655            let next_out_of_line = decoder.next_out_of_line();
10656            let handles_before = decoder.remaining_handles();
10657            if let Some((inlined, num_bytes, num_handles)) =
10658                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10659            {
10660                let member_inline_size =
10661                    <SecureHeapAndRange as fidl::encoding::TypeMarker>::inline_size(
10662                        decoder.context,
10663                    );
10664                if inlined != (member_inline_size <= 4) {
10665                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10666                }
10667                let inner_offset;
10668                let mut inner_depth = depth.clone();
10669                if inlined {
10670                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10671                    inner_offset = next_offset;
10672                } else {
10673                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10674                    inner_depth.increment()?;
10675                }
10676                let val_ref =
10677                    self.entire_heap.get_or_insert_with(|| fidl::new_empty!(SecureHeapAndRange, D));
10678                fidl::decode!(SecureHeapAndRange, D, val_ref, decoder, inner_offset, inner_depth)?;
10679                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10680                {
10681                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10682                }
10683                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10684                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10685                }
10686            }
10687
10688            next_offset += envelope_size;
10689
10690            // Decode the remaining unknown envelopes.
10691            while next_offset < end_offset {
10692                _next_ordinal_to_read += 1;
10693                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10694                next_offset += envelope_size;
10695            }
10696
10697            Ok(())
10698        }
10699    }
10700
10701    impl SecureMemModifySecureHeapPhysicalRangeRequest {
10702        #[inline(always)]
10703        fn max_ordinal_present(&self) -> u64 {
10704            if let Some(_) = self.range_modification {
10705                return 1;
10706            }
10707            0
10708        }
10709    }
10710
10711    impl fidl::encoding::ValueTypeMarker for SecureMemModifySecureHeapPhysicalRangeRequest {
10712        type Borrowed<'a> = &'a Self;
10713        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10714            value
10715        }
10716    }
10717
10718    unsafe impl fidl::encoding::TypeMarker for SecureMemModifySecureHeapPhysicalRangeRequest {
10719        type Owned = Self;
10720
10721        #[inline(always)]
10722        fn inline_align(_context: fidl::encoding::Context) -> usize {
10723            8
10724        }
10725
10726        #[inline(always)]
10727        fn inline_size(_context: fidl::encoding::Context) -> usize {
10728            16
10729        }
10730    }
10731
10732    unsafe impl<D: fidl::encoding::ResourceDialect>
10733        fidl::encoding::Encode<SecureMemModifySecureHeapPhysicalRangeRequest, D>
10734        for &SecureMemModifySecureHeapPhysicalRangeRequest
10735    {
10736        unsafe fn encode(
10737            self,
10738            encoder: &mut fidl::encoding::Encoder<'_, D>,
10739            offset: usize,
10740            mut depth: fidl::encoding::Depth,
10741        ) -> fidl::Result<()> {
10742            encoder.debug_check_bounds::<SecureMemModifySecureHeapPhysicalRangeRequest>(offset);
10743            // Vector header
10744            let max_ordinal: u64 = self.max_ordinal_present();
10745            encoder.write_num(max_ordinal, offset);
10746            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10747            // Calling encoder.out_of_line_offset(0) is not allowed.
10748            if max_ordinal == 0 {
10749                return Ok(());
10750            }
10751            depth.increment()?;
10752            let envelope_size = 8;
10753            let bytes_len = max_ordinal as usize * envelope_size;
10754            #[allow(unused_variables)]
10755            let offset = encoder.out_of_line_offset(bytes_len);
10756            let mut _prev_end_offset: usize = 0;
10757            if 1 > max_ordinal {
10758                return Ok(());
10759            }
10760
10761            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10762            // are envelope_size bytes.
10763            let cur_offset: usize = (1 - 1) * envelope_size;
10764
10765            // Zero reserved fields.
10766            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10767
10768            // Safety:
10769            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10770            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10771            //   envelope_size bytes, there is always sufficient room.
10772            fidl::encoding::encode_in_envelope_optional::<SecureHeapAndRangeModification, D>(
10773                self.range_modification.as_ref().map(
10774                    <SecureHeapAndRangeModification as fidl::encoding::ValueTypeMarker>::borrow,
10775                ),
10776                encoder,
10777                offset + cur_offset,
10778                depth,
10779            )?;
10780
10781            _prev_end_offset = cur_offset + envelope_size;
10782
10783            Ok(())
10784        }
10785    }
10786
10787    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10788        for SecureMemModifySecureHeapPhysicalRangeRequest
10789    {
10790        #[inline(always)]
10791        fn new_empty() -> Self {
10792            Self::default()
10793        }
10794
10795        unsafe fn decode(
10796            &mut self,
10797            decoder: &mut fidl::encoding::Decoder<'_, D>,
10798            offset: usize,
10799            mut depth: fidl::encoding::Depth,
10800        ) -> fidl::Result<()> {
10801            decoder.debug_check_bounds::<Self>(offset);
10802            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10803                None => return Err(fidl::Error::NotNullable),
10804                Some(len) => len,
10805            };
10806            // Calling decoder.out_of_line_offset(0) is not allowed.
10807            if len == 0 {
10808                return Ok(());
10809            };
10810            depth.increment()?;
10811            let envelope_size = 8;
10812            let bytes_len = len * envelope_size;
10813            let offset = decoder.out_of_line_offset(bytes_len)?;
10814            // Decode the envelope for each type.
10815            let mut _next_ordinal_to_read = 0;
10816            let mut next_offset = offset;
10817            let end_offset = offset + bytes_len;
10818            _next_ordinal_to_read += 1;
10819            if next_offset >= end_offset {
10820                return Ok(());
10821            }
10822
10823            // Decode unknown envelopes for gaps in ordinals.
10824            while _next_ordinal_to_read < 1 {
10825                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10826                _next_ordinal_to_read += 1;
10827                next_offset += envelope_size;
10828            }
10829
10830            let next_out_of_line = decoder.next_out_of_line();
10831            let handles_before = decoder.remaining_handles();
10832            if let Some((inlined, num_bytes, num_handles)) =
10833                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10834            {
10835                let member_inline_size =
10836                    <SecureHeapAndRangeModification as fidl::encoding::TypeMarker>::inline_size(
10837                        decoder.context,
10838                    );
10839                if inlined != (member_inline_size <= 4) {
10840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10841                }
10842                let inner_offset;
10843                let mut inner_depth = depth.clone();
10844                if inlined {
10845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10846                    inner_offset = next_offset;
10847                } else {
10848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10849                    inner_depth.increment()?;
10850                }
10851                let val_ref = self
10852                    .range_modification
10853                    .get_or_insert_with(|| fidl::new_empty!(SecureHeapAndRangeModification, D));
10854                fidl::decode!(
10855                    SecureHeapAndRangeModification,
10856                    D,
10857                    val_ref,
10858                    decoder,
10859                    inner_offset,
10860                    inner_depth
10861                )?;
10862                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10863                {
10864                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10865                }
10866                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10867                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10868                }
10869            }
10870
10871            next_offset += envelope_size;
10872
10873            // Decode the remaining unknown envelopes.
10874            while next_offset < end_offset {
10875                _next_ordinal_to_read += 1;
10876                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10877                next_offset += envelope_size;
10878            }
10879
10880            Ok(())
10881        }
10882    }
10883
10884    impl SecureMemZeroSubRangeRequest {
10885        #[inline(always)]
10886        fn max_ordinal_present(&self) -> u64 {
10887            if let Some(_) = self.heap_range {
10888                return 2;
10889            }
10890            if let Some(_) = self.is_covering_range_explicit {
10891                return 1;
10892            }
10893            0
10894        }
10895    }
10896
10897    impl fidl::encoding::ValueTypeMarker for SecureMemZeroSubRangeRequest {
10898        type Borrowed<'a> = &'a Self;
10899        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10900            value
10901        }
10902    }
10903
10904    unsafe impl fidl::encoding::TypeMarker for SecureMemZeroSubRangeRequest {
10905        type Owned = Self;
10906
10907        #[inline(always)]
10908        fn inline_align(_context: fidl::encoding::Context) -> usize {
10909            8
10910        }
10911
10912        #[inline(always)]
10913        fn inline_size(_context: fidl::encoding::Context) -> usize {
10914            16
10915        }
10916    }
10917
10918    unsafe impl<D: fidl::encoding::ResourceDialect>
10919        fidl::encoding::Encode<SecureMemZeroSubRangeRequest, D> for &SecureMemZeroSubRangeRequest
10920    {
10921        unsafe fn encode(
10922            self,
10923            encoder: &mut fidl::encoding::Encoder<'_, D>,
10924            offset: usize,
10925            mut depth: fidl::encoding::Depth,
10926        ) -> fidl::Result<()> {
10927            encoder.debug_check_bounds::<SecureMemZeroSubRangeRequest>(offset);
10928            // Vector header
10929            let max_ordinal: u64 = self.max_ordinal_present();
10930            encoder.write_num(max_ordinal, offset);
10931            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10932            // Calling encoder.out_of_line_offset(0) is not allowed.
10933            if max_ordinal == 0 {
10934                return Ok(());
10935            }
10936            depth.increment()?;
10937            let envelope_size = 8;
10938            let bytes_len = max_ordinal as usize * envelope_size;
10939            #[allow(unused_variables)]
10940            let offset = encoder.out_of_line_offset(bytes_len);
10941            let mut _prev_end_offset: usize = 0;
10942            if 1 > max_ordinal {
10943                return Ok(());
10944            }
10945
10946            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10947            // are envelope_size bytes.
10948            let cur_offset: usize = (1 - 1) * envelope_size;
10949
10950            // Zero reserved fields.
10951            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10952
10953            // Safety:
10954            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10955            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10956            //   envelope_size bytes, there is always sufficient room.
10957            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10958                self.is_covering_range_explicit
10959                    .as_ref()
10960                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10961                encoder,
10962                offset + cur_offset,
10963                depth,
10964            )?;
10965
10966            _prev_end_offset = cur_offset + envelope_size;
10967            if 2 > max_ordinal {
10968                return Ok(());
10969            }
10970
10971            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10972            // are envelope_size bytes.
10973            let cur_offset: usize = (2 - 1) * envelope_size;
10974
10975            // Zero reserved fields.
10976            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10977
10978            // Safety:
10979            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10980            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10981            //   envelope_size bytes, there is always sufficient room.
10982            fidl::encoding::encode_in_envelope_optional::<SecureHeapAndRange, D>(
10983                self.heap_range
10984                    .as_ref()
10985                    .map(<SecureHeapAndRange as fidl::encoding::ValueTypeMarker>::borrow),
10986                encoder,
10987                offset + cur_offset,
10988                depth,
10989            )?;
10990
10991            _prev_end_offset = cur_offset + envelope_size;
10992
10993            Ok(())
10994        }
10995    }
10996
10997    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10998        for SecureMemZeroSubRangeRequest
10999    {
11000        #[inline(always)]
11001        fn new_empty() -> Self {
11002            Self::default()
11003        }
11004
11005        unsafe fn decode(
11006            &mut self,
11007            decoder: &mut fidl::encoding::Decoder<'_, D>,
11008            offset: usize,
11009            mut depth: fidl::encoding::Depth,
11010        ) -> fidl::Result<()> {
11011            decoder.debug_check_bounds::<Self>(offset);
11012            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11013                None => return Err(fidl::Error::NotNullable),
11014                Some(len) => len,
11015            };
11016            // Calling decoder.out_of_line_offset(0) is not allowed.
11017            if len == 0 {
11018                return Ok(());
11019            };
11020            depth.increment()?;
11021            let envelope_size = 8;
11022            let bytes_len = len * envelope_size;
11023            let offset = decoder.out_of_line_offset(bytes_len)?;
11024            // Decode the envelope for each type.
11025            let mut _next_ordinal_to_read = 0;
11026            let mut next_offset = offset;
11027            let end_offset = offset + bytes_len;
11028            _next_ordinal_to_read += 1;
11029            if next_offset >= end_offset {
11030                return Ok(());
11031            }
11032
11033            // Decode unknown envelopes for gaps in ordinals.
11034            while _next_ordinal_to_read < 1 {
11035                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11036                _next_ordinal_to_read += 1;
11037                next_offset += envelope_size;
11038            }
11039
11040            let next_out_of_line = decoder.next_out_of_line();
11041            let handles_before = decoder.remaining_handles();
11042            if let Some((inlined, num_bytes, num_handles)) =
11043                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11044            {
11045                let member_inline_size =
11046                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11047                if inlined != (member_inline_size <= 4) {
11048                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11049                }
11050                let inner_offset;
11051                let mut inner_depth = depth.clone();
11052                if inlined {
11053                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11054                    inner_offset = next_offset;
11055                } else {
11056                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11057                    inner_depth.increment()?;
11058                }
11059                let val_ref = self
11060                    .is_covering_range_explicit
11061                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
11062                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11063                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11064                {
11065                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11066                }
11067                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11068                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11069                }
11070            }
11071
11072            next_offset += envelope_size;
11073            _next_ordinal_to_read += 1;
11074            if next_offset >= end_offset {
11075                return Ok(());
11076            }
11077
11078            // Decode unknown envelopes for gaps in ordinals.
11079            while _next_ordinal_to_read < 2 {
11080                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11081                _next_ordinal_to_read += 1;
11082                next_offset += envelope_size;
11083            }
11084
11085            let next_out_of_line = decoder.next_out_of_line();
11086            let handles_before = decoder.remaining_handles();
11087            if let Some((inlined, num_bytes, num_handles)) =
11088                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11089            {
11090                let member_inline_size =
11091                    <SecureHeapAndRange as fidl::encoding::TypeMarker>::inline_size(
11092                        decoder.context,
11093                    );
11094                if inlined != (member_inline_size <= 4) {
11095                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11096                }
11097                let inner_offset;
11098                let mut inner_depth = depth.clone();
11099                if inlined {
11100                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11101                    inner_offset = next_offset;
11102                } else {
11103                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11104                    inner_depth.increment()?;
11105                }
11106                let val_ref =
11107                    self.heap_range.get_or_insert_with(|| fidl::new_empty!(SecureHeapAndRange, D));
11108                fidl::decode!(SecureHeapAndRange, D, val_ref, decoder, inner_offset, inner_depth)?;
11109                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11110                {
11111                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11112                }
11113                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11114                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11115                }
11116            }
11117
11118            next_offset += envelope_size;
11119
11120            // Decode the remaining unknown envelopes.
11121            while next_offset < end_offset {
11122                _next_ordinal_to_read += 1;
11123                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11124                next_offset += envelope_size;
11125            }
11126
11127            Ok(())
11128        }
11129    }
11130
11131    impl SecureMemGetDynamicSecureHeapsResponse {
11132        #[inline(always)]
11133        fn max_ordinal_present(&self) -> u64 {
11134            if let Some(_) = self.heaps {
11135                return 1;
11136            }
11137            0
11138        }
11139    }
11140
11141    impl fidl::encoding::ValueTypeMarker for SecureMemGetDynamicSecureHeapsResponse {
11142        type Borrowed<'a> = &'a Self;
11143        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11144            value
11145        }
11146    }
11147
11148    unsafe impl fidl::encoding::TypeMarker for SecureMemGetDynamicSecureHeapsResponse {
11149        type Owned = Self;
11150
11151        #[inline(always)]
11152        fn inline_align(_context: fidl::encoding::Context) -> usize {
11153            8
11154        }
11155
11156        #[inline(always)]
11157        fn inline_size(_context: fidl::encoding::Context) -> usize {
11158            16
11159        }
11160    }
11161
11162    unsafe impl<D: fidl::encoding::ResourceDialect>
11163        fidl::encoding::Encode<SecureMemGetDynamicSecureHeapsResponse, D>
11164        for &SecureMemGetDynamicSecureHeapsResponse
11165    {
11166        unsafe fn encode(
11167            self,
11168            encoder: &mut fidl::encoding::Encoder<'_, D>,
11169            offset: usize,
11170            mut depth: fidl::encoding::Depth,
11171        ) -> fidl::Result<()> {
11172            encoder.debug_check_bounds::<SecureMemGetDynamicSecureHeapsResponse>(offset);
11173            // Vector header
11174            let max_ordinal: u64 = self.max_ordinal_present();
11175            encoder.write_num(max_ordinal, offset);
11176            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11177            // Calling encoder.out_of_line_offset(0) is not allowed.
11178            if max_ordinal == 0 {
11179                return Ok(());
11180            }
11181            depth.increment()?;
11182            let envelope_size = 8;
11183            let bytes_len = max_ordinal as usize * envelope_size;
11184            #[allow(unused_variables)]
11185            let offset = encoder.out_of_line_offset(bytes_len);
11186            let mut _prev_end_offset: usize = 0;
11187            if 1 > max_ordinal {
11188                return Ok(());
11189            }
11190
11191            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11192            // are envelope_size bytes.
11193            let cur_offset: usize = (1 - 1) * envelope_size;
11194
11195            // Zero reserved fields.
11196            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11197
11198            // Safety:
11199            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11200            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11201            //   envelope_size bytes, there is always sufficient room.
11202            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<DynamicSecureHeap, 32>, D>(
11203            self.heaps.as_ref().map(<fidl::encoding::Vector<DynamicSecureHeap, 32> as fidl::encoding::ValueTypeMarker>::borrow),
11204            encoder, offset + cur_offset, depth
11205        )?;
11206
11207            _prev_end_offset = cur_offset + envelope_size;
11208
11209            Ok(())
11210        }
11211    }
11212
11213    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11214        for SecureMemGetDynamicSecureHeapsResponse
11215    {
11216        #[inline(always)]
11217        fn new_empty() -> Self {
11218            Self::default()
11219        }
11220
11221        unsafe fn decode(
11222            &mut self,
11223            decoder: &mut fidl::encoding::Decoder<'_, D>,
11224            offset: usize,
11225            mut depth: fidl::encoding::Depth,
11226        ) -> fidl::Result<()> {
11227            decoder.debug_check_bounds::<Self>(offset);
11228            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11229                None => return Err(fidl::Error::NotNullable),
11230                Some(len) => len,
11231            };
11232            // Calling decoder.out_of_line_offset(0) is not allowed.
11233            if len == 0 {
11234                return Ok(());
11235            };
11236            depth.increment()?;
11237            let envelope_size = 8;
11238            let bytes_len = len * envelope_size;
11239            let offset = decoder.out_of_line_offset(bytes_len)?;
11240            // Decode the envelope for each type.
11241            let mut _next_ordinal_to_read = 0;
11242            let mut next_offset = offset;
11243            let end_offset = offset + bytes_len;
11244            _next_ordinal_to_read += 1;
11245            if next_offset >= end_offset {
11246                return Ok(());
11247            }
11248
11249            // Decode unknown envelopes for gaps in ordinals.
11250            while _next_ordinal_to_read < 1 {
11251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11252                _next_ordinal_to_read += 1;
11253                next_offset += envelope_size;
11254            }
11255
11256            let next_out_of_line = decoder.next_out_of_line();
11257            let handles_before = decoder.remaining_handles();
11258            if let Some((inlined, num_bytes, num_handles)) =
11259                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11260            {
11261                let member_inline_size = <fidl::encoding::Vector<DynamicSecureHeap, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11262                if inlined != (member_inline_size <= 4) {
11263                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11264                }
11265                let inner_offset;
11266                let mut inner_depth = depth.clone();
11267                if inlined {
11268                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11269                    inner_offset = next_offset;
11270                } else {
11271                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11272                    inner_depth.increment()?;
11273                }
11274                let val_ref = self.heaps.get_or_insert_with(
11275                    || fidl::new_empty!(fidl::encoding::Vector<DynamicSecureHeap, 32>, D),
11276                );
11277                fidl::decode!(fidl::encoding::Vector<DynamicSecureHeap, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
11278                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11279                {
11280                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11281                }
11282                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11283                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11284                }
11285            }
11286
11287            next_offset += envelope_size;
11288
11289            // Decode the remaining unknown envelopes.
11290            while next_offset < end_offset {
11291                _next_ordinal_to_read += 1;
11292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11293                next_offset += envelope_size;
11294            }
11295
11296            Ok(())
11297        }
11298    }
11299
11300    impl SecureMemGetPhysicalSecureHeapPropertiesResponse {
11301        #[inline(always)]
11302        fn max_ordinal_present(&self) -> u64 {
11303            if let Some(_) = self.properties {
11304                return 1;
11305            }
11306            0
11307        }
11308    }
11309
11310    impl fidl::encoding::ValueTypeMarker for SecureMemGetPhysicalSecureHeapPropertiesResponse {
11311        type Borrowed<'a> = &'a Self;
11312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11313            value
11314        }
11315    }
11316
11317    unsafe impl fidl::encoding::TypeMarker for SecureMemGetPhysicalSecureHeapPropertiesResponse {
11318        type Owned = Self;
11319
11320        #[inline(always)]
11321        fn inline_align(_context: fidl::encoding::Context) -> usize {
11322            8
11323        }
11324
11325        #[inline(always)]
11326        fn inline_size(_context: fidl::encoding::Context) -> usize {
11327            16
11328        }
11329    }
11330
11331    unsafe impl<D: fidl::encoding::ResourceDialect>
11332        fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapPropertiesResponse, D>
11333        for &SecureMemGetPhysicalSecureHeapPropertiesResponse
11334    {
11335        unsafe fn encode(
11336            self,
11337            encoder: &mut fidl::encoding::Encoder<'_, D>,
11338            offset: usize,
11339            mut depth: fidl::encoding::Depth,
11340        ) -> fidl::Result<()> {
11341            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapPropertiesResponse>(offset);
11342            // Vector header
11343            let max_ordinal: u64 = self.max_ordinal_present();
11344            encoder.write_num(max_ordinal, offset);
11345            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11346            // Calling encoder.out_of_line_offset(0) is not allowed.
11347            if max_ordinal == 0 {
11348                return Ok(());
11349            }
11350            depth.increment()?;
11351            let envelope_size = 8;
11352            let bytes_len = max_ordinal as usize * envelope_size;
11353            #[allow(unused_variables)]
11354            let offset = encoder.out_of_line_offset(bytes_len);
11355            let mut _prev_end_offset: usize = 0;
11356            if 1 > max_ordinal {
11357                return Ok(());
11358            }
11359
11360            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11361            // are envelope_size bytes.
11362            let cur_offset: usize = (1 - 1) * envelope_size;
11363
11364            // Zero reserved fields.
11365            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11366
11367            // Safety:
11368            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11369            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11370            //   envelope_size bytes, there is always sufficient room.
11371            fidl::encoding::encode_in_envelope_optional::<SecureHeapProperties, D>(
11372                self.properties
11373                    .as_ref()
11374                    .map(<SecureHeapProperties as fidl::encoding::ValueTypeMarker>::borrow),
11375                encoder,
11376                offset + cur_offset,
11377                depth,
11378            )?;
11379
11380            _prev_end_offset = cur_offset + envelope_size;
11381
11382            Ok(())
11383        }
11384    }
11385
11386    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11387        for SecureMemGetPhysicalSecureHeapPropertiesResponse
11388    {
11389        #[inline(always)]
11390        fn new_empty() -> Self {
11391            Self::default()
11392        }
11393
11394        unsafe fn decode(
11395            &mut self,
11396            decoder: &mut fidl::encoding::Decoder<'_, D>,
11397            offset: usize,
11398            mut depth: fidl::encoding::Depth,
11399        ) -> fidl::Result<()> {
11400            decoder.debug_check_bounds::<Self>(offset);
11401            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11402                None => return Err(fidl::Error::NotNullable),
11403                Some(len) => len,
11404            };
11405            // Calling decoder.out_of_line_offset(0) is not allowed.
11406            if len == 0 {
11407                return Ok(());
11408            };
11409            depth.increment()?;
11410            let envelope_size = 8;
11411            let bytes_len = len * envelope_size;
11412            let offset = decoder.out_of_line_offset(bytes_len)?;
11413            // Decode the envelope for each type.
11414            let mut _next_ordinal_to_read = 0;
11415            let mut next_offset = offset;
11416            let end_offset = offset + bytes_len;
11417            _next_ordinal_to_read += 1;
11418            if next_offset >= end_offset {
11419                return Ok(());
11420            }
11421
11422            // Decode unknown envelopes for gaps in ordinals.
11423            while _next_ordinal_to_read < 1 {
11424                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11425                _next_ordinal_to_read += 1;
11426                next_offset += envelope_size;
11427            }
11428
11429            let next_out_of_line = decoder.next_out_of_line();
11430            let handles_before = decoder.remaining_handles();
11431            if let Some((inlined, num_bytes, num_handles)) =
11432                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11433            {
11434                let member_inline_size =
11435                    <SecureHeapProperties as fidl::encoding::TypeMarker>::inline_size(
11436                        decoder.context,
11437                    );
11438                if inlined != (member_inline_size <= 4) {
11439                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11440                }
11441                let inner_offset;
11442                let mut inner_depth = depth.clone();
11443                if inlined {
11444                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11445                    inner_offset = next_offset;
11446                } else {
11447                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11448                    inner_depth.increment()?;
11449                }
11450                let val_ref = self
11451                    .properties
11452                    .get_or_insert_with(|| fidl::new_empty!(SecureHeapProperties, D));
11453                fidl::decode!(
11454                    SecureHeapProperties,
11455                    D,
11456                    val_ref,
11457                    decoder,
11458                    inner_offset,
11459                    inner_depth
11460                )?;
11461                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11462                {
11463                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11464                }
11465                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11466                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11467                }
11468            }
11469
11470            next_offset += envelope_size;
11471
11472            // Decode the remaining unknown envelopes.
11473            while next_offset < end_offset {
11474                _next_ordinal_to_read += 1;
11475                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11476                next_offset += envelope_size;
11477            }
11478
11479            Ok(())
11480        }
11481    }
11482
11483    impl SecureMemGetPhysicalSecureHeapsResponse {
11484        #[inline(always)]
11485        fn max_ordinal_present(&self) -> u64 {
11486            if let Some(_) = self.heaps {
11487                return 1;
11488            }
11489            0
11490        }
11491    }
11492
11493    impl fidl::encoding::ValueTypeMarker for SecureMemGetPhysicalSecureHeapsResponse {
11494        type Borrowed<'a> = &'a Self;
11495        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11496            value
11497        }
11498    }
11499
11500    unsafe impl fidl::encoding::TypeMarker for SecureMemGetPhysicalSecureHeapsResponse {
11501        type Owned = Self;
11502
11503        #[inline(always)]
11504        fn inline_align(_context: fidl::encoding::Context) -> usize {
11505            8
11506        }
11507
11508        #[inline(always)]
11509        fn inline_size(_context: fidl::encoding::Context) -> usize {
11510            16
11511        }
11512    }
11513
11514    unsafe impl<D: fidl::encoding::ResourceDialect>
11515        fidl::encoding::Encode<SecureMemGetPhysicalSecureHeapsResponse, D>
11516        for &SecureMemGetPhysicalSecureHeapsResponse
11517    {
11518        unsafe fn encode(
11519            self,
11520            encoder: &mut fidl::encoding::Encoder<'_, D>,
11521            offset: usize,
11522            mut depth: fidl::encoding::Depth,
11523        ) -> fidl::Result<()> {
11524            encoder.debug_check_bounds::<SecureMemGetPhysicalSecureHeapsResponse>(offset);
11525            // Vector header
11526            let max_ordinal: u64 = self.max_ordinal_present();
11527            encoder.write_num(max_ordinal, offset);
11528            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11529            // Calling encoder.out_of_line_offset(0) is not allowed.
11530            if max_ordinal == 0 {
11531                return Ok(());
11532            }
11533            depth.increment()?;
11534            let envelope_size = 8;
11535            let bytes_len = max_ordinal as usize * envelope_size;
11536            #[allow(unused_variables)]
11537            let offset = encoder.out_of_line_offset(bytes_len);
11538            let mut _prev_end_offset: usize = 0;
11539            if 1 > max_ordinal {
11540                return Ok(());
11541            }
11542
11543            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11544            // are envelope_size bytes.
11545            let cur_offset: usize = (1 - 1) * envelope_size;
11546
11547            // Zero reserved fields.
11548            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11549
11550            // Safety:
11551            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11552            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11553            //   envelope_size bytes, there is always sufficient room.
11554            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SecureHeapAndRanges, 32>, D>(
11555            self.heaps.as_ref().map(<fidl::encoding::Vector<SecureHeapAndRanges, 32> as fidl::encoding::ValueTypeMarker>::borrow),
11556            encoder, offset + cur_offset, depth
11557        )?;
11558
11559            _prev_end_offset = cur_offset + envelope_size;
11560
11561            Ok(())
11562        }
11563    }
11564
11565    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11566        for SecureMemGetPhysicalSecureHeapsResponse
11567    {
11568        #[inline(always)]
11569        fn new_empty() -> Self {
11570            Self::default()
11571        }
11572
11573        unsafe fn decode(
11574            &mut self,
11575            decoder: &mut fidl::encoding::Decoder<'_, D>,
11576            offset: usize,
11577            mut depth: fidl::encoding::Depth,
11578        ) -> fidl::Result<()> {
11579            decoder.debug_check_bounds::<Self>(offset);
11580            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11581                None => return Err(fidl::Error::NotNullable),
11582                Some(len) => len,
11583            };
11584            // Calling decoder.out_of_line_offset(0) is not allowed.
11585            if len == 0 {
11586                return Ok(());
11587            };
11588            depth.increment()?;
11589            let envelope_size = 8;
11590            let bytes_len = len * envelope_size;
11591            let offset = decoder.out_of_line_offset(bytes_len)?;
11592            // Decode the envelope for each type.
11593            let mut _next_ordinal_to_read = 0;
11594            let mut next_offset = offset;
11595            let end_offset = offset + bytes_len;
11596            _next_ordinal_to_read += 1;
11597            if next_offset >= end_offset {
11598                return Ok(());
11599            }
11600
11601            // Decode unknown envelopes for gaps in ordinals.
11602            while _next_ordinal_to_read < 1 {
11603                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11604                _next_ordinal_to_read += 1;
11605                next_offset += envelope_size;
11606            }
11607
11608            let next_out_of_line = decoder.next_out_of_line();
11609            let handles_before = decoder.remaining_handles();
11610            if let Some((inlined, num_bytes, num_handles)) =
11611                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11612            {
11613                let member_inline_size = <fidl::encoding::Vector<SecureHeapAndRanges, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11614                if inlined != (member_inline_size <= 4) {
11615                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11616                }
11617                let inner_offset;
11618                let mut inner_depth = depth.clone();
11619                if inlined {
11620                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11621                    inner_offset = next_offset;
11622                } else {
11623                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11624                    inner_depth.increment()?;
11625                }
11626                let val_ref = self.heaps.get_or_insert_with(
11627                    || fidl::new_empty!(fidl::encoding::Vector<SecureHeapAndRanges, 32>, D),
11628                );
11629                fidl::decode!(fidl::encoding::Vector<SecureHeapAndRanges, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
11630                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11631                {
11632                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11633                }
11634                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11635                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11636                }
11637            }
11638
11639            next_offset += envelope_size;
11640
11641            // Decode the remaining unknown envelopes.
11642            while next_offset < end_offset {
11643                _next_ordinal_to_read += 1;
11644                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11645                next_offset += envelope_size;
11646            }
11647
11648            Ok(())
11649        }
11650    }
11651
11652    impl SingleBufferSettings {
11653        #[inline(always)]
11654        fn max_ordinal_present(&self) -> u64 {
11655            if let Some(_) = self.image_format_constraints {
11656                return 2;
11657            }
11658            if let Some(_) = self.buffer_settings {
11659                return 1;
11660            }
11661            0
11662        }
11663    }
11664
11665    impl fidl::encoding::ValueTypeMarker for SingleBufferSettings {
11666        type Borrowed<'a> = &'a Self;
11667        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11668            value
11669        }
11670    }
11671
11672    unsafe impl fidl::encoding::TypeMarker for SingleBufferSettings {
11673        type Owned = Self;
11674
11675        #[inline(always)]
11676        fn inline_align(_context: fidl::encoding::Context) -> usize {
11677            8
11678        }
11679
11680        #[inline(always)]
11681        fn inline_size(_context: fidl::encoding::Context) -> usize {
11682            16
11683        }
11684    }
11685
11686    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SingleBufferSettings, D>
11687        for &SingleBufferSettings
11688    {
11689        unsafe fn encode(
11690            self,
11691            encoder: &mut fidl::encoding::Encoder<'_, D>,
11692            offset: usize,
11693            mut depth: fidl::encoding::Depth,
11694        ) -> fidl::Result<()> {
11695            encoder.debug_check_bounds::<SingleBufferSettings>(offset);
11696            // Vector header
11697            let max_ordinal: u64 = self.max_ordinal_present();
11698            encoder.write_num(max_ordinal, offset);
11699            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11700            // Calling encoder.out_of_line_offset(0) is not allowed.
11701            if max_ordinal == 0 {
11702                return Ok(());
11703            }
11704            depth.increment()?;
11705            let envelope_size = 8;
11706            let bytes_len = max_ordinal as usize * envelope_size;
11707            #[allow(unused_variables)]
11708            let offset = encoder.out_of_line_offset(bytes_len);
11709            let mut _prev_end_offset: usize = 0;
11710            if 1 > max_ordinal {
11711                return Ok(());
11712            }
11713
11714            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11715            // are envelope_size bytes.
11716            let cur_offset: usize = (1 - 1) * envelope_size;
11717
11718            // Zero reserved fields.
11719            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11720
11721            // Safety:
11722            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11723            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11724            //   envelope_size bytes, there is always sufficient room.
11725            fidl::encoding::encode_in_envelope_optional::<BufferMemorySettings, D>(
11726                self.buffer_settings
11727                    .as_ref()
11728                    .map(<BufferMemorySettings as fidl::encoding::ValueTypeMarker>::borrow),
11729                encoder,
11730                offset + cur_offset,
11731                depth,
11732            )?;
11733
11734            _prev_end_offset = cur_offset + envelope_size;
11735            if 2 > max_ordinal {
11736                return Ok(());
11737            }
11738
11739            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11740            // are envelope_size bytes.
11741            let cur_offset: usize = (2 - 1) * envelope_size;
11742
11743            // Zero reserved fields.
11744            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11745
11746            // Safety:
11747            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11748            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11749            //   envelope_size bytes, there is always sufficient room.
11750            fidl::encoding::encode_in_envelope_optional::<ImageFormatConstraints, D>(
11751                self.image_format_constraints
11752                    .as_ref()
11753                    .map(<ImageFormatConstraints as fidl::encoding::ValueTypeMarker>::borrow),
11754                encoder,
11755                offset + cur_offset,
11756                depth,
11757            )?;
11758
11759            _prev_end_offset = cur_offset + envelope_size;
11760
11761            Ok(())
11762        }
11763    }
11764
11765    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SingleBufferSettings {
11766        #[inline(always)]
11767        fn new_empty() -> Self {
11768            Self::default()
11769        }
11770
11771        unsafe fn decode(
11772            &mut self,
11773            decoder: &mut fidl::encoding::Decoder<'_, D>,
11774            offset: usize,
11775            mut depth: fidl::encoding::Depth,
11776        ) -> fidl::Result<()> {
11777            decoder.debug_check_bounds::<Self>(offset);
11778            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11779                None => return Err(fidl::Error::NotNullable),
11780                Some(len) => len,
11781            };
11782            // Calling decoder.out_of_line_offset(0) is not allowed.
11783            if len == 0 {
11784                return Ok(());
11785            };
11786            depth.increment()?;
11787            let envelope_size = 8;
11788            let bytes_len = len * envelope_size;
11789            let offset = decoder.out_of_line_offset(bytes_len)?;
11790            // Decode the envelope for each type.
11791            let mut _next_ordinal_to_read = 0;
11792            let mut next_offset = offset;
11793            let end_offset = offset + bytes_len;
11794            _next_ordinal_to_read += 1;
11795            if next_offset >= end_offset {
11796                return Ok(());
11797            }
11798
11799            // Decode unknown envelopes for gaps in ordinals.
11800            while _next_ordinal_to_read < 1 {
11801                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11802                _next_ordinal_to_read += 1;
11803                next_offset += envelope_size;
11804            }
11805
11806            let next_out_of_line = decoder.next_out_of_line();
11807            let handles_before = decoder.remaining_handles();
11808            if let Some((inlined, num_bytes, num_handles)) =
11809                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11810            {
11811                let member_inline_size =
11812                    <BufferMemorySettings as fidl::encoding::TypeMarker>::inline_size(
11813                        decoder.context,
11814                    );
11815                if inlined != (member_inline_size <= 4) {
11816                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11817                }
11818                let inner_offset;
11819                let mut inner_depth = depth.clone();
11820                if inlined {
11821                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11822                    inner_offset = next_offset;
11823                } else {
11824                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11825                    inner_depth.increment()?;
11826                }
11827                let val_ref = self
11828                    .buffer_settings
11829                    .get_or_insert_with(|| fidl::new_empty!(BufferMemorySettings, D));
11830                fidl::decode!(
11831                    BufferMemorySettings,
11832                    D,
11833                    val_ref,
11834                    decoder,
11835                    inner_offset,
11836                    inner_depth
11837                )?;
11838                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11839                {
11840                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11841                }
11842                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11843                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11844                }
11845            }
11846
11847            next_offset += envelope_size;
11848            _next_ordinal_to_read += 1;
11849            if next_offset >= end_offset {
11850                return Ok(());
11851            }
11852
11853            // Decode unknown envelopes for gaps in ordinals.
11854            while _next_ordinal_to_read < 2 {
11855                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11856                _next_ordinal_to_read += 1;
11857                next_offset += envelope_size;
11858            }
11859
11860            let next_out_of_line = decoder.next_out_of_line();
11861            let handles_before = decoder.remaining_handles();
11862            if let Some((inlined, num_bytes, num_handles)) =
11863                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11864            {
11865                let member_inline_size =
11866                    <ImageFormatConstraints as fidl::encoding::TypeMarker>::inline_size(
11867                        decoder.context,
11868                    );
11869                if inlined != (member_inline_size <= 4) {
11870                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11871                }
11872                let inner_offset;
11873                let mut inner_depth = depth.clone();
11874                if inlined {
11875                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11876                    inner_offset = next_offset;
11877                } else {
11878                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11879                    inner_depth.increment()?;
11880                }
11881                let val_ref = self
11882                    .image_format_constraints
11883                    .get_or_insert_with(|| fidl::new_empty!(ImageFormatConstraints, D));
11884                fidl::decode!(
11885                    ImageFormatConstraints,
11886                    D,
11887                    val_ref,
11888                    decoder,
11889                    inner_offset,
11890                    inner_depth
11891                )?;
11892                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11893                {
11894                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11895                }
11896                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11897                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11898                }
11899            }
11900
11901            next_offset += envelope_size;
11902
11903            // Decode the remaining unknown envelopes.
11904            while next_offset < end_offset {
11905                _next_ordinal_to_read += 1;
11906                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11907                next_offset += envelope_size;
11908            }
11909
11910            Ok(())
11911        }
11912    }
11913}