#[repr(transparent)]
pub struct Work(_);
Expand description

A work item.

Wraps the kernel’s C struct work_struct.

Users must add a field of this type to a structure, then implement WorkAdapter so that it can be queued for execution in a thread pool. Examples of it being used are available in the documentation for Queue.

Implementations

Creates a new instance of Work.

Safety

Callers must call either Work::init or Work::init_with_adapter before the work item can be used.

Initialises the work item.

Users should prefer the init_work_item macro because it automatically defines a new lock class key.

Initialises the work item with the given adapter.

Users should prefer the init_work_item_adapter macro because it automatically defines a new lock class key.

Cancels the work item.

It is ok for this to be called when the work is not queued.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.