Trait kernel::driver::RawDeviceId
source · [−]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::ZEROis actually a zeroed-out version of the raw device id.RawDeviceId::to_rawidstoresoffsetin the context/data field of the raw device id so that buses can recover the pointer to the data.
Required Associated Types
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.