pub unsafe trait DriverLayout {
type DriverType: Default;
type DriverData;
const DEVICE_DRIVER_OFFSET: usize;
}Expand description
Trait describing the layout of a specific device driver.
This trait describes the layout of a specific driver structure, such as struct pci_driver or
struct platform_driver.
§Safety
Implementors must guarantee that:
DriverTypeisrepr(C),DriverDatais the type of the driver’s device private data.DriverTypeembeds a validstruct device_driverat byte offsetDEVICE_DRIVER_OFFSET.
Required Associated Constants§
Sourceconst DEVICE_DRIVER_OFFSET: usize
const DEVICE_DRIVER_OFFSET: usize
Byte offset of the embedded struct device_driver within DriverType.
This must correspond exactly to the location of the embedded struct device_driver field.
Required Associated Types§
Sourcetype DriverType: Default
type DriverType: Default
The specific driver type embedding a struct device_driver.
Sourcetype DriverData
type DriverData
The type of the driver’s device private data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.