pub unsafe trait RawDeviceId {
    type RawType: Copy;

    const ZERO: Self::RawType;

    fn to_rawid(&self, offset: isize) -> Self::RawType;
}
Expand description

Conversion from a device id to a raw device id.

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:

  • RawDeviceId::ZERO is actually a zeroed-out version of the raw device id.
  • RawDeviceId::to_rawid stores offset in the context/data field of the raw device id so that buses can recover the pointer to the data.

Required Associated Types

The raw type that holds the device id.

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

Required Associated Constants

A zeroed-out representation of the raw device id.

Id tables created from Self use Self::ZERO as the sentinel to indicate the end of the table.

Required Methods

Converts an id into a raw id.

offset is the offset from the memory location where the raw device id is stored to the location where its associated context information is stored. Implementations must store this in the appropriate context/data field of the raw type.

Implementors

This documentation is an old archive. Please see https://rust.docs.kernel.org instead.