pub unsafe trait AsBusDevice<Ctx: DeviceContext>: AsRef<Device<Ctx>> {
const OFFSET: usize;
// Provided method
unsafe fn from_device(dev: &Device<Ctx>) -> &Self
where Self: Sized { ... }
}Expand description
Convert device references to bus device references.
Bus devices can implement this trait to allow abstractions to provide the bus device in class device callbacks.
This must not be used by drivers and is intended for bus and class device abstractions only.
§Safety
AsBusDevice::OFFSET must be the offset of the embedded base struct device field within a
bus device structure.
Required Associated Constants§
Provided Methods§
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.