Trait RawDeviceId

Source
pub unsafe trait RawDeviceId {
    type RawType: Copy;
}
Expand description

Marker trait to indicate a Rust device ID type represents a corresponding C device ID type.

This is meant to be implemented by buses/subsystems so that they can use IdTable to guarantee (at compile-time) zero-termination of device id tables provided by drivers.

§Safety

Implementers must ensure that Self is layout-compatible with RawDeviceId::RawType; i.e. it’s safe to transmute to RawDeviceId.

This requirement is needed so IdArray::new can convert Self to RawType when building the ID table.

Ideally, this should be achieved using a const function that does conversion instead of transmute; however, const trait functions relies on const_trait_impl unstable feature, which is broken/gone in Rust 1.73.

Required Associated Types§

Source

type RawType: Copy

The raw type that holds the device id.

Id tables created from Self are going to hold this type in its zero-terminated array.

Implementors§

Source§

impl RawDeviceId for kernel::acpi::DeviceId

Source§

type RawType = acpi_device_id

Source§

impl RawDeviceId for kernel::auxiliary::DeviceId

Source§

type RawType = auxiliary_device_id

Source§

impl RawDeviceId for kernel::net::phy::DeviceId

Source§

type RawType = mdio_device_id

Source§

impl RawDeviceId for kernel::of::DeviceId

Source§

type RawType = of_device_id

Source§

impl RawDeviceId for kernel::pci::DeviceId

Source§

type RawType = pci_device_id