pub unsafe trait WorkAdapter {
    type Target;

    const FIELD_OFFSET: isize;

    fn run(w: Ref<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

The type that this work adapter is meant to use.

Required Associated Constants

The offset, in bytes, from the beginning of Self::Target to the instance of Work.

Required Methods

Runs when the work item is picked up for execution after it has been enqueued to some work queue.

Implementors

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