#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub type ConfigOffset = u8;
pub type ExtendedConfigOffset = u16;
pub const BASE_ADDRESS_COUNT: u32 = 6;
pub const BASE_CONFIG_SIZE: u32 = 256;
pub const EXTENDED_CONFIG_SIZE: u32 = 4096;
pub const MAX_BAR_COUNT: u8 = 6;
pub const MAX_CAPABILITIES: u32 = 32;
pub const MAX_DEVICES: u32 = 64;
pub const MAX_EXT_CAPABILITIES: u32 = 32;
pub const MAX_NAME_LEN: u32 = 32;
pub const READBAR_MAX_SIZE: u32 = 1024;
pub const STATUS_DEVSEL_MASK: Status = Status::from_bits_truncate(1536);
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Command: u16 {
const IO_EN = 1;
const MEM_EN = 2;
const BUS_MASTER_EN = 4;
const SPECIAL_EN = 8;
const MEM_WR_INV_EN = 16;
const PAL_SNOOP_EN = 32;
const PERR_RESP_EN = 64;
const AD_STEP_EN = 128;
const SERR_EN = 256;
const FAST_B2_B_EN = 512;
}
}
impl Command {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u16) -> Self {
Self::from_bits_retain(bits)
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u16 {
self.bits() & !Self::all().bits()
}
}
bitflags! {
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Status: u16 {
const INTERRUPT = 8;
const NEW_CAPS = 16;
const SIXTYSIX_MHZ = 32;
const FAST_B2_B = 128;
const MSTR_PERR = 256;
const DEVSEL_LOW = 512;
const DEVSEL_HIGH = 1024;
const TARG_ABORT_SIG = 2048;
const TARG_ABORT_RCV = 4096;
const MSTR_ABORT_RCV = 8192;
const SERR_SIG = 16384;
const PERR = 32768;
}
}
impl Status {
#[inline(always)]
pub fn from_bits_allow_unknown(bits: u16) -> Self {
Self::from_bits_retain(bits)
}
#[inline(always)]
pub fn has_unknown_bits(&self) -> bool {
self.get_unknown_bits() != 0
}
#[inline(always)]
pub fn get_unknown_bits(&self) -> u16 {
self.bits() & !Self::all().bits()
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum CapabilityId {
Null,
PciPwrMgmt,
Agp,
VitalProductData,
SlotIdentification,
Msi,
CompactPciHotswap,
Pcix,
Hypertransport,
Vendor,
DebugPort,
CompactPciCrc,
PciHotPlug,
PciBridgeSubsystemVid,
Agp8X,
SecureDevice,
PciExpress,
Msix,
SataDataNdxCfg,
AdvancedFeatures,
EnhancedAllocation,
FlatteningPortalBridge,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! CapabilityIdUnknown {
() => {
_
};
}
impl CapabilityId {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Null),
1 => Some(Self::PciPwrMgmt),
2 => Some(Self::Agp),
3 => Some(Self::VitalProductData),
4 => Some(Self::SlotIdentification),
5 => Some(Self::Msi),
6 => Some(Self::CompactPciHotswap),
7 => Some(Self::Pcix),
8 => Some(Self::Hypertransport),
9 => Some(Self::Vendor),
10 => Some(Self::DebugPort),
11 => Some(Self::CompactPciCrc),
12 => Some(Self::PciHotPlug),
13 => Some(Self::PciBridgeSubsystemVid),
14 => Some(Self::Agp8X),
15 => Some(Self::SecureDevice),
16 => Some(Self::PciExpress),
17 => Some(Self::Msix),
18 => Some(Self::SataDataNdxCfg),
19 => Some(Self::AdvancedFeatures),
20 => Some(Self::EnhancedAllocation),
21 => Some(Self::FlatteningPortalBridge),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
0 => Self::Null,
1 => Self::PciPwrMgmt,
2 => Self::Agp,
3 => Self::VitalProductData,
4 => Self::SlotIdentification,
5 => Self::Msi,
6 => Self::CompactPciHotswap,
7 => Self::Pcix,
8 => Self::Hypertransport,
9 => Self::Vendor,
10 => Self::DebugPort,
11 => Self::CompactPciCrc,
12 => Self::PciHotPlug,
13 => Self::PciBridgeSubsystemVid,
14 => Self::Agp8X,
15 => Self::SecureDevice,
16 => Self::PciExpress,
17 => Self::Msix,
18 => Self::SataDataNdxCfg,
19 => Self::AdvancedFeatures,
20 => Self::EnhancedAllocation,
21 => Self::FlatteningPortalBridge,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Null => 0,
Self::PciPwrMgmt => 1,
Self::Agp => 2,
Self::VitalProductData => 3,
Self::SlotIdentification => 4,
Self::Msi => 5,
Self::CompactPciHotswap => 6,
Self::Pcix => 7,
Self::Hypertransport => 8,
Self::Vendor => 9,
Self::DebugPort => 10,
Self::CompactPciCrc => 11,
Self::PciHotPlug => 12,
Self::PciBridgeSubsystemVid => 13,
Self::Agp8X => 14,
Self::SecureDevice => 15,
Self::PciExpress => 16,
Self::Msix => 17,
Self::SataDataNdxCfg => 18,
Self::AdvancedFeatures => 19,
Self::EnhancedAllocation => 20,
Self::FlatteningPortalBridge => 21,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum Config {
VendorId,
DeviceId,
Command,
Status,
RevisionId,
ClassCodeIntr,
ClassCodeSub,
ClassCodeBase,
CacheLineSize,
LatencyTimer,
HeaderType,
Bist,
BaseAddresses,
CardbusCisPtr,
SubsystemVendorId,
SubsystemId,
ExpRomAddress,
CapabilitiesPtr,
InterruptLine,
InterruptPin,
MinGrant,
MaxLatency,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u16,
},
}
#[macro_export]
macro_rules! ConfigUnknown {
() => {
_
};
}
impl Config {
#[inline]
pub fn from_primitive(prim: u16) -> Option<Self> {
match prim {
0 => Some(Self::VendorId),
2 => Some(Self::DeviceId),
4 => Some(Self::Command),
6 => Some(Self::Status),
8 => Some(Self::RevisionId),
9 => Some(Self::ClassCodeIntr),
10 => Some(Self::ClassCodeSub),
11 => Some(Self::ClassCodeBase),
12 => Some(Self::CacheLineSize),
13 => Some(Self::LatencyTimer),
14 => Some(Self::HeaderType),
15 => Some(Self::Bist),
16 => Some(Self::BaseAddresses),
40 => Some(Self::CardbusCisPtr),
44 => Some(Self::SubsystemVendorId),
46 => Some(Self::SubsystemId),
48 => Some(Self::ExpRomAddress),
52 => Some(Self::CapabilitiesPtr),
60 => Some(Self::InterruptLine),
61 => Some(Self::InterruptPin),
62 => Some(Self::MinGrant),
63 => Some(Self::MaxLatency),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u16) -> Self {
match prim {
0 => Self::VendorId,
2 => Self::DeviceId,
4 => Self::Command,
6 => Self::Status,
8 => Self::RevisionId,
9 => Self::ClassCodeIntr,
10 => Self::ClassCodeSub,
11 => Self::ClassCodeBase,
12 => Self::CacheLineSize,
13 => Self::LatencyTimer,
14 => Self::HeaderType,
15 => Self::Bist,
16 => Self::BaseAddresses,
40 => Self::CardbusCisPtr,
44 => Self::SubsystemVendorId,
46 => Self::SubsystemId,
48 => Self::ExpRomAddress,
52 => Self::CapabilitiesPtr,
60 => Self::InterruptLine,
61 => Self::InterruptPin,
62 => Self::MinGrant,
63 => Self::MaxLatency,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffff }
}
#[inline]
pub const fn into_primitive(self) -> u16 {
match self {
Self::VendorId => 0,
Self::DeviceId => 2,
Self::Command => 4,
Self::Status => 6,
Self::RevisionId => 8,
Self::ClassCodeIntr => 9,
Self::ClassCodeSub => 10,
Self::ClassCodeBase => 11,
Self::CacheLineSize => 12,
Self::LatencyTimer => 13,
Self::HeaderType => 14,
Self::Bist => 15,
Self::BaseAddresses => 16,
Self::CardbusCisPtr => 40,
Self::SubsystemVendorId => 44,
Self::SubsystemId => 46,
Self::ExpRomAddress => 48,
Self::CapabilitiesPtr => 52,
Self::InterruptLine => 60,
Self::InterruptPin => 61,
Self::MinGrant => 62,
Self::MaxLatency => 63,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum ExtendedCapabilityId {
Null,
AdvancedErrorReporting,
VirtualChannelNoMfvc,
DeviceSerialNumber,
PowerBudgeting,
RootComplexLinkDeclaration,
RootComplexInternalLinkControl,
RootComplexEventCollectorEndpointAssociation,
MultiFunctionVirtualChannel,
VirtualChannel,
Rcrb,
Vendor,
Cac,
Acs,
Ari,
Ats,
SrIov,
MrIov,
Multicast,
Pri,
EnhancedAllocation,
ResizableBar,
DynamicPowerAllocation,
Tph,
LatencyToleranceReporting,
SecondaryPciExpress,
Pmux,
Pasid,
Lnr,
Dpc,
L1PmSubstates,
PrecisionTimeMeasurement,
Mpcie,
FrsQueueing,
ReadinessTimeReporting,
DesignatedVendor,
VfResizableBar,
DataLinkFeature,
PhysicalLayer16,
LaneMarginingAtReceiver,
HierarchyId,
NativePcieEnclosure,
PhysicalLayer32,
AlternateProtocol,
SystemFirmwareIntermediary,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u16,
},
}
#[macro_export]
macro_rules! ExtendedCapabilityIdUnknown {
() => {
_
};
}
impl ExtendedCapabilityId {
#[inline]
pub fn from_primitive(prim: u16) -> Option<Self> {
match prim {
0 => Some(Self::Null),
1 => Some(Self::AdvancedErrorReporting),
2 => Some(Self::VirtualChannelNoMfvc),
3 => Some(Self::DeviceSerialNumber),
4 => Some(Self::PowerBudgeting),
5 => Some(Self::RootComplexLinkDeclaration),
6 => Some(Self::RootComplexInternalLinkControl),
7 => Some(Self::RootComplexEventCollectorEndpointAssociation),
8 => Some(Self::MultiFunctionVirtualChannel),
9 => Some(Self::VirtualChannel),
10 => Some(Self::Rcrb),
11 => Some(Self::Vendor),
12 => Some(Self::Cac),
13 => Some(Self::Acs),
14 => Some(Self::Ari),
15 => Some(Self::Ats),
16 => Some(Self::SrIov),
17 => Some(Self::MrIov),
18 => Some(Self::Multicast),
19 => Some(Self::Pri),
20 => Some(Self::EnhancedAllocation),
21 => Some(Self::ResizableBar),
22 => Some(Self::DynamicPowerAllocation),
23 => Some(Self::Tph),
24 => Some(Self::LatencyToleranceReporting),
25 => Some(Self::SecondaryPciExpress),
26 => Some(Self::Pmux),
27 => Some(Self::Pasid),
28 => Some(Self::Lnr),
29 => Some(Self::Dpc),
30 => Some(Self::L1PmSubstates),
31 => Some(Self::PrecisionTimeMeasurement),
32 => Some(Self::Mpcie),
33 => Some(Self::FrsQueueing),
34 => Some(Self::ReadinessTimeReporting),
35 => Some(Self::DesignatedVendor),
36 => Some(Self::VfResizableBar),
37 => Some(Self::DataLinkFeature),
38 => Some(Self::PhysicalLayer16),
39 => Some(Self::LaneMarginingAtReceiver),
40 => Some(Self::HierarchyId),
41 => Some(Self::NativePcieEnclosure),
42 => Some(Self::PhysicalLayer32),
43 => Some(Self::AlternateProtocol),
44 => Some(Self::SystemFirmwareIntermediary),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u16) -> Self {
match prim {
0 => Self::Null,
1 => Self::AdvancedErrorReporting,
2 => Self::VirtualChannelNoMfvc,
3 => Self::DeviceSerialNumber,
4 => Self::PowerBudgeting,
5 => Self::RootComplexLinkDeclaration,
6 => Self::RootComplexInternalLinkControl,
7 => Self::RootComplexEventCollectorEndpointAssociation,
8 => Self::MultiFunctionVirtualChannel,
9 => Self::VirtualChannel,
10 => Self::Rcrb,
11 => Self::Vendor,
12 => Self::Cac,
13 => Self::Acs,
14 => Self::Ari,
15 => Self::Ats,
16 => Self::SrIov,
17 => Self::MrIov,
18 => Self::Multicast,
19 => Self::Pri,
20 => Self::EnhancedAllocation,
21 => Self::ResizableBar,
22 => Self::DynamicPowerAllocation,
23 => Self::Tph,
24 => Self::LatencyToleranceReporting,
25 => Self::SecondaryPciExpress,
26 => Self::Pmux,
27 => Self::Pasid,
28 => Self::Lnr,
29 => Self::Dpc,
30 => Self::L1PmSubstates,
31 => Self::PrecisionTimeMeasurement,
32 => Self::Mpcie,
33 => Self::FrsQueueing,
34 => Self::ReadinessTimeReporting,
35 => Self::DesignatedVendor,
36 => Self::VfResizableBar,
37 => Self::DataLinkFeature,
38 => Self::PhysicalLayer16,
39 => Self::LaneMarginingAtReceiver,
40 => Self::HierarchyId,
41 => Self::NativePcieEnclosure,
42 => Self::PhysicalLayer32,
43 => Self::AlternateProtocol,
44 => Self::SystemFirmwareIntermediary,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffff }
}
#[inline]
pub const fn into_primitive(self) -> u16 {
match self {
Self::Null => 0,
Self::AdvancedErrorReporting => 1,
Self::VirtualChannelNoMfvc => 2,
Self::DeviceSerialNumber => 3,
Self::PowerBudgeting => 4,
Self::RootComplexLinkDeclaration => 5,
Self::RootComplexInternalLinkControl => 6,
Self::RootComplexEventCollectorEndpointAssociation => 7,
Self::MultiFunctionVirtualChannel => 8,
Self::VirtualChannel => 9,
Self::Rcrb => 10,
Self::Vendor => 11,
Self::Cac => 12,
Self::Acs => 13,
Self::Ari => 14,
Self::Ats => 15,
Self::SrIov => 16,
Self::MrIov => 17,
Self::Multicast => 18,
Self::Pri => 19,
Self::EnhancedAllocation => 20,
Self::ResizableBar => 21,
Self::DynamicPowerAllocation => 22,
Self::Tph => 23,
Self::LatencyToleranceReporting => 24,
Self::SecondaryPciExpress => 25,
Self::Pmux => 26,
Self::Pasid => 27,
Self::Lnr => 28,
Self::Dpc => 29,
Self::L1PmSubstates => 30,
Self::PrecisionTimeMeasurement => 31,
Self::Mpcie => 32,
Self::FrsQueueing => 33,
Self::ReadinessTimeReporting => 34,
Self::DesignatedVendor => 35,
Self::VfResizableBar => 36,
Self::DataLinkFeature => 37,
Self::PhysicalLayer16 => 38,
Self::LaneMarginingAtReceiver => 39,
Self::HierarchyId => 40,
Self::NativePcieEnclosure => 41,
Self::PhysicalLayer32 => 42,
Self::AlternateProtocol => 43,
Self::SystemFirmwareIntermediary => 44,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum HeaderType {
Standard,
Bridge,
CardBus,
Mask,
MultiFn,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! HeaderTypeUnknown {
() => {
_
};
}
impl HeaderType {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Standard),
1 => Some(Self::Bridge),
2 => Some(Self::CardBus),
127 => Some(Self::Mask),
128 => Some(Self::MultiFn),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
0 => Self::Standard,
1 => Self::Bridge,
2 => Self::CardBus,
127 => Self::Mask,
128 => Self::MultiFn,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Standard => 0,
Self::Bridge => 1,
Self::CardBus => 2,
Self::Mask => 127,
Self::MultiFn => 128,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum InterruptMode {
Disabled,
Legacy,
LegacyNoack,
Msi,
MsiX,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u8,
},
}
#[macro_export]
macro_rules! InterruptModeUnknown {
() => {
_
};
}
impl InterruptMode {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
0 => Some(Self::Disabled),
1 => Some(Self::Legacy),
2 => Some(Self::LegacyNoack),
3 => Some(Self::Msi),
4 => Some(Self::MsiX),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
0 => Self::Disabled,
1 => Self::Legacy,
2 => Self::LegacyNoack,
3 => Self::Msi,
4 => Self::MsiX,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Disabled => 0,
Self::Legacy => 1,
Self::LegacyNoack => 2,
Self::Msi => 3,
Self::MsiX => 4,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Address {
pub bus: u8,
pub device: u8,
pub function: u8,
}
impl fidl::Persistable for Address {}
#[derive(Debug, PartialEq)]
pub struct Bar {
pub bar_id: u32,
pub size: u64,
pub result: BarResult,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Bar {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BaseAddress {
pub address: u64,
pub size: u64,
pub is_memory: bool,
pub is_prefetchable: bool,
pub is_64bit: bool,
pub id: u8,
}
impl fidl::Persistable for BaseAddress {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BusGetDevicesResponse {
pub devices: Vec<PciDevice>,
}
impl fidl::Persistable for BusGetDevicesResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BusGetHostBridgeInfoResponse {
pub info: HostBridgeInfo,
}
impl fidl::Persistable for BusGetHostBridgeInfoResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BusReadBarRequest {
pub device: Address,
pub bar_id: u8,
pub offset: u64,
pub size: u64,
}
impl fidl::Persistable for BusReadBarRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct BusReadBarResponse {
pub buffer: Vec<u8>,
}
impl fidl::Persistable for BusReadBarResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct Capability {
pub id: u8,
pub offset: u8,
}
impl fidl::Persistable for Capability {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetBarRequest {
pub bar_id: u32,
}
impl fidl::Persistable for DeviceGetBarRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceGetBtiRequest {
pub index: u32,
}
impl fidl::Persistable for DeviceGetBtiRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetCapabilitiesRequest {
pub id: CapabilityId,
}
impl fidl::Persistable for DeviceGetCapabilitiesRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetCapabilitiesResponse {
pub offsets: Vec<u8>,
}
impl fidl::Persistable for DeviceGetCapabilitiesResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetDeviceInfoResponse {
pub info: DeviceInfo,
}
impl fidl::Persistable for DeviceGetDeviceInfoResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetExtendedCapabilitiesRequest {
pub id: ExtendedCapabilityId,
}
impl fidl::Persistable for DeviceGetExtendedCapabilitiesRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetExtendedCapabilitiesResponse {
pub offsets: Vec<u16>,
}
impl fidl::Persistable for DeviceGetExtendedCapabilitiesResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetInterruptModesResponse {
pub modes: InterruptModes,
}
impl fidl::Persistable for DeviceGetInterruptModesResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceInfo {
pub vendor_id: u16,
pub device_id: u16,
pub base_class: u8,
pub sub_class: u8,
pub program_interface: u8,
pub revision_id: u8,
pub bus_id: u8,
pub dev_id: u8,
pub func_id: u8,
pub padding: Padding,
}
impl fidl::Persistable for DeviceInfo {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceMapInterruptRequest {
pub which_irq: u32,
}
impl fidl::Persistable for DeviceMapInterruptRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceReadConfig16Request {
pub offset: u16,
}
impl fidl::Persistable for DeviceReadConfig16Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceReadConfig32Request {
pub offset: u16,
}
impl fidl::Persistable for DeviceReadConfig32Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceReadConfig8Request {
pub offset: u16,
}
impl fidl::Persistable for DeviceReadConfig8Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceSetBusMasteringRequest {
pub enabled: bool,
}
impl fidl::Persistable for DeviceSetBusMasteringRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceSetInterruptModeRequest {
pub mode: InterruptMode,
pub requested_irq_count: u32,
}
impl fidl::Persistable for DeviceSetInterruptModeRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceWriteConfig16Request {
pub offset: u16,
pub value: u16,
}
impl fidl::Persistable for DeviceWriteConfig16Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceWriteConfig32Request {
pub offset: u16,
pub value: u32,
}
impl fidl::Persistable for DeviceWriteConfig32Request {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceWriteConfig8Request {
pub offset: u16,
pub value: u8,
}
impl fidl::Persistable for DeviceWriteConfig8Request {}
#[derive(Debug, PartialEq)]
pub struct DeviceGetBarResponse {
pub result: Bar,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetBarResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceGetBtiResponse {
pub bti: fidl::Bti,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DeviceGetBtiResponse {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct DeviceMapInterruptResponse {
pub interrupt: fidl::Interrupt,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceMapInterruptResponse
{
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceReadConfig16Response {
pub value: u16,
}
impl fidl::Persistable for DeviceReadConfig16Response {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceReadConfig32Response {
pub value: u32,
}
impl fidl::Persistable for DeviceReadConfig32Response {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct DeviceReadConfig8Response {
pub value: u8,
}
impl fidl::Persistable for DeviceReadConfig8Response {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct ExtendedCapability {
pub id: u16,
pub offset: u16,
}
impl fidl::Persistable for ExtendedCapability {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct HostBridgeInfo {
pub name: String,
pub start_bus_number: u8,
pub end_bus_number: u8,
pub segment_group: u16,
}
impl fidl::Persistable for HostBridgeInfo {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct InterruptModes {
pub has_legacy: bool,
pub msi_count: u8,
pub msix_count: u16,
}
impl fidl::Persistable for InterruptModes {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct IoBar {
pub address: u64,
pub resource: fidl::Resource,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for IoBar {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Padding;
impl fidl::Persistable for Padding {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct PciDevice {
pub base_addresses: Vec<BaseAddress>,
pub capabilities: Vec<Capability>,
pub ext_capabilities: Vec<ExtendedCapability>,
pub config: Vec<u8>,
pub bus_id: u8,
pub device_id: u8,
pub function_id: u8,
}
impl fidl::Persistable for PciDevice {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct UseIntxWorkaroundType;
impl fidl::Persistable for UseIntxWorkaroundType {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct BoardConfiguration {
pub use_intx_workaround: Option<UseIntxWorkaroundType>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for BoardConfiguration {}
#[derive(Debug)]
pub enum BarResult {
Io(IoBar),
Vmo(fidl::Vmo),
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u64,
},
}
#[macro_export]
macro_rules! BarResultUnknown {
() => {
_
};
}
impl PartialEq for BarResult {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(Self::Io(x), Self::Io(y)) => *x == *y,
(Self::Vmo(x), Self::Vmo(y)) => *x == *y,
_ => false,
}
}
}
impl BarResult {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::Io(_) => 1,
Self::Vmo(_) => 2,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn unknown_variant_for_testing() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { .. } => true,
_ => false,
}
}
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for BarResult {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BusMarker;
impl fidl::endpoints::ProtocolMarker for BusMarker {
type Proxy = BusProxy;
type RequestStream = BusRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BusSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.hardware.pci.Bus";
}
impl fidl::endpoints::DiscoverableProtocolMarker for BusMarker {}
pub type BusReadBarResult = Result<Vec<u8>, i32>;
pub trait BusProxyInterface: Send + Sync {
type GetHostBridgeInfoResponseFut: std::future::Future<Output = Result<HostBridgeInfo, fidl::Error>>
+ Send;
fn r#get_host_bridge_info(&self) -> Self::GetHostBridgeInfoResponseFut;
type GetDevicesResponseFut: std::future::Future<Output = Result<Vec<PciDevice>, fidl::Error>>
+ Send;
fn r#get_devices(&self) -> Self::GetDevicesResponseFut;
type ReadBarResponseFut: std::future::Future<Output = Result<BusReadBarResult, fidl::Error>>
+ Send;
fn r#read_bar(
&self,
device: &Address,
bar_id: u8,
offset: u64,
size: u64,
) -> Self::ReadBarResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BusSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BusSynchronousProxy {
type Proxy = BusProxy;
type Protocol = BusMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl BusSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<BusEvent, fidl::Error> {
BusEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_host_bridge_info(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<HostBridgeInfo, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, BusGetHostBridgeInfoResponse>(
(),
0x39f0b21bcd8c065d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.info)
}
pub fn r#get_devices(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<PciDevice>, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, BusGetDevicesResponse>(
(),
0x2b39a32926007c92,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.devices)
}
pub fn r#read_bar(
&self,
mut device: &Address,
mut bar_id: u8,
mut offset: u64,
mut size: u64,
___deadline: zx::MonotonicInstant,
) -> Result<BusReadBarResult, fidl::Error> {
let _response = self
.client
.send_query::<BusReadBarRequest, fidl::encoding::ResultType<BusReadBarResponse, i32>>(
(device, bar_id, offset, size),
0x798f39b0dfdc4860,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.buffer))
}
}
#[derive(Debug, Clone)]
pub struct BusProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for BusProxy {
type Protocol = BusMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl BusProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BusEventStream {
BusEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_host_bridge_info(
&self,
) -> fidl::client::QueryResponseFut<HostBridgeInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
{
BusProxyInterface::r#get_host_bridge_info(self)
}
pub fn r#get_devices(
&self,
) -> fidl::client::QueryResponseFut<Vec<PciDevice>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
BusProxyInterface::r#get_devices(self)
}
pub fn r#read_bar(
&self,
mut device: &Address,
mut bar_id: u8,
mut offset: u64,
mut size: u64,
) -> fidl::client::QueryResponseFut<
BusReadBarResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
BusProxyInterface::r#read_bar(self, device, bar_id, offset, size)
}
}
impl BusProxyInterface for BusProxy {
type GetHostBridgeInfoResponseFut = fidl::client::QueryResponseFut<
HostBridgeInfo,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_host_bridge_info(&self) -> Self::GetHostBridgeInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<HostBridgeInfo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
BusGetHostBridgeInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x39f0b21bcd8c065d,
>(_buf?)?;
Ok(_response.info)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HostBridgeInfo>(
(),
0x39f0b21bcd8c065d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetDevicesResponseFut = fidl::client::QueryResponseFut<
Vec<PciDevice>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_devices(&self) -> Self::GetDevicesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<PciDevice>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
BusGetDevicesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2b39a32926007c92,
>(_buf?)?;
Ok(_response.devices)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<PciDevice>>(
(),
0x2b39a32926007c92,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadBarResponseFut = fidl::client::QueryResponseFut<
BusReadBarResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_bar(
&self,
mut device: &Address,
mut bar_id: u8,
mut offset: u64,
mut size: u64,
) -> Self::ReadBarResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<BusReadBarResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<BusReadBarResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x798f39b0dfdc4860,
>(_buf?)?;
Ok(_response.map(|x| x.buffer))
}
self.client.send_query_and_decode::<BusReadBarRequest, BusReadBarResult>(
(device, bar_id, offset, size),
0x798f39b0dfdc4860,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BusEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for BusEventStream {}
impl futures::stream::FusedStream for BusEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BusEventStream {
type Item = Result<BusEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(BusEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BusEvent {}
impl BusEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<BusEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BusRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for BusRequestStream {}
impl futures::stream::FusedStream for BusRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BusRequestStream {
type Protocol = BusMarker;
type ControlHandle = BusControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
BusControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BusRequestStream {
type Item = Result<BusRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled BusRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x39f0b21bcd8c065d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = BusControlHandle { inner: this.inner.clone() };
Ok(BusRequest::GetHostBridgeInfo {
responder: BusGetHostBridgeInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2b39a32926007c92 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = BusControlHandle { inner: this.inner.clone() };
Ok(BusRequest::GetDevices {
responder: BusGetDevicesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x798f39b0dfdc4860 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
BusReadBarRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BusReadBarRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = BusControlHandle { inner: this.inner.clone() };
Ok(BusRequest::ReadBar {
device: req.device,
bar_id: req.bar_id,
offset: req.offset,
size: req.size,
responder: BusReadBarResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <BusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum BusRequest {
GetHostBridgeInfo { responder: BusGetHostBridgeInfoResponder },
GetDevices { responder: BusGetDevicesResponder },
ReadBar { device: Address, bar_id: u8, offset: u64, size: u64, responder: BusReadBarResponder },
}
impl BusRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_host_bridge_info(self) -> Option<(BusGetHostBridgeInfoResponder)> {
if let BusRequest::GetHostBridgeInfo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_devices(self) -> Option<(BusGetDevicesResponder)> {
if let BusRequest::GetDevices { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_bar(self) -> Option<(Address, u8, u64, u64, BusReadBarResponder)> {
if let BusRequest::ReadBar { device, bar_id, offset, size, responder } = self {
Some((device, bar_id, offset, size, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BusRequest::GetHostBridgeInfo { .. } => "get_host_bridge_info",
BusRequest::GetDevices { .. } => "get_devices",
BusRequest::ReadBar { .. } => "read_bar",
}
}
}
#[derive(Debug, Clone)]
pub struct BusControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for BusControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl BusControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BusGetHostBridgeInfoResponder {
control_handle: std::mem::ManuallyDrop<BusControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BusGetHostBridgeInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BusGetHostBridgeInfoResponder {
type ControlHandle = BusControlHandle;
fn control_handle(&self) -> &BusControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BusGetHostBridgeInfoResponder {
pub fn send(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(info);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut info: &HostBridgeInfo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<BusGetHostBridgeInfoResponse>(
(info,),
self.tx_id,
0x39f0b21bcd8c065d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BusGetDevicesResponder {
control_handle: std::mem::ManuallyDrop<BusControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BusGetDevicesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BusGetDevicesResponder {
type ControlHandle = BusControlHandle;
fn control_handle(&self) -> &BusControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BusGetDevicesResponder {
pub fn send(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
let _result = self.send_raw(devices);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
let _result = self.send_raw(devices);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut devices: &[PciDevice]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<BusGetDevicesResponse>(
(devices,),
self.tx_id,
0x2b39a32926007c92,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BusReadBarResponder {
control_handle: std::mem::ManuallyDrop<BusControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BusReadBarResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BusReadBarResponder {
type ControlHandle = BusControlHandle;
fn control_handle(&self) -> &BusControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BusReadBarResponder {
pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<&[u8], i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<BusReadBarResponse, i32>>(
result.map(|buffer| (buffer,)),
self.tx_id,
0x798f39b0dfdc4860,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeviceMarker;
impl fidl::endpoints::ProtocolMarker for DeviceMarker {
type Proxy = DeviceProxy;
type RequestStream = DeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.hardware.pci.Device";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DeviceMarker {}
pub type DeviceGetBarResult = Result<Bar, i32>;
pub type DeviceSetBusMasteringResult = Result<(), i32>;
pub type DeviceResetDeviceResult = Result<(), i32>;
pub type DeviceAckInterruptResult = Result<(), i32>;
pub type DeviceMapInterruptResult = Result<fidl::Interrupt, i32>;
pub type DeviceSetInterruptModeResult = Result<(), i32>;
pub type DeviceReadConfig8Result = Result<u8, i32>;
pub type DeviceReadConfig16Result = Result<u16, i32>;
pub type DeviceReadConfig32Result = Result<u32, i32>;
pub type DeviceWriteConfig8Result = Result<(), i32>;
pub type DeviceWriteConfig16Result = Result<(), i32>;
pub type DeviceWriteConfig32Result = Result<(), i32>;
pub type DeviceGetBtiResult = Result<fidl::Bti, i32>;
pub trait DeviceProxyInterface: Send + Sync {
type GetDeviceInfoResponseFut: std::future::Future<Output = Result<DeviceInfo, fidl::Error>>
+ Send;
fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut;
type GetBarResponseFut: std::future::Future<Output = Result<DeviceGetBarResult, fidl::Error>>
+ Send;
fn r#get_bar(&self, bar_id: u32) -> Self::GetBarResponseFut;
type SetBusMasteringResponseFut: std::future::Future<Output = Result<DeviceSetBusMasteringResult, fidl::Error>>
+ Send;
fn r#set_bus_mastering(&self, enabled: bool) -> Self::SetBusMasteringResponseFut;
type ResetDeviceResponseFut: std::future::Future<Output = Result<DeviceResetDeviceResult, fidl::Error>>
+ Send;
fn r#reset_device(&self) -> Self::ResetDeviceResponseFut;
type AckInterruptResponseFut: std::future::Future<Output = Result<DeviceAckInterruptResult, fidl::Error>>
+ Send;
fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut;
type MapInterruptResponseFut: std::future::Future<Output = Result<DeviceMapInterruptResult, fidl::Error>>
+ Send;
fn r#map_interrupt(&self, which_irq: u32) -> Self::MapInterruptResponseFut;
type GetInterruptModesResponseFut: std::future::Future<Output = Result<InterruptModes, fidl::Error>>
+ Send;
fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut;
type SetInterruptModeResponseFut: std::future::Future<Output = Result<DeviceSetInterruptModeResult, fidl::Error>>
+ Send;
fn r#set_interrupt_mode(
&self,
mode: InterruptMode,
requested_irq_count: u32,
) -> Self::SetInterruptModeResponseFut;
type ReadConfig8ResponseFut: std::future::Future<Output = Result<DeviceReadConfig8Result, fidl::Error>>
+ Send;
fn r#read_config8(&self, offset: u16) -> Self::ReadConfig8ResponseFut;
type ReadConfig16ResponseFut: std::future::Future<Output = Result<DeviceReadConfig16Result, fidl::Error>>
+ Send;
fn r#read_config16(&self, offset: u16) -> Self::ReadConfig16ResponseFut;
type ReadConfig32ResponseFut: std::future::Future<Output = Result<DeviceReadConfig32Result, fidl::Error>>
+ Send;
fn r#read_config32(&self, offset: u16) -> Self::ReadConfig32ResponseFut;
type WriteConfig8ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig8Result, fidl::Error>>
+ Send;
fn r#write_config8(&self, offset: u16, value: u8) -> Self::WriteConfig8ResponseFut;
type WriteConfig16ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig16Result, fidl::Error>>
+ Send;
fn r#write_config16(&self, offset: u16, value: u16) -> Self::WriteConfig16ResponseFut;
type WriteConfig32ResponseFut: std::future::Future<Output = Result<DeviceWriteConfig32Result, fidl::Error>>
+ Send;
fn r#write_config32(&self, offset: u16, value: u32) -> Self::WriteConfig32ResponseFut;
type GetCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>>
+ Send;
fn r#get_capabilities(&self, id: CapabilityId) -> Self::GetCapabilitiesResponseFut;
type GetExtendedCapabilitiesResponseFut: std::future::Future<Output = Result<Vec<u16>, fidl::Error>>
+ Send;
fn r#get_extended_capabilities(
&self,
id: ExtendedCapabilityId,
) -> Self::GetExtendedCapabilitiesResponseFut;
type GetBtiResponseFut: std::future::Future<Output = Result<DeviceGetBtiResult, fidl::Error>>
+ Send;
fn r#get_bti(&self, index: u32) -> Self::GetBtiResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
type Proxy = DeviceProxy;
type Protocol = DeviceMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl DeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<DeviceEvent, fidl::Error> {
DeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_device_info(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceInfo, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetDeviceInfoResponse>(
(),
0x5599d144d4329916,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.info)
}
pub fn r#get_bar(
&self,
mut bar_id: u32,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceGetBarResult, fidl::Error> {
let _response = self.client.send_query::<
DeviceGetBarRequest,
fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
>(
(bar_id,),
0x6b2683f6fbbff679,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.result))
}
pub fn r#set_bus_mastering(
&self,
mut enabled: bool,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
let _response = self.client.send_query::<
DeviceSetBusMasteringRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(enabled,),
0x3421e9e030211003,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#reset_device(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceResetDeviceResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x3c5b7579bb6f8b9f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#ack_interrupt(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceAckInterruptResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(),
0x70742f64692d5a6b,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#map_interrupt(
&self,
mut which_irq: u32,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceMapInterruptResult, fidl::Error> {
let _response = self.client.send_query::<
DeviceMapInterruptRequest,
fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
>(
(which_irq,),
0x25eeff9d34a1fa13,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.interrupt))
}
pub fn r#get_interrupt_modes(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<InterruptModes, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, DeviceGetInterruptModesResponse>(
(),
0x93f4cd8f79e9f4a,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.modes)
}
pub fn r#set_interrupt_mode(
&self,
mut mode: InterruptMode,
mut requested_irq_count: u32,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
let _response = self.client.send_query::<
DeviceSetInterruptModeRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(mode, requested_irq_count,),
0x85bebad3eb24866,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#read_config8(
&self,
mut offset: u16,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceReadConfig8Result, fidl::Error> {
let _response = self.client.send_query::<
DeviceReadConfig8Request,
fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
>(
(offset,),
0x28f9eb9e6dadda1c,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.value))
}
pub fn r#read_config16(
&self,
mut offset: u16,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceReadConfig16Result, fidl::Error> {
let _response = self.client.send_query::<
DeviceReadConfig16Request,
fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
>(
(offset,),
0x3bcda6171a3270bb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.value))
}
pub fn r#read_config32(
&self,
mut offset: u16,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceReadConfig32Result, fidl::Error> {
let _response = self.client.send_query::<
DeviceReadConfig32Request,
fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
>(
(offset,),
0x55357535402f7507,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.value))
}
pub fn r#write_config8(
&self,
mut offset: u16,
mut value: u8,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceWriteConfig8Result, fidl::Error> {
let _response = self.client.send_query::<
DeviceWriteConfig8Request,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(offset, value,),
0x49a0719e1433cff,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#write_config16(
&self,
mut offset: u16,
mut value: u16,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceWriteConfig16Result, fidl::Error> {
let _response = self.client.send_query::<
DeviceWriteConfig16Request,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(offset, value,),
0x3e30bf13f1c07eff,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#write_config32(
&self,
mut offset: u16,
mut value: u32,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceWriteConfig32Result, fidl::Error> {
let _response = self.client.send_query::<
DeviceWriteConfig32Request,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
(offset, value,),
0x161584e5199b388,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_capabilities(
&self,
mut id: CapabilityId,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<u8>, fidl::Error> {
let _response =
self.client.send_query::<DeviceGetCapabilitiesRequest, DeviceGetCapabilitiesResponse>(
(id,),
0x3a050fde46f3ba0f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.offsets)
}
pub fn r#get_extended_capabilities(
&self,
mut id: ExtendedCapabilityId,
___deadline: zx::MonotonicInstant,
) -> Result<Vec<u16>, fidl::Error> {
let _response = self.client.send_query::<
DeviceGetExtendedCapabilitiesRequest,
DeviceGetExtendedCapabilitiesResponse,
>(
(id,),
0xb8573efcaae0c39,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.offsets)
}
pub fn r#get_bti(
&self,
mut index: u32,
___deadline: zx::MonotonicInstant,
) -> Result<DeviceGetBtiResult, fidl::Error> {
let _response = self.client.send_query::<
DeviceGetBtiRequest,
fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
>(
(index,),
0x5e4fe9efb12d9ee3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.bti))
}
}
#[derive(Debug, Clone)]
pub struct DeviceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DeviceProxy {
type Protocol = DeviceMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl DeviceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeviceEventStream {
DeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_device_info(
&self,
) -> fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>
{
DeviceProxyInterface::r#get_device_info(self)
}
pub fn r#get_bar(
&self,
mut bar_id: u32,
) -> fidl::client::QueryResponseFut<
DeviceGetBarResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#get_bar(self, bar_id)
}
pub fn r#set_bus_mastering(
&self,
mut enabled: bool,
) -> fidl::client::QueryResponseFut<
DeviceSetBusMasteringResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#set_bus_mastering(self, enabled)
}
pub fn r#reset_device(
&self,
) -> fidl::client::QueryResponseFut<
DeviceResetDeviceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#reset_device(self)
}
pub fn r#ack_interrupt(
&self,
) -> fidl::client::QueryResponseFut<
DeviceAckInterruptResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#ack_interrupt(self)
}
pub fn r#map_interrupt(
&self,
mut which_irq: u32,
) -> fidl::client::QueryResponseFut<
DeviceMapInterruptResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#map_interrupt(self, which_irq)
}
pub fn r#get_interrupt_modes(
&self,
) -> fidl::client::QueryResponseFut<InterruptModes, fidl::encoding::DefaultFuchsiaResourceDialect>
{
DeviceProxyInterface::r#get_interrupt_modes(self)
}
pub fn r#set_interrupt_mode(
&self,
mut mode: InterruptMode,
mut requested_irq_count: u32,
) -> fidl::client::QueryResponseFut<
DeviceSetInterruptModeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#set_interrupt_mode(self, mode, requested_irq_count)
}
pub fn r#read_config8(
&self,
mut offset: u16,
) -> fidl::client::QueryResponseFut<
DeviceReadConfig8Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#read_config8(self, offset)
}
pub fn r#read_config16(
&self,
mut offset: u16,
) -> fidl::client::QueryResponseFut<
DeviceReadConfig16Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#read_config16(self, offset)
}
pub fn r#read_config32(
&self,
mut offset: u16,
) -> fidl::client::QueryResponseFut<
DeviceReadConfig32Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#read_config32(self, offset)
}
pub fn r#write_config8(
&self,
mut offset: u16,
mut value: u8,
) -> fidl::client::QueryResponseFut<
DeviceWriteConfig8Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#write_config8(self, offset, value)
}
pub fn r#write_config16(
&self,
mut offset: u16,
mut value: u16,
) -> fidl::client::QueryResponseFut<
DeviceWriteConfig16Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#write_config16(self, offset, value)
}
pub fn r#write_config32(
&self,
mut offset: u16,
mut value: u32,
) -> fidl::client::QueryResponseFut<
DeviceWriteConfig32Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#write_config32(self, offset, value)
}
pub fn r#get_capabilities(
&self,
mut id: CapabilityId,
) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
DeviceProxyInterface::r#get_capabilities(self, id)
}
pub fn r#get_extended_capabilities(
&self,
mut id: ExtendedCapabilityId,
) -> fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>
{
DeviceProxyInterface::r#get_extended_capabilities(self, id)
}
pub fn r#get_bti(
&self,
mut index: u32,
) -> fidl::client::QueryResponseFut<
DeviceGetBtiResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeviceProxyInterface::r#get_bti(self, index)
}
}
impl DeviceProxyInterface for DeviceProxy {
type GetDeviceInfoResponseFut =
fidl::client::QueryResponseFut<DeviceInfo, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_device_info(&self) -> Self::GetDeviceInfoResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceInfo, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetDeviceInfoResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5599d144d4329916,
>(_buf?)?;
Ok(_response.info)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceInfo>(
(),
0x5599d144d4329916,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetBarResponseFut = fidl::client::QueryResponseFut<
DeviceGetBarResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_bar(&self, mut bar_id: u32) -> Self::GetBarResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceGetBarResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceGetBarResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6b2683f6fbbff679,
>(_buf?)?;
Ok(_response.map(|x| x.result))
}
self.client.send_query_and_decode::<DeviceGetBarRequest, DeviceGetBarResult>(
(bar_id,),
0x6b2683f6fbbff679,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetBusMasteringResponseFut = fidl::client::QueryResponseFut<
DeviceSetBusMasteringResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_bus_mastering(&self, mut enabled: bool) -> Self::SetBusMasteringResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceSetBusMasteringResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3421e9e030211003,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<DeviceSetBusMasteringRequest, DeviceSetBusMasteringResult>(
(enabled,),
0x3421e9e030211003,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ResetDeviceResponseFut = fidl::client::QueryResponseFut<
DeviceResetDeviceResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#reset_device(&self) -> Self::ResetDeviceResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceResetDeviceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3c5b7579bb6f8b9f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceResetDeviceResult>(
(),
0x3c5b7579bb6f8b9f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AckInterruptResponseFut = fidl::client::QueryResponseFut<
DeviceAckInterruptResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#ack_interrupt(&self) -> Self::AckInterruptResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceAckInterruptResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x70742f64692d5a6b,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceAckInterruptResult>(
(),
0x70742f64692d5a6b,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type MapInterruptResponseFut = fidl::client::QueryResponseFut<
DeviceMapInterruptResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#map_interrupt(&self, mut which_irq: u32) -> Self::MapInterruptResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceMapInterruptResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x25eeff9d34a1fa13,
>(_buf?)?;
Ok(_response.map(|x| x.interrupt))
}
self.client.send_query_and_decode::<DeviceMapInterruptRequest, DeviceMapInterruptResult>(
(which_irq,),
0x25eeff9d34a1fa13,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetInterruptModesResponseFut = fidl::client::QueryResponseFut<
InterruptModes,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_interrupt_modes(&self) -> Self::GetInterruptModesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<InterruptModes, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetInterruptModesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x93f4cd8f79e9f4a,
>(_buf?)?;
Ok(_response.modes)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, InterruptModes>(
(),
0x93f4cd8f79e9f4a,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetInterruptModeResponseFut = fidl::client::QueryResponseFut<
DeviceSetInterruptModeResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_interrupt_mode(
&self,
mut mode: InterruptMode,
mut requested_irq_count: u32,
) -> Self::SetInterruptModeResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceSetInterruptModeResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x85bebad3eb24866,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<DeviceSetInterruptModeRequest, DeviceSetInterruptModeResult>(
(mode, requested_irq_count),
0x85bebad3eb24866,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadConfig8ResponseFut = fidl::client::QueryResponseFut<
DeviceReadConfig8Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_config8(&self, mut offset: u16) -> Self::ReadConfig8ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceReadConfig8Result, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceReadConfig8Response, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x28f9eb9e6dadda1c,
>(_buf?)?;
Ok(_response.map(|x| x.value))
}
self.client.send_query_and_decode::<DeviceReadConfig8Request, DeviceReadConfig8Result>(
(offset,),
0x28f9eb9e6dadda1c,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadConfig16ResponseFut = fidl::client::QueryResponseFut<
DeviceReadConfig16Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_config16(&self, mut offset: u16) -> Self::ReadConfig16ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceReadConfig16Result, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceReadConfig16Response, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3bcda6171a3270bb,
>(_buf?)?;
Ok(_response.map(|x| x.value))
}
self.client.send_query_and_decode::<DeviceReadConfig16Request, DeviceReadConfig16Result>(
(offset,),
0x3bcda6171a3270bb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ReadConfig32ResponseFut = fidl::client::QueryResponseFut<
DeviceReadConfig32Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#read_config32(&self, mut offset: u16) -> Self::ReadConfig32ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceReadConfig32Result, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceReadConfig32Response, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x55357535402f7507,
>(_buf?)?;
Ok(_response.map(|x| x.value))
}
self.client.send_query_and_decode::<DeviceReadConfig32Request, DeviceReadConfig32Result>(
(offset,),
0x55357535402f7507,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteConfig8ResponseFut = fidl::client::QueryResponseFut<
DeviceWriteConfig8Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_config8(&self, mut offset: u16, mut value: u8) -> Self::WriteConfig8ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceWriteConfig8Result, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x49a0719e1433cff,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DeviceWriteConfig8Request, DeviceWriteConfig8Result>(
(offset, value),
0x49a0719e1433cff,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteConfig16ResponseFut = fidl::client::QueryResponseFut<
DeviceWriteConfig16Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_config16(&self, mut offset: u16, mut value: u16) -> Self::WriteConfig16ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceWriteConfig16Result, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3e30bf13f1c07eff,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DeviceWriteConfig16Request, DeviceWriteConfig16Result>(
(offset, value),
0x3e30bf13f1c07eff,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WriteConfig32ResponseFut = fidl::client::QueryResponseFut<
DeviceWriteConfig32Result,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#write_config32(&self, mut offset: u16, mut value: u32) -> Self::WriteConfig32ResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceWriteConfig32Result, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x161584e5199b388,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<DeviceWriteConfig32Request, DeviceWriteConfig32Result>(
(offset, value),
0x161584e5199b388,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetCapabilitiesResponseFut =
fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_capabilities(&self, mut id: CapabilityId) -> Self::GetCapabilitiesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<u8>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetCapabilitiesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3a050fde46f3ba0f,
>(_buf?)?;
Ok(_response.offsets)
}
self.client.send_query_and_decode::<DeviceGetCapabilitiesRequest, Vec<u8>>(
(id,),
0x3a050fde46f3ba0f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetExtendedCapabilitiesResponseFut =
fidl::client::QueryResponseFut<Vec<u16>, fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#get_extended_capabilities(
&self,
mut id: ExtendedCapabilityId,
) -> Self::GetExtendedCapabilitiesResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Vec<u16>, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
DeviceGetExtendedCapabilitiesResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0xb8573efcaae0c39,
>(_buf?)?;
Ok(_response.offsets)
}
self.client.send_query_and_decode::<DeviceGetExtendedCapabilitiesRequest, Vec<u16>>(
(id,),
0xb8573efcaae0c39,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetBtiResponseFut = fidl::client::QueryResponseFut<
DeviceGetBtiResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_bti(&self, mut index: u32) -> Self::GetBtiResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeviceGetBtiResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<DeviceGetBtiResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5e4fe9efb12d9ee3,
>(_buf?)?;
Ok(_response.map(|x| x.bti))
}
self.client.send_query_and_decode::<DeviceGetBtiRequest, DeviceGetBtiResult>(
(index,),
0x5e4fe9efb12d9ee3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DeviceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DeviceEventStream {}
impl futures::stream::FusedStream for DeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeviceEventStream {
type Item = Result<DeviceEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeviceEvent {}
impl DeviceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DeviceEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DeviceRequestStream {}
impl futures::stream::FusedStream for DeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeviceRequestStream {
type Protocol = DeviceMarker;
type ControlHandle = DeviceControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
DeviceControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for DeviceRequestStream {
type Item = Result<DeviceRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled DeviceRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5599d144d4329916 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetDeviceInfo {
responder: DeviceGetDeviceInfoResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6b2683f6fbbff679 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceGetBarRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBarRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetBar {
bar_id: req.bar_id,
responder: DeviceGetBarResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3421e9e030211003 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceSetBusMasteringRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetBusMasteringRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::SetBusMastering {
enabled: req.enabled,
responder: DeviceSetBusMasteringResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3c5b7579bb6f8b9f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::ResetDevice {
responder: DeviceResetDeviceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x70742f64692d5a6b => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::AckInterrupt {
responder: DeviceAckInterruptResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x25eeff9d34a1fa13 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceMapInterruptRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceMapInterruptRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::MapInterrupt {
which_irq: req.which_irq,
responder: DeviceMapInterruptResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x93f4cd8f79e9f4a => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetInterruptModes {
responder: DeviceGetInterruptModesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x85bebad3eb24866 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceSetInterruptModeRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetInterruptModeRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::SetInterruptMode {
mode: req.mode,
requested_irq_count: req.requested_irq_count,
responder: DeviceSetInterruptModeResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x28f9eb9e6dadda1c => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceReadConfig8Request,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig8Request>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::ReadConfig8 {
offset: req.offset,
responder: DeviceReadConfig8Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3bcda6171a3270bb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceReadConfig16Request,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig16Request>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::ReadConfig16 {
offset: req.offset,
responder: DeviceReadConfig16Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x55357535402f7507 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceReadConfig32Request,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceReadConfig32Request>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::ReadConfig32 {
offset: req.offset,
responder: DeviceReadConfig32Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x49a0719e1433cff => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceWriteConfig8Request,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig8Request>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::WriteConfig8 {
offset: req.offset,
value: req.value,
responder: DeviceWriteConfig8Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3e30bf13f1c07eff => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceWriteConfig16Request,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig16Request>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::WriteConfig16 {
offset: req.offset,
value: req.value,
responder: DeviceWriteConfig16Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x161584e5199b388 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceWriteConfig32Request,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceWriteConfig32Request>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::WriteConfig32 {
offset: req.offset,
value: req.value,
responder: DeviceWriteConfig32Responder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3a050fde46f3ba0f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceGetCapabilitiesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetCapabilities {
id: req.id,
responder: DeviceGetCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0xb8573efcaae0c39 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceGetExtendedCapabilitiesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetExtendedCapabilitiesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetExtendedCapabilities {
id: req.id,
responder: DeviceGetExtendedCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x5e4fe9efb12d9ee3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeviceGetBtiRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetBtiRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeviceControlHandle { inner: this.inner.clone() };
Ok(DeviceRequest::GetBti {
index: req.index,
responder: DeviceGetBtiResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DeviceRequest {
GetDeviceInfo { responder: DeviceGetDeviceInfoResponder },
GetBar { bar_id: u32, responder: DeviceGetBarResponder },
SetBusMastering { enabled: bool, responder: DeviceSetBusMasteringResponder },
ResetDevice { responder: DeviceResetDeviceResponder },
AckInterrupt { responder: DeviceAckInterruptResponder },
MapInterrupt { which_irq: u32, responder: DeviceMapInterruptResponder },
GetInterruptModes { responder: DeviceGetInterruptModesResponder },
SetInterruptMode {
mode: InterruptMode,
requested_irq_count: u32,
responder: DeviceSetInterruptModeResponder,
},
ReadConfig8 { offset: u16, responder: DeviceReadConfig8Responder },
ReadConfig16 { offset: u16, responder: DeviceReadConfig16Responder },
ReadConfig32 { offset: u16, responder: DeviceReadConfig32Responder },
WriteConfig8 { offset: u16, value: u8, responder: DeviceWriteConfig8Responder },
WriteConfig16 { offset: u16, value: u16, responder: DeviceWriteConfig16Responder },
WriteConfig32 { offset: u16, value: u32, responder: DeviceWriteConfig32Responder },
GetCapabilities { id: CapabilityId, responder: DeviceGetCapabilitiesResponder },
GetExtendedCapabilities {
id: ExtendedCapabilityId,
responder: DeviceGetExtendedCapabilitiesResponder,
},
GetBti { index: u32, responder: DeviceGetBtiResponder },
}
impl DeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_device_info(self) -> Option<(DeviceGetDeviceInfoResponder)> {
if let DeviceRequest::GetDeviceInfo { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_bar(self) -> Option<(u32, DeviceGetBarResponder)> {
if let DeviceRequest::GetBar { bar_id, responder } = self {
Some((bar_id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_bus_mastering(self) -> Option<(bool, DeviceSetBusMasteringResponder)> {
if let DeviceRequest::SetBusMastering { enabled, responder } = self {
Some((enabled, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_reset_device(self) -> Option<(DeviceResetDeviceResponder)> {
if let DeviceRequest::ResetDevice { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_ack_interrupt(self) -> Option<(DeviceAckInterruptResponder)> {
if let DeviceRequest::AckInterrupt { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_map_interrupt(self) -> Option<(u32, DeviceMapInterruptResponder)> {
if let DeviceRequest::MapInterrupt { which_irq, responder } = self {
Some((which_irq, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_interrupt_modes(self) -> Option<(DeviceGetInterruptModesResponder)> {
if let DeviceRequest::GetInterruptModes { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_interrupt_mode(
self,
) -> Option<(InterruptMode, u32, DeviceSetInterruptModeResponder)> {
if let DeviceRequest::SetInterruptMode { mode, requested_irq_count, responder } = self {
Some((mode, requested_irq_count, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_config8(self) -> Option<(u16, DeviceReadConfig8Responder)> {
if let DeviceRequest::ReadConfig8 { offset, responder } = self {
Some((offset, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_config16(self) -> Option<(u16, DeviceReadConfig16Responder)> {
if let DeviceRequest::ReadConfig16 { offset, responder } = self {
Some((offset, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_read_config32(self) -> Option<(u16, DeviceReadConfig32Responder)> {
if let DeviceRequest::ReadConfig32 { offset, responder } = self {
Some((offset, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_config8(self) -> Option<(u16, u8, DeviceWriteConfig8Responder)> {
if let DeviceRequest::WriteConfig8 { offset, value, responder } = self {
Some((offset, value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_config16(self) -> Option<(u16, u16, DeviceWriteConfig16Responder)> {
if let DeviceRequest::WriteConfig16 { offset, value, responder } = self {
Some((offset, value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_write_config32(self) -> Option<(u16, u32, DeviceWriteConfig32Responder)> {
if let DeviceRequest::WriteConfig32 { offset, value, responder } = self {
Some((offset, value, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_capabilities(self) -> Option<(CapabilityId, DeviceGetCapabilitiesResponder)> {
if let DeviceRequest::GetCapabilities { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_extended_capabilities(
self,
) -> Option<(ExtendedCapabilityId, DeviceGetExtendedCapabilitiesResponder)> {
if let DeviceRequest::GetExtendedCapabilities { id, responder } = self {
Some((id, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_bti(self) -> Option<(u32, DeviceGetBtiResponder)> {
if let DeviceRequest::GetBti { index, responder } = self {
Some((index, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeviceRequest::GetDeviceInfo { .. } => "get_device_info",
DeviceRequest::GetBar { .. } => "get_bar",
DeviceRequest::SetBusMastering { .. } => "set_bus_mastering",
DeviceRequest::ResetDevice { .. } => "reset_device",
DeviceRequest::AckInterrupt { .. } => "ack_interrupt",
DeviceRequest::MapInterrupt { .. } => "map_interrupt",
DeviceRequest::GetInterruptModes { .. } => "get_interrupt_modes",
DeviceRequest::SetInterruptMode { .. } => "set_interrupt_mode",
DeviceRequest::ReadConfig8 { .. } => "read_config8",
DeviceRequest::ReadConfig16 { .. } => "read_config16",
DeviceRequest::ReadConfig32 { .. } => "read_config32",
DeviceRequest::WriteConfig8 { .. } => "write_config8",
DeviceRequest::WriteConfig16 { .. } => "write_config16",
DeviceRequest::WriteConfig32 { .. } => "write_config32",
DeviceRequest::GetCapabilities { .. } => "get_capabilities",
DeviceRequest::GetExtendedCapabilities { .. } => "get_extended_capabilities",
DeviceRequest::GetBti { .. } => "get_bti",
}
}
}
#[derive(Debug, Clone)]
pub struct DeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DeviceControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl DeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetDeviceInfoResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetDeviceInfoResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetDeviceInfoResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetDeviceInfoResponder {
pub fn send(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(info);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
let _result = self.send_raw(info);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut info: &DeviceInfo) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetDeviceInfoResponse>(
(info,),
self.tx_id,
0x5599d144d4329916,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetBarResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetBarResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetBarResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetBarResponder {
pub fn send(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<Bar, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBarResponse, i32>>(
result.as_mut().map_err(|e| *e).map(|result| (result,)),
self.tx_id,
0x6b2683f6fbbff679,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceSetBusMasteringResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceSetBusMasteringResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceSetBusMasteringResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceSetBusMasteringResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x3421e9e030211003,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceResetDeviceResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceResetDeviceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceResetDeviceResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceResetDeviceResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x3c5b7579bb6f8b9f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceAckInterruptResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceAckInterruptResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceAckInterruptResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceAckInterruptResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x70742f64692d5a6b,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceMapInterruptResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceMapInterruptResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceMapInterruptResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceMapInterruptResponder {
pub fn send(self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Interrupt, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Interrupt, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<DeviceMapInterruptResponse, i32>>(
result.map(|interrupt| (interrupt,)),
self.tx_id,
0x25eeff9d34a1fa13,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetInterruptModesResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetInterruptModesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetInterruptModesResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetInterruptModesResponder {
pub fn send(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
let _result = self.send_raw(modes);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
let _result = self.send_raw(modes);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut modes: &InterruptModes) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetInterruptModesResponse>(
(modes,),
self.tx_id,
0x93f4cd8f79e9f4a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceSetInterruptModeResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceSetInterruptModeResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceSetInterruptModeResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceSetInterruptModeResponder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x85bebad3eb24866,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceReadConfig8Responder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceReadConfig8Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceReadConfig8Responder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceReadConfig8Responder {
pub fn send(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<u8, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<DeviceReadConfig8Response, i32>>(
result.map(|value| (value,)),
self.tx_id,
0x28f9eb9e6dadda1c,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceReadConfig16Responder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceReadConfig16Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceReadConfig16Responder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceReadConfig16Responder {
pub fn send(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<DeviceReadConfig16Response, i32>>(
result.map(|value| (value,)),
self.tx_id,
0x3bcda6171a3270bb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceReadConfig32Responder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceReadConfig32Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceReadConfig32Responder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceReadConfig32Responder {
pub fn send(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<u32, i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<DeviceReadConfig32Response, i32>>(
result.map(|value| (value,)),
self.tx_id,
0x55357535402f7507,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceWriteConfig8Responder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceWriteConfig8Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceWriteConfig8Responder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceWriteConfig8Responder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x49a0719e1433cff,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceWriteConfig16Responder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceWriteConfig16Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceWriteConfig16Responder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceWriteConfig16Responder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x3e30bf13f1c07eff,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceWriteConfig32Responder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceWriteConfig32Responder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceWriteConfig32Responder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceWriteConfig32Responder {
pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x161584e5199b388,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetCapabilitiesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetCapabilitiesResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetCapabilitiesResponder {
pub fn send(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
let _result = self.send_raw(offsets);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
let _result = self.send_raw(offsets);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut offsets: &[u8]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetCapabilitiesResponse>(
(offsets,),
self.tx_id,
0x3a050fde46f3ba0f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetExtendedCapabilitiesResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetExtendedCapabilitiesResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetExtendedCapabilitiesResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetExtendedCapabilitiesResponder {
pub fn send(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
let _result = self.send_raw(offsets);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
let _result = self.send_raw(offsets);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut offsets: &[u16]) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<DeviceGetExtendedCapabilitiesResponse>(
(offsets,),
self.tx_id,
0xb8573efcaae0c39,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeviceGetBtiResponder {
control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeviceGetBtiResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeviceGetBtiResponder {
type ControlHandle = DeviceControlHandle;
fn control_handle(&self) -> &DeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeviceGetBtiResponder {
pub fn send(self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut result: Result<fidl::Bti, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<fidl::Bti, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetBtiResponse, i32>>(
result.map(|bti| (bti,)),
self.tx_id,
0x5e4fe9efb12d9ee3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ServiceMarker;
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceMarker for ServiceMarker {
type Proxy = ServiceProxy;
type Request = ServiceRequest;
const SERVICE_NAME: &'static str = "fuchsia.hardware.pci.Service";
}
#[cfg(target_os = "fuchsia")]
pub enum ServiceRequest {
Device(DeviceRequestStream),
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceRequest for ServiceRequest {
type Service = ServiceMarker;
fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
match name {
"device" => Self::Device(
<DeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
),
_ => panic!("no such member protocol name for service Service"),
}
}
fn member_names() -> &'static [&'static str] {
&["device"]
}
}
#[cfg(target_os = "fuchsia")]
pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::ServiceProxy for ServiceProxy {
type Service = ServiceMarker;
fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
Self(opener)
}
}
#[cfg(target_os = "fuchsia")]
impl ServiceProxy {
pub fn connect_to_device(&self) -> Result<DeviceProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_proxy::<DeviceMarker>();
self.connect_channel_to_device(server_end)?;
Ok(proxy)
}
pub fn connect_to_device_sync(&self) -> Result<DeviceSynchronousProxy, fidl::Error> {
let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<DeviceMarker>();
self.connect_channel_to_device(server_end)?;
Ok(proxy)
}
pub fn connect_channel_to_device(
&self,
server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
) -> Result<(), fidl::Error> {
self.0.open_member("device", server_end.into_channel())
}
pub fn instance_name(&self) -> &str {
self.0.instance_name()
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Command {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
}
impl fidl::encoding::ValueTypeMarker for Command {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Command {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Status {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
}
impl fidl::encoding::ValueTypeMarker for Status {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Status {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.bits(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Status {
#[inline(always)]
fn new_empty() -> Self {
Self::empty()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_bits_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for CapabilityId {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for CapabilityId {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CapabilityId {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilityId {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Config {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u16>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u16>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Config {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Config {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ExtendedCapabilityId {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u16>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u16>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for ExtendedCapabilityId {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for ExtendedCapabilityId
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapabilityId {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u16>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for HeaderType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for HeaderType {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HeaderType {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HeaderType {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for InterruptMode {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for InterruptMode {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for InterruptMode {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptMode {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Address {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Address {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
3
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Address, D> for &Address {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Address>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Address).write_unaligned((self as *const Address).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u8, D>,
T1: fidl::encoding::Encode<u8, D>,
T2: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<Address, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Address>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Address {
#[inline(always)]
fn new_empty() -> Self {
Self {
bus: fidl::new_empty!(u8, D),
device: fidl::new_empty!(u8, D),
function: fidl::new_empty!(u8, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 3);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for Bar {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Bar {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut Bar
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Bar>(offset);
fidl::encoding::Encode::<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.bar_id),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
<BarResult as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.result,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T2: fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>,
> fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Bar>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Bar {
#[inline(always)]
fn new_empty() -> Self {
Self {
bar_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
size: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
result: fidl::new_empty!(BarResult, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u32,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.bar_id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.size,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
BarResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.result,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BaseAddress {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BaseAddress {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BaseAddress, D>
for &BaseAddress
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseAddress>(offset);
fidl::encoding::Encode::<BaseAddress, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.size),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_memory),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_prefetchable),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_64bit),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u64, D>,
T2: fidl::encoding::Encode<bool, D>,
T3: fidl::encoding::Encode<bool, D>,
T4: fidl::encoding::Encode<bool, D>,
T5: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<BaseAddress, D> for (T0, T1, T2, T3, T4, T5)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseAddress>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 17, depth)?;
self.4.encode(encoder, offset + 18, depth)?;
self.5.encode(encoder, offset + 19, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BaseAddress {
#[inline(always)]
fn new_empty() -> Self {
Self {
address: fidl::new_empty!(u64, D),
size: fidl::new_empty!(u64, D),
is_memory: fidl::new_empty!(bool, D),
is_prefetchable: fidl::new_empty!(bool, D),
is_64bit: fidl::new_empty!(bool, D),
id: fidl::new_empty!(u8, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u64, D, &mut self.address, decoder, offset + 0, _depth)?;
fidl::decode!(u64, D, &mut self.size, decoder, offset + 8, _depth)?;
fidl::decode!(bool, D, &mut self.is_memory, decoder, offset + 16, _depth)?;
fidl::decode!(bool, D, &mut self.is_prefetchable, decoder, offset + 17, _depth)?;
fidl::decode!(bool, D, &mut self.is_64bit, decoder, offset + 18, _depth)?;
fidl::decode!(u8, D, &mut self.id, decoder, offset + 19, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BusGetDevicesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BusGetDevicesResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusGetDevicesResponse, D>
for &BusGetDevicesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusGetDevicesResponse>(offset);
fidl::encoding::Encode::<BusGetDevicesResponse, D>::encode(
(
<fidl::encoding::Vector<PciDevice, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.devices),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<PciDevice, 64>, D>,
> fidl::encoding::Encode<BusGetDevicesResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusGetDevicesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusGetDevicesResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { devices: fidl::new_empty!(fidl::encoding::Vector<PciDevice, 64>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<PciDevice, 64>, D, &mut self.devices, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BusGetHostBridgeInfoResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BusGetHostBridgeInfoResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for &BusGetHostBridgeInfoResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
fidl::encoding::Encode::<BusGetHostBridgeInfoResponse, D>::encode(
(<HostBridgeInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<HostBridgeInfo, D>>
fidl::encoding::Encode<BusGetHostBridgeInfoResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusGetHostBridgeInfoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for BusGetHostBridgeInfoResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { info: fidl::new_empty!(HostBridgeInfo, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(HostBridgeInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BusReadBarRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BusReadBarRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarRequest, D>
for &BusReadBarRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusReadBarRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BusReadBarRequest)
.write_unaligned((self as *const BusReadBarRequest).read());
let padding_ptr = buf_ptr.offset(0) as *mut u64;
let padding_mask = 0xffffffff00000000u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Address, D>,
T1: fidl::encoding::Encode<u8, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<u64, D>,
> fidl::encoding::Encode<BusReadBarRequest, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusReadBarRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 3, depth)?;
self.2.encode(encoder, offset + 8, depth)?;
self.3.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
device: fidl::new_empty!(Address, D),
bar_id: fidl::new_empty!(u8, D),
offset: fidl::new_empty!(u64, D),
size: fidl::new_empty!(u64, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 24);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for BusReadBarResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BusReadBarResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BusReadBarResponse, D>
for &BusReadBarResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusReadBarResponse>(offset);
fidl::encoding::Encode::<BusReadBarResponse, D>::encode(
(<fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(
&self.buffer,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
> fidl::encoding::Encode<BusReadBarResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BusReadBarResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BusReadBarResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { buffer: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::UnboundedVector<u8>,
D,
&mut self.buffer,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Capability {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Capability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Capability, D>
for &Capability
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Capability>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut Capability).write_unaligned((self as *const Capability).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u8, D>,
T1: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<Capability, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Capability>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Capability {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u8, D), offset: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetBarRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetBarRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBarRequest, D>
for &DeviceGetBarRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetBarRequest)
.write_unaligned((self as *const DeviceGetBarRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceGetBarRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBarRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBarRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { bar_id: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetBtiRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceGetBtiRequest, D>
for &DeviceGetBtiRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceGetBtiRequest)
.write_unaligned((self as *const DeviceGetBtiRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceGetBtiRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBtiRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceGetBtiRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { index: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for &DeviceGetCapabilitiesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
fidl::encoding::Encode::<DeviceGetCapabilitiesRequest, D>::encode(
(<CapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<CapabilityId, D>>
fidl::encoding::Encode<DeviceGetCapabilitiesRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetCapabilitiesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetCapabilitiesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(CapabilityId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(CapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetCapabilitiesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetCapabilitiesResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D>
for &DeviceGetCapabilitiesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
fidl::encoding::Encode::<DeviceGetCapabilitiesResponse, D>::encode(
(<fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.offsets,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
> fidl::encoding::Encode<DeviceGetCapabilitiesResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetCapabilitiesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetCapabilitiesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetDeviceInfoResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceInfoResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for &DeviceGetDeviceInfoResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
fidl::encoding::Encode::<DeviceGetDeviceInfoResponse, D>::encode(
(<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceInfo, D>>
fidl::encoding::Encode<DeviceGetDeviceInfoResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetDeviceInfoResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetDeviceInfoResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { info: fidl::new_empty!(DeviceInfo, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(DeviceInfo, D, &mut self.info, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D>
for &DeviceGetExtendedCapabilitiesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesRequest, D>::encode(
(<ExtendedCapabilityId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<ExtendedCapabilityId, D>,
> fidl::encoding::Encode<DeviceGetExtendedCapabilitiesRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetExtendedCapabilitiesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(ExtendedCapabilityId, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ExtendedCapabilityId, D, &mut self.id, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetExtendedCapabilitiesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetExtendedCapabilitiesResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D>
for &DeviceGetExtendedCapabilitiesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
fidl::encoding::Encode::<DeviceGetExtendedCapabilitiesResponse, D>::encode(
(<fidl::encoding::Vector<u16, 32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.offsets,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u16, 32>, D>,
> fidl::encoding::Encode<DeviceGetExtendedCapabilitiesResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetExtendedCapabilitiesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetExtendedCapabilitiesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { offsets: fidl::new_empty!(fidl::encoding::Vector<u16, 32>, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::Vector<u16, 32>, D, &mut self.offsets, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceGetInterruptModesResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetInterruptModesResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceGetInterruptModesResponse, D>
for &DeviceGetInterruptModesResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
fidl::encoding::Encode::<DeviceGetInterruptModesResponse, D>::encode(
(<InterruptModes as fidl::encoding::ValueTypeMarker>::borrow(&self.modes),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InterruptModes, D>>
fidl::encoding::Encode<DeviceGetInterruptModesResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetInterruptModesResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceGetInterruptModesResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { modes: fidl::new_empty!(InterruptModes, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(InterruptModes, D, &mut self.modes, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
12
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
for &DeviceInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceInfo>(offset);
fidl::encoding::Encode::<DeviceInfo, D>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.base_class),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.sub_class),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.program_interface),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision_id),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.dev_id),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.func_id),
<Padding as fidl::encoding::ValueTypeMarker>::borrow(&self.padding),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<u8, D>,
T3: fidl::encoding::Encode<u8, D>,
T4: fidl::encoding::Encode<u8, D>,
T5: fidl::encoding::Encode<u8, D>,
T6: fidl::encoding::Encode<u8, D>,
T7: fidl::encoding::Encode<u8, D>,
T8: fidl::encoding::Encode<u8, D>,
T9: fidl::encoding::Encode<Padding, D>,
> fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceInfo>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
self.2.encode(encoder, offset + 4, depth)?;
self.3.encode(encoder, offset + 5, depth)?;
self.4.encode(encoder, offset + 6, depth)?;
self.5.encode(encoder, offset + 7, depth)?;
self.6.encode(encoder, offset + 8, depth)?;
self.7.encode(encoder, offset + 9, depth)?;
self.8.encode(encoder, offset + 10, depth)?;
self.9.encode(encoder, offset + 11, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
vendor_id: fidl::new_empty!(u16, D),
device_id: fidl::new_empty!(u16, D),
base_class: fidl::new_empty!(u8, D),
sub_class: fidl::new_empty!(u8, D),
program_interface: fidl::new_empty!(u8, D),
revision_id: fidl::new_empty!(u8, D),
bus_id: fidl::new_empty!(u8, D),
dev_id: fidl::new_empty!(u8, D),
func_id: fidl::new_empty!(u8, D),
padding: fidl::new_empty!(Padding, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u16, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
fidl::decode!(u16, D, &mut self.device_id, decoder, offset + 2, _depth)?;
fidl::decode!(u8, D, &mut self.base_class, decoder, offset + 4, _depth)?;
fidl::decode!(u8, D, &mut self.sub_class, decoder, offset + 5, _depth)?;
fidl::decode!(u8, D, &mut self.program_interface, decoder, offset + 6, _depth)?;
fidl::decode!(u8, D, &mut self.revision_id, decoder, offset + 7, _depth)?;
fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 8, _depth)?;
fidl::decode!(u8, D, &mut self.dev_id, decoder, offset + 9, _depth)?;
fidl::decode!(u8, D, &mut self.func_id, decoder, offset + 10, _depth)?;
fidl::decode!(Padding, D, &mut self.padding, decoder, offset + 11, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceMapInterruptRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceMapInterruptRequest, D> for &DeviceMapInterruptRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceMapInterruptRequest)
.write_unaligned((self as *const DeviceMapInterruptRequest).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceMapInterruptRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceMapInterruptRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceMapInterruptRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { which_irq: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceReadConfig16Request, D> for &DeviceReadConfig16Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceReadConfig16Request)
.write_unaligned((self as *const DeviceReadConfig16Request).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
fidl::encoding::Encode<DeviceReadConfig16Request, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig16Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceReadConfig16Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { offset: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceReadConfig32Request, D> for &DeviceReadConfig32Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceReadConfig32Request)
.write_unaligned((self as *const DeviceReadConfig32Request).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
fidl::encoding::Encode<DeviceReadConfig32Request, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig32Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceReadConfig32Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { offset: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceReadConfig8Request, D> for &DeviceReadConfig8Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceReadConfig8Request)
.write_unaligned((self as *const DeviceReadConfig8Request).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
fidl::encoding::Encode<DeviceReadConfig8Request, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig8Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceReadConfig8Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { offset: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceSetBusMasteringRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceSetBusMasteringRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for &DeviceSetBusMasteringRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
fidl::encoding::Encode::<DeviceSetBusMasteringRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<DeviceSetBusMasteringRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetBusMasteringRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceSetBusMasteringRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceSetInterruptModeRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceSetInterruptModeRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceSetInterruptModeRequest, D>
for &DeviceSetInterruptModeRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
fidl::encoding::Encode::<DeviceSetInterruptModeRequest, D>::encode(
(
<InterruptMode as fidl::encoding::ValueTypeMarker>::borrow(&self.mode),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.requested_irq_count),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<InterruptMode, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<DeviceSetInterruptModeRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceSetInterruptModeRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceSetInterruptModeRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
mode: fidl::new_empty!(InterruptMode, D),
requested_irq_count: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffffff00u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(InterruptMode, D, &mut self.mode, decoder, offset + 0, _depth)?;
fidl::decode!(u32, D, &mut self.requested_irq_count, decoder, offset + 4, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig16Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig16Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceWriteConfig16Request, D> for &DeviceWriteConfig16Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceWriteConfig16Request)
.write_unaligned((self as *const DeviceWriteConfig16Request).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<DeviceWriteConfig16Request, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceWriteConfig16Request>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceWriteConfig16Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig32Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig32Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceWriteConfig32Request, D> for &DeviceWriteConfig32Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceWriteConfig32Request)
.write_unaligned((self as *const DeviceWriteConfig32Request).read());
let padding_ptr = buf_ptr.offset(0) as *mut u32;
let padding_mask = 0xffff0000u32;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<DeviceWriteConfig32Request, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceWriteConfig32Request>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u32).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceWriteConfig32Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(0) };
let padval = unsafe { (ptr as *const u32).read_unaligned() };
let mask = 0xffff0000u32;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceWriteConfig8Request {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceWriteConfig8Request {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceWriteConfig8Request, D> for &DeviceWriteConfig8Request
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceWriteConfig8Request)
.write_unaligned((self as *const DeviceWriteConfig8Request).read());
let padding_ptr = buf_ptr.offset(2) as *mut u16;
let padding_mask = 0xff00u16;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<DeviceWriteConfig8Request, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceWriteConfig8Request>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(2);
(ptr as *mut u16).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceWriteConfig8Request
{
#[inline(always)]
fn new_empty() -> Self {
Self { offset: fidl::new_empty!(u16, D), value: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(2) };
let padval = unsafe { (ptr as *const u16).read_unaligned() };
let mask = 0xff00u16;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 2 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DeviceGetBarResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetBarResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl
fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut DeviceGetBarResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
fidl::encoding::Encode::<
DeviceGetBarResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<Bar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.result),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<Bar, fidl::encoding::DefaultFuchsiaResourceDialect>>
fidl::encoding::Encode<DeviceGetBarResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBarResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceGetBarResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { result: fidl::new_empty!(Bar, fidl::encoding::DefaultFuchsiaResourceDialect) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Bar,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.result,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DeviceGetBtiResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceGetBtiResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut DeviceGetBtiResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
fidl::encoding::Encode::<
DeviceGetBtiResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Bti,
{ fidl::ObjectType::BTI.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.bti
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Bti,
{ fidl::ObjectType::BTI.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<DeviceGetBtiResponse, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceGetBtiResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceGetBtiResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
bti: fidl::new_empty!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Bti, { fidl::ObjectType::BTI.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.bti, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for DeviceMapInterruptResponse {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceMapInterruptResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl
fidl::encoding::Encode<
DeviceMapInterruptResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut DeviceMapInterruptResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
fidl::encoding::Encode::<
DeviceMapInterruptResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(<fidl::encoding::HandleType<
fidl::Interrupt,
{ fidl::ObjectType::INTERRUPT.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.interrupt
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Interrupt,
{ fidl::ObjectType::INTERRUPT.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
DeviceMapInterruptResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceMapInterruptResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for DeviceMapInterruptResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
interrupt: fidl::new_empty!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(fidl::encoding::HandleType<fidl::Interrupt, { fidl::ObjectType::INTERRUPT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.interrupt, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceReadConfig16Response {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig16Response {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceReadConfig16Response, D> for &DeviceReadConfig16Response
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceReadConfig16Response)
.write_unaligned((self as *const DeviceReadConfig16Response).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u16, D>>
fidl::encoding::Encode<DeviceReadConfig16Response, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig16Response>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceReadConfig16Response
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceReadConfig32Response {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig32Response {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceReadConfig32Response, D> for &DeviceReadConfig32Response
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceReadConfig32Response)
.write_unaligned((self as *const DeviceReadConfig32Response).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
fidl::encoding::Encode<DeviceReadConfig32Response, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig32Response>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceReadConfig32Response
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u32, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for DeviceReadConfig8Response {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeviceReadConfig8Response {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeviceReadConfig8Response, D> for &DeviceReadConfig8Response
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut DeviceReadConfig8Response)
.write_unaligned((self as *const DeviceReadConfig8Response).read());
}
Ok(())
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u8, D>>
fidl::encoding::Encode<DeviceReadConfig8Response, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeviceReadConfig8Response>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeviceReadConfig8Response
{
#[inline(always)]
fn new_empty() -> Self {
Self { value: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 1);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ExtendedCapability {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ExtendedCapability {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExtendedCapability, D>
for &ExtendedCapability
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExtendedCapability>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut ExtendedCapability)
.write_unaligned((self as *const ExtendedCapability).read());
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<ExtendedCapability, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ExtendedCapability>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExtendedCapability {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u16, D), offset: fidl::new_empty!(u16, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for HostBridgeInfo {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for HostBridgeInfo {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HostBridgeInfo, D>
for &HostBridgeInfo
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostBridgeInfo>(offset);
fidl::encoding::Encode::<HostBridgeInfo, D>::encode(
(
<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
&self.name,
),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.start_bus_number),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.end_bus_number),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.segment_group),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
T1: fidl::encoding::Encode<u8, D>,
T2: fidl::encoding::Encode<u8, D>,
T3: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<HostBridgeInfo, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<HostBridgeInfo>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 17, depth)?;
self.3.encode(encoder, offset + 18, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HostBridgeInfo {
#[inline(always)]
fn new_empty() -> Self {
Self {
name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D),
start_bus_number: fidl::new_empty!(u8, D),
end_bus_number: fidl::new_empty!(u8, D),
segment_group: fidl::new_empty!(u16, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::BoundedString<32>,
D,
&mut self.name,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u8, D, &mut self.start_bus_number, decoder, offset + 16, _depth)?;
fidl::decode!(u8, D, &mut self.end_bus_number, decoder, offset + 17, _depth)?;
fidl::decode!(u16, D, &mut self.segment_group, decoder, offset + 18, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for InterruptModes {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for InterruptModes {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InterruptModes, D>
for &InterruptModes
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InterruptModes>(offset);
fidl::encoding::Encode::<InterruptModes, D>::encode(
(
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_legacy),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.msi_count),
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.msix_count),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<bool, D>,
T1: fidl::encoding::Encode<u8, D>,
T2: fidl::encoding::Encode<u16, D>,
> fidl::encoding::Encode<InterruptModes, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<InterruptModes>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 1, depth)?;
self.2.encode(encoder, offset + 2, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptModes {
#[inline(always)]
fn new_empty() -> Self {
Self {
has_legacy: fidl::new_empty!(bool, D),
msi_count: fidl::new_empty!(u8, D),
msix_count: fidl::new_empty!(u16, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.has_legacy, decoder, offset + 0, _depth)?;
fidl::decode!(u8, D, &mut self.msi_count, decoder, offset + 1, _depth)?;
fidl::decode!(u16, D, &mut self.msix_count, decoder, offset + 2, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for IoBar {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for IoBar {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut IoBar
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IoBar>(offset);
fidl::encoding::Encode::<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
<fidl::encoding::HandleType<
fidl::Resource,
{ fidl::ObjectType::RESOURCE.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.resource
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Resource,
{ fidl::ObjectType::RESOURCE.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
> fidl::encoding::Encode<IoBar, fidl::encoding::DefaultFuchsiaResourceDialect>
for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<IoBar>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for IoBar {
#[inline(always)]
fn new_empty() -> Self {
Self {
address: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
resource: fidl::new_empty!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.address,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Resource, { fidl::ObjectType::RESOURCE.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.resource, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Padding {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Padding {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Padding, D> for &Padding {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Padding>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Padding {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for PciDevice {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for PciDevice {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
72
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PciDevice, D>
for &PciDevice
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PciDevice>(offset);
fidl::encoding::Encode::<PciDevice, D>::encode(
(
<fidl::encoding::Vector<BaseAddress, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.base_addresses),
<fidl::encoding::Vector<Capability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.capabilities),
<fidl::encoding::Vector<ExtendedCapability, 32> as fidl::encoding::ValueTypeMarker>::borrow(&self.ext_capabilities),
<fidl::encoding::Vector<u8, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.bus_id),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
<u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.function_id),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<BaseAddress, 6>, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<Capability, 32>, D>,
T2: fidl::encoding::Encode<fidl::encoding::Vector<ExtendedCapability, 32>, D>,
T3: fidl::encoding::Encode<fidl::encoding::Vector<u8, 256>, D>,
T4: fidl::encoding::Encode<u8, D>,
T5: fidl::encoding::Encode<u8, D>,
T6: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<PciDevice, D> for (T0, T1, T2, T3, T4, T5, T6)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<PciDevice>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
self.4.encode(encoder, offset + 64, depth)?;
self.5.encode(encoder, offset + 65, depth)?;
self.6.encode(encoder, offset + 66, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PciDevice {
#[inline(always)]
fn new_empty() -> Self {
Self {
base_addresses: fidl::new_empty!(fidl::encoding::Vector<BaseAddress, 6>, D),
capabilities: fidl::new_empty!(fidl::encoding::Vector<Capability, 32>, D),
ext_capabilities: fidl::new_empty!(fidl::encoding::Vector<ExtendedCapability, 32>, D),
config: fidl::new_empty!(fidl::encoding::Vector<u8, 256>, D),
bus_id: fidl::new_empty!(u8, D),
device_id: fidl::new_empty!(u8, D),
function_id: fidl::new_empty!(u8, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffff000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(fidl::encoding::Vector<BaseAddress, 6>, D, &mut self.base_addresses, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<Capability, 32>, D, &mut self.capabilities, decoder, offset + 16, _depth)?;
fidl::decode!(fidl::encoding::Vector<ExtendedCapability, 32>, D, &mut self.ext_capabilities, decoder, offset + 32, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 256>, D, &mut self.config, decoder, offset + 48, _depth)?;
fidl::decode!(u8, D, &mut self.bus_id, decoder, offset + 64, _depth)?;
fidl::decode!(u8, D, &mut self.device_id, decoder, offset + 65, _depth)?;
fidl::decode!(u8, D, &mut self.function_id, decoder, offset + 66, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for UseIntxWorkaroundType {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for UseIntxWorkaroundType {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<UseIntxWorkaroundType, D>
for &UseIntxWorkaroundType
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<UseIntxWorkaroundType>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UseIntxWorkaroundType {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl BoardConfiguration {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.use_intx_workaround {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for BoardConfiguration {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BoardConfiguration {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BoardConfiguration, D>
for &BoardConfiguration
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BoardConfiguration>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<UseIntxWorkaroundType, D>(
self.use_intx_workaround
.as_ref()
.map(<UseIntxWorkaroundType as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BoardConfiguration {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<UseIntxWorkaroundType as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.use_intx_workaround
.get_or_insert_with(|| fidl::new_empty!(UseIntxWorkaroundType, D));
fidl::decode!(
UseIntxWorkaroundType,
D,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for BarResult {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for BarResult {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl fidl::encoding::Encode<BarResult, fidl::encoding::DefaultFuchsiaResourceDialect>
for &mut BarResult
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BarResult>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
BarResult::Io(ref mut val) => fidl::encoding::encode_in_envelope::<
IoBar,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<IoBar as fidl::encoding::ResourceTypeMarker>::take_or_borrow(val),
encoder,
offset + 8,
_depth,
),
BarResult::Vmo(ref mut val) => fidl::encoding::encode_in_envelope::<
fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>(
<fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
val
),
encoder,
offset + 8,
_depth,
),
BarResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
}
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for BarResult {
#[inline(always)]
fn new_empty() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0 }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <IoBar as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <fidl::encoding::HandleType<
fidl::Vmo,
{ fidl::ObjectType::VMO.into_raw() },
2147483648,
> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
0 => return Err(fidl::Error::UnknownUnionTag),
_ => num_bytes as usize,
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let BarResult::Io(_) = self {
} else {
*self = BarResult::Io(fidl::new_empty!(
IoBar,
fidl::encoding::DefaultFuchsiaResourceDialect
));
}
#[allow(irrefutable_let_patterns)]
if let BarResult::Io(ref mut val) = self {
fidl::decode!(
IoBar,
fidl::encoding::DefaultFuchsiaResourceDialect,
val,
decoder,
_inner_offset,
depth
)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let BarResult::Vmo(_) = self {
} else {
*self = BarResult::Vmo(
fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
);
}
#[allow(irrefutable_let_patterns)]
if let BarResult::Vmo(ref mut val) = self {
fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
#[allow(deprecated)]
ordinal => {
for _ in 0..num_handles {
decoder.drop_next_handle()?;
}
*self = BarResult::__SourceBreaking { unknown_ordinal: ordinal };
}
}
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
Ok(())
}
}
}