Trait kernel::workqueue::WorkAdapter
source · [−]pub unsafe trait WorkAdapter {
type Target;
const FIELD_OFFSET: isize;
fn run(w: Arc<Self::Target>);
}
Expand description
An adapter for work items.
For the most usual case where a type has a Work
in it and is itself the adapter, it is
recommended that they use the impl_self_work_adapter
or impl_work_adapter
macros
instead of implementing the WorkAdapter
manually. The great advantage is that they don’t
require any unsafe blocks.
Safety
Implementers must ensure that there is a Work
instance FIELD_OFFSET
bytes from the
beginning of a valid Target
type. It is normally safe to use the crate::offset_of
macro
for this.
Required Associated Types
Required Associated Constants
sourceconst FIELD_OFFSET: isize
const FIELD_OFFSET: isize
The offset, in bytes, from the beginning of Self::Target
to the instance of Work
.