Macro kernel::impl_has_work

source ·
macro_rules! impl_has_work {
    ($(impl$({$($generics:tt)*})?
       HasWork<$work_type:ty $(, $id:tt)?>
       for $self:ty
       { self.$field:ident }
    )*) => { ... };
}
Expand description

Used to safely implement the HasWork<T, ID> trait.

§Examples

use kernel::sync::Arc;
use kernel::workqueue::{self, impl_has_work, Work};

struct MyStruct<'a, T, const N: usize> {
    work_field: Work<MyStruct<'a, T, N>, 17>,
    f: fn(&'a [T; N]),
}

impl_has_work! {
    impl{'a, T, const N: usize} HasWork<MyStruct<'a, T, N>, 17>
    for MyStruct<'a, T, N> { self.work_field }
}