#[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
sourceimpl Work
impl Work
sourcepub unsafe fn new() -> Self
pub unsafe fn new() -> Self
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.
sourcepub fn init<T: WorkAdapter<Target = T>>(
obj: &UniqueRef<T>,
key: &'static LockClassKey
)
pub fn init<T: WorkAdapter<Target = T>>(
obj: &UniqueRef<T>,
key: &'static LockClassKey
)
Initialises the work item.
Users should prefer the init_work_item
macro because it automatically defines a new
lock class key.
sourcepub fn init_with_adapter<A: WorkAdapter>(
obj: &UniqueRef<A::Target>,
key: &'static LockClassKey
)
pub fn init_with_adapter<A: WorkAdapter>(
obj: &UniqueRef<A::Target>,
key: &'static LockClassKey
)
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.
Auto Trait Implementations
impl !RefUnwindSafe for Work
impl !Send for Work
impl !Sync for Work
impl Unpin for Work
impl UnwindSafe for Work
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more