fidl_fuchsia_hardware_pci/
fidl_fuchsia_hardware_pci.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::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// An offset from the beginning of a device's PCI configuration space. [0, 0x100) is valid.
14pub type ConfigOffset = u8;
15
16/// An offset from the beginning of a device's PCIe configuration space. [0, 0x800) is valid.
17pub type ExtendedConfigOffset = u16;
18
19pub const BASE_ADDRESS_COUNT: u32 = 6;
20
21pub const BASE_CONFIG_SIZE: u32 = 256;
22
23pub const EXTENDED_CONFIG_SIZE: u32 = 4096;
24
25pub const MAX_BAR_COUNT: u8 = 6;
26
27pub const MAX_CAPABILITIES: u32 = 32;
28
29pub const MAX_DEVICES: u32 = 64;
30
31pub const MAX_EXT_CAPABILITIES: u32 = 32;
32
33pub const MAX_NAME_LEN: u32 = 32;
34
35pub const READBAR_MAX_SIZE: u32 = 1024;
36
37pub const STATUS_DEVSEL_MASK: Status = Status::from_bits_truncate(1536);
38
39bitflags! {
40    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
41    pub struct Command: u16 {
42        const IO_EN = 1;
43        const MEM_EN = 2;
44        const BUS_MASTER_EN = 4;
45        const SPECIAL_EN = 8;
46        const MEM_WR_INV_EN = 16;
47        const PAL_SNOOP_EN = 32;
48        const PERR_RESP_EN = 64;
49        const AD_STEP_EN = 128;
50        const SERR_EN = 256;
51        const FAST_B2_B_EN = 512;
52    }
53}
54
55impl Command {
56    #[inline(always)]
57    pub fn from_bits_allow_unknown(bits: u16) -> Self {
58        Self::from_bits_retain(bits)
59    }
60
61    #[inline(always)]
62    pub fn has_unknown_bits(&self) -> bool {
63        self.get_unknown_bits() != 0
64    }
65
66    #[inline(always)]
67    pub fn get_unknown_bits(&self) -> u16 {
68        self.bits() & !Self::all().bits()
69    }
70}
71
72bitflags! {
73    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
74    pub struct Status: u16 {
75        const INTERRUPT = 8;
76        const NEW_CAPS = 16;
77        const SIXTYSIX_MHZ = 32;
78        const FAST_B2_B = 128;
79        const MSTR_PERR = 256;
80        const DEVSEL_LOW = 512;
81        const DEVSEL_HIGH = 1024;
82        const TARG_ABORT_SIG = 2048;
83        const TARG_ABORT_RCV = 4096;
84        const MSTR_ABORT_RCV = 8192;
85        const SERR_SIG = 16384;
86        const PERR = 32768;
87    }
88}
89
90impl Status {
91    #[inline(always)]
92    pub fn from_bits_allow_unknown(bits: u16) -> Self {
93        Self::from_bits_retain(bits)
94    }
95
96    #[inline(always)]
97    pub fn has_unknown_bits(&self) -> bool {
98        self.get_unknown_bits() != 0
99    }
100
101    #[inline(always)]
102    pub fn get_unknown_bits(&self) -> u16 {
103        self.bits() & !Self::all().bits()
104    }
105}
106
107/// PCI Capability ID.
108/// PCI Local Bus Specification v3, appendex H.
109#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
110pub enum CapabilityId {
111    Null,
112    PciPwrMgmt,
113    Agp,
114    VitalProductData,
115    SlotIdentification,
116    Msi,
117    CompactPciHotswap,
118    Pcix,
119    Hypertransport,
120    Vendor,
121    DebugPort,
122    CompactPciCrc,
123    PciHotPlug,
124    PciBridgeSubsystemVid,
125    Agp8X,
126    SecureDevice,
127    PciExpress,
128    Msix,
129    SataDataNdxCfg,
130    AdvancedFeatures,
131    EnhancedAllocation,
132    FlatteningPortalBridge,
133    #[doc(hidden)]
134    __SourceBreaking {
135        unknown_ordinal: u8,
136    },
137}
138
139/// Pattern that matches an unknown `CapabilityId` member.
140#[macro_export]
141macro_rules! CapabilityIdUnknown {
142    () => {
143        _
144    };
145}
146
147impl CapabilityId {
148    #[inline]
149    pub fn from_primitive(prim: u8) -> Option<Self> {
150        match prim {
151            0 => Some(Self::Null),
152            1 => Some(Self::PciPwrMgmt),
153            2 => Some(Self::Agp),
154            3 => Some(Self::VitalProductData),
155            4 => Some(Self::SlotIdentification),
156            5 => Some(Self::Msi),
157            6 => Some(Self::CompactPciHotswap),
158            7 => Some(Self::Pcix),
159            8 => Some(Self::Hypertransport),
160            9 => Some(Self::Vendor),
161            10 => Some(Self::DebugPort),
162            11 => Some(Self::CompactPciCrc),
163            12 => Some(Self::PciHotPlug),
164            13 => Some(Self::PciBridgeSubsystemVid),
165            14 => Some(Self::Agp8X),
166            15 => Some(Self::SecureDevice),
167            16 => Some(Self::PciExpress),
168            17 => Some(Self::Msix),
169            18 => Some(Self::SataDataNdxCfg),
170            19 => Some(Self::AdvancedFeatures),
171            20 => Some(Self::EnhancedAllocation),
172            21 => Some(Self::FlatteningPortalBridge),
173            _ => None,
174        }
175    }
176
177    #[inline]
178    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
179        match prim {
180            0 => Self::Null,
181            1 => Self::PciPwrMgmt,
182            2 => Self::Agp,
183            3 => Self::VitalProductData,
184            4 => Self::SlotIdentification,
185            5 => Self::Msi,
186            6 => Self::CompactPciHotswap,
187            7 => Self::Pcix,
188            8 => Self::Hypertransport,
189            9 => Self::Vendor,
190            10 => Self::DebugPort,
191            11 => Self::CompactPciCrc,
192            12 => Self::PciHotPlug,
193            13 => Self::PciBridgeSubsystemVid,
194            14 => Self::Agp8X,
195            15 => Self::SecureDevice,
196            16 => Self::PciExpress,
197            17 => Self::Msix,
198            18 => Self::SataDataNdxCfg,
199            19 => Self::AdvancedFeatures,
200            20 => Self::EnhancedAllocation,
201            21 => Self::FlatteningPortalBridge,
202            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
203        }
204    }
205
206    #[inline]
207    pub fn unknown() -> Self {
208        Self::__SourceBreaking { unknown_ordinal: 0xff }
209    }
210
211    #[inline]
212    pub const fn into_primitive(self) -> u8 {
213        match self {
214            Self::Null => 0,
215            Self::PciPwrMgmt => 1,
216            Self::Agp => 2,
217            Self::VitalProductData => 3,
218            Self::SlotIdentification => 4,
219            Self::Msi => 5,
220            Self::CompactPciHotswap => 6,
221            Self::Pcix => 7,
222            Self::Hypertransport => 8,
223            Self::Vendor => 9,
224            Self::DebugPort => 10,
225            Self::CompactPciCrc => 11,
226            Self::PciHotPlug => 12,
227            Self::PciBridgeSubsystemVid => 13,
228            Self::Agp8X => 14,
229            Self::SecureDevice => 15,
230            Self::PciExpress => 16,
231            Self::Msix => 17,
232            Self::SataDataNdxCfg => 18,
233            Self::AdvancedFeatures => 19,
234            Self::EnhancedAllocation => 20,
235            Self::FlatteningPortalBridge => 21,
236            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
237        }
238    }
239
240    #[inline]
241    pub fn is_unknown(&self) -> bool {
242        match self {
243            Self::__SourceBreaking { unknown_ordinal: _ } => true,
244            _ => false,
245        }
246    }
247}
248
249/// PCI Configuration Header registers.
250/// PCI Local Bus Specification v3, chapter 6.1.
251#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
252pub enum Config {
253    VendorId,
254    DeviceId,
255    Command,
256    Status,
257    RevisionId,
258    ClassCodeIntr,
259    ClassCodeSub,
260    ClassCodeBase,
261    CacheLineSize,
262    LatencyTimer,
263    HeaderType,
264    Bist,
265    BaseAddresses,
266    CardbusCisPtr,
267    SubsystemVendorId,
268    SubsystemId,
269    ExpRomAddress,
270    CapabilitiesPtr,
271    InterruptLine,
272    InterruptPin,
273    MinGrant,
274    MaxLatency,
275    #[doc(hidden)]
276    __SourceBreaking {
277        unknown_ordinal: u16,
278    },
279}
280
281/// Pattern that matches an unknown `Config` member.
282#[macro_export]
283macro_rules! ConfigUnknown {
284    () => {
285        _
286    };
287}
288
289impl Config {
290    #[inline]
291    pub fn from_primitive(prim: u16) -> Option<Self> {
292        match prim {
293            0 => Some(Self::VendorId),
294            2 => Some(Self::DeviceId),
295            4 => Some(Self::Command),
296            6 => Some(Self::Status),
297            8 => Some(Self::RevisionId),
298            9 => Some(Self::ClassCodeIntr),
299            10 => Some(Self::ClassCodeSub),
300            11 => Some(Self::ClassCodeBase),
301            12 => Some(Self::CacheLineSize),
302            13 => Some(Self::LatencyTimer),
303            14 => Some(Self::HeaderType),
304            15 => Some(Self::Bist),
305            16 => Some(Self::BaseAddresses),
306            40 => Some(Self::CardbusCisPtr),
307            44 => Some(Self::SubsystemVendorId),
308            46 => Some(Self::SubsystemId),
309            48 => Some(Self::ExpRomAddress),
310            52 => Some(Self::CapabilitiesPtr),
311            60 => Some(Self::InterruptLine),
312            61 => Some(Self::InterruptPin),
313            62 => Some(Self::MinGrant),
314            63 => Some(Self::MaxLatency),
315            _ => None,
316        }
317    }
318
319    #[inline]
320    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
321        match prim {
322            0 => Self::VendorId,
323            2 => Self::DeviceId,
324            4 => Self::Command,
325            6 => Self::Status,
326            8 => Self::RevisionId,
327            9 => Self::ClassCodeIntr,
328            10 => Self::ClassCodeSub,
329            11 => Self::ClassCodeBase,
330            12 => Self::CacheLineSize,
331            13 => Self::LatencyTimer,
332            14 => Self::HeaderType,
333            15 => Self::Bist,
334            16 => Self::BaseAddresses,
335            40 => Self::CardbusCisPtr,
336            44 => Self::SubsystemVendorId,
337            46 => Self::SubsystemId,
338            48 => Self::ExpRomAddress,
339            52 => Self::CapabilitiesPtr,
340            60 => Self::InterruptLine,
341            61 => Self::InterruptPin,
342            62 => Self::MinGrant,
343            63 => Self::MaxLatency,
344            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
345        }
346    }
347
348    #[inline]
349    pub fn unknown() -> Self {
350        Self::__SourceBreaking { unknown_ordinal: 0xffff }
351    }
352
353    #[inline]
354    pub const fn into_primitive(self) -> u16 {
355        match self {
356            Self::VendorId => 0,
357            Self::DeviceId => 2,
358            Self::Command => 4,
359            Self::Status => 6,
360            Self::RevisionId => 8,
361            Self::ClassCodeIntr => 9,
362            Self::ClassCodeSub => 10,
363            Self::ClassCodeBase => 11,
364            Self::CacheLineSize => 12,
365            Self::LatencyTimer => 13,
366            Self::HeaderType => 14,
367            Self::Bist => 15,
368            Self::BaseAddresses => 16,
369            Self::CardbusCisPtr => 40,
370            Self::SubsystemVendorId => 44,
371            Self::SubsystemId => 46,
372            Self::ExpRomAddress => 48,
373            Self::CapabilitiesPtr => 52,
374            Self::InterruptLine => 60,
375            Self::InterruptPin => 61,
376            Self::MinGrant => 62,
377            Self::MaxLatency => 63,
378            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
379        }
380    }
381
382    #[inline]
383    pub fn is_unknown(&self) -> bool {
384        match self {
385            Self::__SourceBreaking { unknown_ordinal: _ } => true,
386            _ => false,
387        }
388    }
389}
390
391/// PCI Extended Capability IDs.
392/// PCIe Base Specification rev4, chapter 7.6.
393#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
394pub enum ExtendedCapabilityId {
395    Null,
396    AdvancedErrorReporting,
397    VirtualChannelNoMfvc,
398    DeviceSerialNumber,
399    PowerBudgeting,
400    RootComplexLinkDeclaration,
401    RootComplexInternalLinkControl,
402    RootComplexEventCollectorEndpointAssociation,
403    MultiFunctionVirtualChannel,
404    VirtualChannel,
405    Rcrb,
406    Vendor,
407    Cac,
408    Acs,
409    Ari,
410    Ats,
411    SrIov,
412    MrIov,
413    Multicast,
414    Pri,
415    EnhancedAllocation,
416    ResizableBar,
417    DynamicPowerAllocation,
418    Tph,
419    LatencyToleranceReporting,
420    SecondaryPciExpress,
421    Pmux,
422    Pasid,
423    Lnr,
424    Dpc,
425    L1PmSubstates,
426    PrecisionTimeMeasurement,
427    Mpcie,
428    FrsQueueing,
429    ReadinessTimeReporting,
430    DesignatedVendor,
431    VfResizableBar,
432    DataLinkFeature,
433    PhysicalLayer16,
434    LaneMarginingAtReceiver,
435    HierarchyId,
436    NativePcieEnclosure,
437    PhysicalLayer32,
438    AlternateProtocol,
439    SystemFirmwareIntermediary,
440    #[doc(hidden)]
441    __SourceBreaking {
442        unknown_ordinal: u16,
443    },
444}
445
446/// Pattern that matches an unknown `ExtendedCapabilityId` member.
447#[macro_export]
448macro_rules! ExtendedCapabilityIdUnknown {
449    () => {
450        _
451    };
452}
453
454impl ExtendedCapabilityId {
455    #[inline]
456    pub fn from_primitive(prim: u16) -> Option<Self> {
457        match prim {
458            0 => Some(Self::Null),
459            1 => Some(Self::AdvancedErrorReporting),
460            2 => Some(Self::VirtualChannelNoMfvc),
461            3 => Some(Self::DeviceSerialNumber),
462            4 => Some(Self::PowerBudgeting),
463            5 => Some(Self::RootComplexLinkDeclaration),
464            6 => Some(Self::RootComplexInternalLinkControl),
465            7 => Some(Self::RootComplexEventCollectorEndpointAssociation),
466            8 => Some(Self::MultiFunctionVirtualChannel),
467            9 => Some(Self::VirtualChannel),
468            10 => Some(Self::Rcrb),
469            11 => Some(Self::Vendor),
470            12 => Some(Self::Cac),
471            13 => Some(Self::Acs),
472            14 => Some(Self::Ari),
473            15 => Some(Self::Ats),
474            16 => Some(Self::SrIov),
475            17 => Some(Self::MrIov),
476            18 => Some(Self::Multicast),
477            19 => Some(Self::Pri),
478            20 => Some(Self::EnhancedAllocation),
479            21 => Some(Self::ResizableBar),
480            22 => Some(Self::DynamicPowerAllocation),
481            23 => Some(Self::Tph),
482            24 => Some(Self::LatencyToleranceReporting),
483            25 => Some(Self::SecondaryPciExpress),
484            26 => Some(Self::Pmux),
485            27 => Some(Self::Pasid),
486            28 => Some(Self::Lnr),
487            29 => Some(Self::Dpc),
488            30 => Some(Self::L1PmSubstates),
489            31 => Some(Self::PrecisionTimeMeasurement),
490            32 => Some(Self::Mpcie),
491            33 => Some(Self::FrsQueueing),
492            34 => Some(Self::ReadinessTimeReporting),
493            35 => Some(Self::DesignatedVendor),
494            36 => Some(Self::VfResizableBar),
495            37 => Some(Self::DataLinkFeature),
496            38 => Some(Self::PhysicalLayer16),
497            39 => Some(Self::LaneMarginingAtReceiver),
498            40 => Some(Self::HierarchyId),
499            41 => Some(Self::NativePcieEnclosure),
500            42 => Some(Self::PhysicalLayer32),
501            43 => Some(Self::AlternateProtocol),
502            44 => Some(Self::SystemFirmwareIntermediary),
503            _ => None,
504        }
505    }
506
507    #[inline]
508    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
509        match prim {
510            0 => Self::Null,
511            1 => Self::AdvancedErrorReporting,
512            2 => Self::VirtualChannelNoMfvc,
513            3 => Self::DeviceSerialNumber,
514            4 => Self::PowerBudgeting,
515            5 => Self::RootComplexLinkDeclaration,
516            6 => Self::RootComplexInternalLinkControl,
517            7 => Self::RootComplexEventCollectorEndpointAssociation,
518            8 => Self::MultiFunctionVirtualChannel,
519            9 => Self::VirtualChannel,
520            10 => Self::Rcrb,
521            11 => Self::Vendor,
522            12 => Self::Cac,
523            13 => Self::Acs,
524            14 => Self::Ari,
525            15 => Self::Ats,
526            16 => Self::SrIov,
527            17 => Self::MrIov,
528            18 => Self::Multicast,
529            19 => Self::Pri,
530            20 => Self::EnhancedAllocation,
531            21 => Self::ResizableBar,
532            22 => Self::DynamicPowerAllocation,
533            23 => Self::Tph,
534            24 => Self::LatencyToleranceReporting,
535            25 => Self::SecondaryPciExpress,
536            26 => Self::Pmux,
537            27 => Self::Pasid,
538            28 => Self::Lnr,
539            29 => Self::Dpc,
540            30 => Self::L1PmSubstates,
541            31 => Self::PrecisionTimeMeasurement,
542            32 => Self::Mpcie,
543            33 => Self::FrsQueueing,
544            34 => Self::ReadinessTimeReporting,
545            35 => Self::DesignatedVendor,
546            36 => Self::VfResizableBar,
547            37 => Self::DataLinkFeature,
548            38 => Self::PhysicalLayer16,
549            39 => Self::LaneMarginingAtReceiver,
550            40 => Self::HierarchyId,
551            41 => Self::NativePcieEnclosure,
552            42 => Self::PhysicalLayer32,
553            43 => Self::AlternateProtocol,
554            44 => Self::SystemFirmwareIntermediary,
555            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
556        }
557    }
558
559    #[inline]
560    pub fn unknown() -> Self {
561        Self::__SourceBreaking { unknown_ordinal: 0xffff }
562    }
563
564    #[inline]
565    pub const fn into_primitive(self) -> u16 {
566        match self {
567            Self::Null => 0,
568            Self::AdvancedErrorReporting => 1,
569            Self::VirtualChannelNoMfvc => 2,
570            Self::DeviceSerialNumber => 3,
571            Self::PowerBudgeting => 4,
572            Self::RootComplexLinkDeclaration => 5,
573            Self::RootComplexInternalLinkControl => 6,
574            Self::RootComplexEventCollectorEndpointAssociation => 7,
575            Self::MultiFunctionVirtualChannel => 8,
576            Self::VirtualChannel => 9,
577            Self::Rcrb => 10,
578            Self::Vendor => 11,
579            Self::Cac => 12,
580            Self::Acs => 13,
581            Self::Ari => 14,
582            Self::Ats => 15,
583            Self::SrIov => 16,
584            Self::MrIov => 17,
585            Self::Multicast => 18,
586            Self::Pri => 19,
587            Self::EnhancedAllocation => 20,
588            Self::ResizableBar => 21,
589            Self::DynamicPowerAllocation => 22,
590            Self::Tph => 23,
591            Self::LatencyToleranceReporting => 24,
592            Self::SecondaryPciExpress => 25,
593            Self::Pmux => 26,
594            Self::Pasid => 27,
595            Self::Lnr => 28,
596            Self::Dpc => 29,
597            Self::L1PmSubstates => 30,
598            Self::PrecisionTimeMeasurement => 31,
599            Self::Mpcie => 32,
600            Self::FrsQueueing => 33,
601            Self::ReadinessTimeReporting => 34,
602            Self::DesignatedVendor => 35,
603            Self::VfResizableBar => 36,
604            Self::DataLinkFeature => 37,
605            Self::PhysicalLayer16 => 38,
606            Self::LaneMarginingAtReceiver => 39,
607            Self::HierarchyId => 40,
608            Self::NativePcieEnclosure => 41,
609            Self::PhysicalLayer32 => 42,
610            Self::AlternateProtocol => 43,
611            Self::SystemFirmwareIntermediary => 44,
612            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
613        }
614    }
615
616    #[inline]
617    pub fn is_unknown(&self) -> bool {
618        match self {
619            Self::__SourceBreaking { unknown_ordinal: _ } => true,
620            _ => false,
621        }
622    }
623}
624
625#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
626pub enum HeaderType {
627    Standard,
628    Bridge,
629    CardBus,
630    Mask,
631    MultiFn,
632    #[doc(hidden)]
633    __SourceBreaking {
634        unknown_ordinal: u8,
635    },
636}
637
638/// Pattern that matches an unknown `HeaderType` member.
639#[macro_export]
640macro_rules! HeaderTypeUnknown {
641    () => {
642        _
643    };
644}
645
646impl HeaderType {
647    #[inline]
648    pub fn from_primitive(prim: u8) -> Option<Self> {
649        match prim {
650            0 => Some(Self::Standard),
651            1 => Some(Self::Bridge),
652            2 => Some(Self::CardBus),
653            127 => Some(Self::Mask),
654            128 => Some(Self::MultiFn),
655            _ => None,
656        }
657    }
658
659    #[inline]
660    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
661        match prim {
662            0 => Self::Standard,
663            1 => Self::Bridge,
664            2 => Self::CardBus,
665            127 => Self::Mask,
666            128 => Self::MultiFn,
667            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
668        }
669    }
670
671    #[inline]
672    pub fn unknown() -> Self {
673        Self::__SourceBreaking { unknown_ordinal: 0xff }
674    }
675
676    #[inline]
677    pub const fn into_primitive(self) -> u8 {
678        match self {
679            Self::Standard => 0,
680            Self::Bridge => 1,
681            Self::CardBus => 2,
682            Self::Mask => 127,
683            Self::MultiFn => 128,
684            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
685        }
686    }
687
688    #[inline]
689    pub fn is_unknown(&self) -> bool {
690        match self {
691            Self::__SourceBreaking { unknown_ordinal: _ } => true,
692            _ => false,
693        }
694    }
695}
696
697/// Used with ||SetInterruptMode| to configure an interrupt mode for the device.
698/// Devices configured to use the LEGACY Irq mode must ack their interrupt after
699/// servicing by calling |AckInterrupt|. To avoid this, LEGACY_NOACK can be
700/// used, but the driver's interrupt function will be disabled by the PCI Bus
701/// Driver if it sees excessive interrupt triggers in a given period.
702#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
703pub enum InterruptMode {
704    Disabled,
705    /// Legacy interrupt mode.
706    Legacy,
707    /// Legacy interrupt mode (without ACKing, see |AckInterrupt|).
708    LegacyNoack,
709    /// MSI (messaage-signaled interrupt) mode.
710    Msi,
711    /// MSI-X mode.
712    MsiX,
713    #[doc(hidden)]
714    __SourceBreaking {
715        unknown_ordinal: u8,
716    },
717}
718
719/// Pattern that matches an unknown `InterruptMode` member.
720#[macro_export]
721macro_rules! InterruptModeUnknown {
722    () => {
723        _
724    };
725}
726
727impl InterruptMode {
728    #[inline]
729    pub fn from_primitive(prim: u8) -> Option<Self> {
730        match prim {
731            0 => Some(Self::Disabled),
732            1 => Some(Self::Legacy),
733            2 => Some(Self::LegacyNoack),
734            3 => Some(Self::Msi),
735            4 => Some(Self::MsiX),
736            _ => None,
737        }
738    }
739
740    #[inline]
741    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
742        match prim {
743            0 => Self::Disabled,
744            1 => Self::Legacy,
745            2 => Self::LegacyNoack,
746            3 => Self::Msi,
747            4 => Self::MsiX,
748            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
749        }
750    }
751
752    #[inline]
753    pub fn unknown() -> Self {
754        Self::__SourceBreaking { unknown_ordinal: 0xff }
755    }
756
757    #[inline]
758    pub const fn into_primitive(self) -> u8 {
759        match self {
760            Self::Disabled => 0,
761            Self::Legacy => 1,
762            Self::LegacyNoack => 2,
763            Self::Msi => 3,
764            Self::MsiX => 4,
765            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
766        }
767    }
768
769    #[inline]
770    pub fn is_unknown(&self) -> bool {
771        match self {
772            Self::__SourceBreaking { unknown_ordinal: _ } => true,
773            _ => false,
774        }
775    }
776}
777
778/// An address of a PCI device.
779#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
780#[repr(C)]
781pub struct Address {
782    pub bus: u8,
783    pub device: u8,
784    pub function: u8,
785}
786
787impl fidl::Persistable for Address {}
788
789/// Describes and provides access to a given Base Address Register for the device.
790#[derive(Debug, PartialEq)]
791pub struct Bar {
792    /// The BAR id, [0-5).
793    pub bar_id: u32,
794    pub size: u64,
795    pub result: BarResult,
796}
797
798impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Bar {}
799
800#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
801pub struct BaseAddress {
802    pub address: u64,
803    pub size: u64,
804    pub is_memory: bool,
805    pub is_prefetchable: bool,
806    pub is_64bit: bool,
807    pub id: u8,
808}
809
810impl fidl::Persistable for BaseAddress {}
811
812#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
813pub struct BusGetDevicesResponse {
814    pub devices: Vec<PciDevice>,
815}
816
817impl fidl::Persistable for BusGetDevicesResponse {}
818
819#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
820pub struct BusGetHostBridgeInfoResponse {
821    pub info: HostBridgeInfo,
822}
823
824impl fidl::Persistable for BusGetHostBridgeInfoResponse {}
825
826#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
827#[repr(C)]
828pub struct BusReadBarRequest {
829    pub device: Address,
830    pub bar_id: u8,
831    pub offset: u64,
832    pub size: u64,
833}
834
835impl fidl::Persistable for BusReadBarRequest {}
836
837#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
838pub struct BusReadBarResponse {
839    pub buffer: Vec<u8>,
840}
841
842impl fidl::Persistable for BusReadBarResponse {}
843
844#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
845#[repr(C)]
846pub struct Capability {
847    pub id: u8,
848    pub offset: u8,
849}
850
851impl fidl::Persistable for Capability {}
852
853#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
854#[repr(C)]
855pub struct DeviceGetBarRequest {
856    pub bar_id: u32,
857}
858
859impl fidl::Persistable for DeviceGetBarRequest {}
860
861#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
862#[repr(C)]
863pub struct DeviceGetBtiRequest {
864    pub index: u32,
865}
866
867impl fidl::Persistable for DeviceGetBtiRequest {}
868
869#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
870pub struct DeviceGetCapabilitiesRequest {
871    pub id: CapabilityId,
872}
873
874impl fidl::Persistable for DeviceGetCapabilitiesRequest {}
875
876#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
877pub struct DeviceGetCapabilitiesResponse {
878    pub offsets: Vec<u8>,
879}
880
881impl fidl::Persistable for DeviceGetCapabilitiesResponse {}
882
883#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
884pub struct DeviceGetDeviceInfoResponse {
885    pub info: DeviceInfo,
886}
887
888impl fidl::Persistable for DeviceGetDeviceInfoResponse {}
889
890#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
891pub struct DeviceGetExtendedCapabilitiesRequest {
892    pub id: ExtendedCapabilityId,
893}
894
895impl fidl::Persistable for DeviceGetExtendedCapabilitiesRequest {}
896
897#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
898pub struct DeviceGetExtendedCapabilitiesResponse {
899    pub offsets: Vec<u16>,
900}
901
902impl fidl::Persistable for DeviceGetExtendedCapabilitiesResponse {}
903
904#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
905pub struct DeviceGetInterruptModesResponse {
906    pub modes: InterruptModes,
907}
908
909impl fidl::Persistable for DeviceGetInterruptModesResponse {}
910
911/// Device specific information from a device's configuration header.
912/// PCI Local Bus Specification v3, chapter 6.1.
913#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
914pub struct DeviceInfo {
915    /// Device identification information.
916    pub vendor_id: u16,
917    pub device_id: u16,
918    pub base_class: u8,
919    pub sub_class: u8,
920    pub program_interface: u8,
921    pub revision_id: u8,
922    /// Information pertaining to the device's location in the bus topology.
923    pub bus_id: u8,
924    pub dev_id: u8,
925    pub func_id: u8,
926    pub padding: Padding,
927}
928
929impl fidl::Persistable for DeviceInfo {}
930
931#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
932#[repr(C)]
933pub struct DeviceMapInterruptRequest {
934    pub which_irq: u32,
935}
936
937impl fidl::Persistable for DeviceMapInterruptRequest {}
938
939#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
940#[repr(C)]
941pub struct DeviceReadConfig16Request {
942    pub offset: u16,
943}
944
945impl fidl::Persistable for DeviceReadConfig16Request {}
946
947#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
948#[repr(C)]
949pub struct DeviceReadConfig32Request {
950    pub offset: u16,
951}
952
953impl fidl::Persistable for DeviceReadConfig32Request {}
954
955#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
956#[repr(C)]
957pub struct DeviceReadConfig8Request {
958    pub offset: u16,
959}
960
961impl fidl::Persistable for DeviceReadConfig8Request {}
962
963#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
964pub struct DeviceSetBusMasteringRequest {
965    pub enabled: bool,
966}
967
968impl fidl::Persistable for DeviceSetBusMasteringRequest {}
969
970#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
971pub struct DeviceSetInterruptModeRequest {
972    pub mode: InterruptMode,
973    pub requested_irq_count: u32,
974}
975
976impl fidl::Persistable for DeviceSetInterruptModeRequest {}
977
978#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
979#[repr(C)]
980pub struct DeviceWriteConfig16Request {
981    pub offset: u16,
982    pub value: u16,
983}
984
985impl fidl::Persistable for DeviceWriteConfig16Request {}
986
987#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
988#[repr(C)]
989pub struct DeviceWriteConfig32Request {
990    pub offset: u16,
991    pub value: u32,
992}
993
994impl fidl::Persistable for DeviceWriteConfig32Request {}
995
996#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
997#[repr(C)]
998pub struct DeviceWriteConfig8Request {
999    pub offset: u16,
1000    pub value: u8,
1001}
1002
1003impl fidl::Persistable for DeviceWriteConfig8Request {}
1004
1005#[derive(Debug, PartialEq)]
1006pub struct DeviceGetBarResponse {
1007    pub result: Bar,
1008}
1009
1010impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetBarResponse {}
1011
1012#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1013pub struct DeviceGetBtiResponse {
1014    pub bti: fidl::Bti,
1015}
1016
1017impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetBtiResponse {}
1018
1019#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1020pub struct DeviceMapInterruptResponse {
1021    pub interrupt: fidl::Interrupt,
1022}
1023
1024impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
1025    for DeviceMapInterruptResponse
1026{
1027}
1028
1029#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1030#[repr(C)]
1031pub struct DeviceReadConfig16Response {
1032    pub value: u16,
1033}
1034
1035impl fidl::Persistable for DeviceReadConfig16Response {}
1036
1037#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1038#[repr(C)]
1039pub struct DeviceReadConfig32Response {
1040    pub value: u32,
1041}
1042
1043impl fidl::Persistable for DeviceReadConfig32Response {}
1044
1045#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1046#[repr(C)]
1047pub struct DeviceReadConfig8Response {
1048    pub value: u8,
1049}
1050
1051impl fidl::Persistable for DeviceReadConfig8Response {}
1052
1053#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1054#[repr(C)]
1055pub struct ExtendedCapability {
1056    pub id: u16,
1057    pub offset: u16,
1058}
1059
1060impl fidl::Persistable for ExtendedCapability {}
1061
1062#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1063pub struct HostBridgeInfo {
1064    pub name: String,
1065    pub start_bus_number: u8,
1066    pub end_bus_number: u8,
1067    pub segment_group: u16,
1068}
1069
1070impl fidl::Persistable for HostBridgeInfo {}
1071
1072/// Returned by |GetInterruptModes|. Contains the number of interrupts supported
1073/// by a given PCI device interrupt mode. 0 is returned for a mode if
1074/// unsupported.
1075#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1076pub struct InterruptModes {
1077    /// |True| if the device supports a legacy interrupt.
1078    pub has_legacy: bool,
1079    /// The number of Message-Signaled interrupted supported. Will be in the
1080    /// range of [0, 0x8) depending on device support.
1081    pub msi_count: u8,
1082    /// The number of MSI-X interrupts supported. Will be in the range of [0,
1083    /// 0x800), depending on device and platform support.
1084    pub msix_count: u16,
1085}
1086
1087impl fidl::Persistable for InterruptModes {}
1088
1089#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1090pub struct IoBar {
1091    pub address: u64,
1092    pub resource: fidl::Resource,
1093}
1094
1095impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IoBar {}
1096
1097#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1098pub struct Padding;
1099
1100impl fidl::Persistable for Padding {}
1101
1102#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1103pub struct PciDevice {
1104    pub base_addresses: Vec<BaseAddress>,
1105    pub capabilities: Vec<Capability>,
1106    pub ext_capabilities: Vec<ExtendedCapability>,
1107    pub config: Vec<u8>,
1108    pub bus_id: u8,
1109    pub device_id: u8,
1110    pub function_id: u8,
1111}
1112
1113impl fidl::Persistable for PciDevice {}
1114
1115#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1116pub struct UseIntxWorkaroundType;
1117
1118impl fidl::Persistable for UseIntxWorkaroundType {}
1119
1120#[derive(Clone, Debug, Default, PartialEq)]
1121pub struct BoardConfiguration {
1122    /// If set, use legacy interrupt workarounds for systems that don't properly implement
1123    /// InterruptPin and/or the InterruptStatus bit in device configuration space. Instead, the
1124    /// bus driver will assume INTA and rely on interrupt mappings, and will wake any device sharing
1125    /// a legacy interrupt even if their InterruptStatus bit is not set.
1126    pub use_intx_workaround: Option<UseIntxWorkaroundType>,
1127    #[doc(hidden)]
1128    pub __source_breaking: fidl::marker::SourceBreaking,
1129}
1130
1131impl fidl::Persistable for BoardConfiguration {}
1132
1133#[derive(Debug)]
1134pub enum BarResult {
1135    Io(IoBar),
1136    Vmo(fidl::Vmo),
1137    #[doc(hidden)]
1138    __SourceBreaking {
1139        unknown_ordinal: u64,
1140    },
1141}
1142
1143/// Pattern that matches an unknown `BarResult` member.
1144#[macro_export]
1145macro_rules! BarResultUnknown {
1146    () => {
1147        _
1148    };
1149}
1150
1151// Custom PartialEq so that unknown variants are not equal to themselves.
1152impl PartialEq for BarResult {
1153    fn eq(&self, other: &Self) -> bool {
1154        match (self, other) {
1155            (Self::Io(x), Self::Io(y)) => *x == *y,
1156            (Self::Vmo(x), Self::Vmo(y)) => *x == *y,
1157            _ => false,
1158        }
1159    }
1160}
1161
1162impl BarResult {
1163    #[inline]
1164    pub fn ordinal(&self) -> u64 {
1165        match *self {
1166            Self::Io(_) => 1,
1167            Self::Vmo(_) => 2,
1168            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1169        }
1170    }
1171
1172    #[inline]
1173    pub fn unknown_variant_for_testing() -> Self {
1174        Self::__SourceBreaking { unknown_ordinal: 0 }
1175    }
1176
1177    #[inline]
1178    pub fn is_unknown(&self) -> bool {
1179        match self {
1180            Self::__SourceBreaking { .. } => true,
1181            _ => false,
1182        }
1183    }
1184}
1185
1186impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BarResult {}
1187
1188#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1189pub struct BusMarker;
1190
1191impl fidl::endpoints::ProtocolMarker for BusMarker {
1192    type Proxy = BusProxy;
1193    type RequestStream = BusRequestStream;
1194    #[cfg(target_os = "fuchsia")]
1195    type SynchronousProxy = BusSynchronousProxy;
1196
1197    const DEBUG_NAME: &'static str = "fuchsia.hardware.pci.Bus";
1198}
1199impl fidl::endpoints::DiscoverableProtocolMarker for BusMarker {}
1200pub type BusReadBarResult = Result<Vec<u8>, i32>;
1201
1202pub trait BusProxyInterface: Send + Sync {
1203    type GetHostBridgeInfoResponseFut: std::future::Future<Output = Result<HostBridgeInfo, fidl::Error>>
1204        + Send;
1205    fn r#get_host_bridge_info(&self) -> Self::GetHostBridgeInfoResponseFut;
1206    type GetDevicesResponseFut: std::future::Future<Output = Result<Vec<PciDevice>, fidl::Error>>
1207        + Send;
1208    fn r#get_devices(&self) -> Self::GetDevicesResponseFut;
1209    type ReadBarResponseFut: std::future::Future<Output = Result<BusReadBarResult, fidl::Error>>
1210        + Send;
1211    fn r#read_bar(
1212        &self,
1213        device: &Address,
1214        bar_id: u8,
1215        offset: u64,
1216        size: u64,
1217    ) -> Self::ReadBarResponseFut;
1218}
1219#[derive(Debug)]
1220#[cfg(target_os = "fuchsia")]
1221pub struct BusSynchronousProxy {
1222    client: fidl::client::sync::Client,
1223}
1224
1225#[cfg(target_os = "fuchsia")]
1226impl fidl::endpoints::SynchronousProxy for BusSynchronousProxy {
1227    type Proxy = BusProxy;
1228    type Protocol = BusMarker;
1229
1230    fn from_channel(inner: fidl::Channel) -> Self {
1231        Self::new(inner)
1232    }
1233
1234    fn into_channel(self) -> fidl::Channel {
1235        self.client.into_channel()
1236    }
1237
1238    fn as_channel(&self) -> &fidl::Channel {
1239        self.client.as_channel()
1240    }
1241}
1242
1243#[cfg(target_os = "fuchsia")]
1244impl BusSynchronousProxy {
1245    pub fn new(channel: fidl::Channel) -> Self {
1246        let protocol_name = <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1247        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1248    }
1249
1250    pub fn into_channel(self) -> fidl::Channel {
1251        self.client.into_channel()
1252    }
1253
1254    /// Waits until an event arrives and returns it. It is safe for other
1255    /// threads to make concurrent requests while waiting for an event.
1256    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<BusEvent, fidl::Error> {
1257        BusEvent::decode(self.client.wait_for_event(deadline)?)
1258    }
1259
1260    /// Retrieve information about the segment group and buses covered by a Bus.
1261    pub fn r#get_host_bridge_info(
1262        &self,
1263        ___deadline: zx::MonotonicInstant,
1264    ) -> Result<HostBridgeInfo, fidl::Error> {
1265        let _response =
1266            self.client.send_query::<fidl::encoding::EmptyPayload, BusGetHostBridgeInfoResponse>(
1267                (),
1268                0x39f0b21bcd8c065d,
1269                fidl::encoding::DynamicFlags::empty(),
1270                ___deadline,
1271            )?;
1272        Ok(_response.info)
1273    }
1274
1275    /// Retrieve all Devices on the Bus.
1276    pub fn r#get_devices(
1277        &self,
1278        ___deadline: zx::MonotonicInstant,
1279    ) -> Result<Vec<PciDevice>, fidl::Error> {
1280        let _response =
1281            self.client.send_query::<fidl::encoding::EmptyPayload, BusGetDevicesResponse>(
1282                (),
1283                0x2b39a32926007c92,
1284                fidl::encoding::DynamicFlags::empty(),
1285                ___deadline,
1286            )?;
1287        Ok(_response.devices)
1288    }
1289
1290    /// Read from a Device's base address register (BAR). The BAR must be an MMIO type.
1291    ///
1292    /// Parameters
1293    /// |device|: The address of the device to read from.
1294    /// |bar_id|: The ID of the BAR to read.
1295    /// |offset|: The offset, in bytes, to start the read (default: 0 bytes).
1296    /// |size|: The size of the read (default: 128 bytes). The max size for a
1297    /// read is |READBAR_MAX_SIZE|.
1298    ///
1299    /// Errors:
1300    /// |ZX_ERR_NOT_FOUND|: |device| was not found, or |bar_id| did not exist in |device|.
1301    /// |ZX_ERR_INVALID_ARGS|: |bar_id| is invalid,  or offset / size combined
1302    /// are invalid for the given BAR's size.
1303    /// |ZX_ERR_NOT_SUPPORTED|: The BAR specified by |bar_id| is not an MMIO BAR.
1304    pub fn r#read_bar(
1305        &self,
1306        mut device: &Address,
1307        mut bar_id: u8,
1308        mut offset: u64,
1309        mut size: u64,
1310        ___deadline: zx::MonotonicInstant,
1311    ) -> Result<BusReadBarResult, fidl::Error> {
1312        let _response = self
1313            .client
1314            .send_query::<BusReadBarRequest, fidl::encoding::ResultType<BusReadBarResponse, i32>>(
1315                (device, bar_id, offset, size),
1316                0x798f39b0dfdc4860,
1317                fidl::encoding::DynamicFlags::empty(),
1318                ___deadline,
1319            )?;
1320        Ok(_response.map(|x| x.buffer))
1321    }
1322}
1323
1324#[derive(Debug, Clone)]
1325pub struct BusProxy {
1326    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1327}
1328
1329impl fidl::endpoints::Proxy for BusProxy {
1330    type Protocol = BusMarker;
1331
1332    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1333        Self::new(inner)
1334    }
1335
1336    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1337        self.client.into_channel().map_err(|client| Self { client })
1338    }
1339
1340    fn as_channel(&self) -> &::fidl::AsyncChannel {
1341        self.client.as_channel()
1342    }
1343}
1344
1345impl BusProxy {
1346    /// Create a new Proxy for fuchsia.hardware.pci/Bus.
1347    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1348        let protocol_name = <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1349        Self { client: fidl::client::Client::new(channel, protocol_name) }
1350    }
1351
1352    /// Get a Stream of events from the remote end of the protocol.
1353    ///
1354    /// # Panics
1355    ///
1356    /// Panics if the event stream was already taken.
1357    pub fn take_event_stream(&self) -> BusEventStream {
1358        BusEventStream { event_receiver: self.client.take_event_receiver() }
1359    }
1360
1361    /// Retrieve information about the segment group and buses covered by a Bus.
1362    pub fn r#get_host_bridge_info(
1363        &self,
1364    ) -> fidl::client::QueryResponseFut<HostBridgeInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
1365    {
1366        BusProxyInterface::r#get_host_bridge_info(self)
1367    }
1368
1369    /// Retrieve all Devices on the Bus.
1370    pub fn r#get_devices(
1371        &self,
1372    ) -> fidl::client::QueryResponseFut<Vec<PciDevice>, fidl::encoding::DefaultFuchsiaResourceDialect>
1373    {
1374        BusProxyInterface::r#get_devices(self)
1375    }
1376
1377    /// Read from a Device's base address register (BAR). The BAR must be an MMIO type.
1378    ///
1379    /// Parameters
1380    /// |device|: The address of the device to read from.
1381    /// |bar_id|: The ID of the BAR to read.
1382    /// |offset|: The offset, in bytes, to start the read (default: 0 bytes).
1383    /// |size|: The size of the read (default: 128 bytes). The max size for a
1384    /// read is |READBAR_MAX_SIZE|.
1385    ///
1386    /// Errors:
1387    /// |ZX_ERR_NOT_FOUND|: |device| was not found, or |bar_id| did not exist in |device|.
1388    /// |ZX_ERR_INVALID_ARGS|: |bar_id| is invalid,  or offset / size combined
1389    /// are invalid for the given BAR's size.
1390    /// |ZX_ERR_NOT_SUPPORTED|: The BAR specified by |bar_id| is not an MMIO BAR.
1391    pub fn r#read_bar(
1392        &self,
1393        mut device: &Address,
1394        mut bar_id: u8,
1395        mut offset: u64,
1396        mut size: u64,
1397    ) -> fidl::client::QueryResponseFut<
1398        BusReadBarResult,
1399        fidl::encoding::DefaultFuchsiaResourceDialect,
1400    > {
1401        BusProxyInterface::r#read_bar(self, device, bar_id, offset, size)
1402    }
1403}
1404
1405impl BusProxyInterface for BusProxy {
1406    type GetHostBridgeInfoResponseFut = fidl::client::QueryResponseFut<
1407        HostBridgeInfo,
1408        fidl::encoding::DefaultFuchsiaResourceDialect,
1409    >;
1410    fn r#get_host_bridge_info(&self) -> Self::GetHostBridgeInfoResponseFut {
1411        fn _decode(
1412            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1413        ) -> Result<HostBridgeInfo, fidl::Error> {
1414            let _response = fidl::client::decode_transaction_body::<
1415                BusGetHostBridgeInfoResponse,
1416                fidl::encoding::DefaultFuchsiaResourceDialect,
1417                0x39f0b21bcd8c065d,
1418            >(_buf?)?;
1419            Ok(_response.info)
1420        }
1421        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HostBridgeInfo>(
1422            (),
1423            0x39f0b21bcd8c065d,
1424            fidl::encoding::DynamicFlags::empty(),
1425            _decode,
1426        )
1427    }
1428
1429    type GetDevicesResponseFut = fidl::client::QueryResponseFut<
1430        Vec<PciDevice>,
1431        fidl::encoding::DefaultFuchsiaResourceDialect,
1432    >;
1433    fn r#get_devices(&self) -> Self::GetDevicesResponseFut {
1434        fn _decode(
1435            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1436        ) -> Result<Vec<PciDevice>, fidl::Error> {
1437            let _response = fidl::client::decode_transaction_body::<
1438                BusGetDevicesResponse,
1439                fidl::encoding::DefaultFuchsiaResourceDialect,
1440                0x2b39a32926007c92,
1441            >(_buf?)?;
1442            Ok(_response.devices)
1443        }
1444        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PciDevice>>(
1445            (),
1446            0x2b39a32926007c92,
1447            fidl::encoding::DynamicFlags::empty(),
1448            _decode,
1449        )
1450    }
1451
1452    type ReadBarResponseFut = fidl::client::QueryResponseFut<
1453        BusReadBarResult,
1454        fidl::encoding::DefaultFuchsiaResourceDialect,
1455    >;
1456    fn r#read_bar(
1457        &self,
1458        mut device: &Address,
1459        mut bar_id: u8,
1460        mut offset: u64,
1461        mut size: u64,
1462    ) -> Self::ReadBarResponseFut {
1463        fn _decode(
1464            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1465        ) -> Result<BusReadBarResult, fidl::Error> {
1466            let _response = fidl::client::decode_transaction_body::<
1467                fidl::encoding::ResultType<BusReadBarResponse, i32>,
1468                fidl::encoding::DefaultFuchsiaResourceDialect,
1469                0x798f39b0dfdc4860,
1470            >(_buf?)?;
1471            Ok(_response.map(|x| x.buffer))
1472        }
1473        self.client.send_query_and_decode::<BusReadBarRequest, BusReadBarResult>(
1474            (device, bar_id, offset, size),
1475            0x798f39b0dfdc4860,
1476            fidl::encoding::DynamicFlags::empty(),
1477            _decode,
1478        )
1479    }
1480}
1481
1482pub struct BusEventStream {
1483    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1484}
1485
1486impl std::marker::Unpin for BusEventStream {}
1487
1488impl futures::stream::FusedStream for BusEventStream {
1489    fn is_terminated(&self) -> bool {
1490        self.event_receiver.is_terminated()
1491    }
1492}
1493
1494impl futures::Stream for BusEventStream {
1495    type Item = Result<BusEvent, fidl::Error>;
1496
1497    fn poll_next(
1498        mut self: std::pin::Pin<&mut Self>,
1499        cx: &mut std::task::Context<'_>,
1500    ) -> std::task::Poll<Option<Self::Item>> {
1501        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1502            &mut self.event_receiver,
1503            cx
1504        )?) {
1505            Some(buf) => std::task::Poll::Ready(Some(BusEvent::decode(buf))),
1506            None => std::task::Poll::Ready(None),
1507        }
1508    }
1509}
1510
1511#[derive(Debug)]
1512pub enum BusEvent {}
1513
1514impl BusEvent {
1515    /// Decodes a message buffer as a [`BusEvent`].
1516    fn decode(
1517        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1518    ) -> Result<BusEvent, fidl::Error> {
1519        let (bytes, _handles) = buf.split_mut();
1520        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1521        debug_assert_eq!(tx_header.tx_id, 0);
1522        match tx_header.ordinal {
1523            _ => Err(fidl::Error::UnknownOrdinal {
1524                ordinal: tx_header.ordinal,
1525                protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1526            }),
1527        }
1528    }
1529}
1530
1531/// A Stream of incoming requests for fuchsia.hardware.pci/Bus.
1532pub struct BusRequestStream {
1533    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1534    is_terminated: bool,
1535}
1536
1537impl std::marker::Unpin for BusRequestStream {}
1538
1539impl futures::stream::FusedStream for BusRequestStream {
1540    fn is_terminated(&self) -> bool {
1541        self.is_terminated
1542    }
1543}
1544
1545impl fidl::endpoints::RequestStream for BusRequestStream {
1546    type Protocol = BusMarker;
1547    type ControlHandle = BusControlHandle;
1548
1549    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1550        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1551    }
1552
1553    fn control_handle(&self) -> Self::ControlHandle {
1554        BusControlHandle { inner: self.inner.clone() }
1555    }
1556
1557    fn into_inner(
1558        self,
1559    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1560    {
1561        (self.inner, self.is_terminated)
1562    }
1563
1564    fn from_inner(
1565        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1566        is_terminated: bool,
1567    ) -> Self {
1568        Self { inner, is_terminated }
1569    }
1570}
1571
1572impl futures::Stream for BusRequestStream {
1573    type Item = Result<BusRequest, fidl::Error>;
1574
1575    fn poll_next(
1576        mut self: std::pin::Pin<&mut Self>,
1577        cx: &mut std::task::Context<'_>,
1578    ) -> std::task::Poll<Option<Self::Item>> {
1579        let this = &mut *self;
1580        if this.inner.check_shutdown(cx) {
1581            this.is_terminated = true;
1582            return std::task::Poll::Ready(None);
1583        }
1584        if this.is_terminated {
1585            panic!("polled BusRequestStream after completion");
1586        }
1587        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1588            |bytes, handles| {
1589                match this.inner.channel().read_etc(cx, bytes, handles) {
1590                    std::task::Poll::Ready(Ok(())) => {}
1591                    std::task::Poll::Pending => return std::task::Poll::Pending,
1592                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1593                        this.is_terminated = true;
1594                        return std::task::Poll::Ready(None);
1595                    }
1596                    std::task::Poll::Ready(Err(e)) => {
1597                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1598                            e.into(),
1599                        ))))
1600                    }
1601                }
1602
1603                // A message has been received from the channel
1604                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1605
1606                std::task::Poll::Ready(Some(match header.ordinal {
1607                    0x39f0b21bcd8c065d => {
1608                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1609                        let mut req = fidl::new_empty!(
1610                            fidl::encoding::EmptyPayload,
1611                            fidl::encoding::DefaultFuchsiaResourceDialect
1612                        );
1613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1614                        let control_handle = BusControlHandle { inner: this.inner.clone() };
1615                        Ok(BusRequest::GetHostBridgeInfo {
1616                            responder: BusGetHostBridgeInfoResponder {
1617                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1618                                tx_id: header.tx_id,
1619                            },
1620                        })
1621                    }
1622                    0x2b39a32926007c92 => {
1623                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1624                        let mut req = fidl::new_empty!(
1625                            fidl::encoding::EmptyPayload,
1626                            fidl::encoding::DefaultFuchsiaResourceDialect
1627                        );
1628                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1629                        let control_handle = BusControlHandle { inner: this.inner.clone() };
1630                        Ok(BusRequest::GetDevices {
1631                            responder: BusGetDevicesResponder {
1632                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1633                                tx_id: header.tx_id,
1634                            },
1635                        })
1636                    }
1637                    0x798f39b0dfdc4860 => {
1638                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1639                        let mut req = fidl::new_empty!(
1640                            BusReadBarRequest,
1641                            fidl::encoding::DefaultFuchsiaResourceDialect
1642                        );
1643                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BusReadBarRequest>(&header, _body_bytes, handles, &mut req)?;
1644                        let control_handle = BusControlHandle { inner: this.inner.clone() };
1645                        Ok(BusRequest::ReadBar {
1646                            device: req.device,
1647                            bar_id: req.bar_id,
1648                            offset: req.offset,
1649                            size: req.size,
1650
1651                            responder: BusReadBarResponder {
1652                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1653                                tx_id: header.tx_id,
1654                            },
1655                        })
1656                    }
1657                    _ => Err(fidl::Error::UnknownOrdinal {
1658                        ordinal: header.ordinal,
1659                        protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1660                    }),
1661                }))
1662            },
1663        )
1664    }
1665}
1666
1667/// The Bus protocol provides information about PCI device children on the PCI
1668/// providing the service.
1669#[derive(Debug)]
1670pub enum BusRequest {
1671    /// Retrieve information about the segment group and buses covered by a Bus.
1672    GetHostBridgeInfo { responder: BusGetHostBridgeInfoResponder },
1673    /// Retrieve all Devices on the Bus.
1674    GetDevices { responder: BusGetDevicesResponder },
1675    /// Read from a Device's base address register (BAR). The BAR must be an MMIO type.
1676    ///
1677    /// Parameters
1678    /// |device|: The address of the device to read from.
1679    /// |bar_id|: The ID of the BAR to read.
1680    /// |offset|: The offset, in bytes, to start the read (default: 0 bytes).
1681    /// |size|: The size of the read (default: 128 bytes). The max size for a
1682    /// read is |READBAR_MAX_SIZE|.
1683    ///
1684    /// Errors:
1685    /// |ZX_ERR_NOT_FOUND|: |device| was not found, or |bar_id| did not exist in |device|.
1686    /// |ZX_ERR_INVALID_ARGS|: |bar_id| is invalid,  or offset / size combined
1687    /// are invalid for the given BAR's size.
1688    /// |ZX_ERR_NOT_SUPPORTED|: The BAR specified by |bar_id| is not an MMIO BAR.
1689    ReadBar { device: Address, bar_id: u8, offset: u64, size: u64, responder: BusReadBarResponder },
1690}
1691
1692impl BusRequest {
1693    #[allow(irrefutable_let_patterns)]
1694    pub fn into_get_host_bridge_info(self) -> Option<(BusGetHostBridgeInfoResponder)> {
1695        if let BusRequest::GetHostBridgeInfo { responder } = self {
1696            Some((responder))
1697        } else {
1698            None
1699        }
1700    }
1701
1702    #[allow(irrefutable_let_patterns)]
1703    pub fn into_get_devices(self) -> Option<(BusGetDevicesResponder)> {
1704        if let BusRequest::GetDevices { responder } = self {
1705            Some((responder))
1706        } else {
1707            None
1708        }
1709    }
1710
1711    #[allow(irrefutable_let_patterns)]
1712    pub fn into_read_bar(self) -> Option<(Address, u8, u64, u64, BusReadBarResponder)> {
1713        if let BusRequest::ReadBar { device, bar_id, offset, size, responder } = self {
1714            Some((device, bar_id, offset, size, responder))
1715        } else {
1716            None
1717        }
1718    }
1719
1720    /// Name of the method defined in FIDL
1721    pub fn method_name(&self) -> &'static str {
1722        match *self {
1723            BusRequest::GetHostBridgeInfo { .. } => "get_host_bridge_info",
1724            BusRequest::GetDevices { .. } => "get_devices",
1725            BusRequest::ReadBar { .. } => "read_bar",
1726        }
1727    }
1728}
1729
1730#[derive(Debug, Clone)]
1731pub struct BusControlHandle {
1732    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1733}
1734
1735impl fidl::endpoints::ControlHandle for BusControlHandle {
1736    fn shutdown(&self) {
1737        self.inner.shutdown()
1738    }
1739    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1740        self.inner.shutdown_with_epitaph(status)
1741    }
1742
1743    fn is_closed(&self) -> bool {
1744        self.inner.channel().is_closed()
1745    }
1746    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1747        self.inner.channel().on_closed()
1748    }
1749
1750    #[cfg(target_os = "fuchsia")]
1751    fn signal_peer(
1752        &self,
1753        clear_mask: zx::Signals,
1754        set_mask: zx::Signals,
1755    ) -> Result<(), zx_status::Status> {
1756        use fidl::Peered;
1757        self.inner.channel().signal_peer(clear_mask, set_mask)
1758    }
1759}
1760
1761impl BusControlHandle {}
1762
1763#[must_use = "FIDL methods require a response to be sent"]
1764#[derive(Debug)]
1765pub struct BusGetHostBridgeInfoResponder {
1766    control_handle: std::mem::ManuallyDrop<BusControlHandle>,
1767    tx_id: u32,
1768}
1769
1770/// Set the the channel to be shutdown (see [`BusControlHandle::shutdown`])
1771/// if the responder is dropped without sending a response, so that the client
1772/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1773impl std::ops::Drop for BusGetHostBridgeInfoResponder {
1774    fn drop(&mut self) {
1775        self.control_handle.shutdown();
1776        // Safety: drops once, never accessed again
1777        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1778    }
1779}
1780
1781impl fidl::endpoints::Responder for BusGetHostBridgeInfoResponder {
1782    type ControlHandle = BusControlHandle;
1783
1784    fn control_handle(&self) -> &BusControlHandle {
1785        &self.control_handle
1786    }
1787
1788    fn drop_without_shutdown(mut self) {
1789        // Safety: drops once, never accessed again due to mem::forget
1790        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1791        // Prevent Drop from running (which would shut down the channel)
1792        std::mem::forget(self);
1793    }
1794}
1795
1796impl BusGetHostBridgeInfoResponder {
1797    /// Sends a response to the FIDL transaction.
1798    ///
1799    /// Sets the channel to shutdown if an error occurs.
1800    pub fn send(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
1801        let _result = self.send_raw(info);
1802        if _result.is_err() {
1803            self.control_handle.shutdown();
1804        }
1805        self.drop_without_shutdown();
1806        _result
1807    }
1808
1809    /// Similar to "send" but does not shutdown the channel if an error occurs.
1810    pub fn send_no_shutdown_on_err(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
1811        let _result = self.send_raw(info);
1812        self.drop_without_shutdown();
1813        _result
1814    }
1815
1816    fn send_raw(&self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
1817        self.control_handle.inner.send::<BusGetHostBridgeInfoResponse>(
1818            (info,),
1819            self.tx_id,
1820            0x39f0b21bcd8c065d,
1821            fidl::encoding::DynamicFlags::empty(),
1822        )
1823    }
1824}
1825
1826#[must_use = "FIDL methods require a response to be sent"]
1827#[derive(Debug)]
1828pub struct BusGetDevicesResponder {
1829    control_handle: std::mem::ManuallyDrop<BusControlHandle>,
1830    tx_id: u32,
1831}
1832
1833/// Set the the channel to be shutdown (see [`BusControlHandle::shutdown`])
1834/// if the responder is dropped without sending a response, so that the client
1835/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1836impl std::ops::Drop for BusGetDevicesResponder {
1837    fn drop(&mut self) {
1838        self.control_handle.shutdown();
1839        // Safety: drops once, never accessed again
1840        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1841    }
1842}
1843
1844impl fidl::endpoints::Responder for BusGetDevicesResponder {
1845    type ControlHandle = BusControlHandle;
1846
1847    fn control_handle(&self) -> &BusControlHandle {
1848        &self.control_handle
1849    }
1850
1851    fn drop_without_shutdown(mut self) {
1852        // Safety: drops once, never accessed again due to mem::forget
1853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1854        // Prevent Drop from running (which would shut down the channel)
1855        std::mem::forget(self);
1856    }
1857}
1858
1859impl BusGetDevicesResponder {
1860    /// Sends a response to the FIDL transaction.
1861    ///
1862    /// Sets the channel to shutdown if an error occurs.
1863    pub fn send(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
1864        let _result = self.send_raw(devices);
1865        if _result.is_err() {
1866            self.control_handle.shutdown();
1867        }
1868        self.drop_without_shutdown();
1869        _result
1870    }
1871
1872    /// Similar to "send" but does not shutdown the channel if an error occurs.
1873    pub fn send_no_shutdown_on_err(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
1874        let _result = self.send_raw(devices);
1875        self.drop_without_shutdown();
1876        _result
1877    }
1878
1879    fn send_raw(&self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
1880        self.control_handle.inner.send::<BusGetDevicesResponse>(
1881            (devices,),
1882            self.tx_id,
1883            0x2b39a32926007c92,
1884            fidl::encoding::DynamicFlags::empty(),
1885        )
1886    }
1887}
1888
1889#[must_use = "FIDL methods require a response to be sent"]
1890#[derive(Debug)]
1891pub struct BusReadBarResponder {
1892    control_handle: std::mem::ManuallyDrop<BusControlHandle>,
1893    tx_id: u32,
1894}
1895
1896/// Set the the channel to be shutdown (see [`BusControlHandle::shutdown`])
1897/// if the responder is dropped without sending a response, so that the client
1898/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1899impl std::ops::Drop for BusReadBarResponder {
1900    fn drop(&mut self) {
1901        self.control_handle.shutdown();
1902        // Safety: drops once, never accessed again
1903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1904    }
1905}
1906
1907impl fidl::endpoints::Responder for BusReadBarResponder {
1908    type ControlHandle = BusControlHandle;
1909
1910    fn control_handle(&self) -> &BusControlHandle {
1911        &self.control_handle
1912    }
1913
1914    fn drop_without_shutdown(mut self) {
1915        // Safety: drops once, never accessed again due to mem::forget
1916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1917        // Prevent Drop from running (which would shut down the channel)
1918        std::mem::forget(self);
1919    }
1920}
1921
1922impl BusReadBarResponder {
1923    /// Sends a response to the FIDL transaction.
1924    ///
1925    /// Sets the channel to shutdown if an error occurs.
1926    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1927        let _result = self.send_raw(result);
1928        if _result.is_err() {
1929            self.control_handle.shutdown();
1930        }
1931        self.drop_without_shutdown();
1932        _result
1933    }
1934
1935    /// Similar to "send" but does not shutdown the channel if an error occurs.
1936    pub fn send_no_shutdown_on_err(
1937        self,
1938        mut result: Result<&[u8], i32>,
1939    ) -> Result<(), fidl::Error> {
1940        let _result = self.send_raw(result);
1941        self.drop_without_shutdown();
1942        _result
1943    }
1944
1945    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1946        self.control_handle.inner.send::<fidl::encoding::ResultType<BusReadBarResponse, i32>>(
1947            result.map(|buffer| (buffer,)),
1948            self.tx_id,
1949            0x798f39b0dfdc4860,
1950            fidl::encoding::DynamicFlags::empty(),
1951        )
1952    }
1953}
1954
1955#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1956pub struct DeviceMarker;
1957
1958impl fidl::endpoints::ProtocolMarker for DeviceMarker {
1959    type Proxy = DeviceProxy;
1960    type RequestStream = DeviceRequestStream;
1961    #[cfg(target_os = "fuchsia")]
1962    type SynchronousProxy = DeviceSynchronousProxy;
1963
1964    const DEBUG_NAME: &'static str = "fuchsia.hardware.pci.Device";
1965}
1966impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
1967pub type DeviceGetBarResult = Result<Bar, i32>;
1968pub type DeviceSetBusMasteringResult = Result<(), i32>;
1969pub type DeviceResetDeviceResult = Result<(), i32>;
1970pub type DeviceAckInterruptResult = Result<(), i32>;
1971pub type DeviceMapInterruptResult = Result<fidl::Interrupt, i32>;
1972pub type DeviceSetInterruptModeResult = Result<(), i32>;
1973pub type DeviceReadConfig8Result = Result<u8, i32>;
1974pub type DeviceReadConfig16Result = Result<u16, i32>;
1975pub type DeviceReadConfig32Result = Result<u32, i32>;
1976pub type DeviceWriteConfig8Result = Result<(), i32>;
1977pub type DeviceWriteConfig16Result = Result<(), i32>;
1978pub type DeviceWriteConfig32Result = Result<(), i32>;
1979pub type DeviceGetBtiResult = Result<fidl::Bti, i32>;
1980
1981pub trait DeviceProxyInterface: Send + Sync {
1982    type GetDeviceInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>>
1983        + Send;
1984    fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut;
1985    type GetBarResponseFut: std::future::Future<Output = Result<DeviceGetBarResult, fidl::Error>>
1986        + Send;
1987    fn r#get_bar(&self, bar_id: u32) -> Self::GetBarResponseFut;
1988    type SetBusMasteringResponseFut: std::future::Future<Output = Result<DeviceSetBusMasteringResult, fidl::Error>>
1989        + Send;
1990    fn r#set_bus_mastering(&self, enabled: bool) -> Self::SetBusMasteringResponseFut;
1991    type ResetDeviceResponseFut: std::future::Future<Output = Result<DeviceResetDeviceResult, fidl::Error>>
1992        + Send;
1993    fn r#reset_device(&self) -> Self::ResetDeviceResponseFut;
1994    type AckInterruptResponseFut: std::future::Future<Output = Result<DeviceAckInterruptResult, fidl::Error>>
1995        + Send;
1996    fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut;
1997    type MapInterruptResponseFut: std::future::Future<Output = Result<DeviceMapInterruptResult, fidl::Error>>
1998        + Send;
1999    fn r#map_interrupt(&self, which_irq: u32) -> Self::MapInterruptResponseFut;
2000    type GetInterruptModesResponseFut: std::future::Future<Output = Result<InterruptModes, fidl::Error>>
2001        + Send;
2002    fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut;
2003    type SetInterruptModeResponseFut: std::future::Future<Output = Result<DeviceSetInterruptModeResult, fidl::Error>>
2004        + Send;
2005    fn r#set_interrupt_mode(
2006        &self,
2007        mode: InterruptMode,
2008        requested_irq_count: u32,
2009    ) -> Self::SetInterruptModeResponseFut;
2010    type ReadConfig8ResponseFut: std::future::Future<Output = Result<DeviceReadConfig8Result, fidl::Error>>
2011        + Send;
2012    fn r#read_config8(&self, offset: u16) -> Self::ReadConfig8ResponseFut;
2013    type ReadConfig16ResponseFut: std::future::Future<Output = Result<DeviceReadConfig16Result, fidl::Error>>
2014        + Send;
2015    fn r#read_config16(&self, offset: u16) -> Self::ReadConfig16ResponseFut;
2016    type ReadConfig32ResponseFut: std::future::Future<Output = Result<DeviceReadConfig32Result, fidl::Error>>
2017        + Send;
2018    fn r#read_config32(&self, offset: u16) -> Self::ReadConfig32ResponseFut;
2019    type WriteConfig8ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig8Result, fidl::Error>>
2020        + Send;
2021    fn r#write_config8(&self, offset: u16, value: u8) -> Self::WriteConfig8ResponseFut;
2022    type WriteConfig16ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig16Result, fidl::Error>>
2023        + Send;
2024    fn r#write_config16(&self, offset: u16, value: u16) -> Self::WriteConfig16ResponseFut;
2025    type WriteConfig32ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig32Result, fidl::Error>>
2026        + Send;
2027    fn r#write_config32(&self, offset: u16, value: u32) -> Self::WriteConfig32ResponseFut;
2028    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>>
2029        + Send;
2030    fn r#get_capabilities(&self, id: CapabilityId) -> Self::GetCapabilitiesResponseFut;
2031    type GetExtendedCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u16>, fidl::Error>>
2032        + Send;
2033    fn r#get_extended_capabilities(
2034        &self,
2035        id: ExtendedCapabilityId,
2036    ) -> Self::GetExtendedCapabilitiesResponseFut;
2037    type GetBtiResponseFut: std::future::Future<Output = Result<DeviceGetBtiResult, fidl::Error>>
2038        + Send;
2039    fn r#get_bti(&self, index: u32) -> Self::GetBtiResponseFut;
2040}
2041#[derive(Debug)]
2042#[cfg(target_os = "fuchsia")]
2043pub struct DeviceSynchronousProxy {
2044    client: fidl::client::sync::Client,
2045}
2046
2047#[cfg(target_os = "fuchsia")]
2048impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
2049    type Proxy = DeviceProxy;
2050    type Protocol = DeviceMarker;
2051
2052    fn from_channel(inner: fidl::Channel) -> Self {
2053        Self::new(inner)
2054    }
2055
2056    fn into_channel(self) -> fidl::Channel {
2057        self.client.into_channel()
2058    }
2059
2060    fn as_channel(&self) -> &fidl::Channel {
2061        self.client.as_channel()
2062    }
2063}
2064
2065#[cfg(target_os = "fuchsia")]
2066impl DeviceSynchronousProxy {
2067    pub fn new(channel: fidl::Channel) -> Self {
2068        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2069        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2070    }
2071
2072    pub fn into_channel(self) -> fidl::Channel {
2073        self.client.into_channel()
2074    }
2075
2076    /// Waits until an event arrives and returns it. It is safe for other
2077    /// threads to make concurrent requests while waiting for an event.
2078    pub fn wait_for_event(
2079        &self,
2080        deadline: zx::MonotonicInstant,
2081    ) -> Result<DeviceEvent, fidl::Error> {
2082        DeviceEvent::decode(self.client.wait_for_event(deadline)?)
2083    }
2084
2085    /// Returns a structure containing device information from the configuration header.
2086    pub fn r#get_device_info(
2087        &self,
2088        ___deadline: zx::MonotonicInstant,
2089    ) -> Result<DeviceInfo, fidl::Error> {
2090        let _response =
2091            self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceInfoResponse>(
2092                (),
2093                0x5599d144d4329916,
2094                fidl::encoding::DynamicFlags::empty(),
2095                ___deadline,
2096            )?;
2097        Ok(_response.info)
2098    }
2099
2100    /// Retrieves information for a specified Base Address Register (BAR). If the BAR contains
2101    /// MSI-X capability tables then an attempt will be made to return an MMIO region excluding
2102    /// those tables, if possible. Otherwise, an error will be returned.
2103    ///
2104    /// Parameters:
2105    /// |bar_id|: The id of the BAR being requested. Valid range is [0, 6).
2106    ///
2107    /// Errors:
2108    /// |ZX_ERR_ACCESS_DENIED|: The specified BAR does not have a driver-accessible region due to
2109    /// the presence of MSI-X tables. To use MSI-X see the |SetInterruptMode| method.
2110    /// |ZX_ERR_INTERNAL|: A bus driver error has occurred.
2111    /// |ZX_ERR_INVALID_ARGS|: The |bar_id| specified is outside of the acceptable range.
2112    /// |ZX_ERR_NOT_FOUND|: The specified |bar_id| does not exist for this device.
2113    pub fn r#get_bar(
2114        &self,
2115        mut bar_id: u32,
2116        ___deadline: zx::MonotonicInstant,
2117    ) -> Result<DeviceGetBarResult, fidl::Error> {
2118        let _response = self.client.send_query::<
2119            DeviceGetBarRequest,
2120            fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
2121        >(
2122            (bar_id,),
2123            0x6b2683f6fbbff679,
2124            fidl::encoding::DynamicFlags::empty(),
2125            ___deadline,
2126        )?;
2127        Ok(_response.map(|x| x.result))
2128    }
2129
2130    /// Enables or disables the bus mastering capability for the device.
2131    ///
2132    /// Parameters:
2133    /// |enable|: true to enable bus mastering, false to disable.
2134    ///
2135    /// Errors:
2136    /// |ZX_ERR_BAD_STATE|: Method was called while the device is disabled.
2137    pub fn r#set_bus_mastering(
2138        &self,
2139        mut enabled: bool,
2140        ___deadline: zx::MonotonicInstant,
2141    ) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
2142        let _response = self.client.send_query::<
2143            DeviceSetBusMasteringRequest,
2144            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2145        >(
2146            (enabled,),
2147            0x3421e9e030211003,
2148            fidl::encoding::DynamicFlags::empty(),
2149            ___deadline,
2150        )?;
2151        Ok(_response.map(|x| x))
2152    }
2153
2154    /// Initiates a function level reset for the device. This is a synchronous
2155    /// operation that will not return ontil the reset is complete. Interrupt
2156    /// operation of the device must be disabled before initiating a reset.
2157    ///
2158    /// Errors:
2159    /// |ZX_ERR_BAD_STATE|: Interrupts were not disabled before calling |ResetDevice|.
2160    /// |ZX_ERR_NOT_SUPPORTED|: The device does not support reset.
2161    /// |ZX_ERR_TIMED_OUT|: The device did not complete its reset in the
2162    /// expected amount of time and is presumed to no longer be operating
2163    /// properly.
2164    pub fn r#reset_device(
2165        &self,
2166        ___deadline: zx::MonotonicInstant,
2167    ) -> Result<DeviceResetDeviceResult, fidl::Error> {
2168        let _response = self.client.send_query::<
2169            fidl::encoding::EmptyPayload,
2170            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2171        >(
2172            (),
2173            0x3c5b7579bb6f8b9f,
2174            fidl::encoding::DynamicFlags::empty(),
2175            ___deadline,
2176        )?;
2177        Ok(_response.map(|x| x))
2178    }
2179
2180    /// Alerts the bus driver to deassert the raised legacy interrupt so that it
2181    /// may be waited on again. Only used if |SetInterruptMode| was called with
2182    /// |PCI_INTERRUPT_MODE_LEGACY|.
2183    ///
2184    /// Errors:
2185    /// |ZX_ERR_BAD_STATE|: device is not configured to use the Legacy interrupt mode.
2186    pub fn r#ack_interrupt(
2187        &self,
2188        ___deadline: zx::MonotonicInstant,
2189    ) -> Result<DeviceAckInterruptResult, fidl::Error> {
2190        let _response = self.client.send_query::<
2191            fidl::encoding::EmptyPayload,
2192            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2193        >(
2194            (),
2195            0x70742f64692d5a6b,
2196            fidl::encoding::DynamicFlags::empty(),
2197            ___deadline,
2198        )?;
2199        Ok(_response.map(|x| x))
2200    }
2201
2202    /// Maps a device's interrupt to a zx:interrupt. The device's interrupt mode
2203    /// must already be configured with |SetInterruptMode|, and |which_irq| must
2204    /// be >= to the number of interrupts reported for that interrupt mode by
2205    /// |GetInterruptModes|. A Legacy interrupt may be mapped multiple times,
2206    /// but the handles will point to the same interrupt object. MSI & MSI-X
2207    /// interrupts may only have one outstanding mapping at a time per
2208    /// interrupt. Outstanding MSI & MSI-X interrupt handles must be closed
2209    /// before attempting to change the interrupt mode in a subsequent call to
2210    /// |SetInterruptMode|.
2211    ///
2212    /// Parameters:
2213    /// |which_irq|: The id of the interrupt to map.
2214    ///
2215    /// Errors:
2216    /// |ZX_ERR_ALREADY_BOUND|: The interrupt specified by |which_irq| is
2217    /// already mapped to a valid handle.
2218    /// |ZX_ERR_BAD_STATE|: interrupts are currently disabled for the device.
2219    /// |ZX_ERR_INVALID_ARGS|: |which_irq| is invalid for the mode.
2220    pub fn r#map_interrupt(
2221        &self,
2222        mut which_irq: u32,
2223        ___deadline: zx::MonotonicInstant,
2224    ) -> Result<DeviceMapInterruptResult, fidl::Error> {
2225        let _response = self.client.send_query::<
2226            DeviceMapInterruptRequest,
2227            fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
2228        >(
2229            (which_irq,),
2230            0x25eeff9d34a1fa13,
2231            fidl::encoding::DynamicFlags::empty(),
2232            ___deadline,
2233        )?;
2234        Ok(_response.map(|x| x.interrupt))
2235    }
2236
2237    /// Returns the supported interrupt modes for a device.
2238    pub fn r#get_interrupt_modes(
2239        &self,
2240        ___deadline: zx::MonotonicInstant,
2241    ) -> Result<InterruptModes, fidl::Error> {
2242        let _response = self
2243            .client
2244            .send_query::<fidl::encoding::EmptyPayload, DeviceGetInterruptModesResponse>(
2245                (),
2246                0x93f4cd8f79e9f4a,
2247                fidl::encoding::DynamicFlags::empty(),
2248                ___deadline,
2249            )?;
2250        Ok(_response.modes)
2251    }
2252
2253    /// Configures the interrupt mode for a device. When changing from one
2254    /// interrupt mode to another the driver must ensure existing interrupt
2255    /// handles are closed beforehand.
2256    ///
2257    /// Parameters:
2258    /// |mode|: The |InterruptMode| to request from the bus driver.
2259    /// |requested_irq_count|: The number of interrupts requested.
2260    ///
2261    /// Errors:
2262    /// |ZX_ERR_BAD_STATE|: The driver attempted to change interrupt mode while
2263    /// existing handles to mapped MSIs exist.
2264    /// |ZX_ERR_INVALID_ARGS|: |requested_irq_count| is 0.
2265    /// |ZX_ERR_NOT_SUPPORTED|: The provided |mode| is not supported, or invalid.
2266    pub fn r#set_interrupt_mode(
2267        &self,
2268        mut mode: InterruptMode,
2269        mut requested_irq_count: u32,
2270        ___deadline: zx::MonotonicInstant,
2271    ) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
2272        let _response = self.client.send_query::<
2273            DeviceSetInterruptModeRequest,
2274            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2275        >(
2276            (mode, requested_irq_count,),
2277            0x85bebad3eb24866,
2278            fidl::encoding::DynamicFlags::empty(),
2279            ___deadline,
2280        )?;
2281        Ok(_response.map(|x| x))
2282    }
2283
2284    /// Reads a byte from the device's configuration space. |Offset| must be
2285    /// within [0x0, 0xFF] if PCI, or [0x0, 0xFFF) if PCIe. In most cases a
2286    /// device will be PCIe.
2287    ///
2288    /// Parameters:
2289    /// |offset|: The offset into the device's configuration space to read.
2290    ///
2291    /// Errors:
2292    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2293    pub fn r#read_config8(
2294        &self,
2295        mut offset: u16,
2296        ___deadline: zx::MonotonicInstant,
2297    ) -> Result<DeviceReadConfig8Result, fidl::Error> {
2298        let _response = self.client.send_query::<
2299            DeviceReadConfig8Request,
2300            fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
2301        >(
2302            (offset,),
2303            0x28f9eb9e6dadda1c,
2304            fidl::encoding::DynamicFlags::empty(),
2305            ___deadline,
2306        )?;
2307        Ok(_response.map(|x| x.value))
2308    }
2309
2310    /// Reads two bytes from the device's configuration space. |Offset| must be
2311    /// within [0x0, 0xFE] if PCI, or [0x0, 0xFFE] if PCIe. In most cases a
2312    /// device will be PCIe.
2313    ///
2314    /// Parameters:
2315    /// |offset|: The offset into the device's configuration space to read.
2316    ///
2317    /// Errors:
2318    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2319    pub fn r#read_config16(
2320        &self,
2321        mut offset: u16,
2322        ___deadline: zx::MonotonicInstant,
2323    ) -> Result<DeviceReadConfig16Result, fidl::Error> {
2324        let _response = self.client.send_query::<
2325            DeviceReadConfig16Request,
2326            fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
2327        >(
2328            (offset,),
2329            0x3bcda6171a3270bb,
2330            fidl::encoding::DynamicFlags::empty(),
2331            ___deadline,
2332        )?;
2333        Ok(_response.map(|x| x.value))
2334    }
2335
2336    /// Reads four bytes from the device's configuration space. |Offset| must be
2337    /// within [0x0, 0xFC] if PCI, or [0x0, 0xFFC] if PCIe. In most cases a
2338    /// device will be PCIe.
2339    ///
2340    /// Parameters:
2341    /// |offset|: The offset into the device's configuration space to read.
2342    ///
2343    /// Errors:
2344    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2345    pub fn r#read_config32(
2346        &self,
2347        mut offset: u16,
2348        ___deadline: zx::MonotonicInstant,
2349    ) -> Result<DeviceReadConfig32Result, fidl::Error> {
2350        let _response = self.client.send_query::<
2351            DeviceReadConfig32Request,
2352            fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
2353        >(
2354            (offset,),
2355            0x55357535402f7507,
2356            fidl::encoding::DynamicFlags::empty(),
2357            ___deadline,
2358        )?;
2359        Ok(_response.map(|x| x.value))
2360    }
2361
2362    /// Writes a byte to the device's configuration space. The acceptable
2363    /// ranges of |offset| for writes are [0x40, 0xFF] if PCI, or [0x40,
2364    /// 0xFFF] if PCIe. For most purposes a device will be PCIe.
2365    ///
2366    ///
2367    /// Parameters
2368    /// |offset|: The offset into the device's configuration space to read.
2369    /// |value|: The value to write.
2370    ///
2371    /// Errors:
2372    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2373    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2374    pub fn r#write_config8(
2375        &self,
2376        mut offset: u16,
2377        mut value: u8,
2378        ___deadline: zx::MonotonicInstant,
2379    ) -> Result<DeviceWriteConfig8Result, fidl::Error> {
2380        let _response = self.client.send_query::<
2381            DeviceWriteConfig8Request,
2382            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2383        >(
2384            (offset, value,),
2385            0x49a0719e1433cff,
2386            fidl::encoding::DynamicFlags::empty(),
2387            ___deadline,
2388        )?;
2389        Ok(_response.map(|x| x))
2390    }
2391
2392    /// Writes two bytes to the device's configuration space. The acceptable
2393    /// ranges of |offset| for writes are [0x40, 0xFE] if PCI, or [0x40,
2394    /// 0xFFE] if PCIe. For most purposes a device will be PCIe.
2395    ///
2396    ///
2397    /// Parameters
2398    /// |offset|: The offset into the device's configuration space to read.
2399    /// |value|: The value to write.
2400    ///
2401    /// Errors:
2402    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2403    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2404    pub fn r#write_config16(
2405        &self,
2406        mut offset: u16,
2407        mut value: u16,
2408        ___deadline: zx::MonotonicInstant,
2409    ) -> Result<DeviceWriteConfig16Result, fidl::Error> {
2410        let _response = self.client.send_query::<
2411            DeviceWriteConfig16Request,
2412            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2413        >(
2414            (offset, value,),
2415            0x3e30bf13f1c07eff,
2416            fidl::encoding::DynamicFlags::empty(),
2417            ___deadline,
2418        )?;
2419        Ok(_response.map(|x| x))
2420    }
2421
2422    /// Writes four bytes to the device's configuration space. The acceptable
2423    /// ranges of |offset| for writes are [0x40, 0xFC] if PCI, or [0x40,
2424    /// 0xFFC] if PCIe. For most purposes a device will be PCIe.
2425    ///
2426    ///
2427    /// Parameters
2428    /// |offset|: The offset into the device's configuration space to read.
2429    /// |value|: The value to write.
2430    ///
2431    /// Errors:
2432    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2433    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2434    pub fn r#write_config32(
2435        &self,
2436        mut offset: u16,
2437        mut value: u32,
2438        ___deadline: zx::MonotonicInstant,
2439    ) -> Result<DeviceWriteConfig32Result, fidl::Error> {
2440        let _response = self.client.send_query::<
2441            DeviceWriteConfig32Request,
2442            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2443        >(
2444            (offset, value,),
2445            0x161584e5199b388,
2446            fidl::encoding::DynamicFlags::empty(),
2447            ___deadline,
2448        )?;
2449        Ok(_response.map(|x| x))
2450    }
2451
2452    /// Returns a vector of offsets in configuration space corresponding to
2453    /// capabilities matching the provided capability |id|.  If no corresponding
2454    /// match is found then the vector will be empty.
2455    ///
2456    /// Parameters:
2457    /// |id|: the capability id to search for.
2458    pub fn r#get_capabilities(
2459        &self,
2460        mut id: CapabilityId,
2461        ___deadline: zx::MonotonicInstant,
2462    ) -> Result<Vec<u8>, fidl::Error> {
2463        let _response =
2464            self.client.send_query::<DeviceGetCapabilitiesRequest, DeviceGetCapabilitiesResponse>(
2465                (id,),
2466                0x3a050fde46f3ba0f,
2467                fidl::encoding::DynamicFlags::empty(),
2468                ___deadline,
2469            )?;
2470        Ok(_response.offsets)
2471    }
2472
2473    /// Returns a vector of offsets in configuration space corresponding to
2474    /// extended capabilities matching the provided extended capability |id|.
2475    /// If no corresponding match is found then the vector will be empty.
2476    ///
2477    /// Parameters:
2478    /// |id|: the capability id to search for
2479    pub fn r#get_extended_capabilities(
2480        &self,
2481        mut id: ExtendedCapabilityId,
2482        ___deadline: zx::MonotonicInstant,
2483    ) -> Result<Vec<u16>, fidl::Error> {
2484        let _response = self.client.send_query::<
2485            DeviceGetExtendedCapabilitiesRequest,
2486            DeviceGetExtendedCapabilitiesResponse,
2487        >(
2488            (id,),
2489            0xb8573efcaae0c39,
2490            fidl::encoding::DynamicFlags::empty(),
2491            ___deadline,
2492        )?;
2493        Ok(_response.offsets)
2494    }
2495
2496    /// Returns the Bus Transaction Intiator (BTI) at a given index for the device.
2497    ///
2498    /// Parameters:
2499    /// |index|: the BTI to request.
2500    ///
2501    /// Errors:
2502    /// |ZX_ERR_OUT_OF_RANGE|: |index| was not 0.
2503    pub fn r#get_bti(
2504        &self,
2505        mut index: u32,
2506        ___deadline: zx::MonotonicInstant,
2507    ) -> Result<DeviceGetBtiResult, fidl::Error> {
2508        let _response = self.client.send_query::<
2509            DeviceGetBtiRequest,
2510            fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
2511        >(
2512            (index,),
2513            0x5e4fe9efb12d9ee3,
2514            fidl::encoding::DynamicFlags::empty(),
2515            ___deadline,
2516        )?;
2517        Ok(_response.map(|x| x.bti))
2518    }
2519}
2520
2521#[derive(Debug, Clone)]
2522pub struct DeviceProxy {
2523    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2524}
2525
2526impl fidl::endpoints::Proxy for DeviceProxy {
2527    type Protocol = DeviceMarker;
2528
2529    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2530        Self::new(inner)
2531    }
2532
2533    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2534        self.client.into_channel().map_err(|client| Self { client })
2535    }
2536
2537    fn as_channel(&self) -> &::fidl::AsyncChannel {
2538        self.client.as_channel()
2539    }
2540}
2541
2542impl DeviceProxy {
2543    /// Create a new Proxy for fuchsia.hardware.pci/Device.
2544    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2545        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2546        Self { client: fidl::client::Client::new(channel, protocol_name) }
2547    }
2548
2549    /// Get a Stream of events from the remote end of the protocol.
2550    ///
2551    /// # Panics
2552    ///
2553    /// Panics if the event stream was already taken.
2554    pub fn take_event_stream(&self) -> DeviceEventStream {
2555        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
2556    }
2557
2558    /// Returns a structure containing device information from the configuration header.
2559    pub fn r#get_device_info(
2560        &self,
2561    ) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
2562    {
2563        DeviceProxyInterface::r#get_device_info(self)
2564    }
2565
2566    /// Retrieves information for a specified Base Address Register (BAR). If the BAR contains
2567    /// MSI-X capability tables then an attempt will be made to return an MMIO region excluding
2568    /// those tables, if possible. Otherwise, an error will be returned.
2569    ///
2570    /// Parameters:
2571    /// |bar_id|: The id of the BAR being requested. Valid range is [0, 6).
2572    ///
2573    /// Errors:
2574    /// |ZX_ERR_ACCESS_DENIED|: The specified BAR does not have a driver-accessible region due to
2575    /// the presence of MSI-X tables. To use MSI-X see the |SetInterruptMode| method.
2576    /// |ZX_ERR_INTERNAL|: A bus driver error has occurred.
2577    /// |ZX_ERR_INVALID_ARGS|: The |bar_id| specified is outside of the acceptable range.
2578    /// |ZX_ERR_NOT_FOUND|: The specified |bar_id| does not exist for this device.
2579    pub fn r#get_bar(
2580        &self,
2581        mut bar_id: u32,
2582    ) -> fidl::client::QueryResponseFut<
2583        DeviceGetBarResult,
2584        fidl::encoding::DefaultFuchsiaResourceDialect,
2585    > {
2586        DeviceProxyInterface::r#get_bar(self, bar_id)
2587    }
2588
2589    /// Enables or disables the bus mastering capability for the device.
2590    ///
2591    /// Parameters:
2592    /// |enable|: true to enable bus mastering, false to disable.
2593    ///
2594    /// Errors:
2595    /// |ZX_ERR_BAD_STATE|: Method was called while the device is disabled.
2596    pub fn r#set_bus_mastering(
2597        &self,
2598        mut enabled: bool,
2599    ) -> fidl::client::QueryResponseFut<
2600        DeviceSetBusMasteringResult,
2601        fidl::encoding::DefaultFuchsiaResourceDialect,
2602    > {
2603        DeviceProxyInterface::r#set_bus_mastering(self, enabled)
2604    }
2605
2606    /// Initiates a function level reset for the device. This is a synchronous
2607    /// operation that will not return ontil the reset is complete. Interrupt
2608    /// operation of the device must be disabled before initiating a reset.
2609    ///
2610    /// Errors:
2611    /// |ZX_ERR_BAD_STATE|: Interrupts were not disabled before calling |ResetDevice|.
2612    /// |ZX_ERR_NOT_SUPPORTED|: The device does not support reset.
2613    /// |ZX_ERR_TIMED_OUT|: The device did not complete its reset in the
2614    /// expected amount of time and is presumed to no longer be operating
2615    /// properly.
2616    pub fn r#reset_device(
2617        &self,
2618    ) -> fidl::client::QueryResponseFut<
2619        DeviceResetDeviceResult,
2620        fidl::encoding::DefaultFuchsiaResourceDialect,
2621    > {
2622        DeviceProxyInterface::r#reset_device(self)
2623    }
2624
2625    /// Alerts the bus driver to deassert the raised legacy interrupt so that it
2626    /// may be waited on again. Only used if |SetInterruptMode| was called with
2627    /// |PCI_INTERRUPT_MODE_LEGACY|.
2628    ///
2629    /// Errors:
2630    /// |ZX_ERR_BAD_STATE|: device is not configured to use the Legacy interrupt mode.
2631    pub fn r#ack_interrupt(
2632        &self,
2633    ) -> fidl::client::QueryResponseFut<
2634        DeviceAckInterruptResult,
2635        fidl::encoding::DefaultFuchsiaResourceDialect,
2636    > {
2637        DeviceProxyInterface::r#ack_interrupt(self)
2638    }
2639
2640    /// Maps a device's interrupt to a zx:interrupt. The device's interrupt mode
2641    /// must already be configured with |SetInterruptMode|, and |which_irq| must
2642    /// be >= to the number of interrupts reported for that interrupt mode by
2643    /// |GetInterruptModes|. A Legacy interrupt may be mapped multiple times,
2644    /// but the handles will point to the same interrupt object. MSI & MSI-X
2645    /// interrupts may only have one outstanding mapping at a time per
2646    /// interrupt. Outstanding MSI & MSI-X interrupt handles must be closed
2647    /// before attempting to change the interrupt mode in a subsequent call to
2648    /// |SetInterruptMode|.
2649    ///
2650    /// Parameters:
2651    /// |which_irq|: The id of the interrupt to map.
2652    ///
2653    /// Errors:
2654    /// |ZX_ERR_ALREADY_BOUND|: The interrupt specified by |which_irq| is
2655    /// already mapped to a valid handle.
2656    /// |ZX_ERR_BAD_STATE|: interrupts are currently disabled for the device.
2657    /// |ZX_ERR_INVALID_ARGS|: |which_irq| is invalid for the mode.
2658    pub fn r#map_interrupt(
2659        &self,
2660        mut which_irq: u32,
2661    ) -> fidl::client::QueryResponseFut<
2662        DeviceMapInterruptResult,
2663        fidl::encoding::DefaultFuchsiaResourceDialect,
2664    > {
2665        DeviceProxyInterface::r#map_interrupt(self, which_irq)
2666    }
2667
2668    /// Returns the supported interrupt modes for a device.
2669    pub fn r#get_interrupt_modes(
2670        &self,
2671    ) -> fidl::client::QueryResponseFut<InterruptModes, fidl::encoding::DefaultFuchsiaResourceDialect>
2672    {
2673        DeviceProxyInterface::r#get_interrupt_modes(self)
2674    }
2675
2676    /// Configures the interrupt mode for a device. When changing from one
2677    /// interrupt mode to another the driver must ensure existing interrupt
2678    /// handles are closed beforehand.
2679    ///
2680    /// Parameters:
2681    /// |mode|: The |InterruptMode| to request from the bus driver.
2682    /// |requested_irq_count|: The number of interrupts requested.
2683    ///
2684    /// Errors:
2685    /// |ZX_ERR_BAD_STATE|: The driver attempted to change interrupt mode while
2686    /// existing handles to mapped MSIs exist.
2687    /// |ZX_ERR_INVALID_ARGS|: |requested_irq_count| is 0.
2688    /// |ZX_ERR_NOT_SUPPORTED|: The provided |mode| is not supported, or invalid.
2689    pub fn r#set_interrupt_mode(
2690        &self,
2691        mut mode: InterruptMode,
2692        mut requested_irq_count: u32,
2693    ) -> fidl::client::QueryResponseFut<
2694        DeviceSetInterruptModeResult,
2695        fidl::encoding::DefaultFuchsiaResourceDialect,
2696    > {
2697        DeviceProxyInterface::r#set_interrupt_mode(self, mode, requested_irq_count)
2698    }
2699
2700    /// Reads a byte from the device's configuration space. |Offset| must be
2701    /// within [0x0, 0xFF] if PCI, or [0x0, 0xFFF) if PCIe. In most cases a
2702    /// device will be PCIe.
2703    ///
2704    /// Parameters:
2705    /// |offset|: The offset into the device's configuration space to read.
2706    ///
2707    /// Errors:
2708    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2709    pub fn r#read_config8(
2710        &self,
2711        mut offset: u16,
2712    ) -> fidl::client::QueryResponseFut<
2713        DeviceReadConfig8Result,
2714        fidl::encoding::DefaultFuchsiaResourceDialect,
2715    > {
2716        DeviceProxyInterface::r#read_config8(self, offset)
2717    }
2718
2719    /// Reads two bytes from the device's configuration space. |Offset| must be
2720    /// within [0x0, 0xFE] if PCI, or [0x0, 0xFFE] if PCIe. In most cases a
2721    /// device will be PCIe.
2722    ///
2723    /// Parameters:
2724    /// |offset|: The offset into the device's configuration space to read.
2725    ///
2726    /// Errors:
2727    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2728    pub fn r#read_config16(
2729        &self,
2730        mut offset: u16,
2731    ) -> fidl::client::QueryResponseFut<
2732        DeviceReadConfig16Result,
2733        fidl::encoding::DefaultFuchsiaResourceDialect,
2734    > {
2735        DeviceProxyInterface::r#read_config16(self, offset)
2736    }
2737
2738    /// Reads four bytes from the device's configuration space. |Offset| must be
2739    /// within [0x0, 0xFC] if PCI, or [0x0, 0xFFC] if PCIe. In most cases a
2740    /// device will be PCIe.
2741    ///
2742    /// Parameters:
2743    /// |offset|: The offset into the device's configuration space to read.
2744    ///
2745    /// Errors:
2746    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2747    pub fn r#read_config32(
2748        &self,
2749        mut offset: u16,
2750    ) -> fidl::client::QueryResponseFut<
2751        DeviceReadConfig32Result,
2752        fidl::encoding::DefaultFuchsiaResourceDialect,
2753    > {
2754        DeviceProxyInterface::r#read_config32(self, offset)
2755    }
2756
2757    /// Writes a byte to the device's configuration space. The acceptable
2758    /// ranges of |offset| for writes are [0x40, 0xFF] if PCI, or [0x40,
2759    /// 0xFFF] if PCIe. For most purposes a device will be PCIe.
2760    ///
2761    ///
2762    /// Parameters
2763    /// |offset|: The offset into the device's configuration space to read.
2764    /// |value|: The value to write.
2765    ///
2766    /// Errors:
2767    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2768    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2769    pub fn r#write_config8(
2770        &self,
2771        mut offset: u16,
2772        mut value: u8,
2773    ) -> fidl::client::QueryResponseFut<
2774        DeviceWriteConfig8Result,
2775        fidl::encoding::DefaultFuchsiaResourceDialect,
2776    > {
2777        DeviceProxyInterface::r#write_config8(self, offset, value)
2778    }
2779
2780    /// Writes two bytes to the device's configuration space. The acceptable
2781    /// ranges of |offset| for writes are [0x40, 0xFE] if PCI, or [0x40,
2782    /// 0xFFE] if PCIe. For most purposes a device will be PCIe.
2783    ///
2784    ///
2785    /// Parameters
2786    /// |offset|: The offset into the device's configuration space to read.
2787    /// |value|: The value to write.
2788    ///
2789    /// Errors:
2790    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2791    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2792    pub fn r#write_config16(
2793        &self,
2794        mut offset: u16,
2795        mut value: u16,
2796    ) -> fidl::client::QueryResponseFut<
2797        DeviceWriteConfig16Result,
2798        fidl::encoding::DefaultFuchsiaResourceDialect,
2799    > {
2800        DeviceProxyInterface::r#write_config16(self, offset, value)
2801    }
2802
2803    /// Writes four bytes to the device's configuration space. The acceptable
2804    /// ranges of |offset| for writes are [0x40, 0xFC] if PCI, or [0x40,
2805    /// 0xFFC] if PCIe. For most purposes a device will be PCIe.
2806    ///
2807    ///
2808    /// Parameters
2809    /// |offset|: The offset into the device's configuration space to read.
2810    /// |value|: The value to write.
2811    ///
2812    /// Errors:
2813    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
2814    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
2815    pub fn r#write_config32(
2816        &self,
2817        mut offset: u16,
2818        mut value: u32,
2819    ) -> fidl::client::QueryResponseFut<
2820        DeviceWriteConfig32Result,
2821        fidl::encoding::DefaultFuchsiaResourceDialect,
2822    > {
2823        DeviceProxyInterface::r#write_config32(self, offset, value)
2824    }
2825
2826    /// Returns a vector of offsets in configuration space corresponding to
2827    /// capabilities matching the provided capability |id|.  If no corresponding
2828    /// match is found then the vector will be empty.
2829    ///
2830    /// Parameters:
2831    /// |id|: the capability id to search for.
2832    pub fn r#get_capabilities(
2833        &self,
2834        mut id: CapabilityId,
2835    ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
2836    {
2837        DeviceProxyInterface::r#get_capabilities(self, id)
2838    }
2839
2840    /// Returns a vector of offsets in configuration space corresponding to
2841    /// extended capabilities matching the provided extended capability |id|.
2842    /// If no corresponding match is found then the vector will be empty.
2843    ///
2844    /// Parameters:
2845    /// |id|: the capability id to search for
2846    pub fn r#get_extended_capabilities(
2847        &self,
2848        mut id: ExtendedCapabilityId,
2849    ) -> fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>
2850    {
2851        DeviceProxyInterface::r#get_extended_capabilities(self, id)
2852    }
2853
2854    /// Returns the Bus Transaction Intiator (BTI) at a given index for the device.
2855    ///
2856    /// Parameters:
2857    /// |index|: the BTI to request.
2858    ///
2859    /// Errors:
2860    /// |ZX_ERR_OUT_OF_RANGE|: |index| was not 0.
2861    pub fn r#get_bti(
2862        &self,
2863        mut index: u32,
2864    ) -> fidl::client::QueryResponseFut<
2865        DeviceGetBtiResult,
2866        fidl::encoding::DefaultFuchsiaResourceDialect,
2867    > {
2868        DeviceProxyInterface::r#get_bti(self, index)
2869    }
2870}
2871
2872impl DeviceProxyInterface for DeviceProxy {
2873    type GetDeviceInfoResponseFut =
2874        fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
2875    fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut {
2876        fn _decode(
2877            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2878        ) -> Result<DeviceInfo, fidl::Error> {
2879            let _response = fidl::client::decode_transaction_body::<
2880                DeviceGetDeviceInfoResponse,
2881                fidl::encoding::DefaultFuchsiaResourceDialect,
2882                0x5599d144d4329916,
2883            >(_buf?)?;
2884            Ok(_response.info)
2885        }
2886        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
2887            (),
2888            0x5599d144d4329916,
2889            fidl::encoding::DynamicFlags::empty(),
2890            _decode,
2891        )
2892    }
2893
2894    type GetBarResponseFut = fidl::client::QueryResponseFut<
2895        DeviceGetBarResult,
2896        fidl::encoding::DefaultFuchsiaResourceDialect,
2897    >;
2898    fn r#get_bar(&self, mut bar_id: u32) -> Self::GetBarResponseFut {
2899        fn _decode(
2900            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2901        ) -> Result<DeviceGetBarResult, fidl::Error> {
2902            let _response = fidl::client::decode_transaction_body::<
2903                fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
2904                fidl::encoding::DefaultFuchsiaResourceDialect,
2905                0x6b2683f6fbbff679,
2906            >(_buf?)?;
2907            Ok(_response.map(|x| x.result))
2908        }
2909        self.client.send_query_and_decode::<DeviceGetBarRequest, DeviceGetBarResult>(
2910            (bar_id,),
2911            0x6b2683f6fbbff679,
2912            fidl::encoding::DynamicFlags::empty(),
2913            _decode,
2914        )
2915    }
2916
2917    type SetBusMasteringResponseFut = fidl::client::QueryResponseFut<
2918        DeviceSetBusMasteringResult,
2919        fidl::encoding::DefaultFuchsiaResourceDialect,
2920    >;
2921    fn r#set_bus_mastering(&self, mut enabled: bool) -> Self::SetBusMasteringResponseFut {
2922        fn _decode(
2923            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2924        ) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
2925            let _response = fidl::client::decode_transaction_body::<
2926                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2927                fidl::encoding::DefaultFuchsiaResourceDialect,
2928                0x3421e9e030211003,
2929            >(_buf?)?;
2930            Ok(_response.map(|x| x))
2931        }
2932        self.client
2933            .send_query_and_decode::<DeviceSetBusMasteringRequest, DeviceSetBusMasteringResult>(
2934                (enabled,),
2935                0x3421e9e030211003,
2936                fidl::encoding::DynamicFlags::empty(),
2937                _decode,
2938            )
2939    }
2940
2941    type ResetDeviceResponseFut = fidl::client::QueryResponseFut<
2942        DeviceResetDeviceResult,
2943        fidl::encoding::DefaultFuchsiaResourceDialect,
2944    >;
2945    fn r#reset_device(&self) -> Self::ResetDeviceResponseFut {
2946        fn _decode(
2947            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2948        ) -> Result<DeviceResetDeviceResult, fidl::Error> {
2949            let _response = fidl::client::decode_transaction_body::<
2950                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2951                fidl::encoding::DefaultFuchsiaResourceDialect,
2952                0x3c5b7579bb6f8b9f,
2953            >(_buf?)?;
2954            Ok(_response.map(|x| x))
2955        }
2956        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceResetDeviceResult>(
2957            (),
2958            0x3c5b7579bb6f8b9f,
2959            fidl::encoding::DynamicFlags::empty(),
2960            _decode,
2961        )
2962    }
2963
2964    type AckInterruptResponseFut = fidl::client::QueryResponseFut<
2965        DeviceAckInterruptResult,
2966        fidl::encoding::DefaultFuchsiaResourceDialect,
2967    >;
2968    fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut {
2969        fn _decode(
2970            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2971        ) -> Result<DeviceAckInterruptResult, fidl::Error> {
2972            let _response = fidl::client::decode_transaction_body::<
2973                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2974                fidl::encoding::DefaultFuchsiaResourceDialect,
2975                0x70742f64692d5a6b,
2976            >(_buf?)?;
2977            Ok(_response.map(|x| x))
2978        }
2979        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceAckInterruptResult>(
2980            (),
2981            0x70742f64692d5a6b,
2982            fidl::encoding::DynamicFlags::empty(),
2983            _decode,
2984        )
2985    }
2986
2987    type MapInterruptResponseFut = fidl::client::QueryResponseFut<
2988        DeviceMapInterruptResult,
2989        fidl::encoding::DefaultFuchsiaResourceDialect,
2990    >;
2991    fn r#map_interrupt(&self, mut which_irq: u32) -> Self::MapInterruptResponseFut {
2992        fn _decode(
2993            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2994        ) -> Result<DeviceMapInterruptResult, fidl::Error> {
2995            let _response = fidl::client::decode_transaction_body::<
2996                fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
2997                fidl::encoding::DefaultFuchsiaResourceDialect,
2998                0x25eeff9d34a1fa13,
2999            >(_buf?)?;
3000            Ok(_response.map(|x| x.interrupt))
3001        }
3002        self.client.send_query_and_decode::<DeviceMapInterruptRequest, DeviceMapInterruptResult>(
3003            (which_irq,),
3004            0x25eeff9d34a1fa13,
3005            fidl::encoding::DynamicFlags::empty(),
3006            _decode,
3007        )
3008    }
3009
3010    type GetInterruptModesResponseFut = fidl::client::QueryResponseFut<
3011        InterruptModes,
3012        fidl::encoding::DefaultFuchsiaResourceDialect,
3013    >;
3014    fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut {
3015        fn _decode(
3016            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3017        ) -> Result<InterruptModes, fidl::Error> {
3018            let _response = fidl::client::decode_transaction_body::<
3019                DeviceGetInterruptModesResponse,
3020                fidl::encoding::DefaultFuchsiaResourceDialect,
3021                0x93f4cd8f79e9f4a,
3022            >(_buf?)?;
3023            Ok(_response.modes)
3024        }
3025        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InterruptModes>(
3026            (),
3027            0x93f4cd8f79e9f4a,
3028            fidl::encoding::DynamicFlags::empty(),
3029            _decode,
3030        )
3031    }
3032
3033    type SetInterruptModeResponseFut = fidl::client::QueryResponseFut<
3034        DeviceSetInterruptModeResult,
3035        fidl::encoding::DefaultFuchsiaResourceDialect,
3036    >;
3037    fn r#set_interrupt_mode(
3038        &self,
3039        mut mode: InterruptMode,
3040        mut requested_irq_count: u32,
3041    ) -> Self::SetInterruptModeResponseFut {
3042        fn _decode(
3043            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3044        ) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
3045            let _response = fidl::client::decode_transaction_body::<
3046                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3047                fidl::encoding::DefaultFuchsiaResourceDialect,
3048                0x85bebad3eb24866,
3049            >(_buf?)?;
3050            Ok(_response.map(|x| x))
3051        }
3052        self.client
3053            .send_query_and_decode::<DeviceSetInterruptModeRequest, DeviceSetInterruptModeResult>(
3054                (mode, requested_irq_count),
3055                0x85bebad3eb24866,
3056                fidl::encoding::DynamicFlags::empty(),
3057                _decode,
3058            )
3059    }
3060
3061    type ReadConfig8ResponseFut = fidl::client::QueryResponseFut<
3062        DeviceReadConfig8Result,
3063        fidl::encoding::DefaultFuchsiaResourceDialect,
3064    >;
3065    fn r#read_config8(&self, mut offset: u16) -> Self::ReadConfig8ResponseFut {
3066        fn _decode(
3067            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3068        ) -> Result<DeviceReadConfig8Result, fidl::Error> {
3069            let _response = fidl::client::decode_transaction_body::<
3070                fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
3071                fidl::encoding::DefaultFuchsiaResourceDialect,
3072                0x28f9eb9e6dadda1c,
3073            >(_buf?)?;
3074            Ok(_response.map(|x| x.value))
3075        }
3076        self.client.send_query_and_decode::<DeviceReadConfig8Request, DeviceReadConfig8Result>(
3077            (offset,),
3078            0x28f9eb9e6dadda1c,
3079            fidl::encoding::DynamicFlags::empty(),
3080            _decode,
3081        )
3082    }
3083
3084    type ReadConfig16ResponseFut = fidl::client::QueryResponseFut<
3085        DeviceReadConfig16Result,
3086        fidl::encoding::DefaultFuchsiaResourceDialect,
3087    >;
3088    fn r#read_config16(&self, mut offset: u16) -> Self::ReadConfig16ResponseFut {
3089        fn _decode(
3090            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3091        ) -> Result<DeviceReadConfig16Result, fidl::Error> {
3092            let _response = fidl::client::decode_transaction_body::<
3093                fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
3094                fidl::encoding::DefaultFuchsiaResourceDialect,
3095                0x3bcda6171a3270bb,
3096            >(_buf?)?;
3097            Ok(_response.map(|x| x.value))
3098        }
3099        self.client.send_query_and_decode::<DeviceReadConfig16Request, DeviceReadConfig16Result>(
3100            (offset,),
3101            0x3bcda6171a3270bb,
3102            fidl::encoding::DynamicFlags::empty(),
3103            _decode,
3104        )
3105    }
3106
3107    type ReadConfig32ResponseFut = fidl::client::QueryResponseFut<
3108        DeviceReadConfig32Result,
3109        fidl::encoding::DefaultFuchsiaResourceDialect,
3110    >;
3111    fn r#read_config32(&self, mut offset: u16) -> Self::ReadConfig32ResponseFut {
3112        fn _decode(
3113            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3114        ) -> Result<DeviceReadConfig32Result, fidl::Error> {
3115            let _response = fidl::client::decode_transaction_body::<
3116                fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
3117                fidl::encoding::DefaultFuchsiaResourceDialect,
3118                0x55357535402f7507,
3119            >(_buf?)?;
3120            Ok(_response.map(|x| x.value))
3121        }
3122        self.client.send_query_and_decode::<DeviceReadConfig32Request, DeviceReadConfig32Result>(
3123            (offset,),
3124            0x55357535402f7507,
3125            fidl::encoding::DynamicFlags::empty(),
3126            _decode,
3127        )
3128    }
3129
3130    type WriteConfig8ResponseFut = fidl::client::QueryResponseFut<
3131        DeviceWriteConfig8Result,
3132        fidl::encoding::DefaultFuchsiaResourceDialect,
3133    >;
3134    fn r#write_config8(&self, mut offset: u16, mut value: u8) -> Self::WriteConfig8ResponseFut {
3135        fn _decode(
3136            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3137        ) -> Result<DeviceWriteConfig8Result, fidl::Error> {
3138            let _response = fidl::client::decode_transaction_body::<
3139                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3140                fidl::encoding::DefaultFuchsiaResourceDialect,
3141                0x49a0719e1433cff,
3142            >(_buf?)?;
3143            Ok(_response.map(|x| x))
3144        }
3145        self.client.send_query_and_decode::<DeviceWriteConfig8Request, DeviceWriteConfig8Result>(
3146            (offset, value),
3147            0x49a0719e1433cff,
3148            fidl::encoding::DynamicFlags::empty(),
3149            _decode,
3150        )
3151    }
3152
3153    type WriteConfig16ResponseFut = fidl::client::QueryResponseFut<
3154        DeviceWriteConfig16Result,
3155        fidl::encoding::DefaultFuchsiaResourceDialect,
3156    >;
3157    fn r#write_config16(&self, mut offset: u16, mut value: u16) -> Self::WriteConfig16ResponseFut {
3158        fn _decode(
3159            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3160        ) -> Result<DeviceWriteConfig16Result, fidl::Error> {
3161            let _response = fidl::client::decode_transaction_body::<
3162                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3163                fidl::encoding::DefaultFuchsiaResourceDialect,
3164                0x3e30bf13f1c07eff,
3165            >(_buf?)?;
3166            Ok(_response.map(|x| x))
3167        }
3168        self.client.send_query_and_decode::<DeviceWriteConfig16Request, DeviceWriteConfig16Result>(
3169            (offset, value),
3170            0x3e30bf13f1c07eff,
3171            fidl::encoding::DynamicFlags::empty(),
3172            _decode,
3173        )
3174    }
3175
3176    type WriteConfig32ResponseFut = fidl::client::QueryResponseFut<
3177        DeviceWriteConfig32Result,
3178        fidl::encoding::DefaultFuchsiaResourceDialect,
3179    >;
3180    fn r#write_config32(&self, mut offset: u16, mut value: u32) -> Self::WriteConfig32ResponseFut {
3181        fn _decode(
3182            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3183        ) -> Result<DeviceWriteConfig32Result, fidl::Error> {
3184            let _response = fidl::client::decode_transaction_body::<
3185                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
3186                fidl::encoding::DefaultFuchsiaResourceDialect,
3187                0x161584e5199b388,
3188            >(_buf?)?;
3189            Ok(_response.map(|x| x))
3190        }
3191        self.client.send_query_and_decode::<DeviceWriteConfig32Request, DeviceWriteConfig32Result>(
3192            (offset, value),
3193            0x161584e5199b388,
3194            fidl::encoding::DynamicFlags::empty(),
3195            _decode,
3196        )
3197    }
3198
3199    type GetCapabilitiesResponseFut =
3200        fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3201    fn r#get_capabilities(&self, mut id: CapabilityId) -> Self::GetCapabilitiesResponseFut {
3202        fn _decode(
3203            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3204        ) -> Result<Vec<u8>, fidl::Error> {
3205            let _response = fidl::client::decode_transaction_body::<
3206                DeviceGetCapabilitiesResponse,
3207                fidl::encoding::DefaultFuchsiaResourceDialect,
3208                0x3a050fde46f3ba0f,
3209            >(_buf?)?;
3210            Ok(_response.offsets)
3211        }
3212        self.client.send_query_and_decode::<DeviceGetCapabilitiesRequest, Vec<u8>>(
3213            (id,),
3214            0x3a050fde46f3ba0f,
3215            fidl::encoding::DynamicFlags::empty(),
3216            _decode,
3217        )
3218    }
3219
3220    type GetExtendedCapabilitiesResponseFut =
3221        fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>;
3222    fn r#get_extended_capabilities(
3223        &self,
3224        mut id: ExtendedCapabilityId,
3225    ) -> Self::GetExtendedCapabilitiesResponseFut {
3226        fn _decode(
3227            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3228        ) -> Result<Vec<u16>, fidl::Error> {
3229            let _response = fidl::client::decode_transaction_body::<
3230                DeviceGetExtendedCapabilitiesResponse,
3231                fidl::encoding::DefaultFuchsiaResourceDialect,
3232                0xb8573efcaae0c39,
3233            >(_buf?)?;
3234            Ok(_response.offsets)
3235        }
3236        self.client.send_query_and_decode::<DeviceGetExtendedCapabilitiesRequest, Vec<u16>>(
3237            (id,),
3238            0xb8573efcaae0c39,
3239            fidl::encoding::DynamicFlags::empty(),
3240            _decode,
3241        )
3242    }
3243
3244    type GetBtiResponseFut = fidl::client::QueryResponseFut<
3245        DeviceGetBtiResult,
3246        fidl::encoding::DefaultFuchsiaResourceDialect,
3247    >;
3248    fn r#get_bti(&self, mut index: u32) -> Self::GetBtiResponseFut {
3249        fn _decode(
3250            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3251        ) -> Result<DeviceGetBtiResult, fidl::Error> {
3252            let _response = fidl::client::decode_transaction_body::<
3253                fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
3254                fidl::encoding::DefaultFuchsiaResourceDialect,
3255                0x5e4fe9efb12d9ee3,
3256            >(_buf?)?;
3257            Ok(_response.map(|x| x.bti))
3258        }
3259        self.client.send_query_and_decode::<DeviceGetBtiRequest, DeviceGetBtiResult>(
3260            (index,),
3261            0x5e4fe9efb12d9ee3,
3262            fidl::encoding::DynamicFlags::empty(),
3263            _decode,
3264        )
3265    }
3266}
3267
3268pub struct DeviceEventStream {
3269    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3270}
3271
3272impl std::marker::Unpin for DeviceEventStream {}
3273
3274impl futures::stream::FusedStream for DeviceEventStream {
3275    fn is_terminated(&self) -> bool {
3276        self.event_receiver.is_terminated()
3277    }
3278}
3279
3280impl futures::Stream for DeviceEventStream {
3281    type Item = Result<DeviceEvent, fidl::Error>;
3282
3283    fn poll_next(
3284        mut self: std::pin::Pin<&mut Self>,
3285        cx: &mut std::task::Context<'_>,
3286    ) -> std::task::Poll<Option<Self::Item>> {
3287        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3288            &mut self.event_receiver,
3289            cx
3290        )?) {
3291            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
3292            None => std::task::Poll::Ready(None),
3293        }
3294    }
3295}
3296
3297#[derive(Debug)]
3298pub enum DeviceEvent {}
3299
3300impl DeviceEvent {
3301    /// Decodes a message buffer as a [`DeviceEvent`].
3302    fn decode(
3303        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3304    ) -> Result<DeviceEvent, fidl::Error> {
3305        let (bytes, _handles) = buf.split_mut();
3306        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3307        debug_assert_eq!(tx_header.tx_id, 0);
3308        match tx_header.ordinal {
3309            _ => Err(fidl::Error::UnknownOrdinal {
3310                ordinal: tx_header.ordinal,
3311                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3312            }),
3313        }
3314    }
3315}
3316
3317/// A Stream of incoming requests for fuchsia.hardware.pci/Device.
3318pub struct DeviceRequestStream {
3319    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3320    is_terminated: bool,
3321}
3322
3323impl std::marker::Unpin for DeviceRequestStream {}
3324
3325impl futures::stream::FusedStream for DeviceRequestStream {
3326    fn is_terminated(&self) -> bool {
3327        self.is_terminated
3328    }
3329}
3330
3331impl fidl::endpoints::RequestStream for DeviceRequestStream {
3332    type Protocol = DeviceMarker;
3333    type ControlHandle = DeviceControlHandle;
3334
3335    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3336        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3337    }
3338
3339    fn control_handle(&self) -> Self::ControlHandle {
3340        DeviceControlHandle { inner: self.inner.clone() }
3341    }
3342
3343    fn into_inner(
3344        self,
3345    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3346    {
3347        (self.inner, self.is_terminated)
3348    }
3349
3350    fn from_inner(
3351        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3352        is_terminated: bool,
3353    ) -> Self {
3354        Self { inner, is_terminated }
3355    }
3356}
3357
3358impl futures::Stream for DeviceRequestStream {
3359    type Item = Result<DeviceRequest, fidl::Error>;
3360
3361    fn poll_next(
3362        mut self: std::pin::Pin<&mut Self>,
3363        cx: &mut std::task::Context<'_>,
3364    ) -> std::task::Poll<Option<Self::Item>> {
3365        let this = &mut *self;
3366        if this.inner.check_shutdown(cx) {
3367            this.is_terminated = true;
3368            return std::task::Poll::Ready(None);
3369        }
3370        if this.is_terminated {
3371            panic!("polled DeviceRequestStream after completion");
3372        }
3373        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3374            |bytes, handles| {
3375                match this.inner.channel().read_etc(cx, bytes, handles) {
3376                    std::task::Poll::Ready(Ok(())) => {}
3377                    std::task::Poll::Pending => return std::task::Poll::Pending,
3378                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3379                        this.is_terminated = true;
3380                        return std::task::Poll::Ready(None);
3381                    }
3382                    std::task::Poll::Ready(Err(e)) => {
3383                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3384                            e.into(),
3385                        ))))
3386                    }
3387                }
3388
3389                // A message has been received from the channel
3390                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3391
3392                std::task::Poll::Ready(Some(match header.ordinal {
3393                    0x5599d144d4329916 => {
3394                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3395                        let mut req = fidl::new_empty!(
3396                            fidl::encoding::EmptyPayload,
3397                            fidl::encoding::DefaultFuchsiaResourceDialect
3398                        );
3399                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3400                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3401                        Ok(DeviceRequest::GetDeviceInfo {
3402                            responder: DeviceGetDeviceInfoResponder {
3403                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3404                                tx_id: header.tx_id,
3405                            },
3406                        })
3407                    }
3408                    0x6b2683f6fbbff679 => {
3409                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3410                        let mut req = fidl::new_empty!(
3411                            DeviceGetBarRequest,
3412                            fidl::encoding::DefaultFuchsiaResourceDialect
3413                        );
3414                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBarRequest>(&header, _body_bytes, handles, &mut req)?;
3415                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3416                        Ok(DeviceRequest::GetBar {
3417                            bar_id: req.bar_id,
3418
3419                            responder: DeviceGetBarResponder {
3420                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3421                                tx_id: header.tx_id,
3422                            },
3423                        })
3424                    }
3425                    0x3421e9e030211003 => {
3426                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3427                        let mut req = fidl::new_empty!(
3428                            DeviceSetBusMasteringRequest,
3429                            fidl::encoding::DefaultFuchsiaResourceDialect
3430                        );
3431                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetBusMasteringRequest>(&header, _body_bytes, handles, &mut req)?;
3432                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3433                        Ok(DeviceRequest::SetBusMastering {
3434                            enabled: req.enabled,
3435
3436                            responder: DeviceSetBusMasteringResponder {
3437                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3438                                tx_id: header.tx_id,
3439                            },
3440                        })
3441                    }
3442                    0x3c5b7579bb6f8b9f => {
3443                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3444                        let mut req = fidl::new_empty!(
3445                            fidl::encoding::EmptyPayload,
3446                            fidl::encoding::DefaultFuchsiaResourceDialect
3447                        );
3448                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3449                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3450                        Ok(DeviceRequest::ResetDevice {
3451                            responder: DeviceResetDeviceResponder {
3452                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3453                                tx_id: header.tx_id,
3454                            },
3455                        })
3456                    }
3457                    0x70742f64692d5a6b => {
3458                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3459                        let mut req = fidl::new_empty!(
3460                            fidl::encoding::EmptyPayload,
3461                            fidl::encoding::DefaultFuchsiaResourceDialect
3462                        );
3463                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3464                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3465                        Ok(DeviceRequest::AckInterrupt {
3466                            responder: DeviceAckInterruptResponder {
3467                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3468                                tx_id: header.tx_id,
3469                            },
3470                        })
3471                    }
3472                    0x25eeff9d34a1fa13 => {
3473                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3474                        let mut req = fidl::new_empty!(
3475                            DeviceMapInterruptRequest,
3476                            fidl::encoding::DefaultFuchsiaResourceDialect
3477                        );
3478                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceMapInterruptRequest>(&header, _body_bytes, handles, &mut req)?;
3479                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3480                        Ok(DeviceRequest::MapInterrupt {
3481                            which_irq: req.which_irq,
3482
3483                            responder: DeviceMapInterruptResponder {
3484                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3485                                tx_id: header.tx_id,
3486                            },
3487                        })
3488                    }
3489                    0x93f4cd8f79e9f4a => {
3490                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3491                        let mut req = fidl::new_empty!(
3492                            fidl::encoding::EmptyPayload,
3493                            fidl::encoding::DefaultFuchsiaResourceDialect
3494                        );
3495                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3496                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3497                        Ok(DeviceRequest::GetInterruptModes {
3498                            responder: DeviceGetInterruptModesResponder {
3499                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3500                                tx_id: header.tx_id,
3501                            },
3502                        })
3503                    }
3504                    0x85bebad3eb24866 => {
3505                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3506                        let mut req = fidl::new_empty!(
3507                            DeviceSetInterruptModeRequest,
3508                            fidl::encoding::DefaultFuchsiaResourceDialect
3509                        );
3510                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetInterruptModeRequest>(&header, _body_bytes, handles, &mut req)?;
3511                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3512                        Ok(DeviceRequest::SetInterruptMode {
3513                            mode: req.mode,
3514                            requested_irq_count: req.requested_irq_count,
3515
3516                            responder: DeviceSetInterruptModeResponder {
3517                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3518                                tx_id: header.tx_id,
3519                            },
3520                        })
3521                    }
3522                    0x28f9eb9e6dadda1c => {
3523                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3524                        let mut req = fidl::new_empty!(
3525                            DeviceReadConfig8Request,
3526                            fidl::encoding::DefaultFuchsiaResourceDialect
3527                        );
3528                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig8Request>(&header, _body_bytes, handles, &mut req)?;
3529                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3530                        Ok(DeviceRequest::ReadConfig8 {
3531                            offset: req.offset,
3532
3533                            responder: DeviceReadConfig8Responder {
3534                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3535                                tx_id: header.tx_id,
3536                            },
3537                        })
3538                    }
3539                    0x3bcda6171a3270bb => {
3540                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3541                        let mut req = fidl::new_empty!(
3542                            DeviceReadConfig16Request,
3543                            fidl::encoding::DefaultFuchsiaResourceDialect
3544                        );
3545                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig16Request>(&header, _body_bytes, handles, &mut req)?;
3546                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3547                        Ok(DeviceRequest::ReadConfig16 {
3548                            offset: req.offset,
3549
3550                            responder: DeviceReadConfig16Responder {
3551                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3552                                tx_id: header.tx_id,
3553                            },
3554                        })
3555                    }
3556                    0x55357535402f7507 => {
3557                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3558                        let mut req = fidl::new_empty!(
3559                            DeviceReadConfig32Request,
3560                            fidl::encoding::DefaultFuchsiaResourceDialect
3561                        );
3562                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig32Request>(&header, _body_bytes, handles, &mut req)?;
3563                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3564                        Ok(DeviceRequest::ReadConfig32 {
3565                            offset: req.offset,
3566
3567                            responder: DeviceReadConfig32Responder {
3568                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3569                                tx_id: header.tx_id,
3570                            },
3571                        })
3572                    }
3573                    0x49a0719e1433cff => {
3574                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3575                        let mut req = fidl::new_empty!(
3576                            DeviceWriteConfig8Request,
3577                            fidl::encoding::DefaultFuchsiaResourceDialect
3578                        );
3579                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig8Request>(&header, _body_bytes, handles, &mut req)?;
3580                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3581                        Ok(DeviceRequest::WriteConfig8 {
3582                            offset: req.offset,
3583                            value: req.value,
3584
3585                            responder: DeviceWriteConfig8Responder {
3586                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3587                                tx_id: header.tx_id,
3588                            },
3589                        })
3590                    }
3591                    0x3e30bf13f1c07eff => {
3592                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3593                        let mut req = fidl::new_empty!(
3594                            DeviceWriteConfig16Request,
3595                            fidl::encoding::DefaultFuchsiaResourceDialect
3596                        );
3597                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig16Request>(&header, _body_bytes, handles, &mut req)?;
3598                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3599                        Ok(DeviceRequest::WriteConfig16 {
3600                            offset: req.offset,
3601                            value: req.value,
3602
3603                            responder: DeviceWriteConfig16Responder {
3604                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3605                                tx_id: header.tx_id,
3606                            },
3607                        })
3608                    }
3609                    0x161584e5199b388 => {
3610                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3611                        let mut req = fidl::new_empty!(
3612                            DeviceWriteConfig32Request,
3613                            fidl::encoding::DefaultFuchsiaResourceDialect
3614                        );
3615                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig32Request>(&header, _body_bytes, handles, &mut req)?;
3616                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3617                        Ok(DeviceRequest::WriteConfig32 {
3618                            offset: req.offset,
3619                            value: req.value,
3620
3621                            responder: DeviceWriteConfig32Responder {
3622                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3623                                tx_id: header.tx_id,
3624                            },
3625                        })
3626                    }
3627                    0x3a050fde46f3ba0f => {
3628                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3629                        let mut req = fidl::new_empty!(
3630                            DeviceGetCapabilitiesRequest,
3631                            fidl::encoding::DefaultFuchsiaResourceDialect
3632                        );
3633                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
3634                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3635                        Ok(DeviceRequest::GetCapabilities {
3636                            id: req.id,
3637
3638                            responder: DeviceGetCapabilitiesResponder {
3639                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3640                                tx_id: header.tx_id,
3641                            },
3642                        })
3643                    }
3644                    0xb8573efcaae0c39 => {
3645                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3646                        let mut req = fidl::new_empty!(
3647                            DeviceGetExtendedCapabilitiesRequest,
3648                            fidl::encoding::DefaultFuchsiaResourceDialect
3649                        );
3650                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetExtendedCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
3651                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3652                        Ok(DeviceRequest::GetExtendedCapabilities {
3653                            id: req.id,
3654
3655                            responder: DeviceGetExtendedCapabilitiesResponder {
3656                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3657                                tx_id: header.tx_id,
3658                            },
3659                        })
3660                    }
3661                    0x5e4fe9efb12d9ee3 => {
3662                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3663                        let mut req = fidl::new_empty!(
3664                            DeviceGetBtiRequest,
3665                            fidl::encoding::DefaultFuchsiaResourceDialect
3666                        );
3667                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBtiRequest>(&header, _body_bytes, handles, &mut req)?;
3668                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
3669                        Ok(DeviceRequest::GetBti {
3670                            index: req.index,
3671
3672                            responder: DeviceGetBtiResponder {
3673                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3674                                tx_id: header.tx_id,
3675                            },
3676                        })
3677                    }
3678                    _ => Err(fidl::Error::UnknownOrdinal {
3679                        ordinal: header.ordinal,
3680                        protocol_name:
3681                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3682                    }),
3683                }))
3684            },
3685        )
3686    }
3687}
3688
3689#[derive(Debug)]
3690pub enum DeviceRequest {
3691    /// Returns a structure containing device information from the configuration header.
3692    GetDeviceInfo { responder: DeviceGetDeviceInfoResponder },
3693    /// Retrieves information for a specified Base Address Register (BAR). If the BAR contains
3694    /// MSI-X capability tables then an attempt will be made to return an MMIO region excluding
3695    /// those tables, if possible. Otherwise, an error will be returned.
3696    ///
3697    /// Parameters:
3698    /// |bar_id|: The id of the BAR being requested. Valid range is [0, 6).
3699    ///
3700    /// Errors:
3701    /// |ZX_ERR_ACCESS_DENIED|: The specified BAR does not have a driver-accessible region due to
3702    /// the presence of MSI-X tables. To use MSI-X see the |SetInterruptMode| method.
3703    /// |ZX_ERR_INTERNAL|: A bus driver error has occurred.
3704    /// |ZX_ERR_INVALID_ARGS|: The |bar_id| specified is outside of the acceptable range.
3705    /// |ZX_ERR_NOT_FOUND|: The specified |bar_id| does not exist for this device.
3706    GetBar { bar_id: u32, responder: DeviceGetBarResponder },
3707    /// Enables or disables the bus mastering capability for the device.
3708    ///
3709    /// Parameters:
3710    /// |enable|: true to enable bus mastering, false to disable.
3711    ///
3712    /// Errors:
3713    /// |ZX_ERR_BAD_STATE|: Method was called while the device is disabled.
3714    SetBusMastering { enabled: bool, responder: DeviceSetBusMasteringResponder },
3715    /// Initiates a function level reset for the device. This is a synchronous
3716    /// operation that will not return ontil the reset is complete. Interrupt
3717    /// operation of the device must be disabled before initiating a reset.
3718    ///
3719    /// Errors:
3720    /// |ZX_ERR_BAD_STATE|: Interrupts were not disabled before calling |ResetDevice|.
3721    /// |ZX_ERR_NOT_SUPPORTED|: The device does not support reset.
3722    /// |ZX_ERR_TIMED_OUT|: The device did not complete its reset in the
3723    /// expected amount of time and is presumed to no longer be operating
3724    /// properly.
3725    ResetDevice { responder: DeviceResetDeviceResponder },
3726    /// Alerts the bus driver to deassert the raised legacy interrupt so that it
3727    /// may be waited on again. Only used if |SetInterruptMode| was called with
3728    /// |PCI_INTERRUPT_MODE_LEGACY|.
3729    ///
3730    /// Errors:
3731    /// |ZX_ERR_BAD_STATE|: device is not configured to use the Legacy interrupt mode.
3732    AckInterrupt { responder: DeviceAckInterruptResponder },
3733    /// Maps a device's interrupt to a zx:interrupt. The device's interrupt mode
3734    /// must already be configured with |SetInterruptMode|, and |which_irq| must
3735    /// be >= to the number of interrupts reported for that interrupt mode by
3736    /// |GetInterruptModes|. A Legacy interrupt may be mapped multiple times,
3737    /// but the handles will point to the same interrupt object. MSI & MSI-X
3738    /// interrupts may only have one outstanding mapping at a time per
3739    /// interrupt. Outstanding MSI & MSI-X interrupt handles must be closed
3740    /// before attempting to change the interrupt mode in a subsequent call to
3741    /// |SetInterruptMode|.
3742    ///
3743    /// Parameters:
3744    /// |which_irq|: The id of the interrupt to map.
3745    ///
3746    /// Errors:
3747    /// |ZX_ERR_ALREADY_BOUND|: The interrupt specified by |which_irq| is
3748    /// already mapped to a valid handle.
3749    /// |ZX_ERR_BAD_STATE|: interrupts are currently disabled for the device.
3750    /// |ZX_ERR_INVALID_ARGS|: |which_irq| is invalid for the mode.
3751    MapInterrupt { which_irq: u32, responder: DeviceMapInterruptResponder },
3752    /// Returns the supported interrupt modes for a device.
3753    GetInterruptModes { responder: DeviceGetInterruptModesResponder },
3754    /// Configures the interrupt mode for a device. When changing from one
3755    /// interrupt mode to another the driver must ensure existing interrupt
3756    /// handles are closed beforehand.
3757    ///
3758    /// Parameters:
3759    /// |mode|: The |InterruptMode| to request from the bus driver.
3760    /// |requested_irq_count|: The number of interrupts requested.
3761    ///
3762    /// Errors:
3763    /// |ZX_ERR_BAD_STATE|: The driver attempted to change interrupt mode while
3764    /// existing handles to mapped MSIs exist.
3765    /// |ZX_ERR_INVALID_ARGS|: |requested_irq_count| is 0.
3766    /// |ZX_ERR_NOT_SUPPORTED|: The provided |mode| is not supported, or invalid.
3767    SetInterruptMode {
3768        mode: InterruptMode,
3769        requested_irq_count: u32,
3770        responder: DeviceSetInterruptModeResponder,
3771    },
3772    /// Reads a byte from the device's configuration space. |Offset| must be
3773    /// within [0x0, 0xFF] if PCI, or [0x0, 0xFFF) if PCIe. In most cases a
3774    /// device will be PCIe.
3775    ///
3776    /// Parameters:
3777    /// |offset|: The offset into the device's configuration space to read.
3778    ///
3779    /// Errors:
3780    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
3781    ReadConfig8 { offset: u16, responder: DeviceReadConfig8Responder },
3782    /// Reads two bytes from the device's configuration space. |Offset| must be
3783    /// within [0x0, 0xFE] if PCI, or [0x0, 0xFFE] if PCIe. In most cases a
3784    /// device will be PCIe.
3785    ///
3786    /// Parameters:
3787    /// |offset|: The offset into the device's configuration space to read.
3788    ///
3789    /// Errors:
3790    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
3791    ReadConfig16 { offset: u16, responder: DeviceReadConfig16Responder },
3792    /// Reads four bytes from the device's configuration space. |Offset| must be
3793    /// within [0x0, 0xFC] if PCI, or [0x0, 0xFFC] if PCIe. In most cases a
3794    /// device will be PCIe.
3795    ///
3796    /// Parameters:
3797    /// |offset|: The offset into the device's configuration space to read.
3798    ///
3799    /// Errors:
3800    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
3801    ReadConfig32 { offset: u16, responder: DeviceReadConfig32Responder },
3802    /// Writes a byte to the device's configuration space. The acceptable
3803    /// ranges of |offset| for writes are [0x40, 0xFF] if PCI, or [0x40,
3804    /// 0xFFF] if PCIe. For most purposes a device will be PCIe.
3805    ///
3806    ///
3807    /// Parameters
3808    /// |offset|: The offset into the device's configuration space to read.
3809    /// |value|: The value to write.
3810    ///
3811    /// Errors:
3812    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
3813    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
3814    WriteConfig8 { offset: u16, value: u8, responder: DeviceWriteConfig8Responder },
3815    /// Writes two bytes to the device's configuration space. The acceptable
3816    /// ranges of |offset| for writes are [0x40, 0xFE] if PCI, or [0x40,
3817    /// 0xFFE] if PCIe. For most purposes a device will be PCIe.
3818    ///
3819    ///
3820    /// Parameters
3821    /// |offset|: The offset into the device's configuration space to read.
3822    /// |value|: The value to write.
3823    ///
3824    /// Errors:
3825    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
3826    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
3827    WriteConfig16 { offset: u16, value: u16, responder: DeviceWriteConfig16Responder },
3828    /// Writes four bytes to the device's configuration space. The acceptable
3829    /// ranges of |offset| for writes are [0x40, 0xFC] if PCI, or [0x40,
3830    /// 0xFFC] if PCIe. For most purposes a device will be PCIe.
3831    ///
3832    ///
3833    /// Parameters
3834    /// |offset|: The offset into the device's configuration space to read.
3835    /// |value|: The value to write.
3836    ///
3837    /// Errors:
3838    /// |ZX_ERR_ACCESS_DENIED|: |offset| is within the device's configuration header.
3839    /// |ZX_ERR_OUT_OF_RANGE|: |offset| is an invalid address.
3840    WriteConfig32 { offset: u16, value: u32, responder: DeviceWriteConfig32Responder },
3841    /// Returns a vector of offsets in configuration space corresponding to
3842    /// capabilities matching the provided capability |id|.  If no corresponding
3843    /// match is found then the vector will be empty.
3844    ///
3845    /// Parameters:
3846    /// |id|: the capability id to search for.
3847    GetCapabilities { id: CapabilityId, responder: DeviceGetCapabilitiesResponder },
3848    /// Returns a vector of offsets in configuration space corresponding to
3849    /// extended capabilities matching the provided extended capability |id|.
3850    /// If no corresponding match is found then the vector will be empty.
3851    ///
3852    /// Parameters:
3853    /// |id|: the capability id to search for
3854    GetExtendedCapabilities {
3855        id: ExtendedCapabilityId,
3856        responder: DeviceGetExtendedCapabilitiesResponder,
3857    },
3858    /// Returns the Bus Transaction Intiator (BTI) at a given index for the device.
3859    ///
3860    /// Parameters:
3861    /// |index|: the BTI to request.
3862    ///
3863    /// Errors:
3864    /// |ZX_ERR_OUT_OF_RANGE|: |index| was not 0.
3865    GetBti { index: u32, responder: DeviceGetBtiResponder },
3866}
3867
3868impl DeviceRequest {
3869    #[allow(irrefutable_let_patterns)]
3870    pub fn into_get_device_info(self) -> Option<(DeviceGetDeviceInfoResponder)> {
3871        if let DeviceRequest::GetDeviceInfo { responder } = self {
3872            Some((responder))
3873        } else {
3874            None
3875        }
3876    }
3877
3878    #[allow(irrefutable_let_patterns)]
3879    pub fn into_get_bar(self) -> Option<(u32, DeviceGetBarResponder)> {
3880        if let DeviceRequest::GetBar { bar_id, responder } = self {
3881            Some((bar_id, responder))
3882        } else {
3883            None
3884        }
3885    }
3886
3887    #[allow(irrefutable_let_patterns)]
3888    pub fn into_set_bus_mastering(self) -> Option<(bool, DeviceSetBusMasteringResponder)> {
3889        if let DeviceRequest::SetBusMastering { enabled, responder } = self {
3890            Some((enabled, responder))
3891        } else {
3892            None
3893        }
3894    }
3895
3896    #[allow(irrefutable_let_patterns)]
3897    pub fn into_reset_device(self) -> Option<(DeviceResetDeviceResponder)> {
3898        if let DeviceRequest::ResetDevice { responder } = self {
3899            Some((responder))
3900        } else {
3901            None
3902        }
3903    }
3904
3905    #[allow(irrefutable_let_patterns)]
3906    pub fn into_ack_interrupt(self) -> Option<(DeviceAckInterruptResponder)> {
3907        if let DeviceRequest::AckInterrupt { responder } = self {
3908            Some((responder))
3909        } else {
3910            None
3911        }
3912    }
3913
3914    #[allow(irrefutable_let_patterns)]
3915    pub fn into_map_interrupt(self) -> Option<(u32, DeviceMapInterruptResponder)> {
3916        if let DeviceRequest::MapInterrupt { which_irq, responder } = self {
3917            Some((which_irq, responder))
3918        } else {
3919            None
3920        }
3921    }
3922
3923    #[allow(irrefutable_let_patterns)]
3924    pub fn into_get_interrupt_modes(self) -> Option<(DeviceGetInterruptModesResponder)> {
3925        if let DeviceRequest::GetInterruptModes { responder } = self {
3926            Some((responder))
3927        } else {
3928            None
3929        }
3930    }
3931
3932    #[allow(irrefutable_let_patterns)]
3933    pub fn into_set_interrupt_mode(
3934        self,
3935    ) -> Option<(InterruptMode, u32, DeviceSetInterruptModeResponder)> {
3936        if let DeviceRequest::SetInterruptMode { mode, requested_irq_count, responder } = self {
3937            Some((mode, requested_irq_count, responder))
3938        } else {
3939            None
3940        }
3941    }
3942
3943    #[allow(irrefutable_let_patterns)]
3944    pub fn into_read_config8(self) -> Option<(u16, DeviceReadConfig8Responder)> {
3945        if let DeviceRequest::ReadConfig8 { offset, responder } = self {
3946            Some((offset, responder))
3947        } else {
3948            None
3949        }
3950    }
3951
3952    #[allow(irrefutable_let_patterns)]
3953    pub fn into_read_config16(self) -> Option<(u16, DeviceReadConfig16Responder)> {
3954        if let DeviceRequest::ReadConfig16 { offset, responder } = self {
3955            Some((offset, responder))
3956        } else {
3957            None
3958        }
3959    }
3960
3961    #[allow(irrefutable_let_patterns)]
3962    pub fn into_read_config32(self) -> Option<(u16, DeviceReadConfig32Responder)> {
3963        if let DeviceRequest::ReadConfig32 { offset, responder } = self {
3964            Some((offset, responder))
3965        } else {
3966            None
3967        }
3968    }
3969
3970    #[allow(irrefutable_let_patterns)]
3971    pub fn into_write_config8(self) -> Option<(u16, u8, DeviceWriteConfig8Responder)> {
3972        if let DeviceRequest::WriteConfig8 { offset, value, responder } = self {
3973            Some((offset, value, responder))
3974        } else {
3975            None
3976        }
3977    }
3978
3979    #[allow(irrefutable_let_patterns)]
3980    pub fn into_write_config16(self) -> Option<(u16, u16, DeviceWriteConfig16Responder)> {
3981        if let DeviceRequest::WriteConfig16 { offset, value, responder } = self {
3982            Some((offset, value, responder))
3983        } else {
3984            None
3985        }
3986    }
3987
3988    #[allow(irrefutable_let_patterns)]
3989    pub fn into_write_config32(self) -> Option<(u16, u32, DeviceWriteConfig32Responder)> {
3990        if let DeviceRequest::WriteConfig32 { offset, value, responder } = self {
3991            Some((offset, value, responder))
3992        } else {
3993            None
3994        }
3995    }
3996
3997    #[allow(irrefutable_let_patterns)]
3998    pub fn into_get_capabilities(self) -> Option<(CapabilityId, DeviceGetCapabilitiesResponder)> {
3999        if let DeviceRequest::GetCapabilities { id, responder } = self {
4000            Some((id, responder))
4001        } else {
4002            None
4003        }
4004    }
4005
4006    #[allow(irrefutable_let_patterns)]
4007    pub fn into_get_extended_capabilities(
4008        self,
4009    ) -> Option<(ExtendedCapabilityId, DeviceGetExtendedCapabilitiesResponder)> {
4010        if let DeviceRequest::GetExtendedCapabilities { id, responder } = self {
4011            Some((id, responder))
4012        } else {
4013            None
4014        }
4015    }
4016
4017    #[allow(irrefutable_let_patterns)]
4018    pub fn into_get_bti(self) -> Option<(u32, DeviceGetBtiResponder)> {
4019        if let DeviceRequest::GetBti { index, responder } = self {
4020            Some((index, responder))
4021        } else {
4022            None
4023        }
4024    }
4025
4026    /// Name of the method defined in FIDL
4027    pub fn method_name(&self) -> &'static str {
4028        match *self {
4029            DeviceRequest::GetDeviceInfo { .. } => "get_device_info",
4030            DeviceRequest::GetBar { .. } => "get_bar",
4031            DeviceRequest::SetBusMastering { .. } => "set_bus_mastering",
4032            DeviceRequest::ResetDevice { .. } => "reset_device",
4033            DeviceRequest::AckInterrupt { .. } => "ack_interrupt",
4034            DeviceRequest::MapInterrupt { .. } => "map_interrupt",
4035            DeviceRequest::GetInterruptModes { .. } => "get_interrupt_modes",
4036            DeviceRequest::SetInterruptMode { .. } => "set_interrupt_mode",
4037            DeviceRequest::ReadConfig8 { .. } => "read_config8",
4038            DeviceRequest::ReadConfig16 { .. } => "read_config16",
4039            DeviceRequest::ReadConfig32 { .. } => "read_config32",
4040            DeviceRequest::WriteConfig8 { .. } => "write_config8",
4041            DeviceRequest::WriteConfig16 { .. } => "write_config16",
4042            DeviceRequest::WriteConfig32 { .. } => "write_config32",
4043            DeviceRequest::GetCapabilities { .. } => "get_capabilities",
4044            DeviceRequest::GetExtendedCapabilities { .. } => "get_extended_capabilities",
4045            DeviceRequest::GetBti { .. } => "get_bti",
4046        }
4047    }
4048}
4049
4050#[derive(Debug, Clone)]
4051pub struct DeviceControlHandle {
4052    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4053}
4054
4055impl fidl::endpoints::ControlHandle for DeviceControlHandle {
4056    fn shutdown(&self) {
4057        self.inner.shutdown()
4058    }
4059    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4060        self.inner.shutdown_with_epitaph(status)
4061    }
4062
4063    fn is_closed(&self) -> bool {
4064        self.inner.channel().is_closed()
4065    }
4066    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4067        self.inner.channel().on_closed()
4068    }
4069
4070    #[cfg(target_os = "fuchsia")]
4071    fn signal_peer(
4072        &self,
4073        clear_mask: zx::Signals,
4074        set_mask: zx::Signals,
4075    ) -> Result<(), zx_status::Status> {
4076        use fidl::Peered;
4077        self.inner.channel().signal_peer(clear_mask, set_mask)
4078    }
4079}
4080
4081impl DeviceControlHandle {}
4082
4083#[must_use = "FIDL methods require a response to be sent"]
4084#[derive(Debug)]
4085pub struct DeviceGetDeviceInfoResponder {
4086    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4087    tx_id: u32,
4088}
4089
4090/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4091/// if the responder is dropped without sending a response, so that the client
4092/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4093impl std::ops::Drop for DeviceGetDeviceInfoResponder {
4094    fn drop(&mut self) {
4095        self.control_handle.shutdown();
4096        // Safety: drops once, never accessed again
4097        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4098    }
4099}
4100
4101impl fidl::endpoints::Responder for DeviceGetDeviceInfoResponder {
4102    type ControlHandle = DeviceControlHandle;
4103
4104    fn control_handle(&self) -> &DeviceControlHandle {
4105        &self.control_handle
4106    }
4107
4108    fn drop_without_shutdown(mut self) {
4109        // Safety: drops once, never accessed again due to mem::forget
4110        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4111        // Prevent Drop from running (which would shut down the channel)
4112        std::mem::forget(self);
4113    }
4114}
4115
4116impl DeviceGetDeviceInfoResponder {
4117    /// Sends a response to the FIDL transaction.
4118    ///
4119    /// Sets the channel to shutdown if an error occurs.
4120    pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
4121        let _result = self.send_raw(info);
4122        if _result.is_err() {
4123            self.control_handle.shutdown();
4124        }
4125        self.drop_without_shutdown();
4126        _result
4127    }
4128
4129    /// Similar to "send" but does not shutdown the channel if an error occurs.
4130    pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
4131        let _result = self.send_raw(info);
4132        self.drop_without_shutdown();
4133        _result
4134    }
4135
4136    fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
4137        self.control_handle.inner.send::<DeviceGetDeviceInfoResponse>(
4138            (info,),
4139            self.tx_id,
4140            0x5599d144d4329916,
4141            fidl::encoding::DynamicFlags::empty(),
4142        )
4143    }
4144}
4145
4146#[must_use = "FIDL methods require a response to be sent"]
4147#[derive(Debug)]
4148pub struct DeviceGetBarResponder {
4149    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4150    tx_id: u32,
4151}
4152
4153/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4154/// if the responder is dropped without sending a response, so that the client
4155/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4156impl std::ops::Drop for DeviceGetBarResponder {
4157    fn drop(&mut self) {
4158        self.control_handle.shutdown();
4159        // Safety: drops once, never accessed again
4160        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4161    }
4162}
4163
4164impl fidl::endpoints::Responder for DeviceGetBarResponder {
4165    type ControlHandle = DeviceControlHandle;
4166
4167    fn control_handle(&self) -> &DeviceControlHandle {
4168        &self.control_handle
4169    }
4170
4171    fn drop_without_shutdown(mut self) {
4172        // Safety: drops once, never accessed again due to mem::forget
4173        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4174        // Prevent Drop from running (which would shut down the channel)
4175        std::mem::forget(self);
4176    }
4177}
4178
4179impl DeviceGetBarResponder {
4180    /// Sends a response to the FIDL transaction.
4181    ///
4182    /// Sets the channel to shutdown if an error occurs.
4183    pub fn send(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
4184        let _result = self.send_raw(result);
4185        if _result.is_err() {
4186            self.control_handle.shutdown();
4187        }
4188        self.drop_without_shutdown();
4189        _result
4190    }
4191
4192    /// Similar to "send" but does not shutdown the channel if an error occurs.
4193    pub fn send_no_shutdown_on_err(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
4194        let _result = self.send_raw(result);
4195        self.drop_without_shutdown();
4196        _result
4197    }
4198
4199    fn send_raw(&self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
4200        self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBarResponse, i32>>(
4201            result.as_mut().map_err(|e| *e).map(|result| (result,)),
4202            self.tx_id,
4203            0x6b2683f6fbbff679,
4204            fidl::encoding::DynamicFlags::empty(),
4205        )
4206    }
4207}
4208
4209#[must_use = "FIDL methods require a response to be sent"]
4210#[derive(Debug)]
4211pub struct DeviceSetBusMasteringResponder {
4212    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4213    tx_id: u32,
4214}
4215
4216/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4217/// if the responder is dropped without sending a response, so that the client
4218/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4219impl std::ops::Drop for DeviceSetBusMasteringResponder {
4220    fn drop(&mut self) {
4221        self.control_handle.shutdown();
4222        // Safety: drops once, never accessed again
4223        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4224    }
4225}
4226
4227impl fidl::endpoints::Responder for DeviceSetBusMasteringResponder {
4228    type ControlHandle = DeviceControlHandle;
4229
4230    fn control_handle(&self) -> &DeviceControlHandle {
4231        &self.control_handle
4232    }
4233
4234    fn drop_without_shutdown(mut self) {
4235        // Safety: drops once, never accessed again due to mem::forget
4236        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4237        // Prevent Drop from running (which would shut down the channel)
4238        std::mem::forget(self);
4239    }
4240}
4241
4242impl DeviceSetBusMasteringResponder {
4243    /// Sends a response to the FIDL transaction.
4244    ///
4245    /// Sets the channel to shutdown if an error occurs.
4246    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4247        let _result = self.send_raw(result);
4248        if _result.is_err() {
4249            self.control_handle.shutdown();
4250        }
4251        self.drop_without_shutdown();
4252        _result
4253    }
4254
4255    /// Similar to "send" but does not shutdown the channel if an error occurs.
4256    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4257        let _result = self.send_raw(result);
4258        self.drop_without_shutdown();
4259        _result
4260    }
4261
4262    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4263        self.control_handle
4264            .inner
4265            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4266                result,
4267                self.tx_id,
4268                0x3421e9e030211003,
4269                fidl::encoding::DynamicFlags::empty(),
4270            )
4271    }
4272}
4273
4274#[must_use = "FIDL methods require a response to be sent"]
4275#[derive(Debug)]
4276pub struct DeviceResetDeviceResponder {
4277    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4278    tx_id: u32,
4279}
4280
4281/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4282/// if the responder is dropped without sending a response, so that the client
4283/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4284impl std::ops::Drop for DeviceResetDeviceResponder {
4285    fn drop(&mut self) {
4286        self.control_handle.shutdown();
4287        // Safety: drops once, never accessed again
4288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4289    }
4290}
4291
4292impl fidl::endpoints::Responder for DeviceResetDeviceResponder {
4293    type ControlHandle = DeviceControlHandle;
4294
4295    fn control_handle(&self) -> &DeviceControlHandle {
4296        &self.control_handle
4297    }
4298
4299    fn drop_without_shutdown(mut self) {
4300        // Safety: drops once, never accessed again due to mem::forget
4301        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4302        // Prevent Drop from running (which would shut down the channel)
4303        std::mem::forget(self);
4304    }
4305}
4306
4307impl DeviceResetDeviceResponder {
4308    /// Sends a response to the FIDL transaction.
4309    ///
4310    /// Sets the channel to shutdown if an error occurs.
4311    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4312        let _result = self.send_raw(result);
4313        if _result.is_err() {
4314            self.control_handle.shutdown();
4315        }
4316        self.drop_without_shutdown();
4317        _result
4318    }
4319
4320    /// Similar to "send" but does not shutdown the channel if an error occurs.
4321    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4322        let _result = self.send_raw(result);
4323        self.drop_without_shutdown();
4324        _result
4325    }
4326
4327    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4328        self.control_handle
4329            .inner
4330            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4331                result,
4332                self.tx_id,
4333                0x3c5b7579bb6f8b9f,
4334                fidl::encoding::DynamicFlags::empty(),
4335            )
4336    }
4337}
4338
4339#[must_use = "FIDL methods require a response to be sent"]
4340#[derive(Debug)]
4341pub struct DeviceAckInterruptResponder {
4342    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4343    tx_id: u32,
4344}
4345
4346/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4347/// if the responder is dropped without sending a response, so that the client
4348/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4349impl std::ops::Drop for DeviceAckInterruptResponder {
4350    fn drop(&mut self) {
4351        self.control_handle.shutdown();
4352        // Safety: drops once, never accessed again
4353        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4354    }
4355}
4356
4357impl fidl::endpoints::Responder for DeviceAckInterruptResponder {
4358    type ControlHandle = DeviceControlHandle;
4359
4360    fn control_handle(&self) -> &DeviceControlHandle {
4361        &self.control_handle
4362    }
4363
4364    fn drop_without_shutdown(mut self) {
4365        // Safety: drops once, never accessed again due to mem::forget
4366        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4367        // Prevent Drop from running (which would shut down the channel)
4368        std::mem::forget(self);
4369    }
4370}
4371
4372impl DeviceAckInterruptResponder {
4373    /// Sends a response to the FIDL transaction.
4374    ///
4375    /// Sets the channel to shutdown if an error occurs.
4376    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4377        let _result = self.send_raw(result);
4378        if _result.is_err() {
4379            self.control_handle.shutdown();
4380        }
4381        self.drop_without_shutdown();
4382        _result
4383    }
4384
4385    /// Similar to "send" but does not shutdown the channel if an error occurs.
4386    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4387        let _result = self.send_raw(result);
4388        self.drop_without_shutdown();
4389        _result
4390    }
4391
4392    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4393        self.control_handle
4394            .inner
4395            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4396                result,
4397                self.tx_id,
4398                0x70742f64692d5a6b,
4399                fidl::encoding::DynamicFlags::empty(),
4400            )
4401    }
4402}
4403
4404#[must_use = "FIDL methods require a response to be sent"]
4405#[derive(Debug)]
4406pub struct DeviceMapInterruptResponder {
4407    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4408    tx_id: u32,
4409}
4410
4411/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4412/// if the responder is dropped without sending a response, so that the client
4413/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4414impl std::ops::Drop for DeviceMapInterruptResponder {
4415    fn drop(&mut self) {
4416        self.control_handle.shutdown();
4417        // Safety: drops once, never accessed again
4418        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4419    }
4420}
4421
4422impl fidl::endpoints::Responder for DeviceMapInterruptResponder {
4423    type ControlHandle = DeviceControlHandle;
4424
4425    fn control_handle(&self) -> &DeviceControlHandle {
4426        &self.control_handle
4427    }
4428
4429    fn drop_without_shutdown(mut self) {
4430        // Safety: drops once, never accessed again due to mem::forget
4431        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4432        // Prevent Drop from running (which would shut down the channel)
4433        std::mem::forget(self);
4434    }
4435}
4436
4437impl DeviceMapInterruptResponder {
4438    /// Sends a response to the FIDL transaction.
4439    ///
4440    /// Sets the channel to shutdown if an error occurs.
4441    pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
4442        let _result = self.send_raw(result);
4443        if _result.is_err() {
4444            self.control_handle.shutdown();
4445        }
4446        self.drop_without_shutdown();
4447        _result
4448    }
4449
4450    /// Similar to "send" but does not shutdown the channel if an error occurs.
4451    pub fn send_no_shutdown_on_err(
4452        self,
4453        mut result: Result<fidl::Interrupt, i32>,
4454    ) -> Result<(), fidl::Error> {
4455        let _result = self.send_raw(result);
4456        self.drop_without_shutdown();
4457        _result
4458    }
4459
4460    fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
4461        self.control_handle
4462            .inner
4463            .send::<fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>>(
4464                result.map(|interrupt| (interrupt,)),
4465                self.tx_id,
4466                0x25eeff9d34a1fa13,
4467                fidl::encoding::DynamicFlags::empty(),
4468            )
4469    }
4470}
4471
4472#[must_use = "FIDL methods require a response to be sent"]
4473#[derive(Debug)]
4474pub struct DeviceGetInterruptModesResponder {
4475    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4476    tx_id: u32,
4477}
4478
4479/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4480/// if the responder is dropped without sending a response, so that the client
4481/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4482impl std::ops::Drop for DeviceGetInterruptModesResponder {
4483    fn drop(&mut self) {
4484        self.control_handle.shutdown();
4485        // Safety: drops once, never accessed again
4486        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4487    }
4488}
4489
4490impl fidl::endpoints::Responder for DeviceGetInterruptModesResponder {
4491    type ControlHandle = DeviceControlHandle;
4492
4493    fn control_handle(&self) -> &DeviceControlHandle {
4494        &self.control_handle
4495    }
4496
4497    fn drop_without_shutdown(mut self) {
4498        // Safety: drops once, never accessed again due to mem::forget
4499        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4500        // Prevent Drop from running (which would shut down the channel)
4501        std::mem::forget(self);
4502    }
4503}
4504
4505impl DeviceGetInterruptModesResponder {
4506    /// Sends a response to the FIDL transaction.
4507    ///
4508    /// Sets the channel to shutdown if an error occurs.
4509    pub fn send(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
4510        let _result = self.send_raw(modes);
4511        if _result.is_err() {
4512            self.control_handle.shutdown();
4513        }
4514        self.drop_without_shutdown();
4515        _result
4516    }
4517
4518    /// Similar to "send" but does not shutdown the channel if an error occurs.
4519    pub fn send_no_shutdown_on_err(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
4520        let _result = self.send_raw(modes);
4521        self.drop_without_shutdown();
4522        _result
4523    }
4524
4525    fn send_raw(&self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
4526        self.control_handle.inner.send::<DeviceGetInterruptModesResponse>(
4527            (modes,),
4528            self.tx_id,
4529            0x93f4cd8f79e9f4a,
4530            fidl::encoding::DynamicFlags::empty(),
4531        )
4532    }
4533}
4534
4535#[must_use = "FIDL methods require a response to be sent"]
4536#[derive(Debug)]
4537pub struct DeviceSetInterruptModeResponder {
4538    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4539    tx_id: u32,
4540}
4541
4542/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4543/// if the responder is dropped without sending a response, so that the client
4544/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4545impl std::ops::Drop for DeviceSetInterruptModeResponder {
4546    fn drop(&mut self) {
4547        self.control_handle.shutdown();
4548        // Safety: drops once, never accessed again
4549        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4550    }
4551}
4552
4553impl fidl::endpoints::Responder for DeviceSetInterruptModeResponder {
4554    type ControlHandle = DeviceControlHandle;
4555
4556    fn control_handle(&self) -> &DeviceControlHandle {
4557        &self.control_handle
4558    }
4559
4560    fn drop_without_shutdown(mut self) {
4561        // Safety: drops once, never accessed again due to mem::forget
4562        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4563        // Prevent Drop from running (which would shut down the channel)
4564        std::mem::forget(self);
4565    }
4566}
4567
4568impl DeviceSetInterruptModeResponder {
4569    /// Sends a response to the FIDL transaction.
4570    ///
4571    /// Sets the channel to shutdown if an error occurs.
4572    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4573        let _result = self.send_raw(result);
4574        if _result.is_err() {
4575            self.control_handle.shutdown();
4576        }
4577        self.drop_without_shutdown();
4578        _result
4579    }
4580
4581    /// Similar to "send" but does not shutdown the channel if an error occurs.
4582    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4583        let _result = self.send_raw(result);
4584        self.drop_without_shutdown();
4585        _result
4586    }
4587
4588    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4589        self.control_handle
4590            .inner
4591            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4592                result,
4593                self.tx_id,
4594                0x85bebad3eb24866,
4595                fidl::encoding::DynamicFlags::empty(),
4596            )
4597    }
4598}
4599
4600#[must_use = "FIDL methods require a response to be sent"]
4601#[derive(Debug)]
4602pub struct DeviceReadConfig8Responder {
4603    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4604    tx_id: u32,
4605}
4606
4607/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4608/// if the responder is dropped without sending a response, so that the client
4609/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4610impl std::ops::Drop for DeviceReadConfig8Responder {
4611    fn drop(&mut self) {
4612        self.control_handle.shutdown();
4613        // Safety: drops once, never accessed again
4614        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4615    }
4616}
4617
4618impl fidl::endpoints::Responder for DeviceReadConfig8Responder {
4619    type ControlHandle = DeviceControlHandle;
4620
4621    fn control_handle(&self) -> &DeviceControlHandle {
4622        &self.control_handle
4623    }
4624
4625    fn drop_without_shutdown(mut self) {
4626        // Safety: drops once, never accessed again due to mem::forget
4627        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4628        // Prevent Drop from running (which would shut down the channel)
4629        std::mem::forget(self);
4630    }
4631}
4632
4633impl DeviceReadConfig8Responder {
4634    /// Sends a response to the FIDL transaction.
4635    ///
4636    /// Sets the channel to shutdown if an error occurs.
4637    pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
4638        let _result = self.send_raw(result);
4639        if _result.is_err() {
4640            self.control_handle.shutdown();
4641        }
4642        self.drop_without_shutdown();
4643        _result
4644    }
4645
4646    /// Similar to "send" but does not shutdown the channel if an error occurs.
4647    pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
4648        let _result = self.send_raw(result);
4649        self.drop_without_shutdown();
4650        _result
4651    }
4652
4653    fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
4654        self.control_handle
4655            .inner
4656            .send::<fidl::encoding::ResultType<DeviceReadConfig8Response, i32>>(
4657                result.map(|value| (value,)),
4658                self.tx_id,
4659                0x28f9eb9e6dadda1c,
4660                fidl::encoding::DynamicFlags::empty(),
4661            )
4662    }
4663}
4664
4665#[must_use = "FIDL methods require a response to be sent"]
4666#[derive(Debug)]
4667pub struct DeviceReadConfig16Responder {
4668    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4669    tx_id: u32,
4670}
4671
4672/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4673/// if the responder is dropped without sending a response, so that the client
4674/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4675impl std::ops::Drop for DeviceReadConfig16Responder {
4676    fn drop(&mut self) {
4677        self.control_handle.shutdown();
4678        // Safety: drops once, never accessed again
4679        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4680    }
4681}
4682
4683impl fidl::endpoints::Responder for DeviceReadConfig16Responder {
4684    type ControlHandle = DeviceControlHandle;
4685
4686    fn control_handle(&self) -> &DeviceControlHandle {
4687        &self.control_handle
4688    }
4689
4690    fn drop_without_shutdown(mut self) {
4691        // Safety: drops once, never accessed again due to mem::forget
4692        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4693        // Prevent Drop from running (which would shut down the channel)
4694        std::mem::forget(self);
4695    }
4696}
4697
4698impl DeviceReadConfig16Responder {
4699    /// Sends a response to the FIDL transaction.
4700    ///
4701    /// Sets the channel to shutdown if an error occurs.
4702    pub fn send(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
4703        let _result = self.send_raw(result);
4704        if _result.is_err() {
4705            self.control_handle.shutdown();
4706        }
4707        self.drop_without_shutdown();
4708        _result
4709    }
4710
4711    /// Similar to "send" but does not shutdown the channel if an error occurs.
4712    pub fn send_no_shutdown_on_err(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
4713        let _result = self.send_raw(result);
4714        self.drop_without_shutdown();
4715        _result
4716    }
4717
4718    fn send_raw(&self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
4719        self.control_handle
4720            .inner
4721            .send::<fidl::encoding::ResultType<DeviceReadConfig16Response, i32>>(
4722                result.map(|value| (value,)),
4723                self.tx_id,
4724                0x3bcda6171a3270bb,
4725                fidl::encoding::DynamicFlags::empty(),
4726            )
4727    }
4728}
4729
4730#[must_use = "FIDL methods require a response to be sent"]
4731#[derive(Debug)]
4732pub struct DeviceReadConfig32Responder {
4733    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4734    tx_id: u32,
4735}
4736
4737/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4738/// if the responder is dropped without sending a response, so that the client
4739/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4740impl std::ops::Drop for DeviceReadConfig32Responder {
4741    fn drop(&mut self) {
4742        self.control_handle.shutdown();
4743        // Safety: drops once, never accessed again
4744        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4745    }
4746}
4747
4748impl fidl::endpoints::Responder for DeviceReadConfig32Responder {
4749    type ControlHandle = DeviceControlHandle;
4750
4751    fn control_handle(&self) -> &DeviceControlHandle {
4752        &self.control_handle
4753    }
4754
4755    fn drop_without_shutdown(mut self) {
4756        // Safety: drops once, never accessed again due to mem::forget
4757        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4758        // Prevent Drop from running (which would shut down the channel)
4759        std::mem::forget(self);
4760    }
4761}
4762
4763impl DeviceReadConfig32Responder {
4764    /// Sends a response to the FIDL transaction.
4765    ///
4766    /// Sets the channel to shutdown if an error occurs.
4767    pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
4768        let _result = self.send_raw(result);
4769        if _result.is_err() {
4770            self.control_handle.shutdown();
4771        }
4772        self.drop_without_shutdown();
4773        _result
4774    }
4775
4776    /// Similar to "send" but does not shutdown the channel if an error occurs.
4777    pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
4778        let _result = self.send_raw(result);
4779        self.drop_without_shutdown();
4780        _result
4781    }
4782
4783    fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
4784        self.control_handle
4785            .inner
4786            .send::<fidl::encoding::ResultType<DeviceReadConfig32Response, i32>>(
4787                result.map(|value| (value,)),
4788                self.tx_id,
4789                0x55357535402f7507,
4790                fidl::encoding::DynamicFlags::empty(),
4791            )
4792    }
4793}
4794
4795#[must_use = "FIDL methods require a response to be sent"]
4796#[derive(Debug)]
4797pub struct DeviceWriteConfig8Responder {
4798    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4799    tx_id: u32,
4800}
4801
4802/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4803/// if the responder is dropped without sending a response, so that the client
4804/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4805impl std::ops::Drop for DeviceWriteConfig8Responder {
4806    fn drop(&mut self) {
4807        self.control_handle.shutdown();
4808        // Safety: drops once, never accessed again
4809        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4810    }
4811}
4812
4813impl fidl::endpoints::Responder for DeviceWriteConfig8Responder {
4814    type ControlHandle = DeviceControlHandle;
4815
4816    fn control_handle(&self) -> &DeviceControlHandle {
4817        &self.control_handle
4818    }
4819
4820    fn drop_without_shutdown(mut self) {
4821        // Safety: drops once, never accessed again due to mem::forget
4822        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4823        // Prevent Drop from running (which would shut down the channel)
4824        std::mem::forget(self);
4825    }
4826}
4827
4828impl DeviceWriteConfig8Responder {
4829    /// Sends a response to the FIDL transaction.
4830    ///
4831    /// Sets the channel to shutdown if an error occurs.
4832    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4833        let _result = self.send_raw(result);
4834        if _result.is_err() {
4835            self.control_handle.shutdown();
4836        }
4837        self.drop_without_shutdown();
4838        _result
4839    }
4840
4841    /// Similar to "send" but does not shutdown the channel if an error occurs.
4842    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4843        let _result = self.send_raw(result);
4844        self.drop_without_shutdown();
4845        _result
4846    }
4847
4848    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4849        self.control_handle
4850            .inner
4851            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4852                result,
4853                self.tx_id,
4854                0x49a0719e1433cff,
4855                fidl::encoding::DynamicFlags::empty(),
4856            )
4857    }
4858}
4859
4860#[must_use = "FIDL methods require a response to be sent"]
4861#[derive(Debug)]
4862pub struct DeviceWriteConfig16Responder {
4863    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4864    tx_id: u32,
4865}
4866
4867/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4868/// if the responder is dropped without sending a response, so that the client
4869/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4870impl std::ops::Drop for DeviceWriteConfig16Responder {
4871    fn drop(&mut self) {
4872        self.control_handle.shutdown();
4873        // Safety: drops once, never accessed again
4874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4875    }
4876}
4877
4878impl fidl::endpoints::Responder for DeviceWriteConfig16Responder {
4879    type ControlHandle = DeviceControlHandle;
4880
4881    fn control_handle(&self) -> &DeviceControlHandle {
4882        &self.control_handle
4883    }
4884
4885    fn drop_without_shutdown(mut self) {
4886        // Safety: drops once, never accessed again due to mem::forget
4887        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4888        // Prevent Drop from running (which would shut down the channel)
4889        std::mem::forget(self);
4890    }
4891}
4892
4893impl DeviceWriteConfig16Responder {
4894    /// Sends a response to the FIDL transaction.
4895    ///
4896    /// Sets the channel to shutdown if an error occurs.
4897    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4898        let _result = self.send_raw(result);
4899        if _result.is_err() {
4900            self.control_handle.shutdown();
4901        }
4902        self.drop_without_shutdown();
4903        _result
4904    }
4905
4906    /// Similar to "send" but does not shutdown the channel if an error occurs.
4907    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4908        let _result = self.send_raw(result);
4909        self.drop_without_shutdown();
4910        _result
4911    }
4912
4913    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4914        self.control_handle
4915            .inner
4916            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4917                result,
4918                self.tx_id,
4919                0x3e30bf13f1c07eff,
4920                fidl::encoding::DynamicFlags::empty(),
4921            )
4922    }
4923}
4924
4925#[must_use = "FIDL methods require a response to be sent"]
4926#[derive(Debug)]
4927pub struct DeviceWriteConfig32Responder {
4928    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4929    tx_id: u32,
4930}
4931
4932/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4933/// if the responder is dropped without sending a response, so that the client
4934/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4935impl std::ops::Drop for DeviceWriteConfig32Responder {
4936    fn drop(&mut self) {
4937        self.control_handle.shutdown();
4938        // Safety: drops once, never accessed again
4939        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4940    }
4941}
4942
4943impl fidl::endpoints::Responder for DeviceWriteConfig32Responder {
4944    type ControlHandle = DeviceControlHandle;
4945
4946    fn control_handle(&self) -> &DeviceControlHandle {
4947        &self.control_handle
4948    }
4949
4950    fn drop_without_shutdown(mut self) {
4951        // Safety: drops once, never accessed again due to mem::forget
4952        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4953        // Prevent Drop from running (which would shut down the channel)
4954        std::mem::forget(self);
4955    }
4956}
4957
4958impl DeviceWriteConfig32Responder {
4959    /// Sends a response to the FIDL transaction.
4960    ///
4961    /// Sets the channel to shutdown if an error occurs.
4962    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4963        let _result = self.send_raw(result);
4964        if _result.is_err() {
4965            self.control_handle.shutdown();
4966        }
4967        self.drop_without_shutdown();
4968        _result
4969    }
4970
4971    /// Similar to "send" but does not shutdown the channel if an error occurs.
4972    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4973        let _result = self.send_raw(result);
4974        self.drop_without_shutdown();
4975        _result
4976    }
4977
4978    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4979        self.control_handle
4980            .inner
4981            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
4982                result,
4983                self.tx_id,
4984                0x161584e5199b388,
4985                fidl::encoding::DynamicFlags::empty(),
4986            )
4987    }
4988}
4989
4990#[must_use = "FIDL methods require a response to be sent"]
4991#[derive(Debug)]
4992pub struct DeviceGetCapabilitiesResponder {
4993    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
4994    tx_id: u32,
4995}
4996
4997/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
4998/// if the responder is dropped without sending a response, so that the client
4999/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5000impl std::ops::Drop for DeviceGetCapabilitiesResponder {
5001    fn drop(&mut self) {
5002        self.control_handle.shutdown();
5003        // Safety: drops once, never accessed again
5004        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5005    }
5006}
5007
5008impl fidl::endpoints::Responder for DeviceGetCapabilitiesResponder {
5009    type ControlHandle = DeviceControlHandle;
5010
5011    fn control_handle(&self) -> &DeviceControlHandle {
5012        &self.control_handle
5013    }
5014
5015    fn drop_without_shutdown(mut self) {
5016        // Safety: drops once, never accessed again due to mem::forget
5017        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5018        // Prevent Drop from running (which would shut down the channel)
5019        std::mem::forget(self);
5020    }
5021}
5022
5023impl DeviceGetCapabilitiesResponder {
5024    /// Sends a response to the FIDL transaction.
5025    ///
5026    /// Sets the channel to shutdown if an error occurs.
5027    pub fn send(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
5028        let _result = self.send_raw(offsets);
5029        if _result.is_err() {
5030            self.control_handle.shutdown();
5031        }
5032        self.drop_without_shutdown();
5033        _result
5034    }
5035
5036    /// Similar to "send" but does not shutdown the channel if an error occurs.
5037    pub fn send_no_shutdown_on_err(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
5038        let _result = self.send_raw(offsets);
5039        self.drop_without_shutdown();
5040        _result
5041    }
5042
5043    fn send_raw(&self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
5044        self.control_handle.inner.send::<DeviceGetCapabilitiesResponse>(
5045            (offsets,),
5046            self.tx_id,
5047            0x3a050fde46f3ba0f,
5048            fidl::encoding::DynamicFlags::empty(),
5049        )
5050    }
5051}
5052
5053#[must_use = "FIDL methods require a response to be sent"]
5054#[derive(Debug)]
5055pub struct DeviceGetExtendedCapabilitiesResponder {
5056    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
5057    tx_id: u32,
5058}
5059
5060/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
5061/// if the responder is dropped without sending a response, so that the client
5062/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5063impl std::ops::Drop for DeviceGetExtendedCapabilitiesResponder {
5064    fn drop(&mut self) {
5065        self.control_handle.shutdown();
5066        // Safety: drops once, never accessed again
5067        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5068    }
5069}
5070
5071impl fidl::endpoints::Responder for DeviceGetExtendedCapabilitiesResponder {
5072    type ControlHandle = DeviceControlHandle;
5073
5074    fn control_handle(&self) -> &DeviceControlHandle {
5075        &self.control_handle
5076    }
5077
5078    fn drop_without_shutdown(mut self) {
5079        // Safety: drops once, never accessed again due to mem::forget
5080        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5081        // Prevent Drop from running (which would shut down the channel)
5082        std::mem::forget(self);
5083    }
5084}
5085
5086impl DeviceGetExtendedCapabilitiesResponder {
5087    /// Sends a response to the FIDL transaction.
5088    ///
5089    /// Sets the channel to shutdown if an error occurs.
5090    pub fn send(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
5091        let _result = self.send_raw(offsets);
5092        if _result.is_err() {
5093            self.control_handle.shutdown();
5094        }
5095        self.drop_without_shutdown();
5096        _result
5097    }
5098
5099    /// Similar to "send" but does not shutdown the channel if an error occurs.
5100    pub fn send_no_shutdown_on_err(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
5101        let _result = self.send_raw(offsets);
5102        self.drop_without_shutdown();
5103        _result
5104    }
5105
5106    fn send_raw(&self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
5107        self.control_handle.inner.send::<DeviceGetExtendedCapabilitiesResponse>(
5108            (offsets,),
5109            self.tx_id,
5110            0xb8573efcaae0c39,
5111            fidl::encoding::DynamicFlags::empty(),
5112        )
5113    }
5114}
5115
5116#[must_use = "FIDL methods require a response to be sent"]
5117#[derive(Debug)]
5118pub struct DeviceGetBtiResponder {
5119    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
5120    tx_id: u32,
5121}
5122
5123/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
5124/// if the responder is dropped without sending a response, so that the client
5125/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5126impl std::ops::Drop for DeviceGetBtiResponder {
5127    fn drop(&mut self) {
5128        self.control_handle.shutdown();
5129        // Safety: drops once, never accessed again
5130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5131    }
5132}
5133
5134impl fidl::endpoints::Responder for DeviceGetBtiResponder {
5135    type ControlHandle = DeviceControlHandle;
5136
5137    fn control_handle(&self) -> &DeviceControlHandle {
5138        &self.control_handle
5139    }
5140
5141    fn drop_without_shutdown(mut self) {
5142        // Safety: drops once, never accessed again due to mem::forget
5143        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5144        // Prevent Drop from running (which would shut down the channel)
5145        std::mem::forget(self);
5146    }
5147}
5148
5149impl DeviceGetBtiResponder {
5150    /// Sends a response to the FIDL transaction.
5151    ///
5152    /// Sets the channel to shutdown if an error occurs.
5153    pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
5154        let _result = self.send_raw(result);
5155        if _result.is_err() {
5156            self.control_handle.shutdown();
5157        }
5158        self.drop_without_shutdown();
5159        _result
5160    }
5161
5162    /// Similar to "send" but does not shutdown the channel if an error occurs.
5163    pub fn send_no_shutdown_on_err(
5164        self,
5165        mut result: Result<fidl::Bti, i32>,
5166    ) -> Result<(), fidl::Error> {
5167        let _result = self.send_raw(result);
5168        self.drop_without_shutdown();
5169        _result
5170    }
5171
5172    fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
5173        self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBtiResponse, i32>>(
5174            result.map(|bti| (bti,)),
5175            self.tx_id,
5176            0x5e4fe9efb12d9ee3,
5177            fidl::encoding::DynamicFlags::empty(),
5178        )
5179    }
5180}
5181
5182#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5183pub struct ServiceMarker;
5184
5185#[cfg(target_os = "fuchsia")]
5186impl fidl::endpoints::ServiceMarker for ServiceMarker {
5187    type Proxy = ServiceProxy;
5188    type Request = ServiceRequest;
5189    const SERVICE_NAME: &'static str = "fuchsia.hardware.pci.Service";
5190}
5191
5192/// A request for one of the member protocols of Service.
5193///
5194#[cfg(target_os = "fuchsia")]
5195pub enum ServiceRequest {
5196    Device(DeviceRequestStream),
5197}
5198
5199#[cfg(target_os = "fuchsia")]
5200impl fidl::endpoints::ServiceRequest for ServiceRequest {
5201    type Service = ServiceMarker;
5202
5203    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
5204        match name {
5205            "device" => Self::Device(
5206                <DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
5207            ),
5208            _ => panic!("no such member protocol name for service Service"),
5209        }
5210    }
5211
5212    fn member_names() -> &'static [&'static str] {
5213        &["device"]
5214    }
5215}
5216#[cfg(target_os = "fuchsia")]
5217pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
5218
5219#[cfg(target_os = "fuchsia")]
5220impl fidl::endpoints::ServiceProxy for ServiceProxy {
5221    type Service = ServiceMarker;
5222
5223    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
5224        Self(opener)
5225    }
5226}
5227
5228#[cfg(target_os = "fuchsia")]
5229impl ServiceProxy {
5230    pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
5231        let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
5232        self.connect_channel_to_device(server_end)?;
5233        Ok(proxy)
5234    }
5235
5236    /// Like `connect_to_device`, but returns a sync proxy.
5237    /// See [`Self::connect_to_device`] for more details.
5238    pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
5239        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
5240        self.connect_channel_to_device(server_end)?;
5241        Ok(proxy)
5242    }
5243
5244    /// Like `connect_to_device`, but accepts a server end.
5245    /// See [`Self::connect_to_device`] for more details.
5246    pub fn connect_channel_to_device(
5247        &self,
5248        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
5249    ) -> Result<(), fidl::Error> {
5250        self.0.open_member("device", server_end.into_channel())
5251    }
5252
5253    pub fn instance_name(&self) -> &str {
5254        self.0.instance_name()
5255    }
5256}
5257
5258mod internal {
5259    use super::*;
5260    unsafe impl fidl::encoding::TypeMarker for Command {
5261        type Owned = Self;
5262
5263        #[inline(always)]
5264        fn inline_align(_context: fidl::encoding::Context) -> usize {
5265            2
5266        }
5267
5268        #[inline(always)]
5269        fn inline_size(_context: fidl::encoding::Context) -> usize {
5270            2
5271        }
5272    }
5273
5274    impl fidl::encoding::ValueTypeMarker for Command {
5275        type Borrowed<'a> = Self;
5276        #[inline(always)]
5277        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5278            *value
5279        }
5280    }
5281
5282    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Command {
5283        #[inline]
5284        unsafe fn encode(
5285            self,
5286            encoder: &mut fidl::encoding::Encoder<'_, D>,
5287            offset: usize,
5288            _depth: fidl::encoding::Depth,
5289        ) -> fidl::Result<()> {
5290            encoder.debug_check_bounds::<Self>(offset);
5291            encoder.write_num(self.bits(), offset);
5292            Ok(())
5293        }
5294    }
5295
5296    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
5297        #[inline(always)]
5298        fn new_empty() -> Self {
5299            Self::empty()
5300        }
5301
5302        #[inline]
5303        unsafe fn decode(
5304            &mut self,
5305            decoder: &mut fidl::encoding::Decoder<'_, D>,
5306            offset: usize,
5307            _depth: fidl::encoding::Depth,
5308        ) -> fidl::Result<()> {
5309            decoder.debug_check_bounds::<Self>(offset);
5310            let prim = decoder.read_num::<u16>(offset);
5311            *self = Self::from_bits_allow_unknown(prim);
5312            Ok(())
5313        }
5314    }
5315    unsafe impl fidl::encoding::TypeMarker for Status {
5316        type Owned = Self;
5317
5318        #[inline(always)]
5319        fn inline_align(_context: fidl::encoding::Context) -> usize {
5320            2
5321        }
5322
5323        #[inline(always)]
5324        fn inline_size(_context: fidl::encoding::Context) -> usize {
5325            2
5326        }
5327    }
5328
5329    impl fidl::encoding::ValueTypeMarker for Status {
5330        type Borrowed<'a> = Self;
5331        #[inline(always)]
5332        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5333            *value
5334        }
5335    }
5336
5337    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Status {
5338        #[inline]
5339        unsafe fn encode(
5340            self,
5341            encoder: &mut fidl::encoding::Encoder<'_, D>,
5342            offset: usize,
5343            _depth: fidl::encoding::Depth,
5344        ) -> fidl::Result<()> {
5345            encoder.debug_check_bounds::<Self>(offset);
5346            encoder.write_num(self.bits(), offset);
5347            Ok(())
5348        }
5349    }
5350
5351    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
5352        #[inline(always)]
5353        fn new_empty() -> Self {
5354            Self::empty()
5355        }
5356
5357        #[inline]
5358        unsafe fn decode(
5359            &mut self,
5360            decoder: &mut fidl::encoding::Decoder<'_, D>,
5361            offset: usize,
5362            _depth: fidl::encoding::Depth,
5363        ) -> fidl::Result<()> {
5364            decoder.debug_check_bounds::<Self>(offset);
5365            let prim = decoder.read_num::<u16>(offset);
5366            *self = Self::from_bits_allow_unknown(prim);
5367            Ok(())
5368        }
5369    }
5370    unsafe impl fidl::encoding::TypeMarker for CapabilityId {
5371        type Owned = Self;
5372
5373        #[inline(always)]
5374        fn inline_align(_context: fidl::encoding::Context) -> usize {
5375            std::mem::align_of::<u8>()
5376        }
5377
5378        #[inline(always)]
5379        fn inline_size(_context: fidl::encoding::Context) -> usize {
5380            std::mem::size_of::<u8>()
5381        }
5382
5383        #[inline(always)]
5384        fn encode_is_copy() -> bool {
5385            false
5386        }
5387
5388        #[inline(always)]
5389        fn decode_is_copy() -> bool {
5390            false
5391        }
5392    }
5393
5394    impl fidl::encoding::ValueTypeMarker for CapabilityId {
5395        type Borrowed<'a> = Self;
5396        #[inline(always)]
5397        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5398            *value
5399        }
5400    }
5401
5402    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CapabilityId {
5403        #[inline]
5404        unsafe fn encode(
5405            self,
5406            encoder: &mut fidl::encoding::Encoder<'_, D>,
5407            offset: usize,
5408            _depth: fidl::encoding::Depth,
5409        ) -> fidl::Result<()> {
5410            encoder.debug_check_bounds::<Self>(offset);
5411            encoder.write_num(self.into_primitive(), offset);
5412            Ok(())
5413        }
5414    }
5415
5416    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilityId {
5417        #[inline(always)]
5418        fn new_empty() -> Self {
5419            Self::unknown()
5420        }
5421
5422        #[inline]
5423        unsafe fn decode(
5424            &mut self,
5425            decoder: &mut fidl::encoding::Decoder<'_, D>,
5426            offset: usize,
5427            _depth: fidl::encoding::Depth,
5428        ) -> fidl::Result<()> {
5429            decoder.debug_check_bounds::<Self>(offset);
5430            let prim = decoder.read_num::<u8>(offset);
5431
5432            *self = Self::from_primitive_allow_unknown(prim);
5433            Ok(())
5434        }
5435    }
5436    unsafe impl fidl::encoding::TypeMarker for Config {
5437        type Owned = Self;
5438
5439        #[inline(always)]
5440        fn inline_align(_context: fidl::encoding::Context) -> usize {
5441            std::mem::align_of::<u16>()
5442        }
5443
5444        #[inline(always)]
5445        fn inline_size(_context: fidl::encoding::Context) -> usize {
5446            std::mem::size_of::<u16>()
5447        }
5448
5449        #[inline(always)]
5450        fn encode_is_copy() -> bool {
5451            false
5452        }
5453
5454        #[inline(always)]
5455        fn decode_is_copy() -> bool {
5456            false
5457        }
5458    }
5459
5460    impl fidl::encoding::ValueTypeMarker for Config {
5461        type Borrowed<'a> = Self;
5462        #[inline(always)]
5463        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5464            *value
5465        }
5466    }
5467
5468    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Config {
5469        #[inline]
5470        unsafe fn encode(
5471            self,
5472            encoder: &mut fidl::encoding::Encoder<'_, D>,
5473            offset: usize,
5474            _depth: fidl::encoding::Depth,
5475        ) -> fidl::Result<()> {
5476            encoder.debug_check_bounds::<Self>(offset);
5477            encoder.write_num(self.into_primitive(), offset);
5478            Ok(())
5479        }
5480    }
5481
5482    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
5483        #[inline(always)]
5484        fn new_empty() -> Self {
5485            Self::unknown()
5486        }
5487
5488        #[inline]
5489        unsafe fn decode(
5490            &mut self,
5491            decoder: &mut fidl::encoding::Decoder<'_, D>,
5492            offset: usize,
5493            _depth: fidl::encoding::Depth,
5494        ) -> fidl::Result<()> {
5495            decoder.debug_check_bounds::<Self>(offset);
5496            let prim = decoder.read_num::<u16>(offset);
5497
5498            *self = Self::from_primitive_allow_unknown(prim);
5499            Ok(())
5500        }
5501    }
5502    unsafe impl fidl::encoding::TypeMarker for ExtendedCapabilityId {
5503        type Owned = Self;
5504
5505        #[inline(always)]
5506        fn inline_align(_context: fidl::encoding::Context) -> usize {
5507            std::mem::align_of::<u16>()
5508        }
5509
5510        #[inline(always)]
5511        fn inline_size(_context: fidl::encoding::Context) -> usize {
5512            std::mem::size_of::<u16>()
5513        }
5514
5515        #[inline(always)]
5516        fn encode_is_copy() -> bool {
5517            false
5518        }
5519
5520        #[inline(always)]
5521        fn decode_is_copy() -> bool {
5522            false
5523        }
5524    }
5525
5526    impl fidl::encoding::ValueTypeMarker for ExtendedCapabilityId {
5527        type Borrowed<'a> = Self;
5528        #[inline(always)]
5529        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5530            *value
5531        }
5532    }
5533
5534    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
5535        for ExtendedCapabilityId
5536    {
5537        #[inline]
5538        unsafe fn encode(
5539            self,
5540            encoder: &mut fidl::encoding::Encoder<'_, D>,
5541            offset: usize,
5542            _depth: fidl::encoding::Depth,
5543        ) -> fidl::Result<()> {
5544            encoder.debug_check_bounds::<Self>(offset);
5545            encoder.write_num(self.into_primitive(), offset);
5546            Ok(())
5547        }
5548    }
5549
5550    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapabilityId {
5551        #[inline(always)]
5552        fn new_empty() -> Self {
5553            Self::unknown()
5554        }
5555
5556        #[inline]
5557        unsafe fn decode(
5558            &mut self,
5559            decoder: &mut fidl::encoding::Decoder<'_, D>,
5560            offset: usize,
5561            _depth: fidl::encoding::Depth,
5562        ) -> fidl::Result<()> {
5563            decoder.debug_check_bounds::<Self>(offset);
5564            let prim = decoder.read_num::<u16>(offset);
5565
5566            *self = Self::from_primitive_allow_unknown(prim);
5567            Ok(())
5568        }
5569    }
5570    unsafe impl fidl::encoding::TypeMarker for HeaderType {
5571        type Owned = Self;
5572
5573        #[inline(always)]
5574        fn inline_align(_context: fidl::encoding::Context) -> usize {
5575            std::mem::align_of::<u8>()
5576        }
5577
5578        #[inline(always)]
5579        fn inline_size(_context: fidl::encoding::Context) -> usize {
5580            std::mem::size_of::<u8>()
5581        }
5582
5583        #[inline(always)]
5584        fn encode_is_copy() -> bool {
5585            false
5586        }
5587
5588        #[inline(always)]
5589        fn decode_is_copy() -> bool {
5590            false
5591        }
5592    }
5593
5594    impl fidl::encoding::ValueTypeMarker for HeaderType {
5595        type Borrowed<'a> = Self;
5596        #[inline(always)]
5597        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5598            *value
5599        }
5600    }
5601
5602    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HeaderType {
5603        #[inline]
5604        unsafe fn encode(
5605            self,
5606            encoder: &mut fidl::encoding::Encoder<'_, D>,
5607            offset: usize,
5608            _depth: fidl::encoding::Depth,
5609        ) -> fidl::Result<()> {
5610            encoder.debug_check_bounds::<Self>(offset);
5611            encoder.write_num(self.into_primitive(), offset);
5612            Ok(())
5613        }
5614    }
5615
5616    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HeaderType {
5617        #[inline(always)]
5618        fn new_empty() -> Self {
5619            Self::unknown()
5620        }
5621
5622        #[inline]
5623        unsafe fn decode(
5624            &mut self,
5625            decoder: &mut fidl::encoding::Decoder<'_, D>,
5626            offset: usize,
5627            _depth: fidl::encoding::Depth,
5628        ) -> fidl::Result<()> {
5629            decoder.debug_check_bounds::<Self>(offset);
5630            let prim = decoder.read_num::<u8>(offset);
5631
5632            *self = Self::from_primitive_allow_unknown(prim);
5633            Ok(())
5634        }
5635    }
5636    unsafe impl fidl::encoding::TypeMarker for InterruptMode {
5637        type Owned = Self;
5638
5639        #[inline(always)]
5640        fn inline_align(_context: fidl::encoding::Context) -> usize {
5641            std::mem::align_of::<u8>()
5642        }
5643
5644        #[inline(always)]
5645        fn inline_size(_context: fidl::encoding::Context) -> usize {
5646            std::mem::size_of::<u8>()
5647        }
5648
5649        #[inline(always)]
5650        fn encode_is_copy() -> bool {
5651            false
5652        }
5653
5654        #[inline(always)]
5655        fn decode_is_copy() -> bool {
5656            false
5657        }
5658    }
5659
5660    impl fidl::encoding::ValueTypeMarker for InterruptMode {
5661        type Borrowed<'a> = Self;
5662        #[inline(always)]
5663        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5664            *value
5665        }
5666    }
5667
5668    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InterruptMode {
5669        #[inline]
5670        unsafe fn encode(
5671            self,
5672            encoder: &mut fidl::encoding::Encoder<'_, D>,
5673            offset: usize,
5674            _depth: fidl::encoding::Depth,
5675        ) -> fidl::Result<()> {
5676            encoder.debug_check_bounds::<Self>(offset);
5677            encoder.write_num(self.into_primitive(), offset);
5678            Ok(())
5679        }
5680    }
5681
5682    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptMode {
5683        #[inline(always)]
5684        fn new_empty() -> Self {
5685            Self::unknown()
5686        }
5687
5688        #[inline]
5689        unsafe fn decode(
5690            &mut self,
5691            decoder: &mut fidl::encoding::Decoder<'_, D>,
5692            offset: usize,
5693            _depth: fidl::encoding::Depth,
5694        ) -> fidl::Result<()> {
5695            decoder.debug_check_bounds::<Self>(offset);
5696            let prim = decoder.read_num::<u8>(offset);
5697
5698            *self = Self::from_primitive_allow_unknown(prim);
5699            Ok(())
5700        }
5701    }
5702
5703    impl fidl::encoding::ValueTypeMarker for Address {
5704        type Borrowed<'a> = &'a Self;
5705        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5706            value
5707        }
5708    }
5709
5710    unsafe impl fidl::encoding::TypeMarker for Address {
5711        type Owned = Self;
5712
5713        #[inline(always)]
5714        fn inline_align(_context: fidl::encoding::Context) -> usize {
5715            1
5716        }
5717
5718        #[inline(always)]
5719        fn inline_size(_context: fidl::encoding::Context) -> usize {
5720            3
5721        }
5722        #[inline(always)]
5723        fn encode_is_copy() -> bool {
5724            true
5725        }
5726
5727        #[inline(always)]
5728        fn decode_is_copy() -> bool {
5729            true
5730        }
5731    }
5732
5733    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
5734        #[inline]
5735        unsafe fn encode(
5736            self,
5737            encoder: &mut fidl::encoding::Encoder<'_, D>,
5738            offset: usize,
5739            _depth: fidl::encoding::Depth,
5740        ) -> fidl::Result<()> {
5741            encoder.debug_check_bounds::<Address>(offset);
5742            unsafe {
5743                // Copy the object into the buffer.
5744                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5745                (buf_ptr as *mut Address).write_unaligned((self as *const Address).read());
5746                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5747                // done second because the memcpy will write garbage to these bytes.
5748            }
5749            Ok(())
5750        }
5751    }
5752    unsafe impl<
5753            D: fidl::encoding::ResourceDialect,
5754            T0: fidl::encoding::Encode<u8, D>,
5755            T1: fidl::encoding::Encode<u8, D>,
5756            T2: fidl::encoding::Encode<u8, D>,
5757        > fidl::encoding::Encode<Address, D> for (T0, T1, T2)
5758    {
5759        #[inline]
5760        unsafe fn encode(
5761            self,
5762            encoder: &mut fidl::encoding::Encoder<'_, D>,
5763            offset: usize,
5764            depth: fidl::encoding::Depth,
5765        ) -> fidl::Result<()> {
5766            encoder.debug_check_bounds::<Address>(offset);
5767            // Zero out padding regions. There's no need to apply masks
5768            // because the unmasked parts will be overwritten by fields.
5769            // Write the fields.
5770            self.0.encode(encoder, offset + 0, depth)?;
5771            self.1.encode(encoder, offset + 1, depth)?;
5772            self.2.encode(encoder, offset + 2, depth)?;
5773            Ok(())
5774        }
5775    }
5776
5777    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
5778        #[inline(always)]
5779        fn new_empty() -> Self {
5780            Self {
5781                bus: fidl::new_empty!(u8, D),
5782                device: fidl::new_empty!(u8, D),
5783                function: fidl::new_empty!(u8, D),
5784            }
5785        }
5786
5787        #[inline]
5788        unsafe fn decode(
5789            &mut self,
5790            decoder: &mut fidl::encoding::Decoder<'_, D>,
5791            offset: usize,
5792            _depth: fidl::encoding::Depth,
5793        ) -> fidl::Result<()> {
5794            decoder.debug_check_bounds::<Self>(offset);
5795            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5796            // Verify that padding bytes are zero.
5797            // Copy from the buffer into the object.
5798            unsafe {
5799                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 3);
5800            }
5801            Ok(())
5802        }
5803    }
5804
5805    impl fidl::encoding::ResourceTypeMarker for Bar {
5806        type Borrowed<'a> = &'a mut Self;
5807        fn take_or_borrow<'a>(
5808            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5809        ) -> Self::Borrowed<'a> {
5810            value
5811        }
5812    }
5813
5814    unsafe impl fidl::encoding::TypeMarker for Bar {
5815        type Owned = Self;
5816
5817        #[inline(always)]
5818        fn inline_align(_context: fidl::encoding::Context) -> usize {
5819            8
5820        }
5821
5822        #[inline(always)]
5823        fn inline_size(_context: fidl::encoding::Context) -> usize {
5824            32
5825        }
5826    }
5827
5828    unsafe impl fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
5829        for &mut Bar
5830    {
5831        #[inline]
5832        unsafe fn encode(
5833            self,
5834            encoder: &mut fidl::encoding::Encoder<
5835                '_,
5836                fidl::encoding::DefaultFuchsiaResourceDialect,
5837            >,
5838            offset: usize,
5839            _depth: fidl::encoding::Depth,
5840        ) -> fidl::Result<()> {
5841            encoder.debug_check_bounds::<Bar>(offset);
5842            // Delegate to tuple encoding.
5843            fidl::encoding::Encode::<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5844                (
5845                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bar_id),
5846                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
5847                    <BarResult as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5848                        &mut self.result,
5849                    ),
5850                ),
5851                encoder,
5852                offset,
5853                _depth,
5854            )
5855        }
5856    }
5857    unsafe impl<
5858            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
5859            T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
5860            T2: fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>,
5861        > fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
5862        for (T0, T1, T2)
5863    {
5864        #[inline]
5865        unsafe fn encode(
5866            self,
5867            encoder: &mut fidl::encoding::Encoder<
5868                '_,
5869                fidl::encoding::DefaultFuchsiaResourceDialect,
5870            >,
5871            offset: usize,
5872            depth: fidl::encoding::Depth,
5873        ) -> fidl::Result<()> {
5874            encoder.debug_check_bounds::<Bar>(offset);
5875            // Zero out padding regions. There's no need to apply masks
5876            // because the unmasked parts will be overwritten by fields.
5877            unsafe {
5878                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5879                (ptr as *mut u64).write_unaligned(0);
5880            }
5881            // Write the fields.
5882            self.0.encode(encoder, offset + 0, depth)?;
5883            self.1.encode(encoder, offset + 8, depth)?;
5884            self.2.encode(encoder, offset + 16, depth)?;
5885            Ok(())
5886        }
5887    }
5888
5889    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Bar {
5890        #[inline(always)]
5891        fn new_empty() -> Self {
5892            Self {
5893                bar_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
5894                size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
5895                result: fidl::new_empty!(BarResult, fidl::encoding::DefaultFuchsiaResourceDialect),
5896            }
5897        }
5898
5899        #[inline]
5900        unsafe fn decode(
5901            &mut self,
5902            decoder: &mut fidl::encoding::Decoder<
5903                '_,
5904                fidl::encoding::DefaultFuchsiaResourceDialect,
5905            >,
5906            offset: usize,
5907            _depth: fidl::encoding::Depth,
5908        ) -> fidl::Result<()> {
5909            decoder.debug_check_bounds::<Self>(offset);
5910            // Verify that padding bytes are zero.
5911            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5912            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5913            let mask = 0xffffffff00000000u64;
5914            let maskedval = padval & mask;
5915            if maskedval != 0 {
5916                return Err(fidl::Error::NonZeroPadding {
5917                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5918                });
5919            }
5920            fidl::decode!(
5921                u32,
5922                fidl::encoding::DefaultFuchsiaResourceDialect,
5923                &mut self.bar_id,
5924                decoder,
5925                offset + 0,
5926                _depth
5927            )?;
5928            fidl::decode!(
5929                u64,
5930                fidl::encoding::DefaultFuchsiaResourceDialect,
5931                &mut self.size,
5932                decoder,
5933                offset + 8,
5934                _depth
5935            )?;
5936            fidl::decode!(
5937                BarResult,
5938                fidl::encoding::DefaultFuchsiaResourceDialect,
5939                &mut self.result,
5940                decoder,
5941                offset + 16,
5942                _depth
5943            )?;
5944            Ok(())
5945        }
5946    }
5947
5948    impl fidl::encoding::ValueTypeMarker for BaseAddress {
5949        type Borrowed<'a> = &'a Self;
5950        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5951            value
5952        }
5953    }
5954
5955    unsafe impl fidl::encoding::TypeMarker for BaseAddress {
5956        type Owned = Self;
5957
5958        #[inline(always)]
5959        fn inline_align(_context: fidl::encoding::Context) -> usize {
5960            8
5961        }
5962
5963        #[inline(always)]
5964        fn inline_size(_context: fidl::encoding::Context) -> usize {
5965            24
5966        }
5967    }
5968
5969    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BaseAddress, D>
5970        for &BaseAddress
5971    {
5972        #[inline]
5973        unsafe fn encode(
5974            self,
5975            encoder: &mut fidl::encoding::Encoder<'_, D>,
5976            offset: usize,
5977            _depth: fidl::encoding::Depth,
5978        ) -> fidl::Result<()> {
5979            encoder.debug_check_bounds::<BaseAddress>(offset);
5980            // Delegate to tuple encoding.
5981            fidl::encoding::Encode::<BaseAddress, D>::encode(
5982                (
5983                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
5984                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
5985                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_memory),
5986                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_prefetchable),
5987                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_64bit),
5988                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
5989                ),
5990                encoder,
5991                offset,
5992                _depth,
5993            )
5994        }
5995    }
5996    unsafe impl<
5997            D: fidl::encoding::ResourceDialect,
5998            T0: fidl::encoding::Encode<u64, D>,
5999            T1: fidl::encoding::Encode<u64, D>,
6000            T2: fidl::encoding::Encode<bool, D>,
6001            T3: fidl::encoding::Encode<bool, D>,
6002            T4: fidl::encoding::Encode<bool, D>,
6003            T5: fidl::encoding::Encode<u8, D>,
6004        > fidl::encoding::Encode<BaseAddress, D> for (T0, T1, T2, T3, T4, T5)
6005    {
6006        #[inline]
6007        unsafe fn encode(
6008            self,
6009            encoder: &mut fidl::encoding::Encoder<'_, D>,
6010            offset: usize,
6011            depth: fidl::encoding::Depth,
6012        ) -> fidl::Result<()> {
6013            encoder.debug_check_bounds::<BaseAddress>(offset);
6014            // Zero out padding regions. There's no need to apply masks
6015            // because the unmasked parts will be overwritten by fields.
6016            unsafe {
6017                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
6018                (ptr as *mut u64).write_unaligned(0);
6019            }
6020            // Write the fields.
6021            self.0.encode(encoder, offset + 0, depth)?;
6022            self.1.encode(encoder, offset + 8, depth)?;
6023            self.2.encode(encoder, offset + 16, depth)?;
6024            self.3.encode(encoder, offset + 17, depth)?;
6025            self.4.encode(encoder, offset + 18, depth)?;
6026            self.5.encode(encoder, offset + 19, depth)?;
6027            Ok(())
6028        }
6029    }
6030
6031    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BaseAddress {
6032        #[inline(always)]
6033        fn new_empty() -> Self {
6034            Self {
6035                address: fidl::new_empty!(u64, D),
6036                size: fidl::new_empty!(u64, D),
6037                is_memory: fidl::new_empty!(bool, D),
6038                is_prefetchable: fidl::new_empty!(bool, D),
6039                is_64bit: fidl::new_empty!(bool, D),
6040                id: fidl::new_empty!(u8, D),
6041            }
6042        }
6043
6044        #[inline]
6045        unsafe fn decode(
6046            &mut self,
6047            decoder: &mut fidl::encoding::Decoder<'_, D>,
6048            offset: usize,
6049            _depth: fidl::encoding::Depth,
6050        ) -> fidl::Result<()> {
6051            decoder.debug_check_bounds::<Self>(offset);
6052            // Verify that padding bytes are zero.
6053            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
6054            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6055            let mask = 0xffffffff00000000u64;
6056            let maskedval = padval & mask;
6057            if maskedval != 0 {
6058                return Err(fidl::Error::NonZeroPadding {
6059                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
6060                });
6061            }
6062            fidl::decode!(u64, D, &mut self.address, decoder, offset + 0, _depth)?;
6063            fidl::decode!(u64, D, &mut self.size, decoder, offset + 8, _depth)?;
6064            fidl::decode!(bool, D, &mut self.is_memory, decoder, offset + 16, _depth)?;
6065            fidl::decode!(bool, D, &mut self.is_prefetchable, decoder, offset + 17, _depth)?;
6066            fidl::decode!(bool, D, &mut self.is_64bit, decoder, offset + 18, _depth)?;
6067            fidl::decode!(u8, D, &mut self.id, decoder, offset + 19, _depth)?;
6068            Ok(())
6069        }
6070    }
6071
6072    impl fidl::encoding::ValueTypeMarker for BusGetDevicesResponse {
6073        type Borrowed<'a> = &'a Self;
6074        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6075            value
6076        }
6077    }
6078
6079    unsafe impl fidl::encoding::TypeMarker for BusGetDevicesResponse {
6080        type Owned = Self;
6081
6082        #[inline(always)]
6083        fn inline_align(_context: fidl::encoding::Context) -> usize {
6084            8
6085        }
6086
6087        #[inline(always)]
6088        fn inline_size(_context: fidl::encoding::Context) -> usize {
6089            16
6090        }
6091    }
6092
6093    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusGetDevicesResponse, D>
6094        for &BusGetDevicesResponse
6095    {
6096        #[inline]
6097        unsafe fn encode(
6098            self,
6099            encoder: &mut fidl::encoding::Encoder<'_, D>,
6100            offset: usize,
6101            _depth: fidl::encoding::Depth,
6102        ) -> fidl::Result<()> {
6103            encoder.debug_check_bounds::<BusGetDevicesResponse>(offset);
6104            // Delegate to tuple encoding.
6105            fidl::encoding::Encode::<BusGetDevicesResponse, D>::encode(
6106                (
6107                    <fidl::encoding::Vector<PciDevice, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.devices),
6108                ),
6109                encoder, offset, _depth
6110            )
6111        }
6112    }
6113    unsafe impl<
6114            D: fidl::encoding::ResourceDialect,
6115            T0: fidl::encoding::Encode<fidl::encoding::Vector<PciDevice, 64>, D>,
6116        > fidl::encoding::Encode<BusGetDevicesResponse, D> for (T0,)
6117    {
6118        #[inline]
6119        unsafe fn encode(
6120            self,
6121            encoder: &mut fidl::encoding::Encoder<'_, D>,
6122            offset: usize,
6123            depth: fidl::encoding::Depth,
6124        ) -> fidl::Result<()> {
6125            encoder.debug_check_bounds::<BusGetDevicesResponse>(offset);
6126            // Zero out padding regions. There's no need to apply masks
6127            // because the unmasked parts will be overwritten by fields.
6128            // Write the fields.
6129            self.0.encode(encoder, offset + 0, depth)?;
6130            Ok(())
6131        }
6132    }
6133
6134    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusGetDevicesResponse {
6135        #[inline(always)]
6136        fn new_empty() -> Self {
6137            Self { devices: fidl::new_empty!(fidl::encoding::Vector<PciDevice, 64>, D) }
6138        }
6139
6140        #[inline]
6141        unsafe fn decode(
6142            &mut self,
6143            decoder: &mut fidl::encoding::Decoder<'_, D>,
6144            offset: usize,
6145            _depth: fidl::encoding::Depth,
6146        ) -> fidl::Result<()> {
6147            decoder.debug_check_bounds::<Self>(offset);
6148            // Verify that padding bytes are zero.
6149            fidl::decode!(fidl::encoding::Vector<PciDevice, 64>, D, &mut self.devices, decoder, offset + 0, _depth)?;
6150            Ok(())
6151        }
6152    }
6153
6154    impl fidl::encoding::ValueTypeMarker for BusGetHostBridgeInfoResponse {
6155        type Borrowed<'a> = &'a Self;
6156        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6157            value
6158        }
6159    }
6160
6161    unsafe impl fidl::encoding::TypeMarker for BusGetHostBridgeInfoResponse {
6162        type Owned = Self;
6163
6164        #[inline(always)]
6165        fn inline_align(_context: fidl::encoding::Context) -> usize {
6166            8
6167        }
6168
6169        #[inline(always)]
6170        fn inline_size(_context: fidl::encoding::Context) -> usize {
6171            24
6172        }
6173    }
6174
6175    unsafe impl<D: fidl::encoding::ResourceDialect>
6176        fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for &BusGetHostBridgeInfoResponse
6177    {
6178        #[inline]
6179        unsafe fn encode(
6180            self,
6181            encoder: &mut fidl::encoding::Encoder<'_, D>,
6182            offset: usize,
6183            _depth: fidl::encoding::Depth,
6184        ) -> fidl::Result<()> {
6185            encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
6186            // Delegate to tuple encoding.
6187            fidl::encoding::Encode::<BusGetHostBridgeInfoResponse, D>::encode(
6188                (<HostBridgeInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
6189                encoder,
6190                offset,
6191                _depth,
6192            )
6193        }
6194    }
6195    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HostBridgeInfo, D>>
6196        fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for (T0,)
6197    {
6198        #[inline]
6199        unsafe fn encode(
6200            self,
6201            encoder: &mut fidl::encoding::Encoder<'_, D>,
6202            offset: usize,
6203            depth: fidl::encoding::Depth,
6204        ) -> fidl::Result<()> {
6205            encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
6206            // Zero out padding regions. There's no need to apply masks
6207            // because the unmasked parts will be overwritten by fields.
6208            // Write the fields.
6209            self.0.encode(encoder, offset + 0, depth)?;
6210            Ok(())
6211        }
6212    }
6213
6214    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6215        for BusGetHostBridgeInfoResponse
6216    {
6217        #[inline(always)]
6218        fn new_empty() -> Self {
6219            Self { info: fidl::new_empty!(HostBridgeInfo, D) }
6220        }
6221
6222        #[inline]
6223        unsafe fn decode(
6224            &mut self,
6225            decoder: &mut fidl::encoding::Decoder<'_, D>,
6226            offset: usize,
6227            _depth: fidl::encoding::Depth,
6228        ) -> fidl::Result<()> {
6229            decoder.debug_check_bounds::<Self>(offset);
6230            // Verify that padding bytes are zero.
6231            fidl::decode!(HostBridgeInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
6232            Ok(())
6233        }
6234    }
6235
6236    impl fidl::encoding::ValueTypeMarker for BusReadBarRequest {
6237        type Borrowed<'a> = &'a Self;
6238        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6239            value
6240        }
6241    }
6242
6243    unsafe impl fidl::encoding::TypeMarker for BusReadBarRequest {
6244        type Owned = Self;
6245
6246        #[inline(always)]
6247        fn inline_align(_context: fidl::encoding::Context) -> usize {
6248            8
6249        }
6250
6251        #[inline(always)]
6252        fn inline_size(_context: fidl::encoding::Context) -> usize {
6253            24
6254        }
6255    }
6256
6257    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarRequest, D>
6258        for &BusReadBarRequest
6259    {
6260        #[inline]
6261        unsafe fn encode(
6262            self,
6263            encoder: &mut fidl::encoding::Encoder<'_, D>,
6264            offset: usize,
6265            _depth: fidl::encoding::Depth,
6266        ) -> fidl::Result<()> {
6267            encoder.debug_check_bounds::<BusReadBarRequest>(offset);
6268            unsafe {
6269                // Copy the object into the buffer.
6270                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6271                (buf_ptr as *mut BusReadBarRequest)
6272                    .write_unaligned((self as *const BusReadBarRequest).read());
6273                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
6274                // done second because the memcpy will write garbage to these bytes.
6275                let padding_ptr = buf_ptr.offset(0) as *mut u64;
6276                let padding_mask = 0xffffffff00000000u64;
6277                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
6278            }
6279            Ok(())
6280        }
6281    }
6282    unsafe impl<
6283            D: fidl::encoding::ResourceDialect,
6284            T0: fidl::encoding::Encode<Address, D>,
6285            T1: fidl::encoding::Encode<u8, D>,
6286            T2: fidl::encoding::Encode<u64, D>,
6287            T3: fidl::encoding::Encode<u64, D>,
6288        > fidl::encoding::Encode<BusReadBarRequest, D> for (T0, T1, T2, T3)
6289    {
6290        #[inline]
6291        unsafe fn encode(
6292            self,
6293            encoder: &mut fidl::encoding::Encoder<'_, D>,
6294            offset: usize,
6295            depth: fidl::encoding::Depth,
6296        ) -> fidl::Result<()> {
6297            encoder.debug_check_bounds::<BusReadBarRequest>(offset);
6298            // Zero out padding regions. There's no need to apply masks
6299            // because the unmasked parts will be overwritten by fields.
6300            unsafe {
6301                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6302                (ptr as *mut u64).write_unaligned(0);
6303            }
6304            // Write the fields.
6305            self.0.encode(encoder, offset + 0, depth)?;
6306            self.1.encode(encoder, offset + 3, depth)?;
6307            self.2.encode(encoder, offset + 8, depth)?;
6308            self.3.encode(encoder, offset + 16, depth)?;
6309            Ok(())
6310        }
6311    }
6312
6313    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarRequest {
6314        #[inline(always)]
6315        fn new_empty() -> Self {
6316            Self {
6317                device: fidl::new_empty!(Address, D),
6318                bar_id: fidl::new_empty!(u8, D),
6319                offset: fidl::new_empty!(u64, D),
6320                size: fidl::new_empty!(u64, D),
6321            }
6322        }
6323
6324        #[inline]
6325        unsafe fn decode(
6326            &mut self,
6327            decoder: &mut fidl::encoding::Decoder<'_, D>,
6328            offset: usize,
6329            _depth: fidl::encoding::Depth,
6330        ) -> fidl::Result<()> {
6331            decoder.debug_check_bounds::<Self>(offset);
6332            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6333            // Verify that padding bytes are zero.
6334            let ptr = unsafe { buf_ptr.offset(0) };
6335            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6336            let mask = 0xffffffff00000000u64;
6337            let maskedval = padval & mask;
6338            if maskedval != 0 {
6339                return Err(fidl::Error::NonZeroPadding {
6340                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6341                });
6342            }
6343            // Copy from the buffer into the object.
6344            unsafe {
6345                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
6346            }
6347            Ok(())
6348        }
6349    }
6350
6351    impl fidl::encoding::ValueTypeMarker for BusReadBarResponse {
6352        type Borrowed<'a> = &'a Self;
6353        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6354            value
6355        }
6356    }
6357
6358    unsafe impl fidl::encoding::TypeMarker for BusReadBarResponse {
6359        type Owned = Self;
6360
6361        #[inline(always)]
6362        fn inline_align(_context: fidl::encoding::Context) -> usize {
6363            8
6364        }
6365
6366        #[inline(always)]
6367        fn inline_size(_context: fidl::encoding::Context) -> usize {
6368            16
6369        }
6370    }
6371
6372    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarResponse, D>
6373        for &BusReadBarResponse
6374    {
6375        #[inline]
6376        unsafe fn encode(
6377            self,
6378            encoder: &mut fidl::encoding::Encoder<'_, D>,
6379            offset: usize,
6380            _depth: fidl::encoding::Depth,
6381        ) -> fidl::Result<()> {
6382            encoder.debug_check_bounds::<BusReadBarResponse>(offset);
6383            // Delegate to tuple encoding.
6384            fidl::encoding::Encode::<BusReadBarResponse, D>::encode(
6385                (<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
6386                    &self.buffer,
6387                ),),
6388                encoder,
6389                offset,
6390                _depth,
6391            )
6392        }
6393    }
6394    unsafe impl<
6395            D: fidl::encoding::ResourceDialect,
6396            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
6397        > fidl::encoding::Encode<BusReadBarResponse, D> for (T0,)
6398    {
6399        #[inline]
6400        unsafe fn encode(
6401            self,
6402            encoder: &mut fidl::encoding::Encoder<'_, D>,
6403            offset: usize,
6404            depth: fidl::encoding::Depth,
6405        ) -> fidl::Result<()> {
6406            encoder.debug_check_bounds::<BusReadBarResponse>(offset);
6407            // Zero out padding regions. There's no need to apply masks
6408            // because the unmasked parts will be overwritten by fields.
6409            // Write the fields.
6410            self.0.encode(encoder, offset + 0, depth)?;
6411            Ok(())
6412        }
6413    }
6414
6415    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarResponse {
6416        #[inline(always)]
6417        fn new_empty() -> Self {
6418            Self { buffer: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
6419        }
6420
6421        #[inline]
6422        unsafe fn decode(
6423            &mut self,
6424            decoder: &mut fidl::encoding::Decoder<'_, D>,
6425            offset: usize,
6426            _depth: fidl::encoding::Depth,
6427        ) -> fidl::Result<()> {
6428            decoder.debug_check_bounds::<Self>(offset);
6429            // Verify that padding bytes are zero.
6430            fidl::decode!(
6431                fidl::encoding::UnboundedVector<u8>,
6432                D,
6433                &mut self.buffer,
6434                decoder,
6435                offset + 0,
6436                _depth
6437            )?;
6438            Ok(())
6439        }
6440    }
6441
6442    impl fidl::encoding::ValueTypeMarker for Capability {
6443        type Borrowed<'a> = &'a Self;
6444        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6445            value
6446        }
6447    }
6448
6449    unsafe impl fidl::encoding::TypeMarker for Capability {
6450        type Owned = Self;
6451
6452        #[inline(always)]
6453        fn inline_align(_context: fidl::encoding::Context) -> usize {
6454            1
6455        }
6456
6457        #[inline(always)]
6458        fn inline_size(_context: fidl::encoding::Context) -> usize {
6459            2
6460        }
6461        #[inline(always)]
6462        fn encode_is_copy() -> bool {
6463            true
6464        }
6465
6466        #[inline(always)]
6467        fn decode_is_copy() -> bool {
6468            true
6469        }
6470    }
6471
6472    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Capability, D>
6473        for &Capability
6474    {
6475        #[inline]
6476        unsafe fn encode(
6477            self,
6478            encoder: &mut fidl::encoding::Encoder<'_, D>,
6479            offset: usize,
6480            _depth: fidl::encoding::Depth,
6481        ) -> fidl::Result<()> {
6482            encoder.debug_check_bounds::<Capability>(offset);
6483            unsafe {
6484                // Copy the object into the buffer.
6485                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6486                (buf_ptr as *mut Capability).write_unaligned((self as *const Capability).read());
6487                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
6488                // done second because the memcpy will write garbage to these bytes.
6489            }
6490            Ok(())
6491        }
6492    }
6493    unsafe impl<
6494            D: fidl::encoding::ResourceDialect,
6495            T0: fidl::encoding::Encode<u8, D>,
6496            T1: fidl::encoding::Encode<u8, D>,
6497        > fidl::encoding::Encode<Capability, D> for (T0, T1)
6498    {
6499        #[inline]
6500        unsafe fn encode(
6501            self,
6502            encoder: &mut fidl::encoding::Encoder<'_, D>,
6503            offset: usize,
6504            depth: fidl::encoding::Depth,
6505        ) -> fidl::Result<()> {
6506            encoder.debug_check_bounds::<Capability>(offset);
6507            // Zero out padding regions. There's no need to apply masks
6508            // because the unmasked parts will be overwritten by fields.
6509            // Write the fields.
6510            self.0.encode(encoder, offset + 0, depth)?;
6511            self.1.encode(encoder, offset + 1, depth)?;
6512            Ok(())
6513        }
6514    }
6515
6516    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Capability {
6517        #[inline(always)]
6518        fn new_empty() -> Self {
6519            Self { id: fidl::new_empty!(u8, D), offset: fidl::new_empty!(u8, D) }
6520        }
6521
6522        #[inline]
6523        unsafe fn decode(
6524            &mut self,
6525            decoder: &mut fidl::encoding::Decoder<'_, D>,
6526            offset: usize,
6527            _depth: fidl::encoding::Depth,
6528        ) -> fidl::Result<()> {
6529            decoder.debug_check_bounds::<Self>(offset);
6530            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6531            // Verify that padding bytes are zero.
6532            // Copy from the buffer into the object.
6533            unsafe {
6534                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
6535            }
6536            Ok(())
6537        }
6538    }
6539
6540    impl fidl::encoding::ValueTypeMarker for DeviceGetBarRequest {
6541        type Borrowed<'a> = &'a Self;
6542        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6543            value
6544        }
6545    }
6546
6547    unsafe impl fidl::encoding::TypeMarker for DeviceGetBarRequest {
6548        type Owned = Self;
6549
6550        #[inline(always)]
6551        fn inline_align(_context: fidl::encoding::Context) -> usize {
6552            4
6553        }
6554
6555        #[inline(always)]
6556        fn inline_size(_context: fidl::encoding::Context) -> usize {
6557            4
6558        }
6559        #[inline(always)]
6560        fn encode_is_copy() -> bool {
6561            true
6562        }
6563
6564        #[inline(always)]
6565        fn decode_is_copy() -> bool {
6566            true
6567        }
6568    }
6569
6570    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBarRequest, D>
6571        for &DeviceGetBarRequest
6572    {
6573        #[inline]
6574        unsafe fn encode(
6575            self,
6576            encoder: &mut fidl::encoding::Encoder<'_, D>,
6577            offset: usize,
6578            _depth: fidl::encoding::Depth,
6579        ) -> fidl::Result<()> {
6580            encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
6581            unsafe {
6582                // Copy the object into the buffer.
6583                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6584                (buf_ptr as *mut DeviceGetBarRequest)
6585                    .write_unaligned((self as *const DeviceGetBarRequest).read());
6586                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
6587                // done second because the memcpy will write garbage to these bytes.
6588            }
6589            Ok(())
6590        }
6591    }
6592    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
6593        fidl::encoding::Encode<DeviceGetBarRequest, D> for (T0,)
6594    {
6595        #[inline]
6596        unsafe fn encode(
6597            self,
6598            encoder: &mut fidl::encoding::Encoder<'_, D>,
6599            offset: usize,
6600            depth: fidl::encoding::Depth,
6601        ) -> fidl::Result<()> {
6602            encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
6603            // Zero out padding regions. There's no need to apply masks
6604            // because the unmasked parts will be overwritten by fields.
6605            // Write the fields.
6606            self.0.encode(encoder, offset + 0, depth)?;
6607            Ok(())
6608        }
6609    }
6610
6611    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBarRequest {
6612        #[inline(always)]
6613        fn new_empty() -> Self {
6614            Self { bar_id: fidl::new_empty!(u32, D) }
6615        }
6616
6617        #[inline]
6618        unsafe fn decode(
6619            &mut self,
6620            decoder: &mut fidl::encoding::Decoder<'_, D>,
6621            offset: usize,
6622            _depth: fidl::encoding::Depth,
6623        ) -> fidl::Result<()> {
6624            decoder.debug_check_bounds::<Self>(offset);
6625            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6626            // Verify that padding bytes are zero.
6627            // Copy from the buffer into the object.
6628            unsafe {
6629                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
6630            }
6631            Ok(())
6632        }
6633    }
6634
6635    impl fidl::encoding::ValueTypeMarker for DeviceGetBtiRequest {
6636        type Borrowed<'a> = &'a Self;
6637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6638            value
6639        }
6640    }
6641
6642    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiRequest {
6643        type Owned = Self;
6644
6645        #[inline(always)]
6646        fn inline_align(_context: fidl::encoding::Context) -> usize {
6647            4
6648        }
6649
6650        #[inline(always)]
6651        fn inline_size(_context: fidl::encoding::Context) -> usize {
6652            4
6653        }
6654        #[inline(always)]
6655        fn encode_is_copy() -> bool {
6656            true
6657        }
6658
6659        #[inline(always)]
6660        fn decode_is_copy() -> bool {
6661            true
6662        }
6663    }
6664
6665    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBtiRequest, D>
6666        for &DeviceGetBtiRequest
6667    {
6668        #[inline]
6669        unsafe fn encode(
6670            self,
6671            encoder: &mut fidl::encoding::Encoder<'_, D>,
6672            offset: usize,
6673            _depth: fidl::encoding::Depth,
6674        ) -> fidl::Result<()> {
6675            encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
6676            unsafe {
6677                // Copy the object into the buffer.
6678                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6679                (buf_ptr as *mut DeviceGetBtiRequest)
6680                    .write_unaligned((self as *const DeviceGetBtiRequest).read());
6681                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
6682                // done second because the memcpy will write garbage to these bytes.
6683            }
6684            Ok(())
6685        }
6686    }
6687    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
6688        fidl::encoding::Encode<DeviceGetBtiRequest, D> for (T0,)
6689    {
6690        #[inline]
6691        unsafe fn encode(
6692            self,
6693            encoder: &mut fidl::encoding::Encoder<'_, D>,
6694            offset: usize,
6695            depth: fidl::encoding::Depth,
6696        ) -> fidl::Result<()> {
6697            encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
6698            // Zero out padding regions. There's no need to apply masks
6699            // because the unmasked parts will be overwritten by fields.
6700            // Write the fields.
6701            self.0.encode(encoder, offset + 0, depth)?;
6702            Ok(())
6703        }
6704    }
6705
6706    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBtiRequest {
6707        #[inline(always)]
6708        fn new_empty() -> Self {
6709            Self { index: fidl::new_empty!(u32, D) }
6710        }
6711
6712        #[inline]
6713        unsafe fn decode(
6714            &mut self,
6715            decoder: &mut fidl::encoding::Decoder<'_, D>,
6716            offset: usize,
6717            _depth: fidl::encoding::Depth,
6718        ) -> fidl::Result<()> {
6719            decoder.debug_check_bounds::<Self>(offset);
6720            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6721            // Verify that padding bytes are zero.
6722            // Copy from the buffer into the object.
6723            unsafe {
6724                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
6725            }
6726            Ok(())
6727        }
6728    }
6729
6730    impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesRequest {
6731        type Borrowed<'a> = &'a Self;
6732        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6733            value
6734        }
6735    }
6736
6737    unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesRequest {
6738        type Owned = Self;
6739
6740        #[inline(always)]
6741        fn inline_align(_context: fidl::encoding::Context) -> usize {
6742            1
6743        }
6744
6745        #[inline(always)]
6746        fn inline_size(_context: fidl::encoding::Context) -> usize {
6747            1
6748        }
6749    }
6750
6751    unsafe impl<D: fidl::encoding::ResourceDialect>
6752        fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for &DeviceGetCapabilitiesRequest
6753    {
6754        #[inline]
6755        unsafe fn encode(
6756            self,
6757            encoder: &mut fidl::encoding::Encoder<'_, D>,
6758            offset: usize,
6759            _depth: fidl::encoding::Depth,
6760        ) -> fidl::Result<()> {
6761            encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
6762            // Delegate to tuple encoding.
6763            fidl::encoding::Encode::<DeviceGetCapabilitiesRequest, D>::encode(
6764                (<CapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
6765                encoder,
6766                offset,
6767                _depth,
6768            )
6769        }
6770    }
6771    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CapabilityId, D>>
6772        fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for (T0,)
6773    {
6774        #[inline]
6775        unsafe fn encode(
6776            self,
6777            encoder: &mut fidl::encoding::Encoder<'_, D>,
6778            offset: usize,
6779            depth: fidl::encoding::Depth,
6780        ) -> fidl::Result<()> {
6781            encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
6782            // Zero out padding regions. There's no need to apply masks
6783            // because the unmasked parts will be overwritten by fields.
6784            // Write the fields.
6785            self.0.encode(encoder, offset + 0, depth)?;
6786            Ok(())
6787        }
6788    }
6789
6790    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6791        for DeviceGetCapabilitiesRequest
6792    {
6793        #[inline(always)]
6794        fn new_empty() -> Self {
6795            Self { id: fidl::new_empty!(CapabilityId, D) }
6796        }
6797
6798        #[inline]
6799        unsafe fn decode(
6800            &mut self,
6801            decoder: &mut fidl::encoding::Decoder<'_, D>,
6802            offset: usize,
6803            _depth: fidl::encoding::Depth,
6804        ) -> fidl::Result<()> {
6805            decoder.debug_check_bounds::<Self>(offset);
6806            // Verify that padding bytes are zero.
6807            fidl::decode!(CapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
6808            Ok(())
6809        }
6810    }
6811
6812    impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesResponse {
6813        type Borrowed<'a> = &'a Self;
6814        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6815            value
6816        }
6817    }
6818
6819    unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesResponse {
6820        type Owned = Self;
6821
6822        #[inline(always)]
6823        fn inline_align(_context: fidl::encoding::Context) -> usize {
6824            8
6825        }
6826
6827        #[inline(always)]
6828        fn inline_size(_context: fidl::encoding::Context) -> usize {
6829            16
6830        }
6831    }
6832
6833    unsafe impl<D: fidl::encoding::ResourceDialect>
6834        fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D>
6835        for &DeviceGetCapabilitiesResponse
6836    {
6837        #[inline]
6838        unsafe fn encode(
6839            self,
6840            encoder: &mut fidl::encoding::Encoder<'_, D>,
6841            offset: usize,
6842            _depth: fidl::encoding::Depth,
6843        ) -> fidl::Result<()> {
6844            encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
6845            // Delegate to tuple encoding.
6846            fidl::encoding::Encode::<DeviceGetCapabilitiesResponse, D>::encode(
6847                (<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
6848                    &self.offsets,
6849                ),),
6850                encoder,
6851                offset,
6852                _depth,
6853            )
6854        }
6855    }
6856    unsafe impl<
6857            D: fidl::encoding::ResourceDialect,
6858            T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
6859        > fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D> for (T0,)
6860    {
6861        #[inline]
6862        unsafe fn encode(
6863            self,
6864            encoder: &mut fidl::encoding::Encoder<'_, D>,
6865            offset: usize,
6866            depth: fidl::encoding::Depth,
6867        ) -> fidl::Result<()> {
6868            encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
6869            // Zero out padding regions. There's no need to apply masks
6870            // because the unmasked parts will be overwritten by fields.
6871            // Write the fields.
6872            self.0.encode(encoder, offset + 0, depth)?;
6873            Ok(())
6874        }
6875    }
6876
6877    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6878        for DeviceGetCapabilitiesResponse
6879    {
6880        #[inline(always)]
6881        fn new_empty() -> Self {
6882            Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
6883        }
6884
6885        #[inline]
6886        unsafe fn decode(
6887            &mut self,
6888            decoder: &mut fidl::encoding::Decoder<'_, D>,
6889            offset: usize,
6890            _depth: fidl::encoding::Depth,
6891        ) -> fidl::Result<()> {
6892            decoder.debug_check_bounds::<Self>(offset);
6893            // Verify that padding bytes are zero.
6894            fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
6895            Ok(())
6896        }
6897    }
6898
6899    impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceInfoResponse {
6900        type Borrowed<'a> = &'a Self;
6901        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6902            value
6903        }
6904    }
6905
6906    unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceInfoResponse {
6907        type Owned = Self;
6908
6909        #[inline(always)]
6910        fn inline_align(_context: fidl::encoding::Context) -> usize {
6911            2
6912        }
6913
6914        #[inline(always)]
6915        fn inline_size(_context: fidl::encoding::Context) -> usize {
6916            12
6917        }
6918    }
6919
6920    unsafe impl<D: fidl::encoding::ResourceDialect>
6921        fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for &DeviceGetDeviceInfoResponse
6922    {
6923        #[inline]
6924        unsafe fn encode(
6925            self,
6926            encoder: &mut fidl::encoding::Encoder<'_, D>,
6927            offset: usize,
6928            _depth: fidl::encoding::Depth,
6929        ) -> fidl::Result<()> {
6930            encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
6931            // Delegate to tuple encoding.
6932            fidl::encoding::Encode::<DeviceGetDeviceInfoResponse, D>::encode(
6933                (<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
6934                encoder,
6935                offset,
6936                _depth,
6937            )
6938        }
6939    }
6940    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceInfo, D>>
6941        fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for (T0,)
6942    {
6943        #[inline]
6944        unsafe fn encode(
6945            self,
6946            encoder: &mut fidl::encoding::Encoder<'_, D>,
6947            offset: usize,
6948            depth: fidl::encoding::Depth,
6949        ) -> fidl::Result<()> {
6950            encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
6951            // Zero out padding regions. There's no need to apply masks
6952            // because the unmasked parts will be overwritten by fields.
6953            // Write the fields.
6954            self.0.encode(encoder, offset + 0, depth)?;
6955            Ok(())
6956        }
6957    }
6958
6959    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6960        for DeviceGetDeviceInfoResponse
6961    {
6962        #[inline(always)]
6963        fn new_empty() -> Self {
6964            Self { info: fidl::new_empty!(DeviceInfo, D) }
6965        }
6966
6967        #[inline]
6968        unsafe fn decode(
6969            &mut self,
6970            decoder: &mut fidl::encoding::Decoder<'_, D>,
6971            offset: usize,
6972            _depth: fidl::encoding::Depth,
6973        ) -> fidl::Result<()> {
6974            decoder.debug_check_bounds::<Self>(offset);
6975            // Verify that padding bytes are zero.
6976            fidl::decode!(DeviceInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
6977            Ok(())
6978        }
6979    }
6980
6981    impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesRequest {
6982        type Borrowed<'a> = &'a Self;
6983        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6984            value
6985        }
6986    }
6987
6988    unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesRequest {
6989        type Owned = Self;
6990
6991        #[inline(always)]
6992        fn inline_align(_context: fidl::encoding::Context) -> usize {
6993            2
6994        }
6995
6996        #[inline(always)]
6997        fn inline_size(_context: fidl::encoding::Context) -> usize {
6998            2
6999        }
7000    }
7001
7002    unsafe impl<D: fidl::encoding::ResourceDialect>
7003        fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D>
7004        for &DeviceGetExtendedCapabilitiesRequest
7005    {
7006        #[inline]
7007        unsafe fn encode(
7008            self,
7009            encoder: &mut fidl::encoding::Encoder<'_, D>,
7010            offset: usize,
7011            _depth: fidl::encoding::Depth,
7012        ) -> fidl::Result<()> {
7013            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
7014            // Delegate to tuple encoding.
7015            fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesRequest, D>::encode(
7016                (<ExtendedCapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
7017                encoder,
7018                offset,
7019                _depth,
7020            )
7021        }
7022    }
7023    unsafe impl<
7024            D: fidl::encoding::ResourceDialect,
7025            T0: fidl::encoding::Encode<ExtendedCapabilityId, D>,
7026        > fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D> for (T0,)
7027    {
7028        #[inline]
7029        unsafe fn encode(
7030            self,
7031            encoder: &mut fidl::encoding::Encoder<'_, D>,
7032            offset: usize,
7033            depth: fidl::encoding::Depth,
7034        ) -> fidl::Result<()> {
7035            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
7036            // Zero out padding regions. There's no need to apply masks
7037            // because the unmasked parts will be overwritten by fields.
7038            // Write the fields.
7039            self.0.encode(encoder, offset + 0, depth)?;
7040            Ok(())
7041        }
7042    }
7043
7044    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7045        for DeviceGetExtendedCapabilitiesRequest
7046    {
7047        #[inline(always)]
7048        fn new_empty() -> Self {
7049            Self { id: fidl::new_empty!(ExtendedCapabilityId, D) }
7050        }
7051
7052        #[inline]
7053        unsafe fn decode(
7054            &mut self,
7055            decoder: &mut fidl::encoding::Decoder<'_, D>,
7056            offset: usize,
7057            _depth: fidl::encoding::Depth,
7058        ) -> fidl::Result<()> {
7059            decoder.debug_check_bounds::<Self>(offset);
7060            // Verify that padding bytes are zero.
7061            fidl::decode!(ExtendedCapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
7062            Ok(())
7063        }
7064    }
7065
7066    impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesResponse {
7067        type Borrowed<'a> = &'a Self;
7068        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7069            value
7070        }
7071    }
7072
7073    unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesResponse {
7074        type Owned = Self;
7075
7076        #[inline(always)]
7077        fn inline_align(_context: fidl::encoding::Context) -> usize {
7078            8
7079        }
7080
7081        #[inline(always)]
7082        fn inline_size(_context: fidl::encoding::Context) -> usize {
7083            16
7084        }
7085    }
7086
7087    unsafe impl<D: fidl::encoding::ResourceDialect>
7088        fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D>
7089        for &DeviceGetExtendedCapabilitiesResponse
7090    {
7091        #[inline]
7092        unsafe fn encode(
7093            self,
7094            encoder: &mut fidl::encoding::Encoder<'_, D>,
7095            offset: usize,
7096            _depth: fidl::encoding::Depth,
7097        ) -> fidl::Result<()> {
7098            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
7099            // Delegate to tuple encoding.
7100            fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesResponse, D>::encode(
7101                (<fidl::encoding::Vector<u16, 32> as fidl::encoding::ValueTypeMarker>::borrow(
7102                    &self.offsets,
7103                ),),
7104                encoder,
7105                offset,
7106                _depth,
7107            )
7108        }
7109    }
7110    unsafe impl<
7111            D: fidl::encoding::ResourceDialect,
7112            T0: fidl::encoding::Encode<fidl::encoding::Vector<u16, 32>, D>,
7113        > fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D> for (T0,)
7114    {
7115        #[inline]
7116        unsafe fn encode(
7117            self,
7118            encoder: &mut fidl::encoding::Encoder<'_, D>,
7119            offset: usize,
7120            depth: fidl::encoding::Depth,
7121        ) -> fidl::Result<()> {
7122            encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
7123            // Zero out padding regions. There's no need to apply masks
7124            // because the unmasked parts will be overwritten by fields.
7125            // Write the fields.
7126            self.0.encode(encoder, offset + 0, depth)?;
7127            Ok(())
7128        }
7129    }
7130
7131    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7132        for DeviceGetExtendedCapabilitiesResponse
7133    {
7134        #[inline(always)]
7135        fn new_empty() -> Self {
7136            Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u16, 32>, D) }
7137        }
7138
7139        #[inline]
7140        unsafe fn decode(
7141            &mut self,
7142            decoder: &mut fidl::encoding::Decoder<'_, D>,
7143            offset: usize,
7144            _depth: fidl::encoding::Depth,
7145        ) -> fidl::Result<()> {
7146            decoder.debug_check_bounds::<Self>(offset);
7147            // Verify that padding bytes are zero.
7148            fidl::decode!(fidl::encoding::Vector<u16, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
7149            Ok(())
7150        }
7151    }
7152
7153    impl fidl::encoding::ValueTypeMarker for DeviceGetInterruptModesResponse {
7154        type Borrowed<'a> = &'a Self;
7155        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7156            value
7157        }
7158    }
7159
7160    unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptModesResponse {
7161        type Owned = Self;
7162
7163        #[inline(always)]
7164        fn inline_align(_context: fidl::encoding::Context) -> usize {
7165            2
7166        }
7167
7168        #[inline(always)]
7169        fn inline_size(_context: fidl::encoding::Context) -> usize {
7170            4
7171        }
7172    }
7173
7174    unsafe impl<D: fidl::encoding::ResourceDialect>
7175        fidl::encoding::Encode<DeviceGetInterruptModesResponse, D>
7176        for &DeviceGetInterruptModesResponse
7177    {
7178        #[inline]
7179        unsafe fn encode(
7180            self,
7181            encoder: &mut fidl::encoding::Encoder<'_, D>,
7182            offset: usize,
7183            _depth: fidl::encoding::Depth,
7184        ) -> fidl::Result<()> {
7185            encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
7186            // Delegate to tuple encoding.
7187            fidl::encoding::Encode::<DeviceGetInterruptModesResponse, D>::encode(
7188                (<InterruptModes as fidl::encoding::ValueTypeMarker>::borrow(&self.modes),),
7189                encoder,
7190                offset,
7191                _depth,
7192            )
7193        }
7194    }
7195    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InterruptModes, D>>
7196        fidl::encoding::Encode<DeviceGetInterruptModesResponse, D> for (T0,)
7197    {
7198        #[inline]
7199        unsafe fn encode(
7200            self,
7201            encoder: &mut fidl::encoding::Encoder<'_, D>,
7202            offset: usize,
7203            depth: fidl::encoding::Depth,
7204        ) -> fidl::Result<()> {
7205            encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
7206            // Zero out padding regions. There's no need to apply masks
7207            // because the unmasked parts will be overwritten by fields.
7208            // Write the fields.
7209            self.0.encode(encoder, offset + 0, depth)?;
7210            Ok(())
7211        }
7212    }
7213
7214    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7215        for DeviceGetInterruptModesResponse
7216    {
7217        #[inline(always)]
7218        fn new_empty() -> Self {
7219            Self { modes: fidl::new_empty!(InterruptModes, D) }
7220        }
7221
7222        #[inline]
7223        unsafe fn decode(
7224            &mut self,
7225            decoder: &mut fidl::encoding::Decoder<'_, D>,
7226            offset: usize,
7227            _depth: fidl::encoding::Depth,
7228        ) -> fidl::Result<()> {
7229            decoder.debug_check_bounds::<Self>(offset);
7230            // Verify that padding bytes are zero.
7231            fidl::decode!(InterruptModes, D, &mut self.modes, decoder, offset + 0, _depth)?;
7232            Ok(())
7233        }
7234    }
7235
7236    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
7237        type Borrowed<'a> = &'a Self;
7238        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7239            value
7240        }
7241    }
7242
7243    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
7244        type Owned = Self;
7245
7246        #[inline(always)]
7247        fn inline_align(_context: fidl::encoding::Context) -> usize {
7248            2
7249        }
7250
7251        #[inline(always)]
7252        fn inline_size(_context: fidl::encoding::Context) -> usize {
7253            12
7254        }
7255    }
7256
7257    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
7258        for &DeviceInfo
7259    {
7260        #[inline]
7261        unsafe fn encode(
7262            self,
7263            encoder: &mut fidl::encoding::Encoder<'_, D>,
7264            offset: usize,
7265            _depth: fidl::encoding::Depth,
7266        ) -> fidl::Result<()> {
7267            encoder.debug_check_bounds::<DeviceInfo>(offset);
7268            // Delegate to tuple encoding.
7269            fidl::encoding::Encode::<DeviceInfo, D>::encode(
7270                (
7271                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
7272                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
7273                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.base_class),
7274                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.sub_class),
7275                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.program_interface),
7276                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision_id),
7277                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
7278                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dev_id),
7279                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.func_id),
7280                    <Padding as fidl::encoding::ValueTypeMarker>::borrow(&self.padding),
7281                ),
7282                encoder,
7283                offset,
7284                _depth,
7285            )
7286        }
7287    }
7288    unsafe impl<
7289            D: fidl::encoding::ResourceDialect,
7290            T0: fidl::encoding::Encode<u16, D>,
7291            T1: fidl::encoding::Encode<u16, D>,
7292            T2: fidl::encoding::Encode<u8, D>,
7293            T3: fidl::encoding::Encode<u8, D>,
7294            T4: fidl::encoding::Encode<u8, D>,
7295            T5: fidl::encoding::Encode<u8, D>,
7296            T6: fidl::encoding::Encode<u8, D>,
7297            T7: fidl::encoding::Encode<u8, D>,
7298            T8: fidl::encoding::Encode<u8, D>,
7299            T9: fidl::encoding::Encode<Padding, D>,
7300        > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
7301    {
7302        #[inline]
7303        unsafe fn encode(
7304            self,
7305            encoder: &mut fidl::encoding::Encoder<'_, D>,
7306            offset: usize,
7307            depth: fidl::encoding::Depth,
7308        ) -> fidl::Result<()> {
7309            encoder.debug_check_bounds::<DeviceInfo>(offset);
7310            // Zero out padding regions. There's no need to apply masks
7311            // because the unmasked parts will be overwritten by fields.
7312            // Write the fields.
7313            self.0.encode(encoder, offset + 0, depth)?;
7314            self.1.encode(encoder, offset + 2, depth)?;
7315            self.2.encode(encoder, offset + 4, depth)?;
7316            self.3.encode(encoder, offset + 5, depth)?;
7317            self.4.encode(encoder, offset + 6, depth)?;
7318            self.5.encode(encoder, offset + 7, depth)?;
7319            self.6.encode(encoder, offset + 8, depth)?;
7320            self.7.encode(encoder, offset + 9, depth)?;
7321            self.8.encode(encoder, offset + 10, depth)?;
7322            self.9.encode(encoder, offset + 11, depth)?;
7323            Ok(())
7324        }
7325    }
7326
7327    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
7328        #[inline(always)]
7329        fn new_empty() -> Self {
7330            Self {
7331                vendor_id: fidl::new_empty!(u16, D),
7332                device_id: fidl::new_empty!(u16, D),
7333                base_class: fidl::new_empty!(u8, D),
7334                sub_class: fidl::new_empty!(u8, D),
7335                program_interface: fidl::new_empty!(u8, D),
7336                revision_id: fidl::new_empty!(u8, D),
7337                bus_id: fidl::new_empty!(u8, D),
7338                dev_id: fidl::new_empty!(u8, D),
7339                func_id: fidl::new_empty!(u8, D),
7340                padding: fidl::new_empty!(Padding, D),
7341            }
7342        }
7343
7344        #[inline]
7345        unsafe fn decode(
7346            &mut self,
7347            decoder: &mut fidl::encoding::Decoder<'_, D>,
7348            offset: usize,
7349            _depth: fidl::encoding::Depth,
7350        ) -> fidl::Result<()> {
7351            decoder.debug_check_bounds::<Self>(offset);
7352            // Verify that padding bytes are zero.
7353            fidl::decode!(u16, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
7354            fidl::decode!(u16, D, &mut self.device_id, decoder, offset + 2, _depth)?;
7355            fidl::decode!(u8, D, &mut self.base_class, decoder, offset + 4, _depth)?;
7356            fidl::decode!(u8, D, &mut self.sub_class, decoder, offset + 5, _depth)?;
7357            fidl::decode!(u8, D, &mut self.program_interface, decoder, offset + 6, _depth)?;
7358            fidl::decode!(u8, D, &mut self.revision_id, decoder, offset + 7, _depth)?;
7359            fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 8, _depth)?;
7360            fidl::decode!(u8, D, &mut self.dev_id, decoder, offset + 9, _depth)?;
7361            fidl::decode!(u8, D, &mut self.func_id, decoder, offset + 10, _depth)?;
7362            fidl::decode!(Padding, D, &mut self.padding, decoder, offset + 11, _depth)?;
7363            Ok(())
7364        }
7365    }
7366
7367    impl fidl::encoding::ValueTypeMarker for DeviceMapInterruptRequest {
7368        type Borrowed<'a> = &'a Self;
7369        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7370            value
7371        }
7372    }
7373
7374    unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptRequest {
7375        type Owned = Self;
7376
7377        #[inline(always)]
7378        fn inline_align(_context: fidl::encoding::Context) -> usize {
7379            4
7380        }
7381
7382        #[inline(always)]
7383        fn inline_size(_context: fidl::encoding::Context) -> usize {
7384            4
7385        }
7386        #[inline(always)]
7387        fn encode_is_copy() -> bool {
7388            true
7389        }
7390
7391        #[inline(always)]
7392        fn decode_is_copy() -> bool {
7393            true
7394        }
7395    }
7396
7397    unsafe impl<D: fidl::encoding::ResourceDialect>
7398        fidl::encoding::Encode<DeviceMapInterruptRequest, D> for &DeviceMapInterruptRequest
7399    {
7400        #[inline]
7401        unsafe fn encode(
7402            self,
7403            encoder: &mut fidl::encoding::Encoder<'_, D>,
7404            offset: usize,
7405            _depth: fidl::encoding::Depth,
7406        ) -> fidl::Result<()> {
7407            encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
7408            unsafe {
7409                // Copy the object into the buffer.
7410                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7411                (buf_ptr as *mut DeviceMapInterruptRequest)
7412                    .write_unaligned((self as *const DeviceMapInterruptRequest).read());
7413                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7414                // done second because the memcpy will write garbage to these bytes.
7415            }
7416            Ok(())
7417        }
7418    }
7419    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
7420        fidl::encoding::Encode<DeviceMapInterruptRequest, D> for (T0,)
7421    {
7422        #[inline]
7423        unsafe fn encode(
7424            self,
7425            encoder: &mut fidl::encoding::Encoder<'_, D>,
7426            offset: usize,
7427            depth: fidl::encoding::Depth,
7428        ) -> fidl::Result<()> {
7429            encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
7430            // Zero out padding regions. There's no need to apply masks
7431            // because the unmasked parts will be overwritten by fields.
7432            // Write the fields.
7433            self.0.encode(encoder, offset + 0, depth)?;
7434            Ok(())
7435        }
7436    }
7437
7438    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7439        for DeviceMapInterruptRequest
7440    {
7441        #[inline(always)]
7442        fn new_empty() -> Self {
7443            Self { which_irq: fidl::new_empty!(u32, D) }
7444        }
7445
7446        #[inline]
7447        unsafe fn decode(
7448            &mut self,
7449            decoder: &mut fidl::encoding::Decoder<'_, D>,
7450            offset: usize,
7451            _depth: fidl::encoding::Depth,
7452        ) -> fidl::Result<()> {
7453            decoder.debug_check_bounds::<Self>(offset);
7454            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
7455            // Verify that padding bytes are zero.
7456            // Copy from the buffer into the object.
7457            unsafe {
7458                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
7459            }
7460            Ok(())
7461        }
7462    }
7463
7464    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Request {
7465        type Borrowed<'a> = &'a Self;
7466        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7467            value
7468        }
7469    }
7470
7471    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Request {
7472        type Owned = Self;
7473
7474        #[inline(always)]
7475        fn inline_align(_context: fidl::encoding::Context) -> usize {
7476            2
7477        }
7478
7479        #[inline(always)]
7480        fn inline_size(_context: fidl::encoding::Context) -> usize {
7481            2
7482        }
7483        #[inline(always)]
7484        fn encode_is_copy() -> bool {
7485            true
7486        }
7487
7488        #[inline(always)]
7489        fn decode_is_copy() -> bool {
7490            true
7491        }
7492    }
7493
7494    unsafe impl<D: fidl::encoding::ResourceDialect>
7495        fidl::encoding::Encode<DeviceReadConfig16Request, D> for &DeviceReadConfig16Request
7496    {
7497        #[inline]
7498        unsafe fn encode(
7499            self,
7500            encoder: &mut fidl::encoding::Encoder<'_, D>,
7501            offset: usize,
7502            _depth: fidl::encoding::Depth,
7503        ) -> fidl::Result<()> {
7504            encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
7505            unsafe {
7506                // Copy the object into the buffer.
7507                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7508                (buf_ptr as *mut DeviceReadConfig16Request)
7509                    .write_unaligned((self as *const DeviceReadConfig16Request).read());
7510                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7511                // done second because the memcpy will write garbage to these bytes.
7512            }
7513            Ok(())
7514        }
7515    }
7516    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
7517        fidl::encoding::Encode<DeviceReadConfig16Request, D> for (T0,)
7518    {
7519        #[inline]
7520        unsafe fn encode(
7521            self,
7522            encoder: &mut fidl::encoding::Encoder<'_, D>,
7523            offset: usize,
7524            depth: fidl::encoding::Depth,
7525        ) -> fidl::Result<()> {
7526            encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
7527            // Zero out padding regions. There's no need to apply masks
7528            // because the unmasked parts will be overwritten by fields.
7529            // Write the fields.
7530            self.0.encode(encoder, offset + 0, depth)?;
7531            Ok(())
7532        }
7533    }
7534
7535    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7536        for DeviceReadConfig16Request
7537    {
7538        #[inline(always)]
7539        fn new_empty() -> Self {
7540            Self { offset: fidl::new_empty!(u16, D) }
7541        }
7542
7543        #[inline]
7544        unsafe fn decode(
7545            &mut self,
7546            decoder: &mut fidl::encoding::Decoder<'_, D>,
7547            offset: usize,
7548            _depth: fidl::encoding::Depth,
7549        ) -> fidl::Result<()> {
7550            decoder.debug_check_bounds::<Self>(offset);
7551            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
7552            // Verify that padding bytes are zero.
7553            // Copy from the buffer into the object.
7554            unsafe {
7555                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
7556            }
7557            Ok(())
7558        }
7559    }
7560
7561    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Request {
7562        type Borrowed<'a> = &'a Self;
7563        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7564            value
7565        }
7566    }
7567
7568    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Request {
7569        type Owned = Self;
7570
7571        #[inline(always)]
7572        fn inline_align(_context: fidl::encoding::Context) -> usize {
7573            2
7574        }
7575
7576        #[inline(always)]
7577        fn inline_size(_context: fidl::encoding::Context) -> usize {
7578            2
7579        }
7580        #[inline(always)]
7581        fn encode_is_copy() -> bool {
7582            true
7583        }
7584
7585        #[inline(always)]
7586        fn decode_is_copy() -> bool {
7587            true
7588        }
7589    }
7590
7591    unsafe impl<D: fidl::encoding::ResourceDialect>
7592        fidl::encoding::Encode<DeviceReadConfig32Request, D> for &DeviceReadConfig32Request
7593    {
7594        #[inline]
7595        unsafe fn encode(
7596            self,
7597            encoder: &mut fidl::encoding::Encoder<'_, D>,
7598            offset: usize,
7599            _depth: fidl::encoding::Depth,
7600        ) -> fidl::Result<()> {
7601            encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
7602            unsafe {
7603                // Copy the object into the buffer.
7604                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7605                (buf_ptr as *mut DeviceReadConfig32Request)
7606                    .write_unaligned((self as *const DeviceReadConfig32Request).read());
7607                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7608                // done second because the memcpy will write garbage to these bytes.
7609            }
7610            Ok(())
7611        }
7612    }
7613    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
7614        fidl::encoding::Encode<DeviceReadConfig32Request, D> for (T0,)
7615    {
7616        #[inline]
7617        unsafe fn encode(
7618            self,
7619            encoder: &mut fidl::encoding::Encoder<'_, D>,
7620            offset: usize,
7621            depth: fidl::encoding::Depth,
7622        ) -> fidl::Result<()> {
7623            encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
7624            // Zero out padding regions. There's no need to apply masks
7625            // because the unmasked parts will be overwritten by fields.
7626            // Write the fields.
7627            self.0.encode(encoder, offset + 0, depth)?;
7628            Ok(())
7629        }
7630    }
7631
7632    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7633        for DeviceReadConfig32Request
7634    {
7635        #[inline(always)]
7636        fn new_empty() -> Self {
7637            Self { offset: fidl::new_empty!(u16, D) }
7638        }
7639
7640        #[inline]
7641        unsafe fn decode(
7642            &mut self,
7643            decoder: &mut fidl::encoding::Decoder<'_, D>,
7644            offset: usize,
7645            _depth: fidl::encoding::Depth,
7646        ) -> fidl::Result<()> {
7647            decoder.debug_check_bounds::<Self>(offset);
7648            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
7649            // Verify that padding bytes are zero.
7650            // Copy from the buffer into the object.
7651            unsafe {
7652                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
7653            }
7654            Ok(())
7655        }
7656    }
7657
7658    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Request {
7659        type Borrowed<'a> = &'a Self;
7660        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7661            value
7662        }
7663    }
7664
7665    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Request {
7666        type Owned = Self;
7667
7668        #[inline(always)]
7669        fn inline_align(_context: fidl::encoding::Context) -> usize {
7670            2
7671        }
7672
7673        #[inline(always)]
7674        fn inline_size(_context: fidl::encoding::Context) -> usize {
7675            2
7676        }
7677        #[inline(always)]
7678        fn encode_is_copy() -> bool {
7679            true
7680        }
7681
7682        #[inline(always)]
7683        fn decode_is_copy() -> bool {
7684            true
7685        }
7686    }
7687
7688    unsafe impl<D: fidl::encoding::ResourceDialect>
7689        fidl::encoding::Encode<DeviceReadConfig8Request, D> for &DeviceReadConfig8Request
7690    {
7691        #[inline]
7692        unsafe fn encode(
7693            self,
7694            encoder: &mut fidl::encoding::Encoder<'_, D>,
7695            offset: usize,
7696            _depth: fidl::encoding::Depth,
7697        ) -> fidl::Result<()> {
7698            encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
7699            unsafe {
7700                // Copy the object into the buffer.
7701                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7702                (buf_ptr as *mut DeviceReadConfig8Request)
7703                    .write_unaligned((self as *const DeviceReadConfig8Request).read());
7704                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7705                // done second because the memcpy will write garbage to these bytes.
7706            }
7707            Ok(())
7708        }
7709    }
7710    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
7711        fidl::encoding::Encode<DeviceReadConfig8Request, D> for (T0,)
7712    {
7713        #[inline]
7714        unsafe fn encode(
7715            self,
7716            encoder: &mut fidl::encoding::Encoder<'_, D>,
7717            offset: usize,
7718            depth: fidl::encoding::Depth,
7719        ) -> fidl::Result<()> {
7720            encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
7721            // Zero out padding regions. There's no need to apply masks
7722            // because the unmasked parts will be overwritten by fields.
7723            // Write the fields.
7724            self.0.encode(encoder, offset + 0, depth)?;
7725            Ok(())
7726        }
7727    }
7728
7729    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7730        for DeviceReadConfig8Request
7731    {
7732        #[inline(always)]
7733        fn new_empty() -> Self {
7734            Self { offset: fidl::new_empty!(u16, D) }
7735        }
7736
7737        #[inline]
7738        unsafe fn decode(
7739            &mut self,
7740            decoder: &mut fidl::encoding::Decoder<'_, D>,
7741            offset: usize,
7742            _depth: fidl::encoding::Depth,
7743        ) -> fidl::Result<()> {
7744            decoder.debug_check_bounds::<Self>(offset);
7745            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
7746            // Verify that padding bytes are zero.
7747            // Copy from the buffer into the object.
7748            unsafe {
7749                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
7750            }
7751            Ok(())
7752        }
7753    }
7754
7755    impl fidl::encoding::ValueTypeMarker for DeviceSetBusMasteringRequest {
7756        type Borrowed<'a> = &'a Self;
7757        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7758            value
7759        }
7760    }
7761
7762    unsafe impl fidl::encoding::TypeMarker for DeviceSetBusMasteringRequest {
7763        type Owned = Self;
7764
7765        #[inline(always)]
7766        fn inline_align(_context: fidl::encoding::Context) -> usize {
7767            1
7768        }
7769
7770        #[inline(always)]
7771        fn inline_size(_context: fidl::encoding::Context) -> usize {
7772            1
7773        }
7774    }
7775
7776    unsafe impl<D: fidl::encoding::ResourceDialect>
7777        fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for &DeviceSetBusMasteringRequest
7778    {
7779        #[inline]
7780        unsafe fn encode(
7781            self,
7782            encoder: &mut fidl::encoding::Encoder<'_, D>,
7783            offset: usize,
7784            _depth: fidl::encoding::Depth,
7785        ) -> fidl::Result<()> {
7786            encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
7787            // Delegate to tuple encoding.
7788            fidl::encoding::Encode::<DeviceSetBusMasteringRequest, D>::encode(
7789                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
7790                encoder,
7791                offset,
7792                _depth,
7793            )
7794        }
7795    }
7796    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
7797        fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for (T0,)
7798    {
7799        #[inline]
7800        unsafe fn encode(
7801            self,
7802            encoder: &mut fidl::encoding::Encoder<'_, D>,
7803            offset: usize,
7804            depth: fidl::encoding::Depth,
7805        ) -> fidl::Result<()> {
7806            encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
7807            // Zero out padding regions. There's no need to apply masks
7808            // because the unmasked parts will be overwritten by fields.
7809            // Write the fields.
7810            self.0.encode(encoder, offset + 0, depth)?;
7811            Ok(())
7812        }
7813    }
7814
7815    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7816        for DeviceSetBusMasteringRequest
7817    {
7818        #[inline(always)]
7819        fn new_empty() -> Self {
7820            Self { enabled: fidl::new_empty!(bool, D) }
7821        }
7822
7823        #[inline]
7824        unsafe fn decode(
7825            &mut self,
7826            decoder: &mut fidl::encoding::Decoder<'_, D>,
7827            offset: usize,
7828            _depth: fidl::encoding::Depth,
7829        ) -> fidl::Result<()> {
7830            decoder.debug_check_bounds::<Self>(offset);
7831            // Verify that padding bytes are zero.
7832            fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
7833            Ok(())
7834        }
7835    }
7836
7837    impl fidl::encoding::ValueTypeMarker for DeviceSetInterruptModeRequest {
7838        type Borrowed<'a> = &'a Self;
7839        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7840            value
7841        }
7842    }
7843
7844    unsafe impl fidl::encoding::TypeMarker for DeviceSetInterruptModeRequest {
7845        type Owned = Self;
7846
7847        #[inline(always)]
7848        fn inline_align(_context: fidl::encoding::Context) -> usize {
7849            4
7850        }
7851
7852        #[inline(always)]
7853        fn inline_size(_context: fidl::encoding::Context) -> usize {
7854            8
7855        }
7856    }
7857
7858    unsafe impl<D: fidl::encoding::ResourceDialect>
7859        fidl::encoding::Encode<DeviceSetInterruptModeRequest, D>
7860        for &DeviceSetInterruptModeRequest
7861    {
7862        #[inline]
7863        unsafe fn encode(
7864            self,
7865            encoder: &mut fidl::encoding::Encoder<'_, D>,
7866            offset: usize,
7867            _depth: fidl::encoding::Depth,
7868        ) -> fidl::Result<()> {
7869            encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
7870            // Delegate to tuple encoding.
7871            fidl::encoding::Encode::<DeviceSetInterruptModeRequest, D>::encode(
7872                (
7873                    <InterruptMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
7874                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.requested_irq_count),
7875                ),
7876                encoder,
7877                offset,
7878                _depth,
7879            )
7880        }
7881    }
7882    unsafe impl<
7883            D: fidl::encoding::ResourceDialect,
7884            T0: fidl::encoding::Encode<InterruptMode, D>,
7885            T1: fidl::encoding::Encode<u32, D>,
7886        > fidl::encoding::Encode<DeviceSetInterruptModeRequest, D> for (T0, T1)
7887    {
7888        #[inline]
7889        unsafe fn encode(
7890            self,
7891            encoder: &mut fidl::encoding::Encoder<'_, D>,
7892            offset: usize,
7893            depth: fidl::encoding::Depth,
7894        ) -> fidl::Result<()> {
7895            encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
7896            // Zero out padding regions. There's no need to apply masks
7897            // because the unmasked parts will be overwritten by fields.
7898            unsafe {
7899                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
7900                (ptr as *mut u32).write_unaligned(0);
7901            }
7902            // Write the fields.
7903            self.0.encode(encoder, offset + 0, depth)?;
7904            self.1.encode(encoder, offset + 4, depth)?;
7905            Ok(())
7906        }
7907    }
7908
7909    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7910        for DeviceSetInterruptModeRequest
7911    {
7912        #[inline(always)]
7913        fn new_empty() -> Self {
7914            Self {
7915                mode: fidl::new_empty!(InterruptMode, D),
7916                requested_irq_count: fidl::new_empty!(u32, D),
7917            }
7918        }
7919
7920        #[inline]
7921        unsafe fn decode(
7922            &mut self,
7923            decoder: &mut fidl::encoding::Decoder<'_, D>,
7924            offset: usize,
7925            _depth: fidl::encoding::Depth,
7926        ) -> fidl::Result<()> {
7927            decoder.debug_check_bounds::<Self>(offset);
7928            // Verify that padding bytes are zero.
7929            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
7930            let padval = unsafe { (ptr as *const u32).read_unaligned() };
7931            let mask = 0xffffff00u32;
7932            let maskedval = padval & mask;
7933            if maskedval != 0 {
7934                return Err(fidl::Error::NonZeroPadding {
7935                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
7936                });
7937            }
7938            fidl::decode!(InterruptMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
7939            fidl::decode!(u32, D, &mut self.requested_irq_count, decoder, offset + 4, _depth)?;
7940            Ok(())
7941        }
7942    }
7943
7944    impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig16Request {
7945        type Borrowed<'a> = &'a Self;
7946        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7947            value
7948        }
7949    }
7950
7951    unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig16Request {
7952        type Owned = Self;
7953
7954        #[inline(always)]
7955        fn inline_align(_context: fidl::encoding::Context) -> usize {
7956            2
7957        }
7958
7959        #[inline(always)]
7960        fn inline_size(_context: fidl::encoding::Context) -> usize {
7961            4
7962        }
7963        #[inline(always)]
7964        fn encode_is_copy() -> bool {
7965            true
7966        }
7967
7968        #[inline(always)]
7969        fn decode_is_copy() -> bool {
7970            true
7971        }
7972    }
7973
7974    unsafe impl<D: fidl::encoding::ResourceDialect>
7975        fidl::encoding::Encode<DeviceWriteConfig16Request, D> for &DeviceWriteConfig16Request
7976    {
7977        #[inline]
7978        unsafe fn encode(
7979            self,
7980            encoder: &mut fidl::encoding::Encoder<'_, D>,
7981            offset: usize,
7982            _depth: fidl::encoding::Depth,
7983        ) -> fidl::Result<()> {
7984            encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
7985            unsafe {
7986                // Copy the object into the buffer.
7987                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7988                (buf_ptr as *mut DeviceWriteConfig16Request)
7989                    .write_unaligned((self as *const DeviceWriteConfig16Request).read());
7990                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7991                // done second because the memcpy will write garbage to these bytes.
7992            }
7993            Ok(())
7994        }
7995    }
7996    unsafe impl<
7997            D: fidl::encoding::ResourceDialect,
7998            T0: fidl::encoding::Encode<u16, D>,
7999            T1: fidl::encoding::Encode<u16, D>,
8000        > fidl::encoding::Encode<DeviceWriteConfig16Request, D> for (T0, T1)
8001    {
8002        #[inline]
8003        unsafe fn encode(
8004            self,
8005            encoder: &mut fidl::encoding::Encoder<'_, D>,
8006            offset: usize,
8007            depth: fidl::encoding::Depth,
8008        ) -> fidl::Result<()> {
8009            encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
8010            // Zero out padding regions. There's no need to apply masks
8011            // because the unmasked parts will be overwritten by fields.
8012            // Write the fields.
8013            self.0.encode(encoder, offset + 0, depth)?;
8014            self.1.encode(encoder, offset + 2, depth)?;
8015            Ok(())
8016        }
8017    }
8018
8019    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8020        for DeviceWriteConfig16Request
8021    {
8022        #[inline(always)]
8023        fn new_empty() -> Self {
8024            Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u16, D) }
8025        }
8026
8027        #[inline]
8028        unsafe fn decode(
8029            &mut self,
8030            decoder: &mut fidl::encoding::Decoder<'_, D>,
8031            offset: usize,
8032            _depth: fidl::encoding::Depth,
8033        ) -> fidl::Result<()> {
8034            decoder.debug_check_bounds::<Self>(offset);
8035            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8036            // Verify that padding bytes are zero.
8037            // Copy from the buffer into the object.
8038            unsafe {
8039                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
8040            }
8041            Ok(())
8042        }
8043    }
8044
8045    impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig32Request {
8046        type Borrowed<'a> = &'a Self;
8047        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8048            value
8049        }
8050    }
8051
8052    unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig32Request {
8053        type Owned = Self;
8054
8055        #[inline(always)]
8056        fn inline_align(_context: fidl::encoding::Context) -> usize {
8057            4
8058        }
8059
8060        #[inline(always)]
8061        fn inline_size(_context: fidl::encoding::Context) -> usize {
8062            8
8063        }
8064    }
8065
8066    unsafe impl<D: fidl::encoding::ResourceDialect>
8067        fidl::encoding::Encode<DeviceWriteConfig32Request, D> for &DeviceWriteConfig32Request
8068    {
8069        #[inline]
8070        unsafe fn encode(
8071            self,
8072            encoder: &mut fidl::encoding::Encoder<'_, D>,
8073            offset: usize,
8074            _depth: fidl::encoding::Depth,
8075        ) -> fidl::Result<()> {
8076            encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
8077            unsafe {
8078                // Copy the object into the buffer.
8079                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8080                (buf_ptr as *mut DeviceWriteConfig32Request)
8081                    .write_unaligned((self as *const DeviceWriteConfig32Request).read());
8082                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8083                // done second because the memcpy will write garbage to these bytes.
8084                let padding_ptr = buf_ptr.offset(0) as *mut u32;
8085                let padding_mask = 0xffff0000u32;
8086                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
8087            }
8088            Ok(())
8089        }
8090    }
8091    unsafe impl<
8092            D: fidl::encoding::ResourceDialect,
8093            T0: fidl::encoding::Encode<u16, D>,
8094            T1: fidl::encoding::Encode<u32, D>,
8095        > fidl::encoding::Encode<DeviceWriteConfig32Request, D> for (T0, T1)
8096    {
8097        #[inline]
8098        unsafe fn encode(
8099            self,
8100            encoder: &mut fidl::encoding::Encoder<'_, D>,
8101            offset: usize,
8102            depth: fidl::encoding::Depth,
8103        ) -> fidl::Result<()> {
8104            encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
8105            // Zero out padding regions. There's no need to apply masks
8106            // because the unmasked parts will be overwritten by fields.
8107            unsafe {
8108                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
8109                (ptr as *mut u32).write_unaligned(0);
8110            }
8111            // Write the fields.
8112            self.0.encode(encoder, offset + 0, depth)?;
8113            self.1.encode(encoder, offset + 4, depth)?;
8114            Ok(())
8115        }
8116    }
8117
8118    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8119        for DeviceWriteConfig32Request
8120    {
8121        #[inline(always)]
8122        fn new_empty() -> Self {
8123            Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u32, D) }
8124        }
8125
8126        #[inline]
8127        unsafe fn decode(
8128            &mut self,
8129            decoder: &mut fidl::encoding::Decoder<'_, D>,
8130            offset: usize,
8131            _depth: fidl::encoding::Depth,
8132        ) -> fidl::Result<()> {
8133            decoder.debug_check_bounds::<Self>(offset);
8134            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8135            // Verify that padding bytes are zero.
8136            let ptr = unsafe { buf_ptr.offset(0) };
8137            let padval = unsafe { (ptr as *const u32).read_unaligned() };
8138            let mask = 0xffff0000u32;
8139            let maskedval = padval & mask;
8140            if maskedval != 0 {
8141                return Err(fidl::Error::NonZeroPadding {
8142                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
8143                });
8144            }
8145            // Copy from the buffer into the object.
8146            unsafe {
8147                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
8148            }
8149            Ok(())
8150        }
8151    }
8152
8153    impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig8Request {
8154        type Borrowed<'a> = &'a Self;
8155        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8156            value
8157        }
8158    }
8159
8160    unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig8Request {
8161        type Owned = Self;
8162
8163        #[inline(always)]
8164        fn inline_align(_context: fidl::encoding::Context) -> usize {
8165            2
8166        }
8167
8168        #[inline(always)]
8169        fn inline_size(_context: fidl::encoding::Context) -> usize {
8170            4
8171        }
8172    }
8173
8174    unsafe impl<D: fidl::encoding::ResourceDialect>
8175        fidl::encoding::Encode<DeviceWriteConfig8Request, D> for &DeviceWriteConfig8Request
8176    {
8177        #[inline]
8178        unsafe fn encode(
8179            self,
8180            encoder: &mut fidl::encoding::Encoder<'_, D>,
8181            offset: usize,
8182            _depth: fidl::encoding::Depth,
8183        ) -> fidl::Result<()> {
8184            encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
8185            unsafe {
8186                // Copy the object into the buffer.
8187                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8188                (buf_ptr as *mut DeviceWriteConfig8Request)
8189                    .write_unaligned((self as *const DeviceWriteConfig8Request).read());
8190                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8191                // done second because the memcpy will write garbage to these bytes.
8192                let padding_ptr = buf_ptr.offset(2) as *mut u16;
8193                let padding_mask = 0xff00u16;
8194                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
8195            }
8196            Ok(())
8197        }
8198    }
8199    unsafe impl<
8200            D: fidl::encoding::ResourceDialect,
8201            T0: fidl::encoding::Encode<u16, D>,
8202            T1: fidl::encoding::Encode<u8, D>,
8203        > fidl::encoding::Encode<DeviceWriteConfig8Request, D> for (T0, T1)
8204    {
8205        #[inline]
8206        unsafe fn encode(
8207            self,
8208            encoder: &mut fidl::encoding::Encoder<'_, D>,
8209            offset: usize,
8210            depth: fidl::encoding::Depth,
8211        ) -> fidl::Result<()> {
8212            encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
8213            // Zero out padding regions. There's no need to apply masks
8214            // because the unmasked parts will be overwritten by fields.
8215            unsafe {
8216                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(2);
8217                (ptr as *mut u16).write_unaligned(0);
8218            }
8219            // Write the fields.
8220            self.0.encode(encoder, offset + 0, depth)?;
8221            self.1.encode(encoder, offset + 2, depth)?;
8222            Ok(())
8223        }
8224    }
8225
8226    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8227        for DeviceWriteConfig8Request
8228    {
8229        #[inline(always)]
8230        fn new_empty() -> Self {
8231            Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u8, D) }
8232        }
8233
8234        #[inline]
8235        unsafe fn decode(
8236            &mut self,
8237            decoder: &mut fidl::encoding::Decoder<'_, D>,
8238            offset: usize,
8239            _depth: fidl::encoding::Depth,
8240        ) -> fidl::Result<()> {
8241            decoder.debug_check_bounds::<Self>(offset);
8242            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8243            // Verify that padding bytes are zero.
8244            let ptr = unsafe { buf_ptr.offset(2) };
8245            let padval = unsafe { (ptr as *const u16).read_unaligned() };
8246            let mask = 0xff00u16;
8247            let maskedval = padval & mask;
8248            if maskedval != 0 {
8249                return Err(fidl::Error::NonZeroPadding {
8250                    padding_start: offset + 2 + ((mask as u64).trailing_zeros() / 8) as usize,
8251                });
8252            }
8253            // Copy from the buffer into the object.
8254            unsafe {
8255                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
8256            }
8257            Ok(())
8258        }
8259    }
8260
8261    impl fidl::encoding::ResourceTypeMarker for DeviceGetBarResponse {
8262        type Borrowed<'a> = &'a mut Self;
8263        fn take_or_borrow<'a>(
8264            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8265        ) -> Self::Borrowed<'a> {
8266            value
8267        }
8268    }
8269
8270    unsafe impl fidl::encoding::TypeMarker for DeviceGetBarResponse {
8271        type Owned = Self;
8272
8273        #[inline(always)]
8274        fn inline_align(_context: fidl::encoding::Context) -> usize {
8275            8
8276        }
8277
8278        #[inline(always)]
8279        fn inline_size(_context: fidl::encoding::Context) -> usize {
8280            32
8281        }
8282    }
8283
8284    unsafe impl
8285        fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
8286        for &mut DeviceGetBarResponse
8287    {
8288        #[inline]
8289        unsafe fn encode(
8290            self,
8291            encoder: &mut fidl::encoding::Encoder<
8292                '_,
8293                fidl::encoding::DefaultFuchsiaResourceDialect,
8294            >,
8295            offset: usize,
8296            _depth: fidl::encoding::Depth,
8297        ) -> fidl::Result<()> {
8298            encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
8299            // Delegate to tuple encoding.
8300            fidl::encoding::Encode::<
8301                DeviceGetBarResponse,
8302                fidl::encoding::DefaultFuchsiaResourceDialect,
8303            >::encode(
8304                (<Bar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result),),
8305                encoder,
8306                offset,
8307                _depth,
8308            )
8309        }
8310    }
8311    unsafe impl<T0: fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>>
8312        fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
8313        for (T0,)
8314    {
8315        #[inline]
8316        unsafe fn encode(
8317            self,
8318            encoder: &mut fidl::encoding::Encoder<
8319                '_,
8320                fidl::encoding::DefaultFuchsiaResourceDialect,
8321            >,
8322            offset: usize,
8323            depth: fidl::encoding::Depth,
8324        ) -> fidl::Result<()> {
8325            encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
8326            // Zero out padding regions. There's no need to apply masks
8327            // because the unmasked parts will be overwritten by fields.
8328            // Write the fields.
8329            self.0.encode(encoder, offset + 0, depth)?;
8330            Ok(())
8331        }
8332    }
8333
8334    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8335        for DeviceGetBarResponse
8336    {
8337        #[inline(always)]
8338        fn new_empty() -> Self {
8339            Self { result: fidl::new_empty!(Bar, fidl::encoding::DefaultFuchsiaResourceDialect) }
8340        }
8341
8342        #[inline]
8343        unsafe fn decode(
8344            &mut self,
8345            decoder: &mut fidl::encoding::Decoder<
8346                '_,
8347                fidl::encoding::DefaultFuchsiaResourceDialect,
8348            >,
8349            offset: usize,
8350            _depth: fidl::encoding::Depth,
8351        ) -> fidl::Result<()> {
8352            decoder.debug_check_bounds::<Self>(offset);
8353            // Verify that padding bytes are zero.
8354            fidl::decode!(
8355                Bar,
8356                fidl::encoding::DefaultFuchsiaResourceDialect,
8357                &mut self.result,
8358                decoder,
8359                offset + 0,
8360                _depth
8361            )?;
8362            Ok(())
8363        }
8364    }
8365
8366    impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiResponse {
8367        type Borrowed<'a> = &'a mut Self;
8368        fn take_or_borrow<'a>(
8369            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8370        ) -> Self::Borrowed<'a> {
8371            value
8372        }
8373    }
8374
8375    unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiResponse {
8376        type Owned = Self;
8377
8378        #[inline(always)]
8379        fn inline_align(_context: fidl::encoding::Context) -> usize {
8380            4
8381        }
8382
8383        #[inline(always)]
8384        fn inline_size(_context: fidl::encoding::Context) -> usize {
8385            4
8386        }
8387    }
8388
8389    unsafe impl
8390        fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
8391        for &mut DeviceGetBtiResponse
8392    {
8393        #[inline]
8394        unsafe fn encode(
8395            self,
8396            encoder: &mut fidl::encoding::Encoder<
8397                '_,
8398                fidl::encoding::DefaultFuchsiaResourceDialect,
8399            >,
8400            offset: usize,
8401            _depth: fidl::encoding::Depth,
8402        ) -> fidl::Result<()> {
8403            encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
8404            // Delegate to tuple encoding.
8405            fidl::encoding::Encode::<
8406                DeviceGetBtiResponse,
8407                fidl::encoding::DefaultFuchsiaResourceDialect,
8408            >::encode(
8409                (<fidl::encoding::HandleType<
8410                    fidl::Bti,
8411                    { fidl::ObjectType::BTI.into_raw() },
8412                    2147483648,
8413                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8414                    &mut self.bti
8415                ),),
8416                encoder,
8417                offset,
8418                _depth,
8419            )
8420        }
8421    }
8422    unsafe impl<
8423            T0: fidl::encoding::Encode<
8424                fidl::encoding::HandleType<
8425                    fidl::Bti,
8426                    { fidl::ObjectType::BTI.into_raw() },
8427                    2147483648,
8428                >,
8429                fidl::encoding::DefaultFuchsiaResourceDialect,
8430            >,
8431        >
8432        fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
8433        for (T0,)
8434    {
8435        #[inline]
8436        unsafe fn encode(
8437            self,
8438            encoder: &mut fidl::encoding::Encoder<
8439                '_,
8440                fidl::encoding::DefaultFuchsiaResourceDialect,
8441            >,
8442            offset: usize,
8443            depth: fidl::encoding::Depth,
8444        ) -> fidl::Result<()> {
8445            encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
8446            // Zero out padding regions. There's no need to apply masks
8447            // because the unmasked parts will be overwritten by fields.
8448            // Write the fields.
8449            self.0.encode(encoder, offset + 0, depth)?;
8450            Ok(())
8451        }
8452    }
8453
8454    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8455        for DeviceGetBtiResponse
8456    {
8457        #[inline(always)]
8458        fn new_empty() -> Self {
8459            Self {
8460                bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8461            }
8462        }
8463
8464        #[inline]
8465        unsafe fn decode(
8466            &mut self,
8467            decoder: &mut fidl::encoding::Decoder<
8468                '_,
8469                fidl::encoding::DefaultFuchsiaResourceDialect,
8470            >,
8471            offset: usize,
8472            _depth: fidl::encoding::Depth,
8473        ) -> fidl::Result<()> {
8474            decoder.debug_check_bounds::<Self>(offset);
8475            // Verify that padding bytes are zero.
8476            fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
8477            Ok(())
8478        }
8479    }
8480
8481    impl fidl::encoding::ResourceTypeMarker for DeviceMapInterruptResponse {
8482        type Borrowed<'a> = &'a mut Self;
8483        fn take_or_borrow<'a>(
8484            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8485        ) -> Self::Borrowed<'a> {
8486            value
8487        }
8488    }
8489
8490    unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptResponse {
8491        type Owned = Self;
8492
8493        #[inline(always)]
8494        fn inline_align(_context: fidl::encoding::Context) -> usize {
8495            4
8496        }
8497
8498        #[inline(always)]
8499        fn inline_size(_context: fidl::encoding::Context) -> usize {
8500            4
8501        }
8502    }
8503
8504    unsafe impl
8505        fidl::encoding::Encode<
8506            DeviceMapInterruptResponse,
8507            fidl::encoding::DefaultFuchsiaResourceDialect,
8508        > for &mut DeviceMapInterruptResponse
8509    {
8510        #[inline]
8511        unsafe fn encode(
8512            self,
8513            encoder: &mut fidl::encoding::Encoder<
8514                '_,
8515                fidl::encoding::DefaultFuchsiaResourceDialect,
8516            >,
8517            offset: usize,
8518            _depth: fidl::encoding::Depth,
8519        ) -> fidl::Result<()> {
8520            encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
8521            // Delegate to tuple encoding.
8522            fidl::encoding::Encode::<
8523                DeviceMapInterruptResponse,
8524                fidl::encoding::DefaultFuchsiaResourceDialect,
8525            >::encode(
8526                (<fidl::encoding::HandleType<
8527                    fidl::Interrupt,
8528                    { fidl::ObjectType::INTERRUPT.into_raw() },
8529                    2147483648,
8530                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8531                    &mut self.interrupt
8532                ),),
8533                encoder,
8534                offset,
8535                _depth,
8536            )
8537        }
8538    }
8539    unsafe impl<
8540            T0: fidl::encoding::Encode<
8541                fidl::encoding::HandleType<
8542                    fidl::Interrupt,
8543                    { fidl::ObjectType::INTERRUPT.into_raw() },
8544                    2147483648,
8545                >,
8546                fidl::encoding::DefaultFuchsiaResourceDialect,
8547            >,
8548        >
8549        fidl::encoding::Encode<
8550            DeviceMapInterruptResponse,
8551            fidl::encoding::DefaultFuchsiaResourceDialect,
8552        > for (T0,)
8553    {
8554        #[inline]
8555        unsafe fn encode(
8556            self,
8557            encoder: &mut fidl::encoding::Encoder<
8558                '_,
8559                fidl::encoding::DefaultFuchsiaResourceDialect,
8560            >,
8561            offset: usize,
8562            depth: fidl::encoding::Depth,
8563        ) -> fidl::Result<()> {
8564            encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
8565            // Zero out padding regions. There's no need to apply masks
8566            // because the unmasked parts will be overwritten by fields.
8567            // Write the fields.
8568            self.0.encode(encoder, offset + 0, depth)?;
8569            Ok(())
8570        }
8571    }
8572
8573    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8574        for DeviceMapInterruptResponse
8575    {
8576        #[inline(always)]
8577        fn new_empty() -> Self {
8578            Self {
8579                interrupt: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
8580            }
8581        }
8582
8583        #[inline]
8584        unsafe fn decode(
8585            &mut self,
8586            decoder: &mut fidl::encoding::Decoder<
8587                '_,
8588                fidl::encoding::DefaultFuchsiaResourceDialect,
8589            >,
8590            offset: usize,
8591            _depth: fidl::encoding::Depth,
8592        ) -> fidl::Result<()> {
8593            decoder.debug_check_bounds::<Self>(offset);
8594            // Verify that padding bytes are zero.
8595            fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.interrupt, decoder, offset + 0, _depth)?;
8596            Ok(())
8597        }
8598    }
8599
8600    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Response {
8601        type Borrowed<'a> = &'a Self;
8602        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8603            value
8604        }
8605    }
8606
8607    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Response {
8608        type Owned = Self;
8609
8610        #[inline(always)]
8611        fn inline_align(_context: fidl::encoding::Context) -> usize {
8612            2
8613        }
8614
8615        #[inline(always)]
8616        fn inline_size(_context: fidl::encoding::Context) -> usize {
8617            2
8618        }
8619        #[inline(always)]
8620        fn encode_is_copy() -> bool {
8621            true
8622        }
8623
8624        #[inline(always)]
8625        fn decode_is_copy() -> bool {
8626            true
8627        }
8628    }
8629
8630    unsafe impl<D: fidl::encoding::ResourceDialect>
8631        fidl::encoding::Encode<DeviceReadConfig16Response, D> for &DeviceReadConfig16Response
8632    {
8633        #[inline]
8634        unsafe fn encode(
8635            self,
8636            encoder: &mut fidl::encoding::Encoder<'_, D>,
8637            offset: usize,
8638            _depth: fidl::encoding::Depth,
8639        ) -> fidl::Result<()> {
8640            encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
8641            unsafe {
8642                // Copy the object into the buffer.
8643                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8644                (buf_ptr as *mut DeviceReadConfig16Response)
8645                    .write_unaligned((self as *const DeviceReadConfig16Response).read());
8646                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8647                // done second because the memcpy will write garbage to these bytes.
8648            }
8649            Ok(())
8650        }
8651    }
8652    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
8653        fidl::encoding::Encode<DeviceReadConfig16Response, D> for (T0,)
8654    {
8655        #[inline]
8656        unsafe fn encode(
8657            self,
8658            encoder: &mut fidl::encoding::Encoder<'_, D>,
8659            offset: usize,
8660            depth: fidl::encoding::Depth,
8661        ) -> fidl::Result<()> {
8662            encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
8663            // Zero out padding regions. There's no need to apply masks
8664            // because the unmasked parts will be overwritten by fields.
8665            // Write the fields.
8666            self.0.encode(encoder, offset + 0, depth)?;
8667            Ok(())
8668        }
8669    }
8670
8671    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8672        for DeviceReadConfig16Response
8673    {
8674        #[inline(always)]
8675        fn new_empty() -> Self {
8676            Self { value: fidl::new_empty!(u16, D) }
8677        }
8678
8679        #[inline]
8680        unsafe fn decode(
8681            &mut self,
8682            decoder: &mut fidl::encoding::Decoder<'_, D>,
8683            offset: usize,
8684            _depth: fidl::encoding::Depth,
8685        ) -> fidl::Result<()> {
8686            decoder.debug_check_bounds::<Self>(offset);
8687            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8688            // Verify that padding bytes are zero.
8689            // Copy from the buffer into the object.
8690            unsafe {
8691                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
8692            }
8693            Ok(())
8694        }
8695    }
8696
8697    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Response {
8698        type Borrowed<'a> = &'a Self;
8699        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8700            value
8701        }
8702    }
8703
8704    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Response {
8705        type Owned = Self;
8706
8707        #[inline(always)]
8708        fn inline_align(_context: fidl::encoding::Context) -> usize {
8709            4
8710        }
8711
8712        #[inline(always)]
8713        fn inline_size(_context: fidl::encoding::Context) -> usize {
8714            4
8715        }
8716        #[inline(always)]
8717        fn encode_is_copy() -> bool {
8718            true
8719        }
8720
8721        #[inline(always)]
8722        fn decode_is_copy() -> bool {
8723            true
8724        }
8725    }
8726
8727    unsafe impl<D: fidl::encoding::ResourceDialect>
8728        fidl::encoding::Encode<DeviceReadConfig32Response, D> for &DeviceReadConfig32Response
8729    {
8730        #[inline]
8731        unsafe fn encode(
8732            self,
8733            encoder: &mut fidl::encoding::Encoder<'_, D>,
8734            offset: usize,
8735            _depth: fidl::encoding::Depth,
8736        ) -> fidl::Result<()> {
8737            encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
8738            unsafe {
8739                // Copy the object into the buffer.
8740                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8741                (buf_ptr as *mut DeviceReadConfig32Response)
8742                    .write_unaligned((self as *const DeviceReadConfig32Response).read());
8743                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8744                // done second because the memcpy will write garbage to these bytes.
8745            }
8746            Ok(())
8747        }
8748    }
8749    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
8750        fidl::encoding::Encode<DeviceReadConfig32Response, D> for (T0,)
8751    {
8752        #[inline]
8753        unsafe fn encode(
8754            self,
8755            encoder: &mut fidl::encoding::Encoder<'_, D>,
8756            offset: usize,
8757            depth: fidl::encoding::Depth,
8758        ) -> fidl::Result<()> {
8759            encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
8760            // Zero out padding regions. There's no need to apply masks
8761            // because the unmasked parts will be overwritten by fields.
8762            // Write the fields.
8763            self.0.encode(encoder, offset + 0, depth)?;
8764            Ok(())
8765        }
8766    }
8767
8768    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8769        for DeviceReadConfig32Response
8770    {
8771        #[inline(always)]
8772        fn new_empty() -> Self {
8773            Self { value: fidl::new_empty!(u32, D) }
8774        }
8775
8776        #[inline]
8777        unsafe fn decode(
8778            &mut self,
8779            decoder: &mut fidl::encoding::Decoder<'_, D>,
8780            offset: usize,
8781            _depth: fidl::encoding::Depth,
8782        ) -> fidl::Result<()> {
8783            decoder.debug_check_bounds::<Self>(offset);
8784            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8785            // Verify that padding bytes are zero.
8786            // Copy from the buffer into the object.
8787            unsafe {
8788                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
8789            }
8790            Ok(())
8791        }
8792    }
8793
8794    impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Response {
8795        type Borrowed<'a> = &'a Self;
8796        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8797            value
8798        }
8799    }
8800
8801    unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Response {
8802        type Owned = Self;
8803
8804        #[inline(always)]
8805        fn inline_align(_context: fidl::encoding::Context) -> usize {
8806            1
8807        }
8808
8809        #[inline(always)]
8810        fn inline_size(_context: fidl::encoding::Context) -> usize {
8811            1
8812        }
8813        #[inline(always)]
8814        fn encode_is_copy() -> bool {
8815            true
8816        }
8817
8818        #[inline(always)]
8819        fn decode_is_copy() -> bool {
8820            true
8821        }
8822    }
8823
8824    unsafe impl<D: fidl::encoding::ResourceDialect>
8825        fidl::encoding::Encode<DeviceReadConfig8Response, D> for &DeviceReadConfig8Response
8826    {
8827        #[inline]
8828        unsafe fn encode(
8829            self,
8830            encoder: &mut fidl::encoding::Encoder<'_, D>,
8831            offset: usize,
8832            _depth: fidl::encoding::Depth,
8833        ) -> fidl::Result<()> {
8834            encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
8835            unsafe {
8836                // Copy the object into the buffer.
8837                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8838                (buf_ptr as *mut DeviceReadConfig8Response)
8839                    .write_unaligned((self as *const DeviceReadConfig8Response).read());
8840                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8841                // done second because the memcpy will write garbage to these bytes.
8842            }
8843            Ok(())
8844        }
8845    }
8846    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
8847        fidl::encoding::Encode<DeviceReadConfig8Response, D> for (T0,)
8848    {
8849        #[inline]
8850        unsafe fn encode(
8851            self,
8852            encoder: &mut fidl::encoding::Encoder<'_, D>,
8853            offset: usize,
8854            depth: fidl::encoding::Depth,
8855        ) -> fidl::Result<()> {
8856            encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
8857            // Zero out padding regions. There's no need to apply masks
8858            // because the unmasked parts will be overwritten by fields.
8859            // Write the fields.
8860            self.0.encode(encoder, offset + 0, depth)?;
8861            Ok(())
8862        }
8863    }
8864
8865    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8866        for DeviceReadConfig8Response
8867    {
8868        #[inline(always)]
8869        fn new_empty() -> Self {
8870            Self { value: fidl::new_empty!(u8, D) }
8871        }
8872
8873        #[inline]
8874        unsafe fn decode(
8875            &mut self,
8876            decoder: &mut fidl::encoding::Decoder<'_, D>,
8877            offset: usize,
8878            _depth: fidl::encoding::Depth,
8879        ) -> fidl::Result<()> {
8880            decoder.debug_check_bounds::<Self>(offset);
8881            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8882            // Verify that padding bytes are zero.
8883            // Copy from the buffer into the object.
8884            unsafe {
8885                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
8886            }
8887            Ok(())
8888        }
8889    }
8890
8891    impl fidl::encoding::ValueTypeMarker for ExtendedCapability {
8892        type Borrowed<'a> = &'a Self;
8893        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8894            value
8895        }
8896    }
8897
8898    unsafe impl fidl::encoding::TypeMarker for ExtendedCapability {
8899        type Owned = Self;
8900
8901        #[inline(always)]
8902        fn inline_align(_context: fidl::encoding::Context) -> usize {
8903            2
8904        }
8905
8906        #[inline(always)]
8907        fn inline_size(_context: fidl::encoding::Context) -> usize {
8908            4
8909        }
8910        #[inline(always)]
8911        fn encode_is_copy() -> bool {
8912            true
8913        }
8914
8915        #[inline(always)]
8916        fn decode_is_copy() -> bool {
8917            true
8918        }
8919    }
8920
8921    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExtendedCapability, D>
8922        for &ExtendedCapability
8923    {
8924        #[inline]
8925        unsafe fn encode(
8926            self,
8927            encoder: &mut fidl::encoding::Encoder<'_, D>,
8928            offset: usize,
8929            _depth: fidl::encoding::Depth,
8930        ) -> fidl::Result<()> {
8931            encoder.debug_check_bounds::<ExtendedCapability>(offset);
8932            unsafe {
8933                // Copy the object into the buffer.
8934                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8935                (buf_ptr as *mut ExtendedCapability)
8936                    .write_unaligned((self as *const ExtendedCapability).read());
8937                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8938                // done second because the memcpy will write garbage to these bytes.
8939            }
8940            Ok(())
8941        }
8942    }
8943    unsafe impl<
8944            D: fidl::encoding::ResourceDialect,
8945            T0: fidl::encoding::Encode<u16, D>,
8946            T1: fidl::encoding::Encode<u16, D>,
8947        > fidl::encoding::Encode<ExtendedCapability, D> for (T0, T1)
8948    {
8949        #[inline]
8950        unsafe fn encode(
8951            self,
8952            encoder: &mut fidl::encoding::Encoder<'_, D>,
8953            offset: usize,
8954            depth: fidl::encoding::Depth,
8955        ) -> fidl::Result<()> {
8956            encoder.debug_check_bounds::<ExtendedCapability>(offset);
8957            // Zero out padding regions. There's no need to apply masks
8958            // because the unmasked parts will be overwritten by fields.
8959            // Write the fields.
8960            self.0.encode(encoder, offset + 0, depth)?;
8961            self.1.encode(encoder, offset + 2, depth)?;
8962            Ok(())
8963        }
8964    }
8965
8966    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapability {
8967        #[inline(always)]
8968        fn new_empty() -> Self {
8969            Self { id: fidl::new_empty!(u16, D), offset: fidl::new_empty!(u16, D) }
8970        }
8971
8972        #[inline]
8973        unsafe fn decode(
8974            &mut self,
8975            decoder: &mut fidl::encoding::Decoder<'_, D>,
8976            offset: usize,
8977            _depth: fidl::encoding::Depth,
8978        ) -> fidl::Result<()> {
8979            decoder.debug_check_bounds::<Self>(offset);
8980            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8981            // Verify that padding bytes are zero.
8982            // Copy from the buffer into the object.
8983            unsafe {
8984                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
8985            }
8986            Ok(())
8987        }
8988    }
8989
8990    impl fidl::encoding::ValueTypeMarker for HostBridgeInfo {
8991        type Borrowed<'a> = &'a Self;
8992        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8993            value
8994        }
8995    }
8996
8997    unsafe impl fidl::encoding::TypeMarker for HostBridgeInfo {
8998        type Owned = Self;
8999
9000        #[inline(always)]
9001        fn inline_align(_context: fidl::encoding::Context) -> usize {
9002            8
9003        }
9004
9005        #[inline(always)]
9006        fn inline_size(_context: fidl::encoding::Context) -> usize {
9007            24
9008        }
9009    }
9010
9011    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostBridgeInfo, D>
9012        for &HostBridgeInfo
9013    {
9014        #[inline]
9015        unsafe fn encode(
9016            self,
9017            encoder: &mut fidl::encoding::Encoder<'_, D>,
9018            offset: usize,
9019            _depth: fidl::encoding::Depth,
9020        ) -> fidl::Result<()> {
9021            encoder.debug_check_bounds::<HostBridgeInfo>(offset);
9022            // Delegate to tuple encoding.
9023            fidl::encoding::Encode::<HostBridgeInfo, D>::encode(
9024                (
9025                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
9026                        &self.name,
9027                    ),
9028                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.start_bus_number),
9029                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.end_bus_number),
9030                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.segment_group),
9031                ),
9032                encoder,
9033                offset,
9034                _depth,
9035            )
9036        }
9037    }
9038    unsafe impl<
9039            D: fidl::encoding::ResourceDialect,
9040            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
9041            T1: fidl::encoding::Encode<u8, D>,
9042            T2: fidl::encoding::Encode<u8, D>,
9043            T3: fidl::encoding::Encode<u16, D>,
9044        > fidl::encoding::Encode<HostBridgeInfo, D> for (T0, T1, T2, T3)
9045    {
9046        #[inline]
9047        unsafe fn encode(
9048            self,
9049            encoder: &mut fidl::encoding::Encoder<'_, D>,
9050            offset: usize,
9051            depth: fidl::encoding::Depth,
9052        ) -> fidl::Result<()> {
9053            encoder.debug_check_bounds::<HostBridgeInfo>(offset);
9054            // Zero out padding regions. There's no need to apply masks
9055            // because the unmasked parts will be overwritten by fields.
9056            unsafe {
9057                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9058                (ptr as *mut u64).write_unaligned(0);
9059            }
9060            // Write the fields.
9061            self.0.encode(encoder, offset + 0, depth)?;
9062            self.1.encode(encoder, offset + 16, depth)?;
9063            self.2.encode(encoder, offset + 17, depth)?;
9064            self.3.encode(encoder, offset + 18, depth)?;
9065            Ok(())
9066        }
9067    }
9068
9069    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostBridgeInfo {
9070        #[inline(always)]
9071        fn new_empty() -> Self {
9072            Self {
9073                name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D),
9074                start_bus_number: fidl::new_empty!(u8, D),
9075                end_bus_number: fidl::new_empty!(u8, D),
9076                segment_group: fidl::new_empty!(u16, D),
9077            }
9078        }
9079
9080        #[inline]
9081        unsafe fn decode(
9082            &mut self,
9083            decoder: &mut fidl::encoding::Decoder<'_, D>,
9084            offset: usize,
9085            _depth: fidl::encoding::Depth,
9086        ) -> fidl::Result<()> {
9087            decoder.debug_check_bounds::<Self>(offset);
9088            // Verify that padding bytes are zero.
9089            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9090            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9091            let mask = 0xffffffff00000000u64;
9092            let maskedval = padval & mask;
9093            if maskedval != 0 {
9094                return Err(fidl::Error::NonZeroPadding {
9095                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9096                });
9097            }
9098            fidl::decode!(
9099                fidl::encoding::BoundedString<32>,
9100                D,
9101                &mut self.name,
9102                decoder,
9103                offset + 0,
9104                _depth
9105            )?;
9106            fidl::decode!(u8, D, &mut self.start_bus_number, decoder, offset + 16, _depth)?;
9107            fidl::decode!(u8, D, &mut self.end_bus_number, decoder, offset + 17, _depth)?;
9108            fidl::decode!(u16, D, &mut self.segment_group, decoder, offset + 18, _depth)?;
9109            Ok(())
9110        }
9111    }
9112
9113    impl fidl::encoding::ValueTypeMarker for InterruptModes {
9114        type Borrowed<'a> = &'a Self;
9115        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9116            value
9117        }
9118    }
9119
9120    unsafe impl fidl::encoding::TypeMarker for InterruptModes {
9121        type Owned = Self;
9122
9123        #[inline(always)]
9124        fn inline_align(_context: fidl::encoding::Context) -> usize {
9125            2
9126        }
9127
9128        #[inline(always)]
9129        fn inline_size(_context: fidl::encoding::Context) -> usize {
9130            4
9131        }
9132    }
9133
9134    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InterruptModes, D>
9135        for &InterruptModes
9136    {
9137        #[inline]
9138        unsafe fn encode(
9139            self,
9140            encoder: &mut fidl::encoding::Encoder<'_, D>,
9141            offset: usize,
9142            _depth: fidl::encoding::Depth,
9143        ) -> fidl::Result<()> {
9144            encoder.debug_check_bounds::<InterruptModes>(offset);
9145            // Delegate to tuple encoding.
9146            fidl::encoding::Encode::<InterruptModes, D>::encode(
9147                (
9148                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_legacy),
9149                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.msi_count),
9150                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.msix_count),
9151                ),
9152                encoder,
9153                offset,
9154                _depth,
9155            )
9156        }
9157    }
9158    unsafe impl<
9159            D: fidl::encoding::ResourceDialect,
9160            T0: fidl::encoding::Encode<bool, D>,
9161            T1: fidl::encoding::Encode<u8, D>,
9162            T2: fidl::encoding::Encode<u16, D>,
9163        > fidl::encoding::Encode<InterruptModes, D> for (T0, T1, T2)
9164    {
9165        #[inline]
9166        unsafe fn encode(
9167            self,
9168            encoder: &mut fidl::encoding::Encoder<'_, D>,
9169            offset: usize,
9170            depth: fidl::encoding::Depth,
9171        ) -> fidl::Result<()> {
9172            encoder.debug_check_bounds::<InterruptModes>(offset);
9173            // Zero out padding regions. There's no need to apply masks
9174            // because the unmasked parts will be overwritten by fields.
9175            // Write the fields.
9176            self.0.encode(encoder, offset + 0, depth)?;
9177            self.1.encode(encoder, offset + 1, depth)?;
9178            self.2.encode(encoder, offset + 2, depth)?;
9179            Ok(())
9180        }
9181    }
9182
9183    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptModes {
9184        #[inline(always)]
9185        fn new_empty() -> Self {
9186            Self {
9187                has_legacy: fidl::new_empty!(bool, D),
9188                msi_count: fidl::new_empty!(u8, D),
9189                msix_count: fidl::new_empty!(u16, D),
9190            }
9191        }
9192
9193        #[inline]
9194        unsafe fn decode(
9195            &mut self,
9196            decoder: &mut fidl::encoding::Decoder<'_, D>,
9197            offset: usize,
9198            _depth: fidl::encoding::Depth,
9199        ) -> fidl::Result<()> {
9200            decoder.debug_check_bounds::<Self>(offset);
9201            // Verify that padding bytes are zero.
9202            fidl::decode!(bool, D, &mut self.has_legacy, decoder, offset + 0, _depth)?;
9203            fidl::decode!(u8, D, &mut self.msi_count, decoder, offset + 1, _depth)?;
9204            fidl::decode!(u16, D, &mut self.msix_count, decoder, offset + 2, _depth)?;
9205            Ok(())
9206        }
9207    }
9208
9209    impl fidl::encoding::ResourceTypeMarker for IoBar {
9210        type Borrowed<'a> = &'a mut Self;
9211        fn take_or_borrow<'a>(
9212            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9213        ) -> Self::Borrowed<'a> {
9214            value
9215        }
9216    }
9217
9218    unsafe impl fidl::encoding::TypeMarker for IoBar {
9219        type Owned = Self;
9220
9221        #[inline(always)]
9222        fn inline_align(_context: fidl::encoding::Context) -> usize {
9223            8
9224        }
9225
9226        #[inline(always)]
9227        fn inline_size(_context: fidl::encoding::Context) -> usize {
9228            16
9229        }
9230    }
9231
9232    unsafe impl fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
9233        for &mut IoBar
9234    {
9235        #[inline]
9236        unsafe fn encode(
9237            self,
9238            encoder: &mut fidl::encoding::Encoder<
9239                '_,
9240                fidl::encoding::DefaultFuchsiaResourceDialect,
9241            >,
9242            offset: usize,
9243            _depth: fidl::encoding::Depth,
9244        ) -> fidl::Result<()> {
9245            encoder.debug_check_bounds::<IoBar>(offset);
9246            // Delegate to tuple encoding.
9247            fidl::encoding::Encode::<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9248                (
9249                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
9250                    <fidl::encoding::HandleType<
9251                        fidl::Resource,
9252                        { fidl::ObjectType::RESOURCE.into_raw() },
9253                        2147483648,
9254                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9255                        &mut self.resource
9256                    ),
9257                ),
9258                encoder,
9259                offset,
9260                _depth,
9261            )
9262        }
9263    }
9264    unsafe impl<
9265            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
9266            T1: fidl::encoding::Encode<
9267                fidl::encoding::HandleType<
9268                    fidl::Resource,
9269                    { fidl::ObjectType::RESOURCE.into_raw() },
9270                    2147483648,
9271                >,
9272                fidl::encoding::DefaultFuchsiaResourceDialect,
9273            >,
9274        > fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
9275        for (T0, T1)
9276    {
9277        #[inline]
9278        unsafe fn encode(
9279            self,
9280            encoder: &mut fidl::encoding::Encoder<
9281                '_,
9282                fidl::encoding::DefaultFuchsiaResourceDialect,
9283            >,
9284            offset: usize,
9285            depth: fidl::encoding::Depth,
9286        ) -> fidl::Result<()> {
9287            encoder.debug_check_bounds::<IoBar>(offset);
9288            // Zero out padding regions. There's no need to apply masks
9289            // because the unmasked parts will be overwritten by fields.
9290            unsafe {
9291                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
9292                (ptr as *mut u64).write_unaligned(0);
9293            }
9294            // Write the fields.
9295            self.0.encode(encoder, offset + 0, depth)?;
9296            self.1.encode(encoder, offset + 8, depth)?;
9297            Ok(())
9298        }
9299    }
9300
9301    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for IoBar {
9302        #[inline(always)]
9303        fn new_empty() -> Self {
9304            Self {
9305                address: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
9306                resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9307            }
9308        }
9309
9310        #[inline]
9311        unsafe fn decode(
9312            &mut self,
9313            decoder: &mut fidl::encoding::Decoder<
9314                '_,
9315                fidl::encoding::DefaultFuchsiaResourceDialect,
9316            >,
9317            offset: usize,
9318            _depth: fidl::encoding::Depth,
9319        ) -> fidl::Result<()> {
9320            decoder.debug_check_bounds::<Self>(offset);
9321            // Verify that padding bytes are zero.
9322            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
9323            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9324            let mask = 0xffffffff00000000u64;
9325            let maskedval = padval & mask;
9326            if maskedval != 0 {
9327                return Err(fidl::Error::NonZeroPadding {
9328                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
9329                });
9330            }
9331            fidl::decode!(
9332                u64,
9333                fidl::encoding::DefaultFuchsiaResourceDialect,
9334                &mut self.address,
9335                decoder,
9336                offset + 0,
9337                _depth
9338            )?;
9339            fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 8, _depth)?;
9340            Ok(())
9341        }
9342    }
9343
9344    impl fidl::encoding::ValueTypeMarker for Padding {
9345        type Borrowed<'a> = &'a Self;
9346        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9347            value
9348        }
9349    }
9350
9351    unsafe impl fidl::encoding::TypeMarker for Padding {
9352        type Owned = Self;
9353
9354        #[inline(always)]
9355        fn inline_align(_context: fidl::encoding::Context) -> usize {
9356            1
9357        }
9358
9359        #[inline(always)]
9360        fn inline_size(_context: fidl::encoding::Context) -> usize {
9361            1
9362        }
9363    }
9364
9365    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Padding, D> for &Padding {
9366        #[inline]
9367        unsafe fn encode(
9368            self,
9369            encoder: &mut fidl::encoding::Encoder<'_, D>,
9370            offset: usize,
9371            _depth: fidl::encoding::Depth,
9372        ) -> fidl::Result<()> {
9373            encoder.debug_check_bounds::<Padding>(offset);
9374            encoder.write_num(0u8, offset);
9375            Ok(())
9376        }
9377    }
9378
9379    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Padding {
9380        #[inline(always)]
9381        fn new_empty() -> Self {
9382            Self
9383        }
9384
9385        #[inline]
9386        unsafe fn decode(
9387            &mut self,
9388            decoder: &mut fidl::encoding::Decoder<'_, D>,
9389            offset: usize,
9390            _depth: fidl::encoding::Depth,
9391        ) -> fidl::Result<()> {
9392            decoder.debug_check_bounds::<Self>(offset);
9393            match decoder.read_num::<u8>(offset) {
9394                0 => Ok(()),
9395                _ => Err(fidl::Error::Invalid),
9396            }
9397        }
9398    }
9399
9400    impl fidl::encoding::ValueTypeMarker for PciDevice {
9401        type Borrowed<'a> = &'a Self;
9402        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9403            value
9404        }
9405    }
9406
9407    unsafe impl fidl::encoding::TypeMarker for PciDevice {
9408        type Owned = Self;
9409
9410        #[inline(always)]
9411        fn inline_align(_context: fidl::encoding::Context) -> usize {
9412            8
9413        }
9414
9415        #[inline(always)]
9416        fn inline_size(_context: fidl::encoding::Context) -> usize {
9417            72
9418        }
9419    }
9420
9421    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PciDevice, D>
9422        for &PciDevice
9423    {
9424        #[inline]
9425        unsafe fn encode(
9426            self,
9427            encoder: &mut fidl::encoding::Encoder<'_, D>,
9428            offset: usize,
9429            _depth: fidl::encoding::Depth,
9430        ) -> fidl::Result<()> {
9431            encoder.debug_check_bounds::<PciDevice>(offset);
9432            // Delegate to tuple encoding.
9433            fidl::encoding::Encode::<PciDevice, D>::encode(
9434                (
9435                    <fidl::encoding::Vector<BaseAddress, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.base_addresses),
9436                    <fidl::encoding::Vector<Capability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.capabilities),
9437                    <fidl::encoding::Vector<ExtendedCapability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.ext_capabilities),
9438                    <fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
9439                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
9440                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
9441                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.function_id),
9442                ),
9443                encoder, offset, _depth
9444            )
9445        }
9446    }
9447    unsafe impl<
9448            D: fidl::encoding::ResourceDialect,
9449            T0: fidl::encoding::Encode<fidl::encoding::Vector<BaseAddress, 6>, D>,
9450            T1: fidl::encoding::Encode<fidl::encoding::Vector<Capability, 32>, D>,
9451            T2: fidl::encoding::Encode<fidl::encoding::Vector<ExtendedCapability, 32>, D>,
9452            T3: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
9453            T4: fidl::encoding::Encode<u8, D>,
9454            T5: fidl::encoding::Encode<u8, D>,
9455            T6: fidl::encoding::Encode<u8, D>,
9456        > fidl::encoding::Encode<PciDevice, D> for (T0, T1, T2, T3, T4, T5, T6)
9457    {
9458        #[inline]
9459        unsafe fn encode(
9460            self,
9461            encoder: &mut fidl::encoding::Encoder<'_, D>,
9462            offset: usize,
9463            depth: fidl::encoding::Depth,
9464        ) -> fidl::Result<()> {
9465            encoder.debug_check_bounds::<PciDevice>(offset);
9466            // Zero out padding regions. There's no need to apply masks
9467            // because the unmasked parts will be overwritten by fields.
9468            unsafe {
9469                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
9470                (ptr as *mut u64).write_unaligned(0);
9471            }
9472            // Write the fields.
9473            self.0.encode(encoder, offset + 0, depth)?;
9474            self.1.encode(encoder, offset + 16, depth)?;
9475            self.2.encode(encoder, offset + 32, depth)?;
9476            self.3.encode(encoder, offset + 48, depth)?;
9477            self.4.encode(encoder, offset + 64, depth)?;
9478            self.5.encode(encoder, offset + 65, depth)?;
9479            self.6.encode(encoder, offset + 66, depth)?;
9480            Ok(())
9481        }
9482    }
9483
9484    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PciDevice {
9485        #[inline(always)]
9486        fn new_empty() -> Self {
9487            Self {
9488                base_addresses: fidl::new_empty!(fidl::encoding::Vector<BaseAddress, 6>, D),
9489                capabilities: fidl::new_empty!(fidl::encoding::Vector<Capability, 32>, D),
9490                ext_capabilities: fidl::new_empty!(fidl::encoding::Vector<ExtendedCapability, 32>, D),
9491                config: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
9492                bus_id: fidl::new_empty!(u8, D),
9493                device_id: fidl::new_empty!(u8, D),
9494                function_id: fidl::new_empty!(u8, D),
9495            }
9496        }
9497
9498        #[inline]
9499        unsafe fn decode(
9500            &mut self,
9501            decoder: &mut fidl::encoding::Decoder<'_, D>,
9502            offset: usize,
9503            _depth: fidl::encoding::Depth,
9504        ) -> fidl::Result<()> {
9505            decoder.debug_check_bounds::<Self>(offset);
9506            // Verify that padding bytes are zero.
9507            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
9508            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9509            let mask = 0xffffffffff000000u64;
9510            let maskedval = padval & mask;
9511            if maskedval != 0 {
9512                return Err(fidl::Error::NonZeroPadding {
9513                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
9514                });
9515            }
9516            fidl::decode!(fidl::encoding::Vector<BaseAddress, 6>, D, &mut self.base_addresses, decoder, offset + 0, _depth)?;
9517            fidl::decode!(fidl::encoding::Vector<Capability, 32>, D, &mut self.capabilities, decoder, offset + 16, _depth)?;
9518            fidl::decode!(fidl::encoding::Vector<ExtendedCapability, 32>, D, &mut self.ext_capabilities, decoder, offset + 32, _depth)?;
9519            fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.config, decoder, offset + 48, _depth)?;
9520            fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 64, _depth)?;
9521            fidl::decode!(u8, D, &mut self.device_id, decoder, offset + 65, _depth)?;
9522            fidl::decode!(u8, D, &mut self.function_id, decoder, offset + 66, _depth)?;
9523            Ok(())
9524        }
9525    }
9526
9527    impl fidl::encoding::ValueTypeMarker for UseIntxWorkaroundType {
9528        type Borrowed<'a> = &'a Self;
9529        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9530            value
9531        }
9532    }
9533
9534    unsafe impl fidl::encoding::TypeMarker for UseIntxWorkaroundType {
9535        type Owned = Self;
9536
9537        #[inline(always)]
9538        fn inline_align(_context: fidl::encoding::Context) -> usize {
9539            1
9540        }
9541
9542        #[inline(always)]
9543        fn inline_size(_context: fidl::encoding::Context) -> usize {
9544            1
9545        }
9546    }
9547
9548    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UseIntxWorkaroundType, D>
9549        for &UseIntxWorkaroundType
9550    {
9551        #[inline]
9552        unsafe fn encode(
9553            self,
9554            encoder: &mut fidl::encoding::Encoder<'_, D>,
9555            offset: usize,
9556            _depth: fidl::encoding::Depth,
9557        ) -> fidl::Result<()> {
9558            encoder.debug_check_bounds::<UseIntxWorkaroundType>(offset);
9559            encoder.write_num(0u8, offset);
9560            Ok(())
9561        }
9562    }
9563
9564    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UseIntxWorkaroundType {
9565        #[inline(always)]
9566        fn new_empty() -> Self {
9567            Self
9568        }
9569
9570        #[inline]
9571        unsafe fn decode(
9572            &mut self,
9573            decoder: &mut fidl::encoding::Decoder<'_, D>,
9574            offset: usize,
9575            _depth: fidl::encoding::Depth,
9576        ) -> fidl::Result<()> {
9577            decoder.debug_check_bounds::<Self>(offset);
9578            match decoder.read_num::<u8>(offset) {
9579                0 => Ok(()),
9580                _ => Err(fidl::Error::Invalid),
9581            }
9582        }
9583    }
9584
9585    impl BoardConfiguration {
9586        #[inline(always)]
9587        fn max_ordinal_present(&self) -> u64 {
9588            if let Some(_) = self.use_intx_workaround {
9589                return 1;
9590            }
9591            0
9592        }
9593    }
9594
9595    impl fidl::encoding::ValueTypeMarker for BoardConfiguration {
9596        type Borrowed<'a> = &'a Self;
9597        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9598            value
9599        }
9600    }
9601
9602    unsafe impl fidl::encoding::TypeMarker for BoardConfiguration {
9603        type Owned = Self;
9604
9605        #[inline(always)]
9606        fn inline_align(_context: fidl::encoding::Context) -> usize {
9607            8
9608        }
9609
9610        #[inline(always)]
9611        fn inline_size(_context: fidl::encoding::Context) -> usize {
9612            16
9613        }
9614    }
9615
9616    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoardConfiguration, D>
9617        for &BoardConfiguration
9618    {
9619        unsafe fn encode(
9620            self,
9621            encoder: &mut fidl::encoding::Encoder<'_, D>,
9622            offset: usize,
9623            mut depth: fidl::encoding::Depth,
9624        ) -> fidl::Result<()> {
9625            encoder.debug_check_bounds::<BoardConfiguration>(offset);
9626            // Vector header
9627            let max_ordinal: u64 = self.max_ordinal_present();
9628            encoder.write_num(max_ordinal, offset);
9629            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9630            // Calling encoder.out_of_line_offset(0) is not allowed.
9631            if max_ordinal == 0 {
9632                return Ok(());
9633            }
9634            depth.increment()?;
9635            let envelope_size = 8;
9636            let bytes_len = max_ordinal as usize * envelope_size;
9637            #[allow(unused_variables)]
9638            let offset = encoder.out_of_line_offset(bytes_len);
9639            let mut _prev_end_offset: usize = 0;
9640            if 1 > max_ordinal {
9641                return Ok(());
9642            }
9643
9644            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9645            // are envelope_size bytes.
9646            let cur_offset: usize = (1 - 1) * envelope_size;
9647
9648            // Zero reserved fields.
9649            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9650
9651            // Safety:
9652            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9653            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9654            //   envelope_size bytes, there is always sufficient room.
9655            fidl::encoding::encode_in_envelope_optional::<UseIntxWorkaroundType, D>(
9656                self.use_intx_workaround
9657                    .as_ref()
9658                    .map(<UseIntxWorkaroundType as fidl::encoding::ValueTypeMarker>::borrow),
9659                encoder,
9660                offset + cur_offset,
9661                depth,
9662            )?;
9663
9664            _prev_end_offset = cur_offset + envelope_size;
9665
9666            Ok(())
9667        }
9668    }
9669
9670    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoardConfiguration {
9671        #[inline(always)]
9672        fn new_empty() -> Self {
9673            Self::default()
9674        }
9675
9676        unsafe fn decode(
9677            &mut self,
9678            decoder: &mut fidl::encoding::Decoder<'_, D>,
9679            offset: usize,
9680            mut depth: fidl::encoding::Depth,
9681        ) -> fidl::Result<()> {
9682            decoder.debug_check_bounds::<Self>(offset);
9683            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9684                None => return Err(fidl::Error::NotNullable),
9685                Some(len) => len,
9686            };
9687            // Calling decoder.out_of_line_offset(0) is not allowed.
9688            if len == 0 {
9689                return Ok(());
9690            };
9691            depth.increment()?;
9692            let envelope_size = 8;
9693            let bytes_len = len * envelope_size;
9694            let offset = decoder.out_of_line_offset(bytes_len)?;
9695            // Decode the envelope for each type.
9696            let mut _next_ordinal_to_read = 0;
9697            let mut next_offset = offset;
9698            let end_offset = offset + bytes_len;
9699            _next_ordinal_to_read += 1;
9700            if next_offset >= end_offset {
9701                return Ok(());
9702            }
9703
9704            // Decode unknown envelopes for gaps in ordinals.
9705            while _next_ordinal_to_read < 1 {
9706                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9707                _next_ordinal_to_read += 1;
9708                next_offset += envelope_size;
9709            }
9710
9711            let next_out_of_line = decoder.next_out_of_line();
9712            let handles_before = decoder.remaining_handles();
9713            if let Some((inlined, num_bytes, num_handles)) =
9714                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9715            {
9716                let member_inline_size =
9717                    <UseIntxWorkaroundType as fidl::encoding::TypeMarker>::inline_size(
9718                        decoder.context,
9719                    );
9720                if inlined != (member_inline_size <= 4) {
9721                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9722                }
9723                let inner_offset;
9724                let mut inner_depth = depth.clone();
9725                if inlined {
9726                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9727                    inner_offset = next_offset;
9728                } else {
9729                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9730                    inner_depth.increment()?;
9731                }
9732                let val_ref = self
9733                    .use_intx_workaround
9734                    .get_or_insert_with(|| fidl::new_empty!(UseIntxWorkaroundType, D));
9735                fidl::decode!(
9736                    UseIntxWorkaroundType,
9737                    D,
9738                    val_ref,
9739                    decoder,
9740                    inner_offset,
9741                    inner_depth
9742                )?;
9743                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9744                {
9745                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9746                }
9747                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9748                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9749                }
9750            }
9751
9752            next_offset += envelope_size;
9753
9754            // Decode the remaining unknown envelopes.
9755            while next_offset < end_offset {
9756                _next_ordinal_to_read += 1;
9757                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9758                next_offset += envelope_size;
9759            }
9760
9761            Ok(())
9762        }
9763    }
9764
9765    impl fidl::encoding::ResourceTypeMarker for BarResult {
9766        type Borrowed<'a> = &'a mut Self;
9767        fn take_or_borrow<'a>(
9768            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9769        ) -> Self::Borrowed<'a> {
9770            value
9771        }
9772    }
9773
9774    unsafe impl fidl::encoding::TypeMarker for BarResult {
9775        type Owned = Self;
9776
9777        #[inline(always)]
9778        fn inline_align(_context: fidl::encoding::Context) -> usize {
9779            8
9780        }
9781
9782        #[inline(always)]
9783        fn inline_size(_context: fidl::encoding::Context) -> usize {
9784            16
9785        }
9786    }
9787
9788    unsafe impl fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>
9789        for &mut BarResult
9790    {
9791        #[inline]
9792        unsafe fn encode(
9793            self,
9794            encoder: &mut fidl::encoding::Encoder<
9795                '_,
9796                fidl::encoding::DefaultFuchsiaResourceDialect,
9797            >,
9798            offset: usize,
9799            _depth: fidl::encoding::Depth,
9800        ) -> fidl::Result<()> {
9801            encoder.debug_check_bounds::<BarResult>(offset);
9802            encoder.write_num::<u64>(self.ordinal(), offset);
9803            match self {
9804                BarResult::Io(ref mut val) => fidl::encoding::encode_in_envelope::<
9805                    IoBar,
9806                    fidl::encoding::DefaultFuchsiaResourceDialect,
9807                >(
9808                    <IoBar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
9809                    encoder,
9810                    offset + 8,
9811                    _depth,
9812                ),
9813                BarResult::Vmo(ref mut val) => fidl::encoding::encode_in_envelope::<
9814                    fidl::encoding::HandleType<
9815                        fidl::Vmo,
9816                        { fidl::ObjectType::VMO.into_raw() },
9817                        2147483648,
9818                    >,
9819                    fidl::encoding::DefaultFuchsiaResourceDialect,
9820                >(
9821                    <fidl::encoding::HandleType<
9822                        fidl::Vmo,
9823                        { fidl::ObjectType::VMO.into_raw() },
9824                        2147483648,
9825                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9826                        val
9827                    ),
9828                    encoder,
9829                    offset + 8,
9830                    _depth,
9831                ),
9832                BarResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
9833            }
9834        }
9835    }
9836
9837    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BarResult {
9838        #[inline(always)]
9839        fn new_empty() -> Self {
9840            Self::__SourceBreaking { unknown_ordinal: 0 }
9841        }
9842
9843        #[inline]
9844        unsafe fn decode(
9845            &mut self,
9846            decoder: &mut fidl::encoding::Decoder<
9847                '_,
9848                fidl::encoding::DefaultFuchsiaResourceDialect,
9849            >,
9850            offset: usize,
9851            mut depth: fidl::encoding::Depth,
9852        ) -> fidl::Result<()> {
9853            decoder.debug_check_bounds::<Self>(offset);
9854            #[allow(unused_variables)]
9855            let next_out_of_line = decoder.next_out_of_line();
9856            let handles_before = decoder.remaining_handles();
9857            let (ordinal, inlined, num_bytes, num_handles) =
9858                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
9859
9860            let member_inline_size = match ordinal {
9861                1 => <IoBar as fidl::encoding::TypeMarker>::inline_size(decoder.context),
9862                2 => <fidl::encoding::HandleType<
9863                    fidl::Vmo,
9864                    { fidl::ObjectType::VMO.into_raw() },
9865                    2147483648,
9866                > as fidl::encoding::TypeMarker>::inline_size(decoder.context),
9867                0 => return Err(fidl::Error::UnknownUnionTag),
9868                _ => num_bytes as usize,
9869            };
9870
9871            if inlined != (member_inline_size <= 4) {
9872                return Err(fidl::Error::InvalidInlineBitInEnvelope);
9873            }
9874            let _inner_offset;
9875            if inlined {
9876                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
9877                _inner_offset = offset + 8;
9878            } else {
9879                depth.increment()?;
9880                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9881            }
9882            match ordinal {
9883                1 => {
9884                    #[allow(irrefutable_let_patterns)]
9885                    if let BarResult::Io(_) = self {
9886                        // Do nothing, read the value into the object
9887                    } else {
9888                        // Initialize `self` to the right variant
9889                        *self = BarResult::Io(fidl::new_empty!(
9890                            IoBar,
9891                            fidl::encoding::DefaultFuchsiaResourceDialect
9892                        ));
9893                    }
9894                    #[allow(irrefutable_let_patterns)]
9895                    if let BarResult::Io(ref mut val) = self {
9896                        fidl::decode!(
9897                            IoBar,
9898                            fidl::encoding::DefaultFuchsiaResourceDialect,
9899                            val,
9900                            decoder,
9901                            _inner_offset,
9902                            depth
9903                        )?;
9904                    } else {
9905                        unreachable!()
9906                    }
9907                }
9908                2 => {
9909                    #[allow(irrefutable_let_patterns)]
9910                    if let BarResult::Vmo(_) = self {
9911                        // Do nothing, read the value into the object
9912                    } else {
9913                        // Initialize `self` to the right variant
9914                        *self = BarResult::Vmo(
9915                            fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
9916                        );
9917                    }
9918                    #[allow(irrefutable_let_patterns)]
9919                    if let BarResult::Vmo(ref mut val) = self {
9920                        fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
9921                    } else {
9922                        unreachable!()
9923                    }
9924                }
9925                #[allow(deprecated)]
9926                ordinal => {
9927                    for _ in 0..num_handles {
9928                        decoder.drop_next_handle()?;
9929                    }
9930                    *self = BarResult::__SourceBreaking { unknown_ordinal: ordinal };
9931                }
9932            }
9933            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
9934                return Err(fidl::Error::InvalidNumBytesInEnvelope);
9935            }
9936            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9937                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9938            }
9939            Ok(())
9940        }
9941    }
9942}