DriverLayout

Trait DriverLayout 

Source
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:

  • DriverType is repr(C),
  • DriverData is the type of the driver’s device private data.
  • DriverType embeds a valid struct device_driver at byte offset DEVICE_DRIVER_OFFSET.

Required Associated Constants§

Source

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§

Source

type DriverType: Default

The specific driver type embedding a struct device_driver.

Source

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.

Implementors§

Source§

impl<T: Driver + 'static> DriverLayout for kernel::auxiliary::Adapter<T>

Source§

impl<T: Driver + 'static> DriverLayout for kernel::i2c::Adapter<T>

Source§

impl<T: Driver + 'static> DriverLayout for kernel::pci::Adapter<T>

Source§

impl<T: Driver + 'static> DriverLayout for kernel::platform::Adapter<T>

Source§

impl<T: Driver + 'static> DriverLayout for kernel::usb::Adapter<T>