fidl_fuchsia_gpu_magma_common/
fidl_fuchsia_gpu_magma_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 type ContextId = u32;
12
13pub type ObjectId = u64;
14
15/// Performance counter pools contain byte ranges of buffers. Whenever a performance counter dump is
16/// triggered, the driver removes a range from the pool, writes the performance counter values from
17/// the hardware into it, then signals the client using OnPerformanceCounterReadCompleted. Pool IDs
18/// are arbitrary uint64 values that are allocated by the client.
19pub type PerformanceCounterPoolId = u64;
20
21/// Describes a set of performance counters. The exact meaning depends on the specific driver, but
22/// often is a bitvector representing whether each performance counter is enabled or disabled.
23pub type PerformanceCounterSet = Vec<u64>;
24
25pub type PerformanceCounterTriggerId = u32;
26
27/// The maximum number of ICDs supported by a Magma system driver.
28pub const MAX_ICD_COUNT: u64 = 8;
29
30/// The batch size used to send multiple immediate commands in a single message.
31pub const MAX_IMMEDIATE_COMMANDS_DATA_SIZE: u32 = 2048;
32
33/// The batch size used to send multiple inline commands in a single message.
34pub const MAX_INLINE_COMMANDS_DATA_SIZE: u32 = 2048;
35
36bitflags! {
37    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
38    pub struct CommandBufferFlags: u64 {
39        /// Vendor specific definitions start here
40        const VENDOR_FLAG_0 = 65536;
41    }
42}
43
44impl CommandBufferFlags {
45    #[inline(always)]
46    pub fn from_bits_allow_unknown(bits: u64) -> Self {
47        Self::from_bits_retain(bits)
48    }
49
50    #[inline(always)]
51    pub fn has_unknown_bits(&self) -> bool {
52        self.get_unknown_bits() != 0
53    }
54
55    #[inline(always)]
56    pub fn get_unknown_bits(&self) -> u64 {
57        self.bits() & !Self::all().bits()
58    }
59}
60
61bitflags! {
62    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
63    pub struct IcdFlags: u32 {
64        const SUPPORTS_VULKAN = 1;
65        const SUPPORTS_OPENCL = 2;
66        const SUPPORTS_MEDIA_CODEC_FACTORY = 4;
67    }
68}
69
70impl IcdFlags {
71    #[inline(always)]
72    pub fn from_bits_allow_unknown(bits: u32) -> Self {
73        Self::from_bits_retain(bits)
74    }
75
76    #[inline(always)]
77    pub fn has_unknown_bits(&self) -> bool {
78        self.get_unknown_bits() != 0
79    }
80
81    #[inline(always)]
82    pub fn get_unknown_bits(&self) -> u32 {
83        self.bits() & !Self::all().bits()
84    }
85}
86
87bitflags! {
88    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
89    pub struct ImportFlags: u64 {
90        const SEMAPHORE_ONE_SHOT = 1;
91    }
92}
93
94impl ImportFlags {
95    #[inline(always)]
96    pub fn from_bits_allow_unknown(bits: u64) -> Self {
97        Self::from_bits_retain(bits)
98    }
99
100    #[inline(always)]
101    pub fn has_unknown_bits(&self) -> bool {
102        self.get_unknown_bits() != 0
103    }
104
105    #[inline(always)]
106    pub fn get_unknown_bits(&self) -> u64 {
107        self.bits() & !Self::all().bits()
108    }
109}
110
111bitflags! {
112    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
113    pub struct MapFlags: u64 {
114        const READ = 1;
115        const WRITE = 2;
116        const EXECUTE = 4;
117        /// Uncommitted pages may be comitted on a hardware fault. If this flag is not set, access
118        /// faults should cause an error.
119        const GROWABLE = 8;
120        /// Vendor specific definitions start here
121        const VENDOR_FLAG_0 = 65536;
122    }
123}
124
125impl MapFlags {
126    #[inline(always)]
127    pub fn from_bits_allow_unknown(bits: u64) -> Self {
128        Self::from_bits_retain(bits)
129    }
130
131    #[inline(always)]
132    pub fn has_unknown_bits(&self) -> bool {
133        self.get_unknown_bits() != 0
134    }
135
136    #[inline(always)]
137    pub fn get_unknown_bits(&self) -> u64 {
138        self.bits() & !Self::all().bits()
139    }
140}
141
142bitflags! {
143    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
144    pub struct ResultFlags: u32 {
145        /// This bit is set in result_flags if the performance counters missed some samples, e.g. due to
146        /// the hardware being in protected mode for part of the time.
147        const DISCONTINUITY = 1;
148    }
149}
150
151impl ResultFlags {
152    #[inline(always)]
153    pub fn from_bits_allow_unknown(bits: u32) -> Self {
154        Self::from_bits_retain(bits)
155    }
156
157    #[inline(always)]
158    pub fn has_unknown_bits(&self) -> bool {
159        self.get_unknown_bits() != 0
160    }
161
162    #[inline(always)]
163    pub fn get_unknown_bits(&self) -> u32 {
164        self.bits() & !Self::all().bits()
165    }
166}
167
168#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
169pub enum BufferOp {
170    /// Populate the hardware page tables with the pages mapped in this range, committing pages
171    /// as needed. This is not needed for allocations mapped GROWABLE, since the page tables will
172    /// be populated on demand.
173    PopulateTables,
174    /// Depopulate page table mappings for this range. This prevents the hardware from accessing
175    /// pages in that range, but the pages retain their contents.
176    DepopulateTables,
177    #[doc(hidden)]
178    __SourceBreaking { unknown_ordinal: u32 },
179}
180
181/// Pattern that matches an unknown `BufferOp` member.
182#[macro_export]
183macro_rules! BufferOpUnknown {
184    () => {
185        _
186    };
187}
188
189impl BufferOp {
190    #[inline]
191    pub fn from_primitive(prim: u32) -> Option<Self> {
192        match prim {
193            1 => Some(Self::PopulateTables),
194            2 => Some(Self::DepopulateTables),
195            _ => None,
196        }
197    }
198
199    #[inline]
200    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
201        match prim {
202            1 => Self::PopulateTables,
203            2 => Self::DepopulateTables,
204            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
205        }
206    }
207
208    #[inline]
209    pub fn unknown() -> Self {
210        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
211    }
212
213    #[inline]
214    pub const fn into_primitive(self) -> u32 {
215        match self {
216            Self::PopulateTables => 1,
217            Self::DepopulateTables => 2,
218            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
219        }
220    }
221
222    #[inline]
223    pub fn is_unknown(&self) -> bool {
224        match self {
225            Self::__SourceBreaking { unknown_ordinal: _ } => true,
226            _ => false,
227        }
228    }
229}
230
231#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
232pub enum ObjectType {
233    Event,
234    /// A memory object backeed by a Zircon VMO.
235    Buffer,
236    /// A sync object backed by a Zircon event or VMO.
237    Semaphore,
238    #[doc(hidden)]
239    __SourceBreaking {
240        unknown_ordinal: u32,
241    },
242}
243
244/// Pattern that matches an unknown `ObjectType` member.
245#[macro_export]
246macro_rules! ObjectTypeUnknown {
247    () => {
248        _
249    };
250}
251
252impl ObjectType {
253    #[inline]
254    pub fn from_primitive(prim: u32) -> Option<Self> {
255        match prim {
256            10 => Some(Self::Event),
257            11 => Some(Self::Buffer),
258            12 => Some(Self::Semaphore),
259            _ => None,
260        }
261    }
262
263    #[inline]
264    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
265        match prim {
266            10 => Self::Event,
267            11 => Self::Buffer,
268            12 => Self::Semaphore,
269            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
270        }
271    }
272
273    #[inline]
274    pub fn unknown() -> Self {
275        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
276    }
277
278    #[inline]
279    pub const fn into_primitive(self) -> u32 {
280        match self {
281            Self::Event => 10,
282            Self::Buffer => 11,
283            Self::Semaphore => 12,
284            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
285        }
286    }
287
288    #[inline]
289    pub fn is_unknown(&self) -> bool {
290        match self {
291            Self::__SourceBreaking { unknown_ordinal: _ } => true,
292            _ => false,
293        }
294    }
295}
296
297/// Each element of this enum represents a high-level goal of a specific power state.
298#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
299pub enum PowerGoalType {
300    /// The hardware is powered on, but idle and ready to immediately process work.
301    OnReadyForWork,
302    /// The hardware is in a high-performance state for gaming or other intensive activities.
303    HighPerformance,
304    /// The hardware is in a mode that provides a consistent level of performance for a long period
305    /// of time.
306    SustainedPerformance,
307    #[doc(hidden)]
308    __SourceBreaking { unknown_ordinal: u64 },
309}
310
311/// Pattern that matches an unknown `PowerGoalType` member.
312#[macro_export]
313macro_rules! PowerGoalTypeUnknown {
314    () => {
315        _
316    };
317}
318
319impl PowerGoalType {
320    #[inline]
321    pub fn from_primitive(prim: u64) -> Option<Self> {
322        match prim {
323            1 => Some(Self::OnReadyForWork),
324            2 => Some(Self::HighPerformance),
325            3 => Some(Self::SustainedPerformance),
326            _ => None,
327        }
328    }
329
330    #[inline]
331    pub fn from_primitive_allow_unknown(prim: u64) -> Self {
332        match prim {
333            1 => Self::OnReadyForWork,
334            2 => Self::HighPerformance,
335            3 => Self::SustainedPerformance,
336            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
337        }
338    }
339
340    #[inline]
341    pub fn unknown() -> Self {
342        Self::__SourceBreaking { unknown_ordinal: 0xffffffffffffffff }
343    }
344
345    #[inline]
346    pub const fn into_primitive(self) -> u64 {
347        match self {
348            Self::OnReadyForWork => 1,
349            Self::HighPerformance => 2,
350            Self::SustainedPerformance => 3,
351            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
352        }
353    }
354
355    #[inline]
356    pub fn is_unknown(&self) -> bool {
357        match self {
358            Self::__SourceBreaking { unknown_ordinal: _ } => true,
359            _ => false,
360        }
361    }
362}
363
364/// Types of information about the hardware and driver that can be queried from the Magma system
365/// driver. Vendor-specific ID numbers may be used, but those IDs will be listed elsewhere.
366#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
367pub enum QueryId {
368    /// Returns the hardware vendor ID (simple result) - should be the PCI ID of the hardware
369    /// vendor if possible, or the Khronos vendor ID otherwise.
370    VendorId,
371    /// Returns the hardware device ID (simple result)
372    DeviceId,
373    /// Returns the version of the vendor interfaces supported by the system driver.
374    VendorVersion,
375    /// Returns true if MAGMA_QUERY_TOTAL_TIME is supported (simple result)
376    IsTotalTimeSupported,
377    /// Upper 32bits: max inflight messages, lower 32bits: max inflight memory (MB) (simple result)
378    MaximumInflightParams,
379    /// Returns a struct magma_total_time_query_result (buffer result); see:
380    /// src/graphics/lib/magma/include/magma/magma_common_defs.h
381    MagmaQueryTotalTime,
382    /// Vendor specific query IDs start here
383    VendorQuery0,
384    #[doc(hidden)]
385    __SourceBreaking { unknown_ordinal: u64 },
386}
387
388/// Pattern that matches an unknown `QueryId` member.
389#[macro_export]
390macro_rules! QueryIdUnknown {
391    () => {
392        _
393    };
394}
395
396impl QueryId {
397    #[inline]
398    pub fn from_primitive(prim: u64) -> Option<Self> {
399        match prim {
400            0 => Some(Self::VendorId),
401            1 => Some(Self::DeviceId),
402            2 => Some(Self::VendorVersion),
403            3 => Some(Self::IsTotalTimeSupported),
404            5 => Some(Self::MaximumInflightParams),
405            500 => Some(Self::MagmaQueryTotalTime),
406            10000 => Some(Self::VendorQuery0),
407            _ => None,
408        }
409    }
410
411    #[inline]
412    pub fn from_primitive_allow_unknown(prim: u64) -> Self {
413        match prim {
414            0 => Self::VendorId,
415            1 => Self::DeviceId,
416            2 => Self::VendorVersion,
417            3 => Self::IsTotalTimeSupported,
418            5 => Self::MaximumInflightParams,
419            500 => Self::MagmaQueryTotalTime,
420            10000 => Self::VendorQuery0,
421            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
422        }
423    }
424
425    #[inline]
426    pub fn unknown() -> Self {
427        Self::__SourceBreaking { unknown_ordinal: 0xffffffffffffffff }
428    }
429
430    #[inline]
431    pub const fn into_primitive(self) -> u64 {
432        match self {
433            Self::VendorId => 0,
434            Self::DeviceId => 1,
435            Self::VendorVersion => 2,
436            Self::IsTotalTimeSupported => 3,
437            Self::MaximumInflightParams => 5,
438            Self::MagmaQueryTotalTime => 500,
439            Self::VendorQuery0 => 10000,
440            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
441        }
442    }
443
444    #[inline]
445    pub fn is_unknown(&self) -> bool {
446        match self {
447            Self::__SourceBreaking { unknown_ordinal: _ } => true,
448            _ => false,
449        }
450    }
451}
452
453#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
454#[repr(C)]
455pub struct BufferRange {
456    pub buffer_id: u64,
457    pub offset: u64,
458    pub size: u64,
459}
460
461impl fidl::Persistable for BufferRange {}
462
463/// A command buffer may be used to pass hardware instructions in a shared buffer (VMO).
464#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
465#[repr(C)]
466pub struct CommandBuffer {
467    /// Index of the resource containing instructions to start the command buffer.
468    pub resource_index: u32,
469    /// Starting offset within the resource.
470    pub start_offset: u64,
471}
472
473impl fidl::Persistable for CommandBuffer {}
474
475#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
476pub struct DeviceQueryRequest {
477    pub query_id: QueryId,
478}
479
480impl fidl::Persistable for DeviceQueryRequest {}
481
482#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
483#[repr(C)]
484pub struct DiagnosticDeviceDumpStateRequest {
485    pub dump_type: u32,
486}
487
488impl fidl::Persistable for DiagnosticDeviceDumpStateRequest {}
489
490#[derive(Clone, Debug, PartialEq)]
491pub struct IcdLoaderDeviceGetIcdListResponse {
492    pub icd_list: Vec<IcdInfo>,
493}
494
495impl fidl::Persistable for IcdLoaderDeviceGetIcdListResponse {}
496
497#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
498pub struct PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
499    pub pool_id: u64,
500    pub offsets: Vec<BufferRange>,
501}
502
503impl fidl::Persistable for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {}
504
505#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
506pub struct PrimaryBufferRangeOp2Request {
507    pub op: BufferOp,
508    pub range: BufferRange,
509}
510
511impl fidl::Persistable for PrimaryBufferRangeOp2Request {}
512
513#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
514pub struct PrimaryClearPerformanceCountersRequest {
515    pub counters: Vec<u64>,
516}
517
518impl fidl::Persistable for PrimaryClearPerformanceCountersRequest {}
519
520#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
521#[repr(C)]
522pub struct PrimaryCreateContextRequest {
523    pub context_id: u32,
524}
525
526impl fidl::Persistable for PrimaryCreateContextRequest {}
527
528#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
529#[repr(C)]
530pub struct PrimaryDestroyContextRequest {
531    pub context_id: u32,
532}
533
534impl fidl::Persistable for PrimaryDestroyContextRequest {}
535
536#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
537#[repr(C)]
538pub struct PrimaryDumpPerformanceCountersRequest {
539    pub pool_id: u64,
540    pub trigger_id: u32,
541}
542
543impl fidl::Persistable for PrimaryDumpPerformanceCountersRequest {}
544
545#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
546pub struct PrimaryEnablePerformanceCountersRequest {
547    pub counters: Vec<u64>,
548}
549
550impl fidl::Persistable for PrimaryEnablePerformanceCountersRequest {}
551
552#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
553pub struct PrimaryExecuteCommandRequest {
554    pub context_id: u32,
555    pub resources: Vec<BufferRange>,
556    pub command_buffers: Vec<CommandBuffer>,
557    pub wait_semaphores: Vec<u64>,
558    pub signal_semaphores: Vec<u64>,
559    pub flags: CommandBufferFlags,
560}
561
562impl fidl::Persistable for PrimaryExecuteCommandRequest {}
563
564#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
565pub struct PrimaryExecuteImmediateCommandsRequest {
566    pub context_id: u32,
567    pub command_data: Vec<u8>,
568    pub semaphores: Vec<u64>,
569}
570
571impl fidl::Persistable for PrimaryExecuteImmediateCommandsRequest {}
572
573#[derive(Clone, Debug, PartialEq)]
574pub struct PrimaryExecuteInlineCommandsRequest {
575    pub context_id: u32,
576    pub commands: Vec<InlineCommand>,
577}
578
579impl fidl::Persistable for PrimaryExecuteInlineCommandsRequest {}
580
581#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
582pub struct PrimaryIsPerformanceCounterAccessAllowedResponse {
583    pub enabled: bool,
584}
585
586impl fidl::Persistable for PrimaryIsPerformanceCounterAccessAllowedResponse {}
587
588#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
589#[repr(C)]
590pub struct PrimaryOnNotifyMemoryImportedRequest {
591    pub bytes: u64,
592}
593
594impl fidl::Persistable for PrimaryOnNotifyMemoryImportedRequest {}
595
596#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
597#[repr(C)]
598pub struct PrimaryOnNotifyMessagesConsumedRequest {
599    pub count: u64,
600}
601
602impl fidl::Persistable for PrimaryOnNotifyMessagesConsumedRequest {}
603
604#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
605pub struct PrimaryReleaseObjectRequest {
606    pub object_id: u64,
607    pub object_type: ObjectType,
608}
609
610impl fidl::Persistable for PrimaryReleaseObjectRequest {}
611
612#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
613#[repr(C)]
614pub struct PrimaryReleasePerformanceCounterBufferPoolRequest {
615    pub pool_id: u64,
616}
617
618impl fidl::Persistable for PrimaryReleasePerformanceCounterBufferPoolRequest {}
619
620#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
621#[repr(C)]
622pub struct PrimaryRemovePerformanceCounterBufferFromPoolRequest {
623    pub pool_id: u64,
624    pub buffer_id: u64,
625}
626
627impl fidl::Persistable for PrimaryRemovePerformanceCounterBufferFromPoolRequest {}
628
629#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
630#[repr(C)]
631pub struct TestDeviceGetUnitTestStatusResponse {
632    pub status: i32,
633}
634
635impl fidl::Persistable for TestDeviceGetUnitTestStatusResponse {}
636
637/// Information about an ICD implementation that can be used with a Magma device.
638#[derive(Clone, Debug, Default, PartialEq)]
639pub struct IcdInfo {
640    /// URL of the component implementation that provides the ICD.
641    pub component_url: Option<String>,
642    /// Flags describing the basic capabilities of the ICD, including what APIs it supports.
643    pub flags: Option<IcdFlags>,
644    #[doc(hidden)]
645    pub __source_breaking: fidl::marker::SourceBreaking,
646}
647
648impl fidl::Persistable for IcdInfo {}
649
650#[derive(Clone, Debug, Default, PartialEq)]
651pub struct InlineCommand {
652    pub data: Option<Vec<u8>>,
653    pub semaphores: Option<Vec<u64>>,
654    #[doc(hidden)]
655    pub __source_breaking: fidl::marker::SourceBreaking,
656}
657
658impl fidl::Persistable for InlineCommand {}
659
660#[derive(Clone, Debug, Default, PartialEq)]
661pub struct PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest {
662    /// Required.
663    pub trigger_id: Option<u32>,
664    /// Required.
665    pub buffer_id: Option<u64>,
666    /// Required.
667    pub buffer_offset: Option<u32>,
668    /// Required.
669    pub timestamp: Option<i64>,
670    /// Required.
671    pub flags: Option<ResultFlags>,
672    #[doc(hidden)]
673    pub __source_breaking: fidl::marker::SourceBreaking,
674}
675
676impl fidl::Persistable for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest {}
677
678#[derive(Clone, Debug, Default, PartialEq)]
679pub struct PowerElementProviderGetClockSpeedLevelRequest {
680    /// Required. The target frequency.
681    pub hz: Option<u64>,
682    /// If true and `hz` is greater than the maximum clock frequency, then the level
683    /// corresponding to the greatest supported frequency will be returned. If not true (or not
684    /// specified), this call will return `ZX_ERR_OUT_OF_RANGE` if `hz` is greater than the
685    /// maximum clock frequency.
686    pub allow_max: Option<bool>,
687    #[doc(hidden)]
688    pub __source_breaking: fidl::marker::SourceBreaking,
689}
690
691impl fidl::Persistable for PowerElementProviderGetClockSpeedLevelRequest {}
692
693#[derive(Clone, Debug, Default, PartialEq)]
694pub struct PowerElementProviderSetClockLimitRequest {
695    /// Required. The target frequency
696    pub hz: Option<u64>,
697    #[doc(hidden)]
698    pub __source_breaking: fidl::marker::SourceBreaking,
699}
700
701impl fidl::Persistable for PowerElementProviderSetClockLimitRequest {}
702
703#[derive(Clone, Debug, Default, PartialEq)]
704pub struct PrimaryMapBufferRequest {
705    /// Required.
706    pub hw_va: Option<u64>,
707    /// Required.
708    pub range: Option<BufferRange>,
709    pub flags: Option<MapFlags>,
710    #[doc(hidden)]
711    pub __source_breaking: fidl::marker::SourceBreaking,
712}
713
714impl fidl::Persistable for PrimaryMapBufferRequest {}
715
716#[derive(Clone, Debug, Default, PartialEq)]
717pub struct PrimaryUnmapBufferRequest {
718    /// Required.
719    pub hw_va: Option<u64>,
720    /// Required.
721    pub buffer_id: Option<u64>,
722    #[doc(hidden)]
723    pub __source_breaking: fidl::marker::SourceBreaking,
724}
725
726impl fidl::Persistable for PrimaryUnmapBufferRequest {}
727
728mod internal {
729    use super::*;
730    unsafe impl fidl::encoding::TypeMarker for CommandBufferFlags {
731        type Owned = Self;
732
733        #[inline(always)]
734        fn inline_align(_context: fidl::encoding::Context) -> usize {
735            8
736        }
737
738        #[inline(always)]
739        fn inline_size(_context: fidl::encoding::Context) -> usize {
740            8
741        }
742    }
743
744    impl fidl::encoding::ValueTypeMarker for CommandBufferFlags {
745        type Borrowed<'a> = Self;
746        #[inline(always)]
747        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
748            *value
749        }
750    }
751
752    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
753        for CommandBufferFlags
754    {
755        #[inline]
756        unsafe fn encode(
757            self,
758            encoder: &mut fidl::encoding::Encoder<'_, D>,
759            offset: usize,
760            _depth: fidl::encoding::Depth,
761        ) -> fidl::Result<()> {
762            encoder.debug_check_bounds::<Self>(offset);
763            encoder.write_num(self.bits(), offset);
764            Ok(())
765        }
766    }
767
768    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CommandBufferFlags {
769        #[inline(always)]
770        fn new_empty() -> Self {
771            Self::empty()
772        }
773
774        #[inline]
775        unsafe fn decode(
776            &mut self,
777            decoder: &mut fidl::encoding::Decoder<'_, D>,
778            offset: usize,
779            _depth: fidl::encoding::Depth,
780        ) -> fidl::Result<()> {
781            decoder.debug_check_bounds::<Self>(offset);
782            let prim = decoder.read_num::<u64>(offset);
783            *self = Self::from_bits_allow_unknown(prim);
784            Ok(())
785        }
786    }
787    unsafe impl fidl::encoding::TypeMarker for IcdFlags {
788        type Owned = Self;
789
790        #[inline(always)]
791        fn inline_align(_context: fidl::encoding::Context) -> usize {
792            4
793        }
794
795        #[inline(always)]
796        fn inline_size(_context: fidl::encoding::Context) -> usize {
797            4
798        }
799    }
800
801    impl fidl::encoding::ValueTypeMarker for IcdFlags {
802        type Borrowed<'a> = Self;
803        #[inline(always)]
804        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
805            *value
806        }
807    }
808
809    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for IcdFlags {
810        #[inline]
811        unsafe fn encode(
812            self,
813            encoder: &mut fidl::encoding::Encoder<'_, D>,
814            offset: usize,
815            _depth: fidl::encoding::Depth,
816        ) -> fidl::Result<()> {
817            encoder.debug_check_bounds::<Self>(offset);
818            encoder.write_num(self.bits(), offset);
819            Ok(())
820        }
821    }
822
823    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IcdFlags {
824        #[inline(always)]
825        fn new_empty() -> Self {
826            Self::empty()
827        }
828
829        #[inline]
830        unsafe fn decode(
831            &mut self,
832            decoder: &mut fidl::encoding::Decoder<'_, D>,
833            offset: usize,
834            _depth: fidl::encoding::Depth,
835        ) -> fidl::Result<()> {
836            decoder.debug_check_bounds::<Self>(offset);
837            let prim = decoder.read_num::<u32>(offset);
838            *self = Self::from_bits_allow_unknown(prim);
839            Ok(())
840        }
841    }
842    unsafe impl fidl::encoding::TypeMarker for ImportFlags {
843        type Owned = Self;
844
845        #[inline(always)]
846        fn inline_align(_context: fidl::encoding::Context) -> usize {
847            8
848        }
849
850        #[inline(always)]
851        fn inline_size(_context: fidl::encoding::Context) -> usize {
852            8
853        }
854    }
855
856    impl fidl::encoding::ValueTypeMarker for ImportFlags {
857        type Borrowed<'a> = Self;
858        #[inline(always)]
859        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
860            *value
861        }
862    }
863
864    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ImportFlags {
865        #[inline]
866        unsafe fn encode(
867            self,
868            encoder: &mut fidl::encoding::Encoder<'_, D>,
869            offset: usize,
870            _depth: fidl::encoding::Depth,
871        ) -> fidl::Result<()> {
872            encoder.debug_check_bounds::<Self>(offset);
873            encoder.write_num(self.bits(), offset);
874            Ok(())
875        }
876    }
877
878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImportFlags {
879        #[inline(always)]
880        fn new_empty() -> Self {
881            Self::empty()
882        }
883
884        #[inline]
885        unsafe fn decode(
886            &mut self,
887            decoder: &mut fidl::encoding::Decoder<'_, D>,
888            offset: usize,
889            _depth: fidl::encoding::Depth,
890        ) -> fidl::Result<()> {
891            decoder.debug_check_bounds::<Self>(offset);
892            let prim = decoder.read_num::<u64>(offset);
893            *self = Self::from_bits_allow_unknown(prim);
894            Ok(())
895        }
896    }
897    unsafe impl fidl::encoding::TypeMarker for MapFlags {
898        type Owned = Self;
899
900        #[inline(always)]
901        fn inline_align(_context: fidl::encoding::Context) -> usize {
902            8
903        }
904
905        #[inline(always)]
906        fn inline_size(_context: fidl::encoding::Context) -> usize {
907            8
908        }
909    }
910
911    impl fidl::encoding::ValueTypeMarker for MapFlags {
912        type Borrowed<'a> = Self;
913        #[inline(always)]
914        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
915            *value
916        }
917    }
918
919    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MapFlags {
920        #[inline]
921        unsafe fn encode(
922            self,
923            encoder: &mut fidl::encoding::Encoder<'_, D>,
924            offset: usize,
925            _depth: fidl::encoding::Depth,
926        ) -> fidl::Result<()> {
927            encoder.debug_check_bounds::<Self>(offset);
928            encoder.write_num(self.bits(), offset);
929            Ok(())
930        }
931    }
932
933    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MapFlags {
934        #[inline(always)]
935        fn new_empty() -> Self {
936            Self::empty()
937        }
938
939        #[inline]
940        unsafe fn decode(
941            &mut self,
942            decoder: &mut fidl::encoding::Decoder<'_, D>,
943            offset: usize,
944            _depth: fidl::encoding::Depth,
945        ) -> fidl::Result<()> {
946            decoder.debug_check_bounds::<Self>(offset);
947            let prim = decoder.read_num::<u64>(offset);
948            *self = Self::from_bits_allow_unknown(prim);
949            Ok(())
950        }
951    }
952    unsafe impl fidl::encoding::TypeMarker for ResultFlags {
953        type Owned = Self;
954
955        #[inline(always)]
956        fn inline_align(_context: fidl::encoding::Context) -> usize {
957            4
958        }
959
960        #[inline(always)]
961        fn inline_size(_context: fidl::encoding::Context) -> usize {
962            4
963        }
964    }
965
966    impl fidl::encoding::ValueTypeMarker for ResultFlags {
967        type Borrowed<'a> = Self;
968        #[inline(always)]
969        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
970            *value
971        }
972    }
973
974    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ResultFlags {
975        #[inline]
976        unsafe fn encode(
977            self,
978            encoder: &mut fidl::encoding::Encoder<'_, D>,
979            offset: usize,
980            _depth: fidl::encoding::Depth,
981        ) -> fidl::Result<()> {
982            encoder.debug_check_bounds::<Self>(offset);
983            encoder.write_num(self.bits(), offset);
984            Ok(())
985        }
986    }
987
988    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResultFlags {
989        #[inline(always)]
990        fn new_empty() -> Self {
991            Self::empty()
992        }
993
994        #[inline]
995        unsafe fn decode(
996            &mut self,
997            decoder: &mut fidl::encoding::Decoder<'_, D>,
998            offset: usize,
999            _depth: fidl::encoding::Depth,
1000        ) -> fidl::Result<()> {
1001            decoder.debug_check_bounds::<Self>(offset);
1002            let prim = decoder.read_num::<u32>(offset);
1003            *self = Self::from_bits_allow_unknown(prim);
1004            Ok(())
1005        }
1006    }
1007    unsafe impl fidl::encoding::TypeMarker for BufferOp {
1008        type Owned = Self;
1009
1010        #[inline(always)]
1011        fn inline_align(_context: fidl::encoding::Context) -> usize {
1012            std::mem::align_of::<u32>()
1013        }
1014
1015        #[inline(always)]
1016        fn inline_size(_context: fidl::encoding::Context) -> usize {
1017            std::mem::size_of::<u32>()
1018        }
1019
1020        #[inline(always)]
1021        fn encode_is_copy() -> bool {
1022            false
1023        }
1024
1025        #[inline(always)]
1026        fn decode_is_copy() -> bool {
1027            false
1028        }
1029    }
1030
1031    impl fidl::encoding::ValueTypeMarker for BufferOp {
1032        type Borrowed<'a> = Self;
1033        #[inline(always)]
1034        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1035            *value
1036        }
1037    }
1038
1039    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BufferOp {
1040        #[inline]
1041        unsafe fn encode(
1042            self,
1043            encoder: &mut fidl::encoding::Encoder<'_, D>,
1044            offset: usize,
1045            _depth: fidl::encoding::Depth,
1046        ) -> fidl::Result<()> {
1047            encoder.debug_check_bounds::<Self>(offset);
1048            encoder.write_num(self.into_primitive(), offset);
1049            Ok(())
1050        }
1051    }
1052
1053    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferOp {
1054        #[inline(always)]
1055        fn new_empty() -> Self {
1056            Self::unknown()
1057        }
1058
1059        #[inline]
1060        unsafe fn decode(
1061            &mut self,
1062            decoder: &mut fidl::encoding::Decoder<'_, D>,
1063            offset: usize,
1064            _depth: fidl::encoding::Depth,
1065        ) -> fidl::Result<()> {
1066            decoder.debug_check_bounds::<Self>(offset);
1067            let prim = decoder.read_num::<u32>(offset);
1068
1069            *self = Self::from_primitive_allow_unknown(prim);
1070            Ok(())
1071        }
1072    }
1073    unsafe impl fidl::encoding::TypeMarker for ObjectType {
1074        type Owned = Self;
1075
1076        #[inline(always)]
1077        fn inline_align(_context: fidl::encoding::Context) -> usize {
1078            std::mem::align_of::<u32>()
1079        }
1080
1081        #[inline(always)]
1082        fn inline_size(_context: fidl::encoding::Context) -> usize {
1083            std::mem::size_of::<u32>()
1084        }
1085
1086        #[inline(always)]
1087        fn encode_is_copy() -> bool {
1088            false
1089        }
1090
1091        #[inline(always)]
1092        fn decode_is_copy() -> bool {
1093            false
1094        }
1095    }
1096
1097    impl fidl::encoding::ValueTypeMarker for ObjectType {
1098        type Borrowed<'a> = Self;
1099        #[inline(always)]
1100        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1101            *value
1102        }
1103    }
1104
1105    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ObjectType {
1106        #[inline]
1107        unsafe fn encode(
1108            self,
1109            encoder: &mut fidl::encoding::Encoder<'_, D>,
1110            offset: usize,
1111            _depth: fidl::encoding::Depth,
1112        ) -> fidl::Result<()> {
1113            encoder.debug_check_bounds::<Self>(offset);
1114            encoder.write_num(self.into_primitive(), offset);
1115            Ok(())
1116        }
1117    }
1118
1119    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ObjectType {
1120        #[inline(always)]
1121        fn new_empty() -> Self {
1122            Self::unknown()
1123        }
1124
1125        #[inline]
1126        unsafe fn decode(
1127            &mut self,
1128            decoder: &mut fidl::encoding::Decoder<'_, D>,
1129            offset: usize,
1130            _depth: fidl::encoding::Depth,
1131        ) -> fidl::Result<()> {
1132            decoder.debug_check_bounds::<Self>(offset);
1133            let prim = decoder.read_num::<u32>(offset);
1134
1135            *self = Self::from_primitive_allow_unknown(prim);
1136            Ok(())
1137        }
1138    }
1139    unsafe impl fidl::encoding::TypeMarker for PowerGoalType {
1140        type Owned = Self;
1141
1142        #[inline(always)]
1143        fn inline_align(_context: fidl::encoding::Context) -> usize {
1144            std::mem::align_of::<u64>()
1145        }
1146
1147        #[inline(always)]
1148        fn inline_size(_context: fidl::encoding::Context) -> usize {
1149            std::mem::size_of::<u64>()
1150        }
1151
1152        #[inline(always)]
1153        fn encode_is_copy() -> bool {
1154            false
1155        }
1156
1157        #[inline(always)]
1158        fn decode_is_copy() -> bool {
1159            false
1160        }
1161    }
1162
1163    impl fidl::encoding::ValueTypeMarker for PowerGoalType {
1164        type Borrowed<'a> = Self;
1165        #[inline(always)]
1166        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1167            *value
1168        }
1169    }
1170
1171    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PowerGoalType {
1172        #[inline]
1173        unsafe fn encode(
1174            self,
1175            encoder: &mut fidl::encoding::Encoder<'_, D>,
1176            offset: usize,
1177            _depth: fidl::encoding::Depth,
1178        ) -> fidl::Result<()> {
1179            encoder.debug_check_bounds::<Self>(offset);
1180            encoder.write_num(self.into_primitive(), offset);
1181            Ok(())
1182        }
1183    }
1184
1185    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PowerGoalType {
1186        #[inline(always)]
1187        fn new_empty() -> Self {
1188            Self::unknown()
1189        }
1190
1191        #[inline]
1192        unsafe fn decode(
1193            &mut self,
1194            decoder: &mut fidl::encoding::Decoder<'_, D>,
1195            offset: usize,
1196            _depth: fidl::encoding::Depth,
1197        ) -> fidl::Result<()> {
1198            decoder.debug_check_bounds::<Self>(offset);
1199            let prim = decoder.read_num::<u64>(offset);
1200
1201            *self = Self::from_primitive_allow_unknown(prim);
1202            Ok(())
1203        }
1204    }
1205    unsafe impl fidl::encoding::TypeMarker for QueryId {
1206        type Owned = Self;
1207
1208        #[inline(always)]
1209        fn inline_align(_context: fidl::encoding::Context) -> usize {
1210            std::mem::align_of::<u64>()
1211        }
1212
1213        #[inline(always)]
1214        fn inline_size(_context: fidl::encoding::Context) -> usize {
1215            std::mem::size_of::<u64>()
1216        }
1217
1218        #[inline(always)]
1219        fn encode_is_copy() -> bool {
1220            false
1221        }
1222
1223        #[inline(always)]
1224        fn decode_is_copy() -> bool {
1225            false
1226        }
1227    }
1228
1229    impl fidl::encoding::ValueTypeMarker for QueryId {
1230        type Borrowed<'a> = Self;
1231        #[inline(always)]
1232        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1233            *value
1234        }
1235    }
1236
1237    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for QueryId {
1238        #[inline]
1239        unsafe fn encode(
1240            self,
1241            encoder: &mut fidl::encoding::Encoder<'_, D>,
1242            offset: usize,
1243            _depth: fidl::encoding::Depth,
1244        ) -> fidl::Result<()> {
1245            encoder.debug_check_bounds::<Self>(offset);
1246            encoder.write_num(self.into_primitive(), offset);
1247            Ok(())
1248        }
1249    }
1250
1251    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for QueryId {
1252        #[inline(always)]
1253        fn new_empty() -> Self {
1254            Self::unknown()
1255        }
1256
1257        #[inline]
1258        unsafe fn decode(
1259            &mut self,
1260            decoder: &mut fidl::encoding::Decoder<'_, D>,
1261            offset: usize,
1262            _depth: fidl::encoding::Depth,
1263        ) -> fidl::Result<()> {
1264            decoder.debug_check_bounds::<Self>(offset);
1265            let prim = decoder.read_num::<u64>(offset);
1266
1267            *self = Self::from_primitive_allow_unknown(prim);
1268            Ok(())
1269        }
1270    }
1271
1272    impl fidl::encoding::ValueTypeMarker for BufferRange {
1273        type Borrowed<'a> = &'a Self;
1274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1275            value
1276        }
1277    }
1278
1279    unsafe impl fidl::encoding::TypeMarker for BufferRange {
1280        type Owned = Self;
1281
1282        #[inline(always)]
1283        fn inline_align(_context: fidl::encoding::Context) -> usize {
1284            8
1285        }
1286
1287        #[inline(always)]
1288        fn inline_size(_context: fidl::encoding::Context) -> usize {
1289            24
1290        }
1291        #[inline(always)]
1292        fn encode_is_copy() -> bool {
1293            true
1294        }
1295
1296        #[inline(always)]
1297        fn decode_is_copy() -> bool {
1298            true
1299        }
1300    }
1301
1302    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BufferRange, D>
1303        for &BufferRange
1304    {
1305        #[inline]
1306        unsafe fn encode(
1307            self,
1308            encoder: &mut fidl::encoding::Encoder<'_, D>,
1309            offset: usize,
1310            _depth: fidl::encoding::Depth,
1311        ) -> fidl::Result<()> {
1312            encoder.debug_check_bounds::<BufferRange>(offset);
1313            unsafe {
1314                // Copy the object into the buffer.
1315                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1316                (buf_ptr as *mut BufferRange).write_unaligned((self as *const BufferRange).read());
1317                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1318                // done second because the memcpy will write garbage to these bytes.
1319            }
1320            Ok(())
1321        }
1322    }
1323    unsafe impl<
1324            D: fidl::encoding::ResourceDialect,
1325            T0: fidl::encoding::Encode<u64, D>,
1326            T1: fidl::encoding::Encode<u64, D>,
1327            T2: fidl::encoding::Encode<u64, D>,
1328        > fidl::encoding::Encode<BufferRange, D> for (T0, T1, T2)
1329    {
1330        #[inline]
1331        unsafe fn encode(
1332            self,
1333            encoder: &mut fidl::encoding::Encoder<'_, D>,
1334            offset: usize,
1335            depth: fidl::encoding::Depth,
1336        ) -> fidl::Result<()> {
1337            encoder.debug_check_bounds::<BufferRange>(offset);
1338            // Zero out padding regions. There's no need to apply masks
1339            // because the unmasked parts will be overwritten by fields.
1340            // Write the fields.
1341            self.0.encode(encoder, offset + 0, depth)?;
1342            self.1.encode(encoder, offset + 8, depth)?;
1343            self.2.encode(encoder, offset + 16, depth)?;
1344            Ok(())
1345        }
1346    }
1347
1348    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BufferRange {
1349        #[inline(always)]
1350        fn new_empty() -> Self {
1351            Self {
1352                buffer_id: fidl::new_empty!(u64, D),
1353                offset: fidl::new_empty!(u64, D),
1354                size: fidl::new_empty!(u64, D),
1355            }
1356        }
1357
1358        #[inline]
1359        unsafe fn decode(
1360            &mut self,
1361            decoder: &mut fidl::encoding::Decoder<'_, D>,
1362            offset: usize,
1363            _depth: fidl::encoding::Depth,
1364        ) -> fidl::Result<()> {
1365            decoder.debug_check_bounds::<Self>(offset);
1366            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1367            // Verify that padding bytes are zero.
1368            // Copy from the buffer into the object.
1369            unsafe {
1370                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
1371            }
1372            Ok(())
1373        }
1374    }
1375
1376    impl fidl::encoding::ValueTypeMarker for CommandBuffer {
1377        type Borrowed<'a> = &'a Self;
1378        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1379            value
1380        }
1381    }
1382
1383    unsafe impl fidl::encoding::TypeMarker for CommandBuffer {
1384        type Owned = Self;
1385
1386        #[inline(always)]
1387        fn inline_align(_context: fidl::encoding::Context) -> usize {
1388            8
1389        }
1390
1391        #[inline(always)]
1392        fn inline_size(_context: fidl::encoding::Context) -> usize {
1393            16
1394        }
1395    }
1396
1397    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CommandBuffer, D>
1398        for &CommandBuffer
1399    {
1400        #[inline]
1401        unsafe fn encode(
1402            self,
1403            encoder: &mut fidl::encoding::Encoder<'_, D>,
1404            offset: usize,
1405            _depth: fidl::encoding::Depth,
1406        ) -> fidl::Result<()> {
1407            encoder.debug_check_bounds::<CommandBuffer>(offset);
1408            unsafe {
1409                // Copy the object into the buffer.
1410                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1411                (buf_ptr as *mut CommandBuffer)
1412                    .write_unaligned((self as *const CommandBuffer).read());
1413                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1414                // done second because the memcpy will write garbage to these bytes.
1415                let padding_ptr = buf_ptr.offset(0) as *mut u64;
1416                let padding_mask = 0xffffffff00000000u64;
1417                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1418            }
1419            Ok(())
1420        }
1421    }
1422    unsafe impl<
1423            D: fidl::encoding::ResourceDialect,
1424            T0: fidl::encoding::Encode<u32, D>,
1425            T1: fidl::encoding::Encode<u64, D>,
1426        > fidl::encoding::Encode<CommandBuffer, D> for (T0, T1)
1427    {
1428        #[inline]
1429        unsafe fn encode(
1430            self,
1431            encoder: &mut fidl::encoding::Encoder<'_, D>,
1432            offset: usize,
1433            depth: fidl::encoding::Depth,
1434        ) -> fidl::Result<()> {
1435            encoder.debug_check_bounds::<CommandBuffer>(offset);
1436            // Zero out padding regions. There's no need to apply masks
1437            // because the unmasked parts will be overwritten by fields.
1438            unsafe {
1439                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1440                (ptr as *mut u64).write_unaligned(0);
1441            }
1442            // Write the fields.
1443            self.0.encode(encoder, offset + 0, depth)?;
1444            self.1.encode(encoder, offset + 8, depth)?;
1445            Ok(())
1446        }
1447    }
1448
1449    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CommandBuffer {
1450        #[inline(always)]
1451        fn new_empty() -> Self {
1452            Self {
1453                resource_index: fidl::new_empty!(u32, D),
1454                start_offset: fidl::new_empty!(u64, D),
1455            }
1456        }
1457
1458        #[inline]
1459        unsafe fn decode(
1460            &mut self,
1461            decoder: &mut fidl::encoding::Decoder<'_, D>,
1462            offset: usize,
1463            _depth: fidl::encoding::Depth,
1464        ) -> fidl::Result<()> {
1465            decoder.debug_check_bounds::<Self>(offset);
1466            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1467            // Verify that padding bytes are zero.
1468            let ptr = unsafe { buf_ptr.offset(0) };
1469            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1470            let mask = 0xffffffff00000000u64;
1471            let maskedval = padval & mask;
1472            if maskedval != 0 {
1473                return Err(fidl::Error::NonZeroPadding {
1474                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1475                });
1476            }
1477            // Copy from the buffer into the object.
1478            unsafe {
1479                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1480            }
1481            Ok(())
1482        }
1483    }
1484
1485    impl fidl::encoding::ValueTypeMarker for DeviceQueryRequest {
1486        type Borrowed<'a> = &'a Self;
1487        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1488            value
1489        }
1490    }
1491
1492    unsafe impl fidl::encoding::TypeMarker for DeviceQueryRequest {
1493        type Owned = Self;
1494
1495        #[inline(always)]
1496        fn inline_align(_context: fidl::encoding::Context) -> usize {
1497            8
1498        }
1499
1500        #[inline(always)]
1501        fn inline_size(_context: fidl::encoding::Context) -> usize {
1502            8
1503        }
1504    }
1505
1506    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceQueryRequest, D>
1507        for &DeviceQueryRequest
1508    {
1509        #[inline]
1510        unsafe fn encode(
1511            self,
1512            encoder: &mut fidl::encoding::Encoder<'_, D>,
1513            offset: usize,
1514            _depth: fidl::encoding::Depth,
1515        ) -> fidl::Result<()> {
1516            encoder.debug_check_bounds::<DeviceQueryRequest>(offset);
1517            // Delegate to tuple encoding.
1518            fidl::encoding::Encode::<DeviceQueryRequest, D>::encode(
1519                (<QueryId as fidl::encoding::ValueTypeMarker>::borrow(&self.query_id),),
1520                encoder,
1521                offset,
1522                _depth,
1523            )
1524        }
1525    }
1526    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<QueryId, D>>
1527        fidl::encoding::Encode<DeviceQueryRequest, D> for (T0,)
1528    {
1529        #[inline]
1530        unsafe fn encode(
1531            self,
1532            encoder: &mut fidl::encoding::Encoder<'_, D>,
1533            offset: usize,
1534            depth: fidl::encoding::Depth,
1535        ) -> fidl::Result<()> {
1536            encoder.debug_check_bounds::<DeviceQueryRequest>(offset);
1537            // Zero out padding regions. There's no need to apply masks
1538            // because the unmasked parts will be overwritten by fields.
1539            // Write the fields.
1540            self.0.encode(encoder, offset + 0, depth)?;
1541            Ok(())
1542        }
1543    }
1544
1545    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceQueryRequest {
1546        #[inline(always)]
1547        fn new_empty() -> Self {
1548            Self { query_id: fidl::new_empty!(QueryId, D) }
1549        }
1550
1551        #[inline]
1552        unsafe fn decode(
1553            &mut self,
1554            decoder: &mut fidl::encoding::Decoder<'_, D>,
1555            offset: usize,
1556            _depth: fidl::encoding::Depth,
1557        ) -> fidl::Result<()> {
1558            decoder.debug_check_bounds::<Self>(offset);
1559            // Verify that padding bytes are zero.
1560            fidl::decode!(QueryId, D, &mut self.query_id, decoder, offset + 0, _depth)?;
1561            Ok(())
1562        }
1563    }
1564
1565    impl fidl::encoding::ValueTypeMarker for DiagnosticDeviceDumpStateRequest {
1566        type Borrowed<'a> = &'a Self;
1567        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1568            value
1569        }
1570    }
1571
1572    unsafe impl fidl::encoding::TypeMarker for DiagnosticDeviceDumpStateRequest {
1573        type Owned = Self;
1574
1575        #[inline(always)]
1576        fn inline_align(_context: fidl::encoding::Context) -> usize {
1577            4
1578        }
1579
1580        #[inline(always)]
1581        fn inline_size(_context: fidl::encoding::Context) -> usize {
1582            4
1583        }
1584        #[inline(always)]
1585        fn encode_is_copy() -> bool {
1586            true
1587        }
1588
1589        #[inline(always)]
1590        fn decode_is_copy() -> bool {
1591            true
1592        }
1593    }
1594
1595    unsafe impl<D: fidl::encoding::ResourceDialect>
1596        fidl::encoding::Encode<DiagnosticDeviceDumpStateRequest, D>
1597        for &DiagnosticDeviceDumpStateRequest
1598    {
1599        #[inline]
1600        unsafe fn encode(
1601            self,
1602            encoder: &mut fidl::encoding::Encoder<'_, D>,
1603            offset: usize,
1604            _depth: fidl::encoding::Depth,
1605        ) -> fidl::Result<()> {
1606            encoder.debug_check_bounds::<DiagnosticDeviceDumpStateRequest>(offset);
1607            unsafe {
1608                // Copy the object into the buffer.
1609                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1610                (buf_ptr as *mut DiagnosticDeviceDumpStateRequest)
1611                    .write_unaligned((self as *const DiagnosticDeviceDumpStateRequest).read());
1612                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1613                // done second because the memcpy will write garbage to these bytes.
1614            }
1615            Ok(())
1616        }
1617    }
1618    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1619        fidl::encoding::Encode<DiagnosticDeviceDumpStateRequest, D> for (T0,)
1620    {
1621        #[inline]
1622        unsafe fn encode(
1623            self,
1624            encoder: &mut fidl::encoding::Encoder<'_, D>,
1625            offset: usize,
1626            depth: fidl::encoding::Depth,
1627        ) -> fidl::Result<()> {
1628            encoder.debug_check_bounds::<DiagnosticDeviceDumpStateRequest>(offset);
1629            // Zero out padding regions. There's no need to apply masks
1630            // because the unmasked parts will be overwritten by fields.
1631            // Write the fields.
1632            self.0.encode(encoder, offset + 0, depth)?;
1633            Ok(())
1634        }
1635    }
1636
1637    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1638        for DiagnosticDeviceDumpStateRequest
1639    {
1640        #[inline(always)]
1641        fn new_empty() -> Self {
1642            Self { dump_type: fidl::new_empty!(u32, D) }
1643        }
1644
1645        #[inline]
1646        unsafe fn decode(
1647            &mut self,
1648            decoder: &mut fidl::encoding::Decoder<'_, D>,
1649            offset: usize,
1650            _depth: fidl::encoding::Depth,
1651        ) -> fidl::Result<()> {
1652            decoder.debug_check_bounds::<Self>(offset);
1653            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1654            // Verify that padding bytes are zero.
1655            // Copy from the buffer into the object.
1656            unsafe {
1657                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1658            }
1659            Ok(())
1660        }
1661    }
1662
1663    impl fidl::encoding::ValueTypeMarker for IcdLoaderDeviceGetIcdListResponse {
1664        type Borrowed<'a> = &'a Self;
1665        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1666            value
1667        }
1668    }
1669
1670    unsafe impl fidl::encoding::TypeMarker for IcdLoaderDeviceGetIcdListResponse {
1671        type Owned = Self;
1672
1673        #[inline(always)]
1674        fn inline_align(_context: fidl::encoding::Context) -> usize {
1675            8
1676        }
1677
1678        #[inline(always)]
1679        fn inline_size(_context: fidl::encoding::Context) -> usize {
1680            16
1681        }
1682    }
1683
1684    unsafe impl<D: fidl::encoding::ResourceDialect>
1685        fidl::encoding::Encode<IcdLoaderDeviceGetIcdListResponse, D>
1686        for &IcdLoaderDeviceGetIcdListResponse
1687    {
1688        #[inline]
1689        unsafe fn encode(
1690            self,
1691            encoder: &mut fidl::encoding::Encoder<'_, D>,
1692            offset: usize,
1693            _depth: fidl::encoding::Depth,
1694        ) -> fidl::Result<()> {
1695            encoder.debug_check_bounds::<IcdLoaderDeviceGetIcdListResponse>(offset);
1696            // Delegate to tuple encoding.
1697            fidl::encoding::Encode::<IcdLoaderDeviceGetIcdListResponse, D>::encode(
1698                (<fidl::encoding::Vector<IcdInfo, 8> as fidl::encoding::ValueTypeMarker>::borrow(
1699                    &self.icd_list,
1700                ),),
1701                encoder,
1702                offset,
1703                _depth,
1704            )
1705        }
1706    }
1707    unsafe impl<
1708            D: fidl::encoding::ResourceDialect,
1709            T0: fidl::encoding::Encode<fidl::encoding::Vector<IcdInfo, 8>, D>,
1710        > fidl::encoding::Encode<IcdLoaderDeviceGetIcdListResponse, D> for (T0,)
1711    {
1712        #[inline]
1713        unsafe fn encode(
1714            self,
1715            encoder: &mut fidl::encoding::Encoder<'_, D>,
1716            offset: usize,
1717            depth: fidl::encoding::Depth,
1718        ) -> fidl::Result<()> {
1719            encoder.debug_check_bounds::<IcdLoaderDeviceGetIcdListResponse>(offset);
1720            // Zero out padding regions. There's no need to apply masks
1721            // because the unmasked parts will be overwritten by fields.
1722            // Write the fields.
1723            self.0.encode(encoder, offset + 0, depth)?;
1724            Ok(())
1725        }
1726    }
1727
1728    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1729        for IcdLoaderDeviceGetIcdListResponse
1730    {
1731        #[inline(always)]
1732        fn new_empty() -> Self {
1733            Self { icd_list: fidl::new_empty!(fidl::encoding::Vector<IcdInfo, 8>, D) }
1734        }
1735
1736        #[inline]
1737        unsafe fn decode(
1738            &mut self,
1739            decoder: &mut fidl::encoding::Decoder<'_, D>,
1740            offset: usize,
1741            _depth: fidl::encoding::Depth,
1742        ) -> fidl::Result<()> {
1743            decoder.debug_check_bounds::<Self>(offset);
1744            // Verify that padding bytes are zero.
1745            fidl::decode!(fidl::encoding::Vector<IcdInfo, 8>, D, &mut self.icd_list, decoder, offset + 0, _depth)?;
1746            Ok(())
1747        }
1748    }
1749
1750    impl fidl::encoding::ValueTypeMarker for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
1751        type Borrowed<'a> = &'a Self;
1752        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1753            value
1754        }
1755    }
1756
1757    unsafe impl fidl::encoding::TypeMarker for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest {
1758        type Owned = Self;
1759
1760        #[inline(always)]
1761        fn inline_align(_context: fidl::encoding::Context) -> usize {
1762            8
1763        }
1764
1765        #[inline(always)]
1766        fn inline_size(_context: fidl::encoding::Context) -> usize {
1767            24
1768        }
1769    }
1770
1771    unsafe impl<D: fidl::encoding::ResourceDialect>
1772        fidl::encoding::Encode<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest, D>
1773        for &PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest
1774    {
1775        #[inline]
1776        unsafe fn encode(
1777            self,
1778            encoder: &mut fidl::encoding::Encoder<'_, D>,
1779            offset: usize,
1780            _depth: fidl::encoding::Depth,
1781        ) -> fidl::Result<()> {
1782            encoder.debug_check_bounds::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
1783                offset,
1784            );
1785            // Delegate to tuple encoding.
1786            fidl::encoding::Encode::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest, D>::encode(
1787                (
1788                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.pool_id),
1789                    <fidl::encoding::Vector<BufferRange, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.offsets),
1790                ),
1791                encoder, offset, _depth
1792            )
1793        }
1794    }
1795    unsafe impl<
1796            D: fidl::encoding::ResourceDialect,
1797            T0: fidl::encoding::Encode<u64, D>,
1798            T1: fidl::encoding::Encode<fidl::encoding::Vector<BufferRange, 64>, D>,
1799        > fidl::encoding::Encode<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest, D>
1800        for (T0, T1)
1801    {
1802        #[inline]
1803        unsafe fn encode(
1804            self,
1805            encoder: &mut fidl::encoding::Encoder<'_, D>,
1806            offset: usize,
1807            depth: fidl::encoding::Depth,
1808        ) -> fidl::Result<()> {
1809            encoder.debug_check_bounds::<PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest>(
1810                offset,
1811            );
1812            // Zero out padding regions. There's no need to apply masks
1813            // because the unmasked parts will be overwritten by fields.
1814            // Write the fields.
1815            self.0.encode(encoder, offset + 0, depth)?;
1816            self.1.encode(encoder, offset + 8, depth)?;
1817            Ok(())
1818        }
1819    }
1820
1821    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1822        for PrimaryAddPerformanceCounterBufferOffsetsToPoolRequest
1823    {
1824        #[inline(always)]
1825        fn new_empty() -> Self {
1826            Self {
1827                pool_id: fidl::new_empty!(u64, D),
1828                offsets: fidl::new_empty!(fidl::encoding::Vector<BufferRange, 64>, D),
1829            }
1830        }
1831
1832        #[inline]
1833        unsafe fn decode(
1834            &mut self,
1835            decoder: &mut fidl::encoding::Decoder<'_, D>,
1836            offset: usize,
1837            _depth: fidl::encoding::Depth,
1838        ) -> fidl::Result<()> {
1839            decoder.debug_check_bounds::<Self>(offset);
1840            // Verify that padding bytes are zero.
1841            fidl::decode!(u64, D, &mut self.pool_id, decoder, offset + 0, _depth)?;
1842            fidl::decode!(fidl::encoding::Vector<BufferRange, 64>, D, &mut self.offsets, decoder, offset + 8, _depth)?;
1843            Ok(())
1844        }
1845    }
1846
1847    impl fidl::encoding::ValueTypeMarker for PrimaryBufferRangeOp2Request {
1848        type Borrowed<'a> = &'a Self;
1849        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1850            value
1851        }
1852    }
1853
1854    unsafe impl fidl::encoding::TypeMarker for PrimaryBufferRangeOp2Request {
1855        type Owned = Self;
1856
1857        #[inline(always)]
1858        fn inline_align(_context: fidl::encoding::Context) -> usize {
1859            8
1860        }
1861
1862        #[inline(always)]
1863        fn inline_size(_context: fidl::encoding::Context) -> usize {
1864            32
1865        }
1866    }
1867
1868    unsafe impl<D: fidl::encoding::ResourceDialect>
1869        fidl::encoding::Encode<PrimaryBufferRangeOp2Request, D> for &PrimaryBufferRangeOp2Request
1870    {
1871        #[inline]
1872        unsafe fn encode(
1873            self,
1874            encoder: &mut fidl::encoding::Encoder<'_, D>,
1875            offset: usize,
1876            _depth: fidl::encoding::Depth,
1877        ) -> fidl::Result<()> {
1878            encoder.debug_check_bounds::<PrimaryBufferRangeOp2Request>(offset);
1879            // Delegate to tuple encoding.
1880            fidl::encoding::Encode::<PrimaryBufferRangeOp2Request, D>::encode(
1881                (
1882                    <BufferOp as fidl::encoding::ValueTypeMarker>::borrow(&self.op),
1883                    <BufferRange as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
1884                ),
1885                encoder,
1886                offset,
1887                _depth,
1888            )
1889        }
1890    }
1891    unsafe impl<
1892            D: fidl::encoding::ResourceDialect,
1893            T0: fidl::encoding::Encode<BufferOp, D>,
1894            T1: fidl::encoding::Encode<BufferRange, D>,
1895        > fidl::encoding::Encode<PrimaryBufferRangeOp2Request, D> for (T0, T1)
1896    {
1897        #[inline]
1898        unsafe fn encode(
1899            self,
1900            encoder: &mut fidl::encoding::Encoder<'_, D>,
1901            offset: usize,
1902            depth: fidl::encoding::Depth,
1903        ) -> fidl::Result<()> {
1904            encoder.debug_check_bounds::<PrimaryBufferRangeOp2Request>(offset);
1905            // Zero out padding regions. There's no need to apply masks
1906            // because the unmasked parts will be overwritten by fields.
1907            unsafe {
1908                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1909                (ptr as *mut u64).write_unaligned(0);
1910            }
1911            // Write the fields.
1912            self.0.encode(encoder, offset + 0, depth)?;
1913            self.1.encode(encoder, offset + 8, depth)?;
1914            Ok(())
1915        }
1916    }
1917
1918    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1919        for PrimaryBufferRangeOp2Request
1920    {
1921        #[inline(always)]
1922        fn new_empty() -> Self {
1923            Self { op: fidl::new_empty!(BufferOp, D), range: fidl::new_empty!(BufferRange, D) }
1924        }
1925
1926        #[inline]
1927        unsafe fn decode(
1928            &mut self,
1929            decoder: &mut fidl::encoding::Decoder<'_, D>,
1930            offset: usize,
1931            _depth: fidl::encoding::Depth,
1932        ) -> fidl::Result<()> {
1933            decoder.debug_check_bounds::<Self>(offset);
1934            // Verify that padding bytes are zero.
1935            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1936            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1937            let mask = 0xffffffff00000000u64;
1938            let maskedval = padval & mask;
1939            if maskedval != 0 {
1940                return Err(fidl::Error::NonZeroPadding {
1941                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1942                });
1943            }
1944            fidl::decode!(BufferOp, D, &mut self.op, decoder, offset + 0, _depth)?;
1945            fidl::decode!(BufferRange, D, &mut self.range, decoder, offset + 8, _depth)?;
1946            Ok(())
1947        }
1948    }
1949
1950    impl fidl::encoding::ValueTypeMarker for PrimaryClearPerformanceCountersRequest {
1951        type Borrowed<'a> = &'a Self;
1952        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1953            value
1954        }
1955    }
1956
1957    unsafe impl fidl::encoding::TypeMarker for PrimaryClearPerformanceCountersRequest {
1958        type Owned = Self;
1959
1960        #[inline(always)]
1961        fn inline_align(_context: fidl::encoding::Context) -> usize {
1962            8
1963        }
1964
1965        #[inline(always)]
1966        fn inline_size(_context: fidl::encoding::Context) -> usize {
1967            16
1968        }
1969    }
1970
1971    unsafe impl<D: fidl::encoding::ResourceDialect>
1972        fidl::encoding::Encode<PrimaryClearPerformanceCountersRequest, D>
1973        for &PrimaryClearPerformanceCountersRequest
1974    {
1975        #[inline]
1976        unsafe fn encode(
1977            self,
1978            encoder: &mut fidl::encoding::Encoder<'_, D>,
1979            offset: usize,
1980            _depth: fidl::encoding::Depth,
1981        ) -> fidl::Result<()> {
1982            encoder.debug_check_bounds::<PrimaryClearPerformanceCountersRequest>(offset);
1983            // Delegate to tuple encoding.
1984            fidl::encoding::Encode::<PrimaryClearPerformanceCountersRequest, D>::encode(
1985                (<fidl::encoding::Vector<u64, 64> as fidl::encoding::ValueTypeMarker>::borrow(
1986                    &self.counters,
1987                ),),
1988                encoder,
1989                offset,
1990                _depth,
1991            )
1992        }
1993    }
1994    unsafe impl<
1995            D: fidl::encoding::ResourceDialect,
1996            T0: fidl::encoding::Encode<fidl::encoding::Vector<u64, 64>, D>,
1997        > fidl::encoding::Encode<PrimaryClearPerformanceCountersRequest, D> for (T0,)
1998    {
1999        #[inline]
2000        unsafe fn encode(
2001            self,
2002            encoder: &mut fidl::encoding::Encoder<'_, D>,
2003            offset: usize,
2004            depth: fidl::encoding::Depth,
2005        ) -> fidl::Result<()> {
2006            encoder.debug_check_bounds::<PrimaryClearPerformanceCountersRequest>(offset);
2007            // Zero out padding regions. There's no need to apply masks
2008            // because the unmasked parts will be overwritten by fields.
2009            // Write the fields.
2010            self.0.encode(encoder, offset + 0, depth)?;
2011            Ok(())
2012        }
2013    }
2014
2015    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2016        for PrimaryClearPerformanceCountersRequest
2017    {
2018        #[inline(always)]
2019        fn new_empty() -> Self {
2020            Self { counters: fidl::new_empty!(fidl::encoding::Vector<u64, 64>, D) }
2021        }
2022
2023        #[inline]
2024        unsafe fn decode(
2025            &mut self,
2026            decoder: &mut fidl::encoding::Decoder<'_, D>,
2027            offset: usize,
2028            _depth: fidl::encoding::Depth,
2029        ) -> fidl::Result<()> {
2030            decoder.debug_check_bounds::<Self>(offset);
2031            // Verify that padding bytes are zero.
2032            fidl::decode!(fidl::encoding::Vector<u64, 64>, D, &mut self.counters, decoder, offset + 0, _depth)?;
2033            Ok(())
2034        }
2035    }
2036
2037    impl fidl::encoding::ValueTypeMarker for PrimaryCreateContextRequest {
2038        type Borrowed<'a> = &'a Self;
2039        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2040            value
2041        }
2042    }
2043
2044    unsafe impl fidl::encoding::TypeMarker for PrimaryCreateContextRequest {
2045        type Owned = Self;
2046
2047        #[inline(always)]
2048        fn inline_align(_context: fidl::encoding::Context) -> usize {
2049            4
2050        }
2051
2052        #[inline(always)]
2053        fn inline_size(_context: fidl::encoding::Context) -> usize {
2054            4
2055        }
2056        #[inline(always)]
2057        fn encode_is_copy() -> bool {
2058            true
2059        }
2060
2061        #[inline(always)]
2062        fn decode_is_copy() -> bool {
2063            true
2064        }
2065    }
2066
2067    unsafe impl<D: fidl::encoding::ResourceDialect>
2068        fidl::encoding::Encode<PrimaryCreateContextRequest, D> for &PrimaryCreateContextRequest
2069    {
2070        #[inline]
2071        unsafe fn encode(
2072            self,
2073            encoder: &mut fidl::encoding::Encoder<'_, D>,
2074            offset: usize,
2075            _depth: fidl::encoding::Depth,
2076        ) -> fidl::Result<()> {
2077            encoder.debug_check_bounds::<PrimaryCreateContextRequest>(offset);
2078            unsafe {
2079                // Copy the object into the buffer.
2080                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2081                (buf_ptr as *mut PrimaryCreateContextRequest)
2082                    .write_unaligned((self as *const PrimaryCreateContextRequest).read());
2083                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2084                // done second because the memcpy will write garbage to these bytes.
2085            }
2086            Ok(())
2087        }
2088    }
2089    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2090        fidl::encoding::Encode<PrimaryCreateContextRequest, D> for (T0,)
2091    {
2092        #[inline]
2093        unsafe fn encode(
2094            self,
2095            encoder: &mut fidl::encoding::Encoder<'_, D>,
2096            offset: usize,
2097            depth: fidl::encoding::Depth,
2098        ) -> fidl::Result<()> {
2099            encoder.debug_check_bounds::<PrimaryCreateContextRequest>(offset);
2100            // Zero out padding regions. There's no need to apply masks
2101            // because the unmasked parts will be overwritten by fields.
2102            // Write the fields.
2103            self.0.encode(encoder, offset + 0, depth)?;
2104            Ok(())
2105        }
2106    }
2107
2108    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2109        for PrimaryCreateContextRequest
2110    {
2111        #[inline(always)]
2112        fn new_empty() -> Self {
2113            Self { context_id: fidl::new_empty!(u32, D) }
2114        }
2115
2116        #[inline]
2117        unsafe fn decode(
2118            &mut self,
2119            decoder: &mut fidl::encoding::Decoder<'_, D>,
2120            offset: usize,
2121            _depth: fidl::encoding::Depth,
2122        ) -> fidl::Result<()> {
2123            decoder.debug_check_bounds::<Self>(offset);
2124            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2125            // Verify that padding bytes are zero.
2126            // Copy from the buffer into the object.
2127            unsafe {
2128                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2129            }
2130            Ok(())
2131        }
2132    }
2133
2134    impl fidl::encoding::ValueTypeMarker for PrimaryDestroyContextRequest {
2135        type Borrowed<'a> = &'a Self;
2136        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2137            value
2138        }
2139    }
2140
2141    unsafe impl fidl::encoding::TypeMarker for PrimaryDestroyContextRequest {
2142        type Owned = Self;
2143
2144        #[inline(always)]
2145        fn inline_align(_context: fidl::encoding::Context) -> usize {
2146            4
2147        }
2148
2149        #[inline(always)]
2150        fn inline_size(_context: fidl::encoding::Context) -> usize {
2151            4
2152        }
2153        #[inline(always)]
2154        fn encode_is_copy() -> bool {
2155            true
2156        }
2157
2158        #[inline(always)]
2159        fn decode_is_copy() -> bool {
2160            true
2161        }
2162    }
2163
2164    unsafe impl<D: fidl::encoding::ResourceDialect>
2165        fidl::encoding::Encode<PrimaryDestroyContextRequest, D> for &PrimaryDestroyContextRequest
2166    {
2167        #[inline]
2168        unsafe fn encode(
2169            self,
2170            encoder: &mut fidl::encoding::Encoder<'_, D>,
2171            offset: usize,
2172            _depth: fidl::encoding::Depth,
2173        ) -> fidl::Result<()> {
2174            encoder.debug_check_bounds::<PrimaryDestroyContextRequest>(offset);
2175            unsafe {
2176                // Copy the object into the buffer.
2177                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2178                (buf_ptr as *mut PrimaryDestroyContextRequest)
2179                    .write_unaligned((self as *const PrimaryDestroyContextRequest).read());
2180                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2181                // done second because the memcpy will write garbage to these bytes.
2182            }
2183            Ok(())
2184        }
2185    }
2186    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2187        fidl::encoding::Encode<PrimaryDestroyContextRequest, D> for (T0,)
2188    {
2189        #[inline]
2190        unsafe fn encode(
2191            self,
2192            encoder: &mut fidl::encoding::Encoder<'_, D>,
2193            offset: usize,
2194            depth: fidl::encoding::Depth,
2195        ) -> fidl::Result<()> {
2196            encoder.debug_check_bounds::<PrimaryDestroyContextRequest>(offset);
2197            // Zero out padding regions. There's no need to apply masks
2198            // because the unmasked parts will be overwritten by fields.
2199            // Write the fields.
2200            self.0.encode(encoder, offset + 0, depth)?;
2201            Ok(())
2202        }
2203    }
2204
2205    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2206        for PrimaryDestroyContextRequest
2207    {
2208        #[inline(always)]
2209        fn new_empty() -> Self {
2210            Self { context_id: fidl::new_empty!(u32, D) }
2211        }
2212
2213        #[inline]
2214        unsafe fn decode(
2215            &mut self,
2216            decoder: &mut fidl::encoding::Decoder<'_, D>,
2217            offset: usize,
2218            _depth: fidl::encoding::Depth,
2219        ) -> fidl::Result<()> {
2220            decoder.debug_check_bounds::<Self>(offset);
2221            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2222            // Verify that padding bytes are zero.
2223            // Copy from the buffer into the object.
2224            unsafe {
2225                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2226            }
2227            Ok(())
2228        }
2229    }
2230
2231    impl fidl::encoding::ValueTypeMarker for PrimaryDumpPerformanceCountersRequest {
2232        type Borrowed<'a> = &'a Self;
2233        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2234            value
2235        }
2236    }
2237
2238    unsafe impl fidl::encoding::TypeMarker for PrimaryDumpPerformanceCountersRequest {
2239        type Owned = Self;
2240
2241        #[inline(always)]
2242        fn inline_align(_context: fidl::encoding::Context) -> usize {
2243            8
2244        }
2245
2246        #[inline(always)]
2247        fn inline_size(_context: fidl::encoding::Context) -> usize {
2248            16
2249        }
2250    }
2251
2252    unsafe impl<D: fidl::encoding::ResourceDialect>
2253        fidl::encoding::Encode<PrimaryDumpPerformanceCountersRequest, D>
2254        for &PrimaryDumpPerformanceCountersRequest
2255    {
2256        #[inline]
2257        unsafe fn encode(
2258            self,
2259            encoder: &mut fidl::encoding::Encoder<'_, D>,
2260            offset: usize,
2261            _depth: fidl::encoding::Depth,
2262        ) -> fidl::Result<()> {
2263            encoder.debug_check_bounds::<PrimaryDumpPerformanceCountersRequest>(offset);
2264            unsafe {
2265                // Copy the object into the buffer.
2266                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2267                (buf_ptr as *mut PrimaryDumpPerformanceCountersRequest)
2268                    .write_unaligned((self as *const PrimaryDumpPerformanceCountersRequest).read());
2269                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2270                // done second because the memcpy will write garbage to these bytes.
2271                let padding_ptr = buf_ptr.offset(8) as *mut u64;
2272                let padding_mask = 0xffffffff00000000u64;
2273                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2274            }
2275            Ok(())
2276        }
2277    }
2278    unsafe impl<
2279            D: fidl::encoding::ResourceDialect,
2280            T0: fidl::encoding::Encode<u64, D>,
2281            T1: fidl::encoding::Encode<u32, D>,
2282        > fidl::encoding::Encode<PrimaryDumpPerformanceCountersRequest, D> for (T0, T1)
2283    {
2284        #[inline]
2285        unsafe fn encode(
2286            self,
2287            encoder: &mut fidl::encoding::Encoder<'_, D>,
2288            offset: usize,
2289            depth: fidl::encoding::Depth,
2290        ) -> fidl::Result<()> {
2291            encoder.debug_check_bounds::<PrimaryDumpPerformanceCountersRequest>(offset);
2292            // Zero out padding regions. There's no need to apply masks
2293            // because the unmasked parts will be overwritten by fields.
2294            unsafe {
2295                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2296                (ptr as *mut u64).write_unaligned(0);
2297            }
2298            // Write the fields.
2299            self.0.encode(encoder, offset + 0, depth)?;
2300            self.1.encode(encoder, offset + 8, depth)?;
2301            Ok(())
2302        }
2303    }
2304
2305    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2306        for PrimaryDumpPerformanceCountersRequest
2307    {
2308        #[inline(always)]
2309        fn new_empty() -> Self {
2310            Self { pool_id: fidl::new_empty!(u64, D), trigger_id: fidl::new_empty!(u32, D) }
2311        }
2312
2313        #[inline]
2314        unsafe fn decode(
2315            &mut self,
2316            decoder: &mut fidl::encoding::Decoder<'_, D>,
2317            offset: usize,
2318            _depth: fidl::encoding::Depth,
2319        ) -> fidl::Result<()> {
2320            decoder.debug_check_bounds::<Self>(offset);
2321            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2322            // Verify that padding bytes are zero.
2323            let ptr = unsafe { buf_ptr.offset(8) };
2324            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2325            let mask = 0xffffffff00000000u64;
2326            let maskedval = padval & mask;
2327            if maskedval != 0 {
2328                return Err(fidl::Error::NonZeroPadding {
2329                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2330                });
2331            }
2332            // Copy from the buffer into the object.
2333            unsafe {
2334                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2335            }
2336            Ok(())
2337        }
2338    }
2339
2340    impl fidl::encoding::ValueTypeMarker for PrimaryEnablePerformanceCountersRequest {
2341        type Borrowed<'a> = &'a Self;
2342        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2343            value
2344        }
2345    }
2346
2347    unsafe impl fidl::encoding::TypeMarker for PrimaryEnablePerformanceCountersRequest {
2348        type Owned = Self;
2349
2350        #[inline(always)]
2351        fn inline_align(_context: fidl::encoding::Context) -> usize {
2352            8
2353        }
2354
2355        #[inline(always)]
2356        fn inline_size(_context: fidl::encoding::Context) -> usize {
2357            16
2358        }
2359    }
2360
2361    unsafe impl<D: fidl::encoding::ResourceDialect>
2362        fidl::encoding::Encode<PrimaryEnablePerformanceCountersRequest, D>
2363        for &PrimaryEnablePerformanceCountersRequest
2364    {
2365        #[inline]
2366        unsafe fn encode(
2367            self,
2368            encoder: &mut fidl::encoding::Encoder<'_, D>,
2369            offset: usize,
2370            _depth: fidl::encoding::Depth,
2371        ) -> fidl::Result<()> {
2372            encoder.debug_check_bounds::<PrimaryEnablePerformanceCountersRequest>(offset);
2373            // Delegate to tuple encoding.
2374            fidl::encoding::Encode::<PrimaryEnablePerformanceCountersRequest, D>::encode(
2375                (<fidl::encoding::Vector<u64, 64> as fidl::encoding::ValueTypeMarker>::borrow(
2376                    &self.counters,
2377                ),),
2378                encoder,
2379                offset,
2380                _depth,
2381            )
2382        }
2383    }
2384    unsafe impl<
2385            D: fidl::encoding::ResourceDialect,
2386            T0: fidl::encoding::Encode<fidl::encoding::Vector<u64, 64>, D>,
2387        > fidl::encoding::Encode<PrimaryEnablePerformanceCountersRequest, D> for (T0,)
2388    {
2389        #[inline]
2390        unsafe fn encode(
2391            self,
2392            encoder: &mut fidl::encoding::Encoder<'_, D>,
2393            offset: usize,
2394            depth: fidl::encoding::Depth,
2395        ) -> fidl::Result<()> {
2396            encoder.debug_check_bounds::<PrimaryEnablePerformanceCountersRequest>(offset);
2397            // Zero out padding regions. There's no need to apply masks
2398            // because the unmasked parts will be overwritten by fields.
2399            // Write the fields.
2400            self.0.encode(encoder, offset + 0, depth)?;
2401            Ok(())
2402        }
2403    }
2404
2405    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2406        for PrimaryEnablePerformanceCountersRequest
2407    {
2408        #[inline(always)]
2409        fn new_empty() -> Self {
2410            Self { counters: fidl::new_empty!(fidl::encoding::Vector<u64, 64>, D) }
2411        }
2412
2413        #[inline]
2414        unsafe fn decode(
2415            &mut self,
2416            decoder: &mut fidl::encoding::Decoder<'_, D>,
2417            offset: usize,
2418            _depth: fidl::encoding::Depth,
2419        ) -> fidl::Result<()> {
2420            decoder.debug_check_bounds::<Self>(offset);
2421            // Verify that padding bytes are zero.
2422            fidl::decode!(fidl::encoding::Vector<u64, 64>, D, &mut self.counters, decoder, offset + 0, _depth)?;
2423            Ok(())
2424        }
2425    }
2426
2427    impl fidl::encoding::ValueTypeMarker for PrimaryExecuteCommandRequest {
2428        type Borrowed<'a> = &'a Self;
2429        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2430            value
2431        }
2432    }
2433
2434    unsafe impl fidl::encoding::TypeMarker for PrimaryExecuteCommandRequest {
2435        type Owned = Self;
2436
2437        #[inline(always)]
2438        fn inline_align(_context: fidl::encoding::Context) -> usize {
2439            8
2440        }
2441
2442        #[inline(always)]
2443        fn inline_size(_context: fidl::encoding::Context) -> usize {
2444            80
2445        }
2446    }
2447
2448    unsafe impl<D: fidl::encoding::ResourceDialect>
2449        fidl::encoding::Encode<PrimaryExecuteCommandRequest, D> for &PrimaryExecuteCommandRequest
2450    {
2451        #[inline]
2452        unsafe fn encode(
2453            self,
2454            encoder: &mut fidl::encoding::Encoder<'_, D>,
2455            offset: usize,
2456            _depth: fidl::encoding::Depth,
2457        ) -> fidl::Result<()> {
2458            encoder.debug_check_bounds::<PrimaryExecuteCommandRequest>(offset);
2459            // Delegate to tuple encoding.
2460            fidl::encoding::Encode::<PrimaryExecuteCommandRequest, D>::encode(
2461                (
2462                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.context_id),
2463                    <fidl::encoding::UnboundedVector<BufferRange> as fidl::encoding::ValueTypeMarker>::borrow(&self.resources),
2464                    <fidl::encoding::UnboundedVector<CommandBuffer> as fidl::encoding::ValueTypeMarker>::borrow(&self.command_buffers),
2465                    <fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.wait_semaphores),
2466                    <fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.signal_semaphores),
2467                    <CommandBufferFlags as fidl::encoding::ValueTypeMarker>::borrow(&self.flags),
2468                ),
2469                encoder, offset, _depth
2470            )
2471        }
2472    }
2473    unsafe impl<
2474            D: fidl::encoding::ResourceDialect,
2475            T0: fidl::encoding::Encode<u32, D>,
2476            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<BufferRange>, D>,
2477            T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<CommandBuffer>, D>,
2478            T3: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>, D>,
2479            T4: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>, D>,
2480            T5: fidl::encoding::Encode<CommandBufferFlags, D>,
2481        > fidl::encoding::Encode<PrimaryExecuteCommandRequest, D> for (T0, T1, T2, T3, T4, T5)
2482    {
2483        #[inline]
2484        unsafe fn encode(
2485            self,
2486            encoder: &mut fidl::encoding::Encoder<'_, D>,
2487            offset: usize,
2488            depth: fidl::encoding::Depth,
2489        ) -> fidl::Result<()> {
2490            encoder.debug_check_bounds::<PrimaryExecuteCommandRequest>(offset);
2491            // Zero out padding regions. There's no need to apply masks
2492            // because the unmasked parts will be overwritten by fields.
2493            unsafe {
2494                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2495                (ptr as *mut u64).write_unaligned(0);
2496            }
2497            // Write the fields.
2498            self.0.encode(encoder, offset + 0, depth)?;
2499            self.1.encode(encoder, offset + 8, depth)?;
2500            self.2.encode(encoder, offset + 24, depth)?;
2501            self.3.encode(encoder, offset + 40, depth)?;
2502            self.4.encode(encoder, offset + 56, depth)?;
2503            self.5.encode(encoder, offset + 72, depth)?;
2504            Ok(())
2505        }
2506    }
2507
2508    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2509        for PrimaryExecuteCommandRequest
2510    {
2511        #[inline(always)]
2512        fn new_empty() -> Self {
2513            Self {
2514                context_id: fidl::new_empty!(u32, D),
2515                resources: fidl::new_empty!(fidl::encoding::UnboundedVector<BufferRange>, D),
2516                command_buffers: fidl::new_empty!(
2517                    fidl::encoding::UnboundedVector<CommandBuffer>,
2518                    D
2519                ),
2520                wait_semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D),
2521                signal_semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D),
2522                flags: fidl::new_empty!(CommandBufferFlags, D),
2523            }
2524        }
2525
2526        #[inline]
2527        unsafe fn decode(
2528            &mut self,
2529            decoder: &mut fidl::encoding::Decoder<'_, D>,
2530            offset: usize,
2531            _depth: fidl::encoding::Depth,
2532        ) -> fidl::Result<()> {
2533            decoder.debug_check_bounds::<Self>(offset);
2534            // Verify that padding bytes are zero.
2535            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2536            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2537            let mask = 0xffffffff00000000u64;
2538            let maskedval = padval & mask;
2539            if maskedval != 0 {
2540                return Err(fidl::Error::NonZeroPadding {
2541                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2542                });
2543            }
2544            fidl::decode!(u32, D, &mut self.context_id, decoder, offset + 0, _depth)?;
2545            fidl::decode!(
2546                fidl::encoding::UnboundedVector<BufferRange>,
2547                D,
2548                &mut self.resources,
2549                decoder,
2550                offset + 8,
2551                _depth
2552            )?;
2553            fidl::decode!(
2554                fidl::encoding::UnboundedVector<CommandBuffer>,
2555                D,
2556                &mut self.command_buffers,
2557                decoder,
2558                offset + 24,
2559                _depth
2560            )?;
2561            fidl::decode!(
2562                fidl::encoding::UnboundedVector<u64>,
2563                D,
2564                &mut self.wait_semaphores,
2565                decoder,
2566                offset + 40,
2567                _depth
2568            )?;
2569            fidl::decode!(
2570                fidl::encoding::UnboundedVector<u64>,
2571                D,
2572                &mut self.signal_semaphores,
2573                decoder,
2574                offset + 56,
2575                _depth
2576            )?;
2577            fidl::decode!(CommandBufferFlags, D, &mut self.flags, decoder, offset + 72, _depth)?;
2578            Ok(())
2579        }
2580    }
2581
2582    impl fidl::encoding::ValueTypeMarker for PrimaryExecuteImmediateCommandsRequest {
2583        type Borrowed<'a> = &'a Self;
2584        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2585            value
2586        }
2587    }
2588
2589    unsafe impl fidl::encoding::TypeMarker for PrimaryExecuteImmediateCommandsRequest {
2590        type Owned = Self;
2591
2592        #[inline(always)]
2593        fn inline_align(_context: fidl::encoding::Context) -> usize {
2594            8
2595        }
2596
2597        #[inline(always)]
2598        fn inline_size(_context: fidl::encoding::Context) -> usize {
2599            40
2600        }
2601    }
2602
2603    unsafe impl<D: fidl::encoding::ResourceDialect>
2604        fidl::encoding::Encode<PrimaryExecuteImmediateCommandsRequest, D>
2605        for &PrimaryExecuteImmediateCommandsRequest
2606    {
2607        #[inline]
2608        unsafe fn encode(
2609            self,
2610            encoder: &mut fidl::encoding::Encoder<'_, D>,
2611            offset: usize,
2612            _depth: fidl::encoding::Depth,
2613        ) -> fidl::Result<()> {
2614            encoder.debug_check_bounds::<PrimaryExecuteImmediateCommandsRequest>(offset);
2615            // Delegate to tuple encoding.
2616            fidl::encoding::Encode::<PrimaryExecuteImmediateCommandsRequest, D>::encode(
2617                (
2618                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.context_id),
2619                    <fidl::encoding::Vector<u8, 2048> as fidl::encoding::ValueTypeMarker>::borrow(&self.command_data),
2620                    <fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.semaphores),
2621                ),
2622                encoder, offset, _depth
2623            )
2624        }
2625    }
2626    unsafe impl<
2627            D: fidl::encoding::ResourceDialect,
2628            T0: fidl::encoding::Encode<u32, D>,
2629            T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 2048>, D>,
2630            T2: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u64>, D>,
2631        > fidl::encoding::Encode<PrimaryExecuteImmediateCommandsRequest, D> for (T0, T1, T2)
2632    {
2633        #[inline]
2634        unsafe fn encode(
2635            self,
2636            encoder: &mut fidl::encoding::Encoder<'_, D>,
2637            offset: usize,
2638            depth: fidl::encoding::Depth,
2639        ) -> fidl::Result<()> {
2640            encoder.debug_check_bounds::<PrimaryExecuteImmediateCommandsRequest>(offset);
2641            // Zero out padding regions. There's no need to apply masks
2642            // because the unmasked parts will be overwritten by fields.
2643            unsafe {
2644                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2645                (ptr as *mut u64).write_unaligned(0);
2646            }
2647            // Write the fields.
2648            self.0.encode(encoder, offset + 0, depth)?;
2649            self.1.encode(encoder, offset + 8, depth)?;
2650            self.2.encode(encoder, offset + 24, depth)?;
2651            Ok(())
2652        }
2653    }
2654
2655    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2656        for PrimaryExecuteImmediateCommandsRequest
2657    {
2658        #[inline(always)]
2659        fn new_empty() -> Self {
2660            Self {
2661                context_id: fidl::new_empty!(u32, D),
2662                command_data: fidl::new_empty!(fidl::encoding::Vector<u8, 2048>, D),
2663                semaphores: fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D),
2664            }
2665        }
2666
2667        #[inline]
2668        unsafe fn decode(
2669            &mut self,
2670            decoder: &mut fidl::encoding::Decoder<'_, D>,
2671            offset: usize,
2672            _depth: fidl::encoding::Depth,
2673        ) -> fidl::Result<()> {
2674            decoder.debug_check_bounds::<Self>(offset);
2675            // Verify that padding bytes are zero.
2676            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2677            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2678            let mask = 0xffffffff00000000u64;
2679            let maskedval = padval & mask;
2680            if maskedval != 0 {
2681                return Err(fidl::Error::NonZeroPadding {
2682                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2683                });
2684            }
2685            fidl::decode!(u32, D, &mut self.context_id, decoder, offset + 0, _depth)?;
2686            fidl::decode!(fidl::encoding::Vector<u8, 2048>, D, &mut self.command_data, decoder, offset + 8, _depth)?;
2687            fidl::decode!(
2688                fidl::encoding::UnboundedVector<u64>,
2689                D,
2690                &mut self.semaphores,
2691                decoder,
2692                offset + 24,
2693                _depth
2694            )?;
2695            Ok(())
2696        }
2697    }
2698
2699    impl fidl::encoding::ValueTypeMarker for PrimaryExecuteInlineCommandsRequest {
2700        type Borrowed<'a> = &'a Self;
2701        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2702            value
2703        }
2704    }
2705
2706    unsafe impl fidl::encoding::TypeMarker for PrimaryExecuteInlineCommandsRequest {
2707        type Owned = Self;
2708
2709        #[inline(always)]
2710        fn inline_align(_context: fidl::encoding::Context) -> usize {
2711            8
2712        }
2713
2714        #[inline(always)]
2715        fn inline_size(_context: fidl::encoding::Context) -> usize {
2716            24
2717        }
2718    }
2719
2720    unsafe impl<D: fidl::encoding::ResourceDialect>
2721        fidl::encoding::Encode<PrimaryExecuteInlineCommandsRequest, D>
2722        for &PrimaryExecuteInlineCommandsRequest
2723    {
2724        #[inline]
2725        unsafe fn encode(
2726            self,
2727            encoder: &mut fidl::encoding::Encoder<'_, D>,
2728            offset: usize,
2729            _depth: fidl::encoding::Depth,
2730        ) -> fidl::Result<()> {
2731            encoder.debug_check_bounds::<PrimaryExecuteInlineCommandsRequest>(offset);
2732            // Delegate to tuple encoding.
2733            fidl::encoding::Encode::<PrimaryExecuteInlineCommandsRequest, D>::encode(
2734                (
2735                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.context_id),
2736                    <fidl::encoding::UnboundedVector<InlineCommand> as fidl::encoding::ValueTypeMarker>::borrow(&self.commands),
2737                ),
2738                encoder, offset, _depth
2739            )
2740        }
2741    }
2742    unsafe impl<
2743            D: fidl::encoding::ResourceDialect,
2744            T0: fidl::encoding::Encode<u32, D>,
2745            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<InlineCommand>, D>,
2746        > fidl::encoding::Encode<PrimaryExecuteInlineCommandsRequest, D> for (T0, T1)
2747    {
2748        #[inline]
2749        unsafe fn encode(
2750            self,
2751            encoder: &mut fidl::encoding::Encoder<'_, D>,
2752            offset: usize,
2753            depth: fidl::encoding::Depth,
2754        ) -> fidl::Result<()> {
2755            encoder.debug_check_bounds::<PrimaryExecuteInlineCommandsRequest>(offset);
2756            // Zero out padding regions. There's no need to apply masks
2757            // because the unmasked parts will be overwritten by fields.
2758            unsafe {
2759                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2760                (ptr as *mut u64).write_unaligned(0);
2761            }
2762            // Write the fields.
2763            self.0.encode(encoder, offset + 0, depth)?;
2764            self.1.encode(encoder, offset + 8, depth)?;
2765            Ok(())
2766        }
2767    }
2768
2769    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2770        for PrimaryExecuteInlineCommandsRequest
2771    {
2772        #[inline(always)]
2773        fn new_empty() -> Self {
2774            Self {
2775                context_id: fidl::new_empty!(u32, D),
2776                commands: fidl::new_empty!(fidl::encoding::UnboundedVector<InlineCommand>, D),
2777            }
2778        }
2779
2780        #[inline]
2781        unsafe fn decode(
2782            &mut self,
2783            decoder: &mut fidl::encoding::Decoder<'_, D>,
2784            offset: usize,
2785            _depth: fidl::encoding::Depth,
2786        ) -> fidl::Result<()> {
2787            decoder.debug_check_bounds::<Self>(offset);
2788            // Verify that padding bytes are zero.
2789            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2790            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2791            let mask = 0xffffffff00000000u64;
2792            let maskedval = padval & mask;
2793            if maskedval != 0 {
2794                return Err(fidl::Error::NonZeroPadding {
2795                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2796                });
2797            }
2798            fidl::decode!(u32, D, &mut self.context_id, decoder, offset + 0, _depth)?;
2799            fidl::decode!(
2800                fidl::encoding::UnboundedVector<InlineCommand>,
2801                D,
2802                &mut self.commands,
2803                decoder,
2804                offset + 8,
2805                _depth
2806            )?;
2807            Ok(())
2808        }
2809    }
2810
2811    impl fidl::encoding::ValueTypeMarker for PrimaryIsPerformanceCounterAccessAllowedResponse {
2812        type Borrowed<'a> = &'a Self;
2813        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2814            value
2815        }
2816    }
2817
2818    unsafe impl fidl::encoding::TypeMarker for PrimaryIsPerformanceCounterAccessAllowedResponse {
2819        type Owned = Self;
2820
2821        #[inline(always)]
2822        fn inline_align(_context: fidl::encoding::Context) -> usize {
2823            1
2824        }
2825
2826        #[inline(always)]
2827        fn inline_size(_context: fidl::encoding::Context) -> usize {
2828            1
2829        }
2830    }
2831
2832    unsafe impl<D: fidl::encoding::ResourceDialect>
2833        fidl::encoding::Encode<PrimaryIsPerformanceCounterAccessAllowedResponse, D>
2834        for &PrimaryIsPerformanceCounterAccessAllowedResponse
2835    {
2836        #[inline]
2837        unsafe fn encode(
2838            self,
2839            encoder: &mut fidl::encoding::Encoder<'_, D>,
2840            offset: usize,
2841            _depth: fidl::encoding::Depth,
2842        ) -> fidl::Result<()> {
2843            encoder.debug_check_bounds::<PrimaryIsPerformanceCounterAccessAllowedResponse>(offset);
2844            // Delegate to tuple encoding.
2845            fidl::encoding::Encode::<PrimaryIsPerformanceCounterAccessAllowedResponse, D>::encode(
2846                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
2847                encoder,
2848                offset,
2849                _depth,
2850            )
2851        }
2852    }
2853    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2854        fidl::encoding::Encode<PrimaryIsPerformanceCounterAccessAllowedResponse, D> for (T0,)
2855    {
2856        #[inline]
2857        unsafe fn encode(
2858            self,
2859            encoder: &mut fidl::encoding::Encoder<'_, D>,
2860            offset: usize,
2861            depth: fidl::encoding::Depth,
2862        ) -> fidl::Result<()> {
2863            encoder.debug_check_bounds::<PrimaryIsPerformanceCounterAccessAllowedResponse>(offset);
2864            // Zero out padding regions. There's no need to apply masks
2865            // because the unmasked parts will be overwritten by fields.
2866            // Write the fields.
2867            self.0.encode(encoder, offset + 0, depth)?;
2868            Ok(())
2869        }
2870    }
2871
2872    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2873        for PrimaryIsPerformanceCounterAccessAllowedResponse
2874    {
2875        #[inline(always)]
2876        fn new_empty() -> Self {
2877            Self { enabled: fidl::new_empty!(bool, D) }
2878        }
2879
2880        #[inline]
2881        unsafe fn decode(
2882            &mut self,
2883            decoder: &mut fidl::encoding::Decoder<'_, D>,
2884            offset: usize,
2885            _depth: fidl::encoding::Depth,
2886        ) -> fidl::Result<()> {
2887            decoder.debug_check_bounds::<Self>(offset);
2888            // Verify that padding bytes are zero.
2889            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
2890            Ok(())
2891        }
2892    }
2893
2894    impl fidl::encoding::ValueTypeMarker for PrimaryOnNotifyMemoryImportedRequest {
2895        type Borrowed<'a> = &'a Self;
2896        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2897            value
2898        }
2899    }
2900
2901    unsafe impl fidl::encoding::TypeMarker for PrimaryOnNotifyMemoryImportedRequest {
2902        type Owned = Self;
2903
2904        #[inline(always)]
2905        fn inline_align(_context: fidl::encoding::Context) -> usize {
2906            8
2907        }
2908
2909        #[inline(always)]
2910        fn inline_size(_context: fidl::encoding::Context) -> usize {
2911            8
2912        }
2913        #[inline(always)]
2914        fn encode_is_copy() -> bool {
2915            true
2916        }
2917
2918        #[inline(always)]
2919        fn decode_is_copy() -> bool {
2920            true
2921        }
2922    }
2923
2924    unsafe impl<D: fidl::encoding::ResourceDialect>
2925        fidl::encoding::Encode<PrimaryOnNotifyMemoryImportedRequest, D>
2926        for &PrimaryOnNotifyMemoryImportedRequest
2927    {
2928        #[inline]
2929        unsafe fn encode(
2930            self,
2931            encoder: &mut fidl::encoding::Encoder<'_, D>,
2932            offset: usize,
2933            _depth: fidl::encoding::Depth,
2934        ) -> fidl::Result<()> {
2935            encoder.debug_check_bounds::<PrimaryOnNotifyMemoryImportedRequest>(offset);
2936            unsafe {
2937                // Copy the object into the buffer.
2938                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2939                (buf_ptr as *mut PrimaryOnNotifyMemoryImportedRequest)
2940                    .write_unaligned((self as *const PrimaryOnNotifyMemoryImportedRequest).read());
2941                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2942                // done second because the memcpy will write garbage to these bytes.
2943            }
2944            Ok(())
2945        }
2946    }
2947    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2948        fidl::encoding::Encode<PrimaryOnNotifyMemoryImportedRequest, D> for (T0,)
2949    {
2950        #[inline]
2951        unsafe fn encode(
2952            self,
2953            encoder: &mut fidl::encoding::Encoder<'_, D>,
2954            offset: usize,
2955            depth: fidl::encoding::Depth,
2956        ) -> fidl::Result<()> {
2957            encoder.debug_check_bounds::<PrimaryOnNotifyMemoryImportedRequest>(offset);
2958            // Zero out padding regions. There's no need to apply masks
2959            // because the unmasked parts will be overwritten by fields.
2960            // Write the fields.
2961            self.0.encode(encoder, offset + 0, depth)?;
2962            Ok(())
2963        }
2964    }
2965
2966    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2967        for PrimaryOnNotifyMemoryImportedRequest
2968    {
2969        #[inline(always)]
2970        fn new_empty() -> Self {
2971            Self { bytes: fidl::new_empty!(u64, D) }
2972        }
2973
2974        #[inline]
2975        unsafe fn decode(
2976            &mut self,
2977            decoder: &mut fidl::encoding::Decoder<'_, D>,
2978            offset: usize,
2979            _depth: fidl::encoding::Depth,
2980        ) -> fidl::Result<()> {
2981            decoder.debug_check_bounds::<Self>(offset);
2982            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2983            // Verify that padding bytes are zero.
2984            // Copy from the buffer into the object.
2985            unsafe {
2986                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2987            }
2988            Ok(())
2989        }
2990    }
2991
2992    impl fidl::encoding::ValueTypeMarker for PrimaryOnNotifyMessagesConsumedRequest {
2993        type Borrowed<'a> = &'a Self;
2994        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2995            value
2996        }
2997    }
2998
2999    unsafe impl fidl::encoding::TypeMarker for PrimaryOnNotifyMessagesConsumedRequest {
3000        type Owned = Self;
3001
3002        #[inline(always)]
3003        fn inline_align(_context: fidl::encoding::Context) -> usize {
3004            8
3005        }
3006
3007        #[inline(always)]
3008        fn inline_size(_context: fidl::encoding::Context) -> usize {
3009            8
3010        }
3011        #[inline(always)]
3012        fn encode_is_copy() -> bool {
3013            true
3014        }
3015
3016        #[inline(always)]
3017        fn decode_is_copy() -> bool {
3018            true
3019        }
3020    }
3021
3022    unsafe impl<D: fidl::encoding::ResourceDialect>
3023        fidl::encoding::Encode<PrimaryOnNotifyMessagesConsumedRequest, D>
3024        for &PrimaryOnNotifyMessagesConsumedRequest
3025    {
3026        #[inline]
3027        unsafe fn encode(
3028            self,
3029            encoder: &mut fidl::encoding::Encoder<'_, D>,
3030            offset: usize,
3031            _depth: fidl::encoding::Depth,
3032        ) -> fidl::Result<()> {
3033            encoder.debug_check_bounds::<PrimaryOnNotifyMessagesConsumedRequest>(offset);
3034            unsafe {
3035                // Copy the object into the buffer.
3036                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3037                (buf_ptr as *mut PrimaryOnNotifyMessagesConsumedRequest).write_unaligned(
3038                    (self as *const PrimaryOnNotifyMessagesConsumedRequest).read(),
3039                );
3040                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3041                // done second because the memcpy will write garbage to these bytes.
3042            }
3043            Ok(())
3044        }
3045    }
3046    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
3047        fidl::encoding::Encode<PrimaryOnNotifyMessagesConsumedRequest, D> for (T0,)
3048    {
3049        #[inline]
3050        unsafe fn encode(
3051            self,
3052            encoder: &mut fidl::encoding::Encoder<'_, D>,
3053            offset: usize,
3054            depth: fidl::encoding::Depth,
3055        ) -> fidl::Result<()> {
3056            encoder.debug_check_bounds::<PrimaryOnNotifyMessagesConsumedRequest>(offset);
3057            // Zero out padding regions. There's no need to apply masks
3058            // because the unmasked parts will be overwritten by fields.
3059            // Write the fields.
3060            self.0.encode(encoder, offset + 0, depth)?;
3061            Ok(())
3062        }
3063    }
3064
3065    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3066        for PrimaryOnNotifyMessagesConsumedRequest
3067    {
3068        #[inline(always)]
3069        fn new_empty() -> Self {
3070            Self { count: fidl::new_empty!(u64, D) }
3071        }
3072
3073        #[inline]
3074        unsafe fn decode(
3075            &mut self,
3076            decoder: &mut fidl::encoding::Decoder<'_, D>,
3077            offset: usize,
3078            _depth: fidl::encoding::Depth,
3079        ) -> fidl::Result<()> {
3080            decoder.debug_check_bounds::<Self>(offset);
3081            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3082            // Verify that padding bytes are zero.
3083            // Copy from the buffer into the object.
3084            unsafe {
3085                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3086            }
3087            Ok(())
3088        }
3089    }
3090
3091    impl fidl::encoding::ValueTypeMarker for PrimaryReleaseObjectRequest {
3092        type Borrowed<'a> = &'a Self;
3093        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3094            value
3095        }
3096    }
3097
3098    unsafe impl fidl::encoding::TypeMarker for PrimaryReleaseObjectRequest {
3099        type Owned = Self;
3100
3101        #[inline(always)]
3102        fn inline_align(_context: fidl::encoding::Context) -> usize {
3103            8
3104        }
3105
3106        #[inline(always)]
3107        fn inline_size(_context: fidl::encoding::Context) -> usize {
3108            16
3109        }
3110    }
3111
3112    unsafe impl<D: fidl::encoding::ResourceDialect>
3113        fidl::encoding::Encode<PrimaryReleaseObjectRequest, D> for &PrimaryReleaseObjectRequest
3114    {
3115        #[inline]
3116        unsafe fn encode(
3117            self,
3118            encoder: &mut fidl::encoding::Encoder<'_, D>,
3119            offset: usize,
3120            _depth: fidl::encoding::Depth,
3121        ) -> fidl::Result<()> {
3122            encoder.debug_check_bounds::<PrimaryReleaseObjectRequest>(offset);
3123            // Delegate to tuple encoding.
3124            fidl::encoding::Encode::<PrimaryReleaseObjectRequest, D>::encode(
3125                (
3126                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.object_id),
3127                    <ObjectType as fidl::encoding::ValueTypeMarker>::borrow(&self.object_type),
3128                ),
3129                encoder,
3130                offset,
3131                _depth,
3132            )
3133        }
3134    }
3135    unsafe impl<
3136            D: fidl::encoding::ResourceDialect,
3137            T0: fidl::encoding::Encode<u64, D>,
3138            T1: fidl::encoding::Encode<ObjectType, D>,
3139        > fidl::encoding::Encode<PrimaryReleaseObjectRequest, D> for (T0, T1)
3140    {
3141        #[inline]
3142        unsafe fn encode(
3143            self,
3144            encoder: &mut fidl::encoding::Encoder<'_, D>,
3145            offset: usize,
3146            depth: fidl::encoding::Depth,
3147        ) -> fidl::Result<()> {
3148            encoder.debug_check_bounds::<PrimaryReleaseObjectRequest>(offset);
3149            // Zero out padding regions. There's no need to apply masks
3150            // because the unmasked parts will be overwritten by fields.
3151            unsafe {
3152                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3153                (ptr as *mut u64).write_unaligned(0);
3154            }
3155            // Write the fields.
3156            self.0.encode(encoder, offset + 0, depth)?;
3157            self.1.encode(encoder, offset + 8, depth)?;
3158            Ok(())
3159        }
3160    }
3161
3162    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3163        for PrimaryReleaseObjectRequest
3164    {
3165        #[inline(always)]
3166        fn new_empty() -> Self {
3167            Self {
3168                object_id: fidl::new_empty!(u64, D),
3169                object_type: fidl::new_empty!(ObjectType, D),
3170            }
3171        }
3172
3173        #[inline]
3174        unsafe fn decode(
3175            &mut self,
3176            decoder: &mut fidl::encoding::Decoder<'_, D>,
3177            offset: usize,
3178            _depth: fidl::encoding::Depth,
3179        ) -> fidl::Result<()> {
3180            decoder.debug_check_bounds::<Self>(offset);
3181            // Verify that padding bytes are zero.
3182            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3183            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3184            let mask = 0xffffffff00000000u64;
3185            let maskedval = padval & mask;
3186            if maskedval != 0 {
3187                return Err(fidl::Error::NonZeroPadding {
3188                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3189                });
3190            }
3191            fidl::decode!(u64, D, &mut self.object_id, decoder, offset + 0, _depth)?;
3192            fidl::decode!(ObjectType, D, &mut self.object_type, decoder, offset + 8, _depth)?;
3193            Ok(())
3194        }
3195    }
3196
3197    impl fidl::encoding::ValueTypeMarker for PrimaryReleasePerformanceCounterBufferPoolRequest {
3198        type Borrowed<'a> = &'a Self;
3199        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3200            value
3201        }
3202    }
3203
3204    unsafe impl fidl::encoding::TypeMarker for PrimaryReleasePerformanceCounterBufferPoolRequest {
3205        type Owned = Self;
3206
3207        #[inline(always)]
3208        fn inline_align(_context: fidl::encoding::Context) -> usize {
3209            8
3210        }
3211
3212        #[inline(always)]
3213        fn inline_size(_context: fidl::encoding::Context) -> usize {
3214            8
3215        }
3216        #[inline(always)]
3217        fn encode_is_copy() -> bool {
3218            true
3219        }
3220
3221        #[inline(always)]
3222        fn decode_is_copy() -> bool {
3223            true
3224        }
3225    }
3226
3227    unsafe impl<D: fidl::encoding::ResourceDialect>
3228        fidl::encoding::Encode<PrimaryReleasePerformanceCounterBufferPoolRequest, D>
3229        for &PrimaryReleasePerformanceCounterBufferPoolRequest
3230    {
3231        #[inline]
3232        unsafe fn encode(
3233            self,
3234            encoder: &mut fidl::encoding::Encoder<'_, D>,
3235            offset: usize,
3236            _depth: fidl::encoding::Depth,
3237        ) -> fidl::Result<()> {
3238            encoder.debug_check_bounds::<PrimaryReleasePerformanceCounterBufferPoolRequest>(offset);
3239            unsafe {
3240                // Copy the object into the buffer.
3241                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3242                (buf_ptr as *mut PrimaryReleasePerformanceCounterBufferPoolRequest)
3243                    .write_unaligned(
3244                        (self as *const PrimaryReleasePerformanceCounterBufferPoolRequest).read(),
3245                    );
3246                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3247                // done second because the memcpy will write garbage to these bytes.
3248            }
3249            Ok(())
3250        }
3251    }
3252    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
3253        fidl::encoding::Encode<PrimaryReleasePerformanceCounterBufferPoolRequest, D> for (T0,)
3254    {
3255        #[inline]
3256        unsafe fn encode(
3257            self,
3258            encoder: &mut fidl::encoding::Encoder<'_, D>,
3259            offset: usize,
3260            depth: fidl::encoding::Depth,
3261        ) -> fidl::Result<()> {
3262            encoder.debug_check_bounds::<PrimaryReleasePerformanceCounterBufferPoolRequest>(offset);
3263            // Zero out padding regions. There's no need to apply masks
3264            // because the unmasked parts will be overwritten by fields.
3265            // Write the fields.
3266            self.0.encode(encoder, offset + 0, depth)?;
3267            Ok(())
3268        }
3269    }
3270
3271    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3272        for PrimaryReleasePerformanceCounterBufferPoolRequest
3273    {
3274        #[inline(always)]
3275        fn new_empty() -> Self {
3276            Self { pool_id: fidl::new_empty!(u64, D) }
3277        }
3278
3279        #[inline]
3280        unsafe fn decode(
3281            &mut self,
3282            decoder: &mut fidl::encoding::Decoder<'_, D>,
3283            offset: usize,
3284            _depth: fidl::encoding::Depth,
3285        ) -> fidl::Result<()> {
3286            decoder.debug_check_bounds::<Self>(offset);
3287            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3288            // Verify that padding bytes are zero.
3289            // Copy from the buffer into the object.
3290            unsafe {
3291                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3292            }
3293            Ok(())
3294        }
3295    }
3296
3297    impl fidl::encoding::ValueTypeMarker for PrimaryRemovePerformanceCounterBufferFromPoolRequest {
3298        type Borrowed<'a> = &'a Self;
3299        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3300            value
3301        }
3302    }
3303
3304    unsafe impl fidl::encoding::TypeMarker for PrimaryRemovePerformanceCounterBufferFromPoolRequest {
3305        type Owned = Self;
3306
3307        #[inline(always)]
3308        fn inline_align(_context: fidl::encoding::Context) -> usize {
3309            8
3310        }
3311
3312        #[inline(always)]
3313        fn inline_size(_context: fidl::encoding::Context) -> usize {
3314            16
3315        }
3316        #[inline(always)]
3317        fn encode_is_copy() -> bool {
3318            true
3319        }
3320
3321        #[inline(always)]
3322        fn decode_is_copy() -> bool {
3323            true
3324        }
3325    }
3326
3327    unsafe impl<D: fidl::encoding::ResourceDialect>
3328        fidl::encoding::Encode<PrimaryRemovePerformanceCounterBufferFromPoolRequest, D>
3329        for &PrimaryRemovePerformanceCounterBufferFromPoolRequest
3330    {
3331        #[inline]
3332        unsafe fn encode(
3333            self,
3334            encoder: &mut fidl::encoding::Encoder<'_, D>,
3335            offset: usize,
3336            _depth: fidl::encoding::Depth,
3337        ) -> fidl::Result<()> {
3338            encoder
3339                .debug_check_bounds::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(offset);
3340            unsafe {
3341                // Copy the object into the buffer.
3342                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3343                (buf_ptr as *mut PrimaryRemovePerformanceCounterBufferFromPoolRequest)
3344                    .write_unaligned(
3345                        (self as *const PrimaryRemovePerformanceCounterBufferFromPoolRequest)
3346                            .read(),
3347                    );
3348                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3349                // done second because the memcpy will write garbage to these bytes.
3350            }
3351            Ok(())
3352        }
3353    }
3354    unsafe impl<
3355            D: fidl::encoding::ResourceDialect,
3356            T0: fidl::encoding::Encode<u64, D>,
3357            T1: fidl::encoding::Encode<u64, D>,
3358        > fidl::encoding::Encode<PrimaryRemovePerformanceCounterBufferFromPoolRequest, D>
3359        for (T0, T1)
3360    {
3361        #[inline]
3362        unsafe fn encode(
3363            self,
3364            encoder: &mut fidl::encoding::Encoder<'_, D>,
3365            offset: usize,
3366            depth: fidl::encoding::Depth,
3367        ) -> fidl::Result<()> {
3368            encoder
3369                .debug_check_bounds::<PrimaryRemovePerformanceCounterBufferFromPoolRequest>(offset);
3370            // Zero out padding regions. There's no need to apply masks
3371            // because the unmasked parts will be overwritten by fields.
3372            // Write the fields.
3373            self.0.encode(encoder, offset + 0, depth)?;
3374            self.1.encode(encoder, offset + 8, depth)?;
3375            Ok(())
3376        }
3377    }
3378
3379    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3380        for PrimaryRemovePerformanceCounterBufferFromPoolRequest
3381    {
3382        #[inline(always)]
3383        fn new_empty() -> Self {
3384            Self { pool_id: fidl::new_empty!(u64, D), buffer_id: fidl::new_empty!(u64, D) }
3385        }
3386
3387        #[inline]
3388        unsafe fn decode(
3389            &mut self,
3390            decoder: &mut fidl::encoding::Decoder<'_, D>,
3391            offset: usize,
3392            _depth: fidl::encoding::Depth,
3393        ) -> fidl::Result<()> {
3394            decoder.debug_check_bounds::<Self>(offset);
3395            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3396            // Verify that padding bytes are zero.
3397            // Copy from the buffer into the object.
3398            unsafe {
3399                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3400            }
3401            Ok(())
3402        }
3403    }
3404
3405    impl fidl::encoding::ValueTypeMarker for TestDeviceGetUnitTestStatusResponse {
3406        type Borrowed<'a> = &'a Self;
3407        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3408            value
3409        }
3410    }
3411
3412    unsafe impl fidl::encoding::TypeMarker for TestDeviceGetUnitTestStatusResponse {
3413        type Owned = Self;
3414
3415        #[inline(always)]
3416        fn inline_align(_context: fidl::encoding::Context) -> usize {
3417            4
3418        }
3419
3420        #[inline(always)]
3421        fn inline_size(_context: fidl::encoding::Context) -> usize {
3422            4
3423        }
3424        #[inline(always)]
3425        fn encode_is_copy() -> bool {
3426            true
3427        }
3428
3429        #[inline(always)]
3430        fn decode_is_copy() -> bool {
3431            true
3432        }
3433    }
3434
3435    unsafe impl<D: fidl::encoding::ResourceDialect>
3436        fidl::encoding::Encode<TestDeviceGetUnitTestStatusResponse, D>
3437        for &TestDeviceGetUnitTestStatusResponse
3438    {
3439        #[inline]
3440        unsafe fn encode(
3441            self,
3442            encoder: &mut fidl::encoding::Encoder<'_, D>,
3443            offset: usize,
3444            _depth: fidl::encoding::Depth,
3445        ) -> fidl::Result<()> {
3446            encoder.debug_check_bounds::<TestDeviceGetUnitTestStatusResponse>(offset);
3447            unsafe {
3448                // Copy the object into the buffer.
3449                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3450                (buf_ptr as *mut TestDeviceGetUnitTestStatusResponse)
3451                    .write_unaligned((self as *const TestDeviceGetUnitTestStatusResponse).read());
3452                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3453                // done second because the memcpy will write garbage to these bytes.
3454            }
3455            Ok(())
3456        }
3457    }
3458    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
3459        fidl::encoding::Encode<TestDeviceGetUnitTestStatusResponse, D> for (T0,)
3460    {
3461        #[inline]
3462        unsafe fn encode(
3463            self,
3464            encoder: &mut fidl::encoding::Encoder<'_, D>,
3465            offset: usize,
3466            depth: fidl::encoding::Depth,
3467        ) -> fidl::Result<()> {
3468            encoder.debug_check_bounds::<TestDeviceGetUnitTestStatusResponse>(offset);
3469            // Zero out padding regions. There's no need to apply masks
3470            // because the unmasked parts will be overwritten by fields.
3471            // Write the fields.
3472            self.0.encode(encoder, offset + 0, depth)?;
3473            Ok(())
3474        }
3475    }
3476
3477    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3478        for TestDeviceGetUnitTestStatusResponse
3479    {
3480        #[inline(always)]
3481        fn new_empty() -> Self {
3482            Self { status: fidl::new_empty!(i32, D) }
3483        }
3484
3485        #[inline]
3486        unsafe fn decode(
3487            &mut self,
3488            decoder: &mut fidl::encoding::Decoder<'_, D>,
3489            offset: usize,
3490            _depth: fidl::encoding::Depth,
3491        ) -> fidl::Result<()> {
3492            decoder.debug_check_bounds::<Self>(offset);
3493            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3494            // Verify that padding bytes are zero.
3495            // Copy from the buffer into the object.
3496            unsafe {
3497                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3498            }
3499            Ok(())
3500        }
3501    }
3502
3503    impl IcdInfo {
3504        #[inline(always)]
3505        fn max_ordinal_present(&self) -> u64 {
3506            if let Some(_) = self.flags {
3507                return 2;
3508            }
3509            if let Some(_) = self.component_url {
3510                return 1;
3511            }
3512            0
3513        }
3514    }
3515
3516    impl fidl::encoding::ValueTypeMarker for IcdInfo {
3517        type Borrowed<'a> = &'a Self;
3518        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3519            value
3520        }
3521    }
3522
3523    unsafe impl fidl::encoding::TypeMarker for IcdInfo {
3524        type Owned = Self;
3525
3526        #[inline(always)]
3527        fn inline_align(_context: fidl::encoding::Context) -> usize {
3528            8
3529        }
3530
3531        #[inline(always)]
3532        fn inline_size(_context: fidl::encoding::Context) -> usize {
3533            16
3534        }
3535    }
3536
3537    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IcdInfo, D> for &IcdInfo {
3538        unsafe fn encode(
3539            self,
3540            encoder: &mut fidl::encoding::Encoder<'_, D>,
3541            offset: usize,
3542            mut depth: fidl::encoding::Depth,
3543        ) -> fidl::Result<()> {
3544            encoder.debug_check_bounds::<IcdInfo>(offset);
3545            // Vector header
3546            let max_ordinal: u64 = self.max_ordinal_present();
3547            encoder.write_num(max_ordinal, offset);
3548            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3549            // Calling encoder.out_of_line_offset(0) is not allowed.
3550            if max_ordinal == 0 {
3551                return Ok(());
3552            }
3553            depth.increment()?;
3554            let envelope_size = 8;
3555            let bytes_len = max_ordinal as usize * envelope_size;
3556            #[allow(unused_variables)]
3557            let offset = encoder.out_of_line_offset(bytes_len);
3558            let mut _prev_end_offset: usize = 0;
3559            if 1 > 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 = (1 - 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::<fidl::encoding::BoundedString<4096>, D>(
3575            self.component_url.as_ref().map(<fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow),
3576            encoder, offset + cur_offset, depth
3577        )?;
3578
3579            _prev_end_offset = cur_offset + envelope_size;
3580            if 2 > max_ordinal {
3581                return Ok(());
3582            }
3583
3584            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3585            // are envelope_size bytes.
3586            let cur_offset: usize = (2 - 1) * envelope_size;
3587
3588            // Zero reserved fields.
3589            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3590
3591            // Safety:
3592            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3593            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3594            //   envelope_size bytes, there is always sufficient room.
3595            fidl::encoding::encode_in_envelope_optional::<IcdFlags, D>(
3596                self.flags.as_ref().map(<IcdFlags as fidl::encoding::ValueTypeMarker>::borrow),
3597                encoder,
3598                offset + cur_offset,
3599                depth,
3600            )?;
3601
3602            _prev_end_offset = cur_offset + envelope_size;
3603
3604            Ok(())
3605        }
3606    }
3607
3608    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IcdInfo {
3609        #[inline(always)]
3610        fn new_empty() -> Self {
3611            Self::default()
3612        }
3613
3614        unsafe fn decode(
3615            &mut self,
3616            decoder: &mut fidl::encoding::Decoder<'_, D>,
3617            offset: usize,
3618            mut depth: fidl::encoding::Depth,
3619        ) -> fidl::Result<()> {
3620            decoder.debug_check_bounds::<Self>(offset);
3621            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3622                None => return Err(fidl::Error::NotNullable),
3623                Some(len) => len,
3624            };
3625            // Calling decoder.out_of_line_offset(0) is not allowed.
3626            if len == 0 {
3627                return Ok(());
3628            };
3629            depth.increment()?;
3630            let envelope_size = 8;
3631            let bytes_len = len * envelope_size;
3632            let offset = decoder.out_of_line_offset(bytes_len)?;
3633            // Decode the envelope for each type.
3634            let mut _next_ordinal_to_read = 0;
3635            let mut next_offset = offset;
3636            let end_offset = offset + bytes_len;
3637            _next_ordinal_to_read += 1;
3638            if next_offset >= end_offset {
3639                return Ok(());
3640            }
3641
3642            // Decode unknown envelopes for gaps in ordinals.
3643            while _next_ordinal_to_read < 1 {
3644                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3645                _next_ordinal_to_read += 1;
3646                next_offset += envelope_size;
3647            }
3648
3649            let next_out_of_line = decoder.next_out_of_line();
3650            let handles_before = decoder.remaining_handles();
3651            if let Some((inlined, num_bytes, num_handles)) =
3652                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3653            {
3654                let member_inline_size = <fidl::encoding::BoundedString<4096> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3655                if inlined != (member_inline_size <= 4) {
3656                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3657                }
3658                let inner_offset;
3659                let mut inner_depth = depth.clone();
3660                if inlined {
3661                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3662                    inner_offset = next_offset;
3663                } else {
3664                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3665                    inner_depth.increment()?;
3666                }
3667                let val_ref = self.component_url.get_or_insert_with(|| {
3668                    fidl::new_empty!(fidl::encoding::BoundedString<4096>, D)
3669                });
3670                fidl::decode!(
3671                    fidl::encoding::BoundedString<4096>,
3672                    D,
3673                    val_ref,
3674                    decoder,
3675                    inner_offset,
3676                    inner_depth
3677                )?;
3678                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3679                {
3680                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3681                }
3682                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3683                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3684                }
3685            }
3686
3687            next_offset += envelope_size;
3688            _next_ordinal_to_read += 1;
3689            if next_offset >= end_offset {
3690                return Ok(());
3691            }
3692
3693            // Decode unknown envelopes for gaps in ordinals.
3694            while _next_ordinal_to_read < 2 {
3695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3696                _next_ordinal_to_read += 1;
3697                next_offset += envelope_size;
3698            }
3699
3700            let next_out_of_line = decoder.next_out_of_line();
3701            let handles_before = decoder.remaining_handles();
3702            if let Some((inlined, num_bytes, num_handles)) =
3703                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3704            {
3705                let member_inline_size =
3706                    <IcdFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3707                if inlined != (member_inline_size <= 4) {
3708                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3709                }
3710                let inner_offset;
3711                let mut inner_depth = depth.clone();
3712                if inlined {
3713                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3714                    inner_offset = next_offset;
3715                } else {
3716                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3717                    inner_depth.increment()?;
3718                }
3719                let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(IcdFlags, D));
3720                fidl::decode!(IcdFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
3721                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3722                {
3723                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3724                }
3725                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3726                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3727                }
3728            }
3729
3730            next_offset += envelope_size;
3731
3732            // Decode the remaining unknown envelopes.
3733            while next_offset < end_offset {
3734                _next_ordinal_to_read += 1;
3735                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3736                next_offset += envelope_size;
3737            }
3738
3739            Ok(())
3740        }
3741    }
3742
3743    impl InlineCommand {
3744        #[inline(always)]
3745        fn max_ordinal_present(&self) -> u64 {
3746            if let Some(_) = self.semaphores {
3747                return 2;
3748            }
3749            if let Some(_) = self.data {
3750                return 1;
3751            }
3752            0
3753        }
3754    }
3755
3756    impl fidl::encoding::ValueTypeMarker for InlineCommand {
3757        type Borrowed<'a> = &'a Self;
3758        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3759            value
3760        }
3761    }
3762
3763    unsafe impl fidl::encoding::TypeMarker for InlineCommand {
3764        type Owned = Self;
3765
3766        #[inline(always)]
3767        fn inline_align(_context: fidl::encoding::Context) -> usize {
3768            8
3769        }
3770
3771        #[inline(always)]
3772        fn inline_size(_context: fidl::encoding::Context) -> usize {
3773            16
3774        }
3775    }
3776
3777    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InlineCommand, D>
3778        for &InlineCommand
3779    {
3780        unsafe fn encode(
3781            self,
3782            encoder: &mut fidl::encoding::Encoder<'_, D>,
3783            offset: usize,
3784            mut depth: fidl::encoding::Depth,
3785        ) -> fidl::Result<()> {
3786            encoder.debug_check_bounds::<InlineCommand>(offset);
3787            // Vector header
3788            let max_ordinal: u64 = self.max_ordinal_present();
3789            encoder.write_num(max_ordinal, offset);
3790            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3791            // Calling encoder.out_of_line_offset(0) is not allowed.
3792            if max_ordinal == 0 {
3793                return Ok(());
3794            }
3795            depth.increment()?;
3796            let envelope_size = 8;
3797            let bytes_len = max_ordinal as usize * envelope_size;
3798            #[allow(unused_variables)]
3799            let offset = encoder.out_of_line_offset(bytes_len);
3800            let mut _prev_end_offset: usize = 0;
3801            if 1 > max_ordinal {
3802                return Ok(());
3803            }
3804
3805            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3806            // are envelope_size bytes.
3807            let cur_offset: usize = (1 - 1) * envelope_size;
3808
3809            // Zero reserved fields.
3810            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3811
3812            // Safety:
3813            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3814            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3815            //   envelope_size bytes, there is always sufficient room.
3816            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u8>, D>(
3817            self.data.as_ref().map(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow),
3818            encoder, offset + cur_offset, depth
3819        )?;
3820
3821            _prev_end_offset = cur_offset + envelope_size;
3822            if 2 > max_ordinal {
3823                return Ok(());
3824            }
3825
3826            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3827            // are envelope_size bytes.
3828            let cur_offset: usize = (2 - 1) * envelope_size;
3829
3830            // Zero reserved fields.
3831            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3832
3833            // Safety:
3834            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3835            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3836            //   envelope_size bytes, there is always sufficient room.
3837            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<u64>, D>(
3838            self.semaphores.as_ref().map(<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow),
3839            encoder, offset + cur_offset, depth
3840        )?;
3841
3842            _prev_end_offset = cur_offset + envelope_size;
3843
3844            Ok(())
3845        }
3846    }
3847
3848    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InlineCommand {
3849        #[inline(always)]
3850        fn new_empty() -> Self {
3851            Self::default()
3852        }
3853
3854        unsafe fn decode(
3855            &mut self,
3856            decoder: &mut fidl::encoding::Decoder<'_, D>,
3857            offset: usize,
3858            mut depth: fidl::encoding::Depth,
3859        ) -> fidl::Result<()> {
3860            decoder.debug_check_bounds::<Self>(offset);
3861            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3862                None => return Err(fidl::Error::NotNullable),
3863                Some(len) => len,
3864            };
3865            // Calling decoder.out_of_line_offset(0) is not allowed.
3866            if len == 0 {
3867                return Ok(());
3868            };
3869            depth.increment()?;
3870            let envelope_size = 8;
3871            let bytes_len = len * envelope_size;
3872            let offset = decoder.out_of_line_offset(bytes_len)?;
3873            // Decode the envelope for each type.
3874            let mut _next_ordinal_to_read = 0;
3875            let mut next_offset = offset;
3876            let end_offset = offset + bytes_len;
3877            _next_ordinal_to_read += 1;
3878            if next_offset >= end_offset {
3879                return Ok(());
3880            }
3881
3882            // Decode unknown envelopes for gaps in ordinals.
3883            while _next_ordinal_to_read < 1 {
3884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3885                _next_ordinal_to_read += 1;
3886                next_offset += envelope_size;
3887            }
3888
3889            let next_out_of_line = decoder.next_out_of_line();
3890            let handles_before = decoder.remaining_handles();
3891            if let Some((inlined, num_bytes, num_handles)) =
3892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3893            {
3894                let member_inline_size = <fidl::encoding::UnboundedVector<u8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3895                if inlined != (member_inline_size <= 4) {
3896                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3897                }
3898                let inner_offset;
3899                let mut inner_depth = depth.clone();
3900                if inlined {
3901                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3902                    inner_offset = next_offset;
3903                } else {
3904                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3905                    inner_depth.increment()?;
3906                }
3907                let val_ref = self.data.get_or_insert_with(|| {
3908                    fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D)
3909                });
3910                fidl::decode!(
3911                    fidl::encoding::UnboundedVector<u8>,
3912                    D,
3913                    val_ref,
3914                    decoder,
3915                    inner_offset,
3916                    inner_depth
3917                )?;
3918                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3919                {
3920                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3921                }
3922                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3923                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3924                }
3925            }
3926
3927            next_offset += envelope_size;
3928            _next_ordinal_to_read += 1;
3929            if next_offset >= end_offset {
3930                return Ok(());
3931            }
3932
3933            // Decode unknown envelopes for gaps in ordinals.
3934            while _next_ordinal_to_read < 2 {
3935                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3936                _next_ordinal_to_read += 1;
3937                next_offset += envelope_size;
3938            }
3939
3940            let next_out_of_line = decoder.next_out_of_line();
3941            let handles_before = decoder.remaining_handles();
3942            if let Some((inlined, num_bytes, num_handles)) =
3943                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3944            {
3945                let member_inline_size = <fidl::encoding::UnboundedVector<u64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3946                if inlined != (member_inline_size <= 4) {
3947                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3948                }
3949                let inner_offset;
3950                let mut inner_depth = depth.clone();
3951                if inlined {
3952                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3953                    inner_offset = next_offset;
3954                } else {
3955                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3956                    inner_depth.increment()?;
3957                }
3958                let val_ref = self.semaphores.get_or_insert_with(|| {
3959                    fidl::new_empty!(fidl::encoding::UnboundedVector<u64>, D)
3960                });
3961                fidl::decode!(
3962                    fidl::encoding::UnboundedVector<u64>,
3963                    D,
3964                    val_ref,
3965                    decoder,
3966                    inner_offset,
3967                    inner_depth
3968                )?;
3969                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3970                {
3971                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3972                }
3973                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3974                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3975                }
3976            }
3977
3978            next_offset += envelope_size;
3979
3980            // Decode the remaining unknown envelopes.
3981            while next_offset < end_offset {
3982                _next_ordinal_to_read += 1;
3983                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3984                next_offset += envelope_size;
3985            }
3986
3987            Ok(())
3988        }
3989    }
3990
3991    impl PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest {
3992        #[inline(always)]
3993        fn max_ordinal_present(&self) -> u64 {
3994            if let Some(_) = self.flags {
3995                return 5;
3996            }
3997            if let Some(_) = self.timestamp {
3998                return 4;
3999            }
4000            if let Some(_) = self.buffer_offset {
4001                return 3;
4002            }
4003            if let Some(_) = self.buffer_id {
4004                return 2;
4005            }
4006            if let Some(_) = self.trigger_id {
4007                return 1;
4008            }
4009            0
4010        }
4011    }
4012
4013    impl fidl::encoding::ValueTypeMarker
4014        for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
4015    {
4016        type Borrowed<'a> = &'a Self;
4017        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4018            value
4019        }
4020    }
4021
4022    unsafe impl fidl::encoding::TypeMarker
4023        for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
4024    {
4025        type Owned = Self;
4026
4027        #[inline(always)]
4028        fn inline_align(_context: fidl::encoding::Context) -> usize {
4029            8
4030        }
4031
4032        #[inline(always)]
4033        fn inline_size(_context: fidl::encoding::Context) -> usize {
4034            16
4035        }
4036    }
4037
4038    unsafe impl<D: fidl::encoding::ResourceDialect>
4039        fidl::encoding::Encode<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest, D>
4040        for &PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
4041    {
4042        unsafe fn encode(
4043            self,
4044            encoder: &mut fidl::encoding::Encoder<'_, D>,
4045            offset: usize,
4046            mut depth: fidl::encoding::Depth,
4047        ) -> fidl::Result<()> {
4048            encoder.debug_check_bounds::<PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest>(offset);
4049            // Vector header
4050            let max_ordinal: u64 = self.max_ordinal_present();
4051            encoder.write_num(max_ordinal, offset);
4052            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4053            // Calling encoder.out_of_line_offset(0) is not allowed.
4054            if max_ordinal == 0 {
4055                return Ok(());
4056            }
4057            depth.increment()?;
4058            let envelope_size = 8;
4059            let bytes_len = max_ordinal as usize * envelope_size;
4060            #[allow(unused_variables)]
4061            let offset = encoder.out_of_line_offset(bytes_len);
4062            let mut _prev_end_offset: usize = 0;
4063            if 1 > max_ordinal {
4064                return Ok(());
4065            }
4066
4067            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4068            // are envelope_size bytes.
4069            let cur_offset: usize = (1 - 1) * envelope_size;
4070
4071            // Zero reserved fields.
4072            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4073
4074            // Safety:
4075            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4076            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4077            //   envelope_size bytes, there is always sufficient room.
4078            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4079                self.trigger_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4080                encoder,
4081                offset + cur_offset,
4082                depth,
4083            )?;
4084
4085            _prev_end_offset = cur_offset + envelope_size;
4086            if 2 > max_ordinal {
4087                return Ok(());
4088            }
4089
4090            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4091            // are envelope_size bytes.
4092            let cur_offset: usize = (2 - 1) * envelope_size;
4093
4094            // Zero reserved fields.
4095            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4096
4097            // Safety:
4098            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4099            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4100            //   envelope_size bytes, there is always sufficient room.
4101            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4102                self.buffer_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4103                encoder,
4104                offset + cur_offset,
4105                depth,
4106            )?;
4107
4108            _prev_end_offset = cur_offset + envelope_size;
4109            if 3 > max_ordinal {
4110                return Ok(());
4111            }
4112
4113            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4114            // are envelope_size bytes.
4115            let cur_offset: usize = (3 - 1) * envelope_size;
4116
4117            // Zero reserved fields.
4118            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4119
4120            // Safety:
4121            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4122            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4123            //   envelope_size bytes, there is always sufficient room.
4124            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4125                self.buffer_offset.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4126                encoder,
4127                offset + cur_offset,
4128                depth,
4129            )?;
4130
4131            _prev_end_offset = cur_offset + envelope_size;
4132            if 4 > max_ordinal {
4133                return Ok(());
4134            }
4135
4136            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4137            // are envelope_size bytes.
4138            let cur_offset: usize = (4 - 1) * envelope_size;
4139
4140            // Zero reserved fields.
4141            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4142
4143            // Safety:
4144            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4145            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4146            //   envelope_size bytes, there is always sufficient room.
4147            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4148                self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4149                encoder,
4150                offset + cur_offset,
4151                depth,
4152            )?;
4153
4154            _prev_end_offset = cur_offset + envelope_size;
4155            if 5 > max_ordinal {
4156                return Ok(());
4157            }
4158
4159            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4160            // are envelope_size bytes.
4161            let cur_offset: usize = (5 - 1) * envelope_size;
4162
4163            // Zero reserved fields.
4164            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4165
4166            // Safety:
4167            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4168            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4169            //   envelope_size bytes, there is always sufficient room.
4170            fidl::encoding::encode_in_envelope_optional::<ResultFlags, D>(
4171                self.flags.as_ref().map(<ResultFlags as fidl::encoding::ValueTypeMarker>::borrow),
4172                encoder,
4173                offset + cur_offset,
4174                depth,
4175            )?;
4176
4177            _prev_end_offset = cur_offset + envelope_size;
4178
4179            Ok(())
4180        }
4181    }
4182
4183    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4184        for PerformanceCounterEventsOnPerformanceCounterReadCompletedRequest
4185    {
4186        #[inline(always)]
4187        fn new_empty() -> Self {
4188            Self::default()
4189        }
4190
4191        unsafe fn decode(
4192            &mut self,
4193            decoder: &mut fidl::encoding::Decoder<'_, D>,
4194            offset: usize,
4195            mut depth: fidl::encoding::Depth,
4196        ) -> fidl::Result<()> {
4197            decoder.debug_check_bounds::<Self>(offset);
4198            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4199                None => return Err(fidl::Error::NotNullable),
4200                Some(len) => len,
4201            };
4202            // Calling decoder.out_of_line_offset(0) is not allowed.
4203            if len == 0 {
4204                return Ok(());
4205            };
4206            depth.increment()?;
4207            let envelope_size = 8;
4208            let bytes_len = len * envelope_size;
4209            let offset = decoder.out_of_line_offset(bytes_len)?;
4210            // Decode the envelope for each type.
4211            let mut _next_ordinal_to_read = 0;
4212            let mut next_offset = offset;
4213            let end_offset = offset + bytes_len;
4214            _next_ordinal_to_read += 1;
4215            if next_offset >= end_offset {
4216                return Ok(());
4217            }
4218
4219            // Decode unknown envelopes for gaps in ordinals.
4220            while _next_ordinal_to_read < 1 {
4221                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4222                _next_ordinal_to_read += 1;
4223                next_offset += envelope_size;
4224            }
4225
4226            let next_out_of_line = decoder.next_out_of_line();
4227            let handles_before = decoder.remaining_handles();
4228            if let Some((inlined, num_bytes, num_handles)) =
4229                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4230            {
4231                let member_inline_size =
4232                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4233                if inlined != (member_inline_size <= 4) {
4234                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4235                }
4236                let inner_offset;
4237                let mut inner_depth = depth.clone();
4238                if inlined {
4239                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4240                    inner_offset = next_offset;
4241                } else {
4242                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4243                    inner_depth.increment()?;
4244                }
4245                let val_ref = self.trigger_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4246                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4247                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4248                {
4249                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4250                }
4251                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4252                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4253                }
4254            }
4255
4256            next_offset += envelope_size;
4257            _next_ordinal_to_read += 1;
4258            if next_offset >= end_offset {
4259                return Ok(());
4260            }
4261
4262            // Decode unknown envelopes for gaps in ordinals.
4263            while _next_ordinal_to_read < 2 {
4264                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4265                _next_ordinal_to_read += 1;
4266                next_offset += envelope_size;
4267            }
4268
4269            let next_out_of_line = decoder.next_out_of_line();
4270            let handles_before = decoder.remaining_handles();
4271            if let Some((inlined, num_bytes, num_handles)) =
4272                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4273            {
4274                let member_inline_size =
4275                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4276                if inlined != (member_inline_size <= 4) {
4277                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4278                }
4279                let inner_offset;
4280                let mut inner_depth = depth.clone();
4281                if inlined {
4282                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4283                    inner_offset = next_offset;
4284                } else {
4285                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4286                    inner_depth.increment()?;
4287                }
4288                let val_ref = self.buffer_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
4289                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4290                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4291                {
4292                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4293                }
4294                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4295                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4296                }
4297            }
4298
4299            next_offset += envelope_size;
4300            _next_ordinal_to_read += 1;
4301            if next_offset >= end_offset {
4302                return Ok(());
4303            }
4304
4305            // Decode unknown envelopes for gaps in ordinals.
4306            while _next_ordinal_to_read < 3 {
4307                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4308                _next_ordinal_to_read += 1;
4309                next_offset += envelope_size;
4310            }
4311
4312            let next_out_of_line = decoder.next_out_of_line();
4313            let handles_before = decoder.remaining_handles();
4314            if let Some((inlined, num_bytes, num_handles)) =
4315                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4316            {
4317                let member_inline_size =
4318                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4319                if inlined != (member_inline_size <= 4) {
4320                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4321                }
4322                let inner_offset;
4323                let mut inner_depth = depth.clone();
4324                if inlined {
4325                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4326                    inner_offset = next_offset;
4327                } else {
4328                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4329                    inner_depth.increment()?;
4330                }
4331                let val_ref = self.buffer_offset.get_or_insert_with(|| fidl::new_empty!(u32, D));
4332                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4333                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4334                {
4335                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4336                }
4337                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4338                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4339                }
4340            }
4341
4342            next_offset += envelope_size;
4343            _next_ordinal_to_read += 1;
4344            if next_offset >= end_offset {
4345                return Ok(());
4346            }
4347
4348            // Decode unknown envelopes for gaps in ordinals.
4349            while _next_ordinal_to_read < 4 {
4350                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4351                _next_ordinal_to_read += 1;
4352                next_offset += envelope_size;
4353            }
4354
4355            let next_out_of_line = decoder.next_out_of_line();
4356            let handles_before = decoder.remaining_handles();
4357            if let Some((inlined, num_bytes, num_handles)) =
4358                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4359            {
4360                let member_inline_size =
4361                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4362                if inlined != (member_inline_size <= 4) {
4363                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4364                }
4365                let inner_offset;
4366                let mut inner_depth = depth.clone();
4367                if inlined {
4368                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4369                    inner_offset = next_offset;
4370                } else {
4371                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4372                    inner_depth.increment()?;
4373                }
4374                let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
4375                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4376                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4377                {
4378                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4379                }
4380                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4381                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4382                }
4383            }
4384
4385            next_offset += envelope_size;
4386            _next_ordinal_to_read += 1;
4387            if next_offset >= end_offset {
4388                return Ok(());
4389            }
4390
4391            // Decode unknown envelopes for gaps in ordinals.
4392            while _next_ordinal_to_read < 5 {
4393                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4394                _next_ordinal_to_read += 1;
4395                next_offset += envelope_size;
4396            }
4397
4398            let next_out_of_line = decoder.next_out_of_line();
4399            let handles_before = decoder.remaining_handles();
4400            if let Some((inlined, num_bytes, num_handles)) =
4401                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4402            {
4403                let member_inline_size =
4404                    <ResultFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4405                if inlined != (member_inline_size <= 4) {
4406                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4407                }
4408                let inner_offset;
4409                let mut inner_depth = depth.clone();
4410                if inlined {
4411                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4412                    inner_offset = next_offset;
4413                } else {
4414                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4415                    inner_depth.increment()?;
4416                }
4417                let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(ResultFlags, D));
4418                fidl::decode!(ResultFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
4419                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4420                {
4421                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4422                }
4423                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4424                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4425                }
4426            }
4427
4428            next_offset += envelope_size;
4429
4430            // Decode the remaining unknown envelopes.
4431            while next_offset < end_offset {
4432                _next_ordinal_to_read += 1;
4433                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4434                next_offset += envelope_size;
4435            }
4436
4437            Ok(())
4438        }
4439    }
4440
4441    impl PowerElementProviderGetClockSpeedLevelRequest {
4442        #[inline(always)]
4443        fn max_ordinal_present(&self) -> u64 {
4444            if let Some(_) = self.allow_max {
4445                return 2;
4446            }
4447            if let Some(_) = self.hz {
4448                return 1;
4449            }
4450            0
4451        }
4452    }
4453
4454    impl fidl::encoding::ValueTypeMarker for PowerElementProviderGetClockSpeedLevelRequest {
4455        type Borrowed<'a> = &'a Self;
4456        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4457            value
4458        }
4459    }
4460
4461    unsafe impl fidl::encoding::TypeMarker for PowerElementProviderGetClockSpeedLevelRequest {
4462        type Owned = Self;
4463
4464        #[inline(always)]
4465        fn inline_align(_context: fidl::encoding::Context) -> usize {
4466            8
4467        }
4468
4469        #[inline(always)]
4470        fn inline_size(_context: fidl::encoding::Context) -> usize {
4471            16
4472        }
4473    }
4474
4475    unsafe impl<D: fidl::encoding::ResourceDialect>
4476        fidl::encoding::Encode<PowerElementProviderGetClockSpeedLevelRequest, D>
4477        for &PowerElementProviderGetClockSpeedLevelRequest
4478    {
4479        unsafe fn encode(
4480            self,
4481            encoder: &mut fidl::encoding::Encoder<'_, D>,
4482            offset: usize,
4483            mut depth: fidl::encoding::Depth,
4484        ) -> fidl::Result<()> {
4485            encoder.debug_check_bounds::<PowerElementProviderGetClockSpeedLevelRequest>(offset);
4486            // Vector header
4487            let max_ordinal: u64 = self.max_ordinal_present();
4488            encoder.write_num(max_ordinal, offset);
4489            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4490            // Calling encoder.out_of_line_offset(0) is not allowed.
4491            if max_ordinal == 0 {
4492                return Ok(());
4493            }
4494            depth.increment()?;
4495            let envelope_size = 8;
4496            let bytes_len = max_ordinal as usize * envelope_size;
4497            #[allow(unused_variables)]
4498            let offset = encoder.out_of_line_offset(bytes_len);
4499            let mut _prev_end_offset: usize = 0;
4500            if 1 > max_ordinal {
4501                return Ok(());
4502            }
4503
4504            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4505            // are envelope_size bytes.
4506            let cur_offset: usize = (1 - 1) * envelope_size;
4507
4508            // Zero reserved fields.
4509            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4510
4511            // Safety:
4512            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4513            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4514            //   envelope_size bytes, there is always sufficient room.
4515            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4516                self.hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4517                encoder,
4518                offset + cur_offset,
4519                depth,
4520            )?;
4521
4522            _prev_end_offset = cur_offset + envelope_size;
4523            if 2 > max_ordinal {
4524                return Ok(());
4525            }
4526
4527            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4528            // are envelope_size bytes.
4529            let cur_offset: usize = (2 - 1) * envelope_size;
4530
4531            // Zero reserved fields.
4532            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4533
4534            // Safety:
4535            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4536            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4537            //   envelope_size bytes, there is always sufficient room.
4538            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4539                self.allow_max.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4540                encoder,
4541                offset + cur_offset,
4542                depth,
4543            )?;
4544
4545            _prev_end_offset = cur_offset + envelope_size;
4546
4547            Ok(())
4548        }
4549    }
4550
4551    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4552        for PowerElementProviderGetClockSpeedLevelRequest
4553    {
4554        #[inline(always)]
4555        fn new_empty() -> Self {
4556            Self::default()
4557        }
4558
4559        unsafe fn decode(
4560            &mut self,
4561            decoder: &mut fidl::encoding::Decoder<'_, D>,
4562            offset: usize,
4563            mut depth: fidl::encoding::Depth,
4564        ) -> fidl::Result<()> {
4565            decoder.debug_check_bounds::<Self>(offset);
4566            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4567                None => return Err(fidl::Error::NotNullable),
4568                Some(len) => len,
4569            };
4570            // Calling decoder.out_of_line_offset(0) is not allowed.
4571            if len == 0 {
4572                return Ok(());
4573            };
4574            depth.increment()?;
4575            let envelope_size = 8;
4576            let bytes_len = len * envelope_size;
4577            let offset = decoder.out_of_line_offset(bytes_len)?;
4578            // Decode the envelope for each type.
4579            let mut _next_ordinal_to_read = 0;
4580            let mut next_offset = offset;
4581            let end_offset = offset + bytes_len;
4582            _next_ordinal_to_read += 1;
4583            if next_offset >= end_offset {
4584                return Ok(());
4585            }
4586
4587            // Decode unknown envelopes for gaps in ordinals.
4588            while _next_ordinal_to_read < 1 {
4589                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4590                _next_ordinal_to_read += 1;
4591                next_offset += envelope_size;
4592            }
4593
4594            let next_out_of_line = decoder.next_out_of_line();
4595            let handles_before = decoder.remaining_handles();
4596            if let Some((inlined, num_bytes, num_handles)) =
4597                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4598            {
4599                let member_inline_size =
4600                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4601                if inlined != (member_inline_size <= 4) {
4602                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4603                }
4604                let inner_offset;
4605                let mut inner_depth = depth.clone();
4606                if inlined {
4607                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4608                    inner_offset = next_offset;
4609                } else {
4610                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4611                    inner_depth.increment()?;
4612                }
4613                let val_ref = self.hz.get_or_insert_with(|| fidl::new_empty!(u64, D));
4614                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4615                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4616                {
4617                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4618                }
4619                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4620                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4621                }
4622            }
4623
4624            next_offset += envelope_size;
4625            _next_ordinal_to_read += 1;
4626            if next_offset >= end_offset {
4627                return Ok(());
4628            }
4629
4630            // Decode unknown envelopes for gaps in ordinals.
4631            while _next_ordinal_to_read < 2 {
4632                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4633                _next_ordinal_to_read += 1;
4634                next_offset += envelope_size;
4635            }
4636
4637            let next_out_of_line = decoder.next_out_of_line();
4638            let handles_before = decoder.remaining_handles();
4639            if let Some((inlined, num_bytes, num_handles)) =
4640                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4641            {
4642                let member_inline_size =
4643                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4644                if inlined != (member_inline_size <= 4) {
4645                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4646                }
4647                let inner_offset;
4648                let mut inner_depth = depth.clone();
4649                if inlined {
4650                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4651                    inner_offset = next_offset;
4652                } else {
4653                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4654                    inner_depth.increment()?;
4655                }
4656                let val_ref = self.allow_max.get_or_insert_with(|| fidl::new_empty!(bool, D));
4657                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4658                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4659                {
4660                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4661                }
4662                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4663                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4664                }
4665            }
4666
4667            next_offset += envelope_size;
4668
4669            // Decode the remaining unknown envelopes.
4670            while next_offset < end_offset {
4671                _next_ordinal_to_read += 1;
4672                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4673                next_offset += envelope_size;
4674            }
4675
4676            Ok(())
4677        }
4678    }
4679
4680    impl PowerElementProviderSetClockLimitRequest {
4681        #[inline(always)]
4682        fn max_ordinal_present(&self) -> u64 {
4683            if let Some(_) = self.hz {
4684                return 1;
4685            }
4686            0
4687        }
4688    }
4689
4690    impl fidl::encoding::ValueTypeMarker for PowerElementProviderSetClockLimitRequest {
4691        type Borrowed<'a> = &'a Self;
4692        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4693            value
4694        }
4695    }
4696
4697    unsafe impl fidl::encoding::TypeMarker for PowerElementProviderSetClockLimitRequest {
4698        type Owned = Self;
4699
4700        #[inline(always)]
4701        fn inline_align(_context: fidl::encoding::Context) -> usize {
4702            8
4703        }
4704
4705        #[inline(always)]
4706        fn inline_size(_context: fidl::encoding::Context) -> usize {
4707            16
4708        }
4709    }
4710
4711    unsafe impl<D: fidl::encoding::ResourceDialect>
4712        fidl::encoding::Encode<PowerElementProviderSetClockLimitRequest, D>
4713        for &PowerElementProviderSetClockLimitRequest
4714    {
4715        unsafe fn encode(
4716            self,
4717            encoder: &mut fidl::encoding::Encoder<'_, D>,
4718            offset: usize,
4719            mut depth: fidl::encoding::Depth,
4720        ) -> fidl::Result<()> {
4721            encoder.debug_check_bounds::<PowerElementProviderSetClockLimitRequest>(offset);
4722            // Vector header
4723            let max_ordinal: u64 = self.max_ordinal_present();
4724            encoder.write_num(max_ordinal, offset);
4725            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4726            // Calling encoder.out_of_line_offset(0) is not allowed.
4727            if max_ordinal == 0 {
4728                return Ok(());
4729            }
4730            depth.increment()?;
4731            let envelope_size = 8;
4732            let bytes_len = max_ordinal as usize * envelope_size;
4733            #[allow(unused_variables)]
4734            let offset = encoder.out_of_line_offset(bytes_len);
4735            let mut _prev_end_offset: usize = 0;
4736            if 1 > max_ordinal {
4737                return Ok(());
4738            }
4739
4740            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4741            // are envelope_size bytes.
4742            let cur_offset: usize = (1 - 1) * envelope_size;
4743
4744            // Zero reserved fields.
4745            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4746
4747            // Safety:
4748            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4749            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4750            //   envelope_size bytes, there is always sufficient room.
4751            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4752                self.hz.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4753                encoder,
4754                offset + cur_offset,
4755                depth,
4756            )?;
4757
4758            _prev_end_offset = cur_offset + envelope_size;
4759
4760            Ok(())
4761        }
4762    }
4763
4764    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4765        for PowerElementProviderSetClockLimitRequest
4766    {
4767        #[inline(always)]
4768        fn new_empty() -> Self {
4769            Self::default()
4770        }
4771
4772        unsafe fn decode(
4773            &mut self,
4774            decoder: &mut fidl::encoding::Decoder<'_, D>,
4775            offset: usize,
4776            mut depth: fidl::encoding::Depth,
4777        ) -> fidl::Result<()> {
4778            decoder.debug_check_bounds::<Self>(offset);
4779            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4780                None => return Err(fidl::Error::NotNullable),
4781                Some(len) => len,
4782            };
4783            // Calling decoder.out_of_line_offset(0) is not allowed.
4784            if len == 0 {
4785                return Ok(());
4786            };
4787            depth.increment()?;
4788            let envelope_size = 8;
4789            let bytes_len = len * envelope_size;
4790            let offset = decoder.out_of_line_offset(bytes_len)?;
4791            // Decode the envelope for each type.
4792            let mut _next_ordinal_to_read = 0;
4793            let mut next_offset = offset;
4794            let end_offset = offset + bytes_len;
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 < 1 {
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                    <u64 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.hz.get_or_insert_with(|| fidl::new_empty!(u64, D));
4827                fidl::decode!(u64, 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
4839            // Decode the remaining unknown envelopes.
4840            while next_offset < end_offset {
4841                _next_ordinal_to_read += 1;
4842                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4843                next_offset += envelope_size;
4844            }
4845
4846            Ok(())
4847        }
4848    }
4849
4850    impl PrimaryMapBufferRequest {
4851        #[inline(always)]
4852        fn max_ordinal_present(&self) -> u64 {
4853            if let Some(_) = self.flags {
4854                return 3;
4855            }
4856            if let Some(_) = self.range {
4857                return 2;
4858            }
4859            if let Some(_) = self.hw_va {
4860                return 1;
4861            }
4862            0
4863        }
4864    }
4865
4866    impl fidl::encoding::ValueTypeMarker for PrimaryMapBufferRequest {
4867        type Borrowed<'a> = &'a Self;
4868        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4869            value
4870        }
4871    }
4872
4873    unsafe impl fidl::encoding::TypeMarker for PrimaryMapBufferRequest {
4874        type Owned = Self;
4875
4876        #[inline(always)]
4877        fn inline_align(_context: fidl::encoding::Context) -> usize {
4878            8
4879        }
4880
4881        #[inline(always)]
4882        fn inline_size(_context: fidl::encoding::Context) -> usize {
4883            16
4884        }
4885    }
4886
4887    unsafe impl<D: fidl::encoding::ResourceDialect>
4888        fidl::encoding::Encode<PrimaryMapBufferRequest, D> for &PrimaryMapBufferRequest
4889    {
4890        unsafe fn encode(
4891            self,
4892            encoder: &mut fidl::encoding::Encoder<'_, D>,
4893            offset: usize,
4894            mut depth: fidl::encoding::Depth,
4895        ) -> fidl::Result<()> {
4896            encoder.debug_check_bounds::<PrimaryMapBufferRequest>(offset);
4897            // Vector header
4898            let max_ordinal: u64 = self.max_ordinal_present();
4899            encoder.write_num(max_ordinal, offset);
4900            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4901            // Calling encoder.out_of_line_offset(0) is not allowed.
4902            if max_ordinal == 0 {
4903                return Ok(());
4904            }
4905            depth.increment()?;
4906            let envelope_size = 8;
4907            let bytes_len = max_ordinal as usize * envelope_size;
4908            #[allow(unused_variables)]
4909            let offset = encoder.out_of_line_offset(bytes_len);
4910            let mut _prev_end_offset: usize = 0;
4911            if 1 > max_ordinal {
4912                return Ok(());
4913            }
4914
4915            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4916            // are envelope_size bytes.
4917            let cur_offset: usize = (1 - 1) * envelope_size;
4918
4919            // Zero reserved fields.
4920            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4921
4922            // Safety:
4923            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4924            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4925            //   envelope_size bytes, there is always sufficient room.
4926            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4927                self.hw_va.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4928                encoder,
4929                offset + cur_offset,
4930                depth,
4931            )?;
4932
4933            _prev_end_offset = cur_offset + envelope_size;
4934            if 2 > max_ordinal {
4935                return Ok(());
4936            }
4937
4938            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4939            // are envelope_size bytes.
4940            let cur_offset: usize = (2 - 1) * envelope_size;
4941
4942            // Zero reserved fields.
4943            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4944
4945            // Safety:
4946            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4947            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4948            //   envelope_size bytes, there is always sufficient room.
4949            fidl::encoding::encode_in_envelope_optional::<BufferRange, D>(
4950                self.range.as_ref().map(<BufferRange as fidl::encoding::ValueTypeMarker>::borrow),
4951                encoder,
4952                offset + cur_offset,
4953                depth,
4954            )?;
4955
4956            _prev_end_offset = cur_offset + envelope_size;
4957            if 3 > max_ordinal {
4958                return Ok(());
4959            }
4960
4961            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4962            // are envelope_size bytes.
4963            let cur_offset: usize = (3 - 1) * envelope_size;
4964
4965            // Zero reserved fields.
4966            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4967
4968            // Safety:
4969            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4970            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4971            //   envelope_size bytes, there is always sufficient room.
4972            fidl::encoding::encode_in_envelope_optional::<MapFlags, D>(
4973                self.flags.as_ref().map(<MapFlags as fidl::encoding::ValueTypeMarker>::borrow),
4974                encoder,
4975                offset + cur_offset,
4976                depth,
4977            )?;
4978
4979            _prev_end_offset = cur_offset + envelope_size;
4980
4981            Ok(())
4982        }
4983    }
4984
4985    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4986        for PrimaryMapBufferRequest
4987    {
4988        #[inline(always)]
4989        fn new_empty() -> Self {
4990            Self::default()
4991        }
4992
4993        unsafe fn decode(
4994            &mut self,
4995            decoder: &mut fidl::encoding::Decoder<'_, D>,
4996            offset: usize,
4997            mut depth: fidl::encoding::Depth,
4998        ) -> fidl::Result<()> {
4999            decoder.debug_check_bounds::<Self>(offset);
5000            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5001                None => return Err(fidl::Error::NotNullable),
5002                Some(len) => len,
5003            };
5004            // Calling decoder.out_of_line_offset(0) is not allowed.
5005            if len == 0 {
5006                return Ok(());
5007            };
5008            depth.increment()?;
5009            let envelope_size = 8;
5010            let bytes_len = len * envelope_size;
5011            let offset = decoder.out_of_line_offset(bytes_len)?;
5012            // Decode the envelope for each type.
5013            let mut _next_ordinal_to_read = 0;
5014            let mut next_offset = offset;
5015            let end_offset = offset + bytes_len;
5016            _next_ordinal_to_read += 1;
5017            if next_offset >= end_offset {
5018                return Ok(());
5019            }
5020
5021            // Decode unknown envelopes for gaps in ordinals.
5022            while _next_ordinal_to_read < 1 {
5023                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5024                _next_ordinal_to_read += 1;
5025                next_offset += envelope_size;
5026            }
5027
5028            let next_out_of_line = decoder.next_out_of_line();
5029            let handles_before = decoder.remaining_handles();
5030            if let Some((inlined, num_bytes, num_handles)) =
5031                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5032            {
5033                let member_inline_size =
5034                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5035                if inlined != (member_inline_size <= 4) {
5036                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5037                }
5038                let inner_offset;
5039                let mut inner_depth = depth.clone();
5040                if inlined {
5041                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5042                    inner_offset = next_offset;
5043                } else {
5044                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5045                    inner_depth.increment()?;
5046                }
5047                let val_ref = self.hw_va.get_or_insert_with(|| fidl::new_empty!(u64, D));
5048                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5049                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5050                {
5051                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5052                }
5053                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5054                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5055                }
5056            }
5057
5058            next_offset += envelope_size;
5059            _next_ordinal_to_read += 1;
5060            if next_offset >= end_offset {
5061                return Ok(());
5062            }
5063
5064            // Decode unknown envelopes for gaps in ordinals.
5065            while _next_ordinal_to_read < 2 {
5066                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5067                _next_ordinal_to_read += 1;
5068                next_offset += envelope_size;
5069            }
5070
5071            let next_out_of_line = decoder.next_out_of_line();
5072            let handles_before = decoder.remaining_handles();
5073            if let Some((inlined, num_bytes, num_handles)) =
5074                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5075            {
5076                let member_inline_size =
5077                    <BufferRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5078                if inlined != (member_inline_size <= 4) {
5079                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5080                }
5081                let inner_offset;
5082                let mut inner_depth = depth.clone();
5083                if inlined {
5084                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5085                    inner_offset = next_offset;
5086                } else {
5087                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5088                    inner_depth.increment()?;
5089                }
5090                let val_ref = self.range.get_or_insert_with(|| fidl::new_empty!(BufferRange, D));
5091                fidl::decode!(BufferRange, D, val_ref, decoder, inner_offset, inner_depth)?;
5092                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5093                {
5094                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5095                }
5096                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5097                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5098                }
5099            }
5100
5101            next_offset += envelope_size;
5102            _next_ordinal_to_read += 1;
5103            if next_offset >= end_offset {
5104                return Ok(());
5105            }
5106
5107            // Decode unknown envelopes for gaps in ordinals.
5108            while _next_ordinal_to_read < 3 {
5109                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5110                _next_ordinal_to_read += 1;
5111                next_offset += envelope_size;
5112            }
5113
5114            let next_out_of_line = decoder.next_out_of_line();
5115            let handles_before = decoder.remaining_handles();
5116            if let Some((inlined, num_bytes, num_handles)) =
5117                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5118            {
5119                let member_inline_size =
5120                    <MapFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5121                if inlined != (member_inline_size <= 4) {
5122                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5123                }
5124                let inner_offset;
5125                let mut inner_depth = depth.clone();
5126                if inlined {
5127                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5128                    inner_offset = next_offset;
5129                } else {
5130                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5131                    inner_depth.increment()?;
5132                }
5133                let val_ref = self.flags.get_or_insert_with(|| fidl::new_empty!(MapFlags, D));
5134                fidl::decode!(MapFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
5135                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5136                {
5137                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5138                }
5139                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5140                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5141                }
5142            }
5143
5144            next_offset += envelope_size;
5145
5146            // Decode the remaining unknown envelopes.
5147            while next_offset < end_offset {
5148                _next_ordinal_to_read += 1;
5149                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5150                next_offset += envelope_size;
5151            }
5152
5153            Ok(())
5154        }
5155    }
5156
5157    impl PrimaryUnmapBufferRequest {
5158        #[inline(always)]
5159        fn max_ordinal_present(&self) -> u64 {
5160            if let Some(_) = self.buffer_id {
5161                return 2;
5162            }
5163            if let Some(_) = self.hw_va {
5164                return 1;
5165            }
5166            0
5167        }
5168    }
5169
5170    impl fidl::encoding::ValueTypeMarker for PrimaryUnmapBufferRequest {
5171        type Borrowed<'a> = &'a Self;
5172        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5173            value
5174        }
5175    }
5176
5177    unsafe impl fidl::encoding::TypeMarker for PrimaryUnmapBufferRequest {
5178        type Owned = Self;
5179
5180        #[inline(always)]
5181        fn inline_align(_context: fidl::encoding::Context) -> usize {
5182            8
5183        }
5184
5185        #[inline(always)]
5186        fn inline_size(_context: fidl::encoding::Context) -> usize {
5187            16
5188        }
5189    }
5190
5191    unsafe impl<D: fidl::encoding::ResourceDialect>
5192        fidl::encoding::Encode<PrimaryUnmapBufferRequest, D> for &PrimaryUnmapBufferRequest
5193    {
5194        unsafe fn encode(
5195            self,
5196            encoder: &mut fidl::encoding::Encoder<'_, D>,
5197            offset: usize,
5198            mut depth: fidl::encoding::Depth,
5199        ) -> fidl::Result<()> {
5200            encoder.debug_check_bounds::<PrimaryUnmapBufferRequest>(offset);
5201            // Vector header
5202            let max_ordinal: u64 = self.max_ordinal_present();
5203            encoder.write_num(max_ordinal, offset);
5204            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5205            // Calling encoder.out_of_line_offset(0) is not allowed.
5206            if max_ordinal == 0 {
5207                return Ok(());
5208            }
5209            depth.increment()?;
5210            let envelope_size = 8;
5211            let bytes_len = max_ordinal as usize * envelope_size;
5212            #[allow(unused_variables)]
5213            let offset = encoder.out_of_line_offset(bytes_len);
5214            let mut _prev_end_offset: usize = 0;
5215            if 1 > max_ordinal {
5216                return Ok(());
5217            }
5218
5219            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5220            // are envelope_size bytes.
5221            let cur_offset: usize = (1 - 1) * envelope_size;
5222
5223            // Zero reserved fields.
5224            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5225
5226            // Safety:
5227            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5228            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5229            //   envelope_size bytes, there is always sufficient room.
5230            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5231                self.hw_va.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5232                encoder,
5233                offset + cur_offset,
5234                depth,
5235            )?;
5236
5237            _prev_end_offset = cur_offset + envelope_size;
5238            if 2 > max_ordinal {
5239                return Ok(());
5240            }
5241
5242            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5243            // are envelope_size bytes.
5244            let cur_offset: usize = (2 - 1) * envelope_size;
5245
5246            // Zero reserved fields.
5247            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5248
5249            // Safety:
5250            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5251            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5252            //   envelope_size bytes, there is always sufficient room.
5253            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5254                self.buffer_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5255                encoder,
5256                offset + cur_offset,
5257                depth,
5258            )?;
5259
5260            _prev_end_offset = cur_offset + envelope_size;
5261
5262            Ok(())
5263        }
5264    }
5265
5266    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5267        for PrimaryUnmapBufferRequest
5268    {
5269        #[inline(always)]
5270        fn new_empty() -> Self {
5271            Self::default()
5272        }
5273
5274        unsafe fn decode(
5275            &mut self,
5276            decoder: &mut fidl::encoding::Decoder<'_, D>,
5277            offset: usize,
5278            mut depth: fidl::encoding::Depth,
5279        ) -> fidl::Result<()> {
5280            decoder.debug_check_bounds::<Self>(offset);
5281            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5282                None => return Err(fidl::Error::NotNullable),
5283                Some(len) => len,
5284            };
5285            // Calling decoder.out_of_line_offset(0) is not allowed.
5286            if len == 0 {
5287                return Ok(());
5288            };
5289            depth.increment()?;
5290            let envelope_size = 8;
5291            let bytes_len = len * envelope_size;
5292            let offset = decoder.out_of_line_offset(bytes_len)?;
5293            // Decode the envelope for each type.
5294            let mut _next_ordinal_to_read = 0;
5295            let mut next_offset = offset;
5296            let end_offset = offset + bytes_len;
5297            _next_ordinal_to_read += 1;
5298            if next_offset >= end_offset {
5299                return Ok(());
5300            }
5301
5302            // Decode unknown envelopes for gaps in ordinals.
5303            while _next_ordinal_to_read < 1 {
5304                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5305                _next_ordinal_to_read += 1;
5306                next_offset += envelope_size;
5307            }
5308
5309            let next_out_of_line = decoder.next_out_of_line();
5310            let handles_before = decoder.remaining_handles();
5311            if let Some((inlined, num_bytes, num_handles)) =
5312                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5313            {
5314                let member_inline_size =
5315                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5316                if inlined != (member_inline_size <= 4) {
5317                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5318                }
5319                let inner_offset;
5320                let mut inner_depth = depth.clone();
5321                if inlined {
5322                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5323                    inner_offset = next_offset;
5324                } else {
5325                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5326                    inner_depth.increment()?;
5327                }
5328                let val_ref = self.hw_va.get_or_insert_with(|| fidl::new_empty!(u64, D));
5329                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5330                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5331                {
5332                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5333                }
5334                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5335                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5336                }
5337            }
5338
5339            next_offset += envelope_size;
5340            _next_ordinal_to_read += 1;
5341            if next_offset >= end_offset {
5342                return Ok(());
5343            }
5344
5345            // Decode unknown envelopes for gaps in ordinals.
5346            while _next_ordinal_to_read < 2 {
5347                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5348                _next_ordinal_to_read += 1;
5349                next_offset += envelope_size;
5350            }
5351
5352            let next_out_of_line = decoder.next_out_of_line();
5353            let handles_before = decoder.remaining_handles();
5354            if let Some((inlined, num_bytes, num_handles)) =
5355                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5356            {
5357                let member_inline_size =
5358                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5359                if inlined != (member_inline_size <= 4) {
5360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5361                }
5362                let inner_offset;
5363                let mut inner_depth = depth.clone();
5364                if inlined {
5365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5366                    inner_offset = next_offset;
5367                } else {
5368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5369                    inner_depth.increment()?;
5370                }
5371                let val_ref = self.buffer_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
5372                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5373                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5374                {
5375                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5376                }
5377                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5378                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5379                }
5380            }
5381
5382            next_offset += envelope_size;
5383
5384            // Decode the remaining unknown envelopes.
5385            while next_offset < end_offset {
5386                _next_ordinal_to_read += 1;
5387                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5388                next_offset += envelope_size;
5389            }
5390
5391            Ok(())
5392        }
5393    }
5394}