[][src]Macro v9::decl_context

macro_rules! decl_context {
    (
        $(#[$meta:meta])*
        $vis:vis struct $name:ident {
            $(
                $(#[$cmeta:meta])*
                $cvis:vis $cn:ident
                                     $(: &$cty_ref:ty,)?
                                     $(: &mut $cty_mut:ty,)?
                                     $(: $cty:path,)?
            )*
        }
    ) => { ... };
}

Extract many things at once.

Several kernels might have a set of arguments in common. Furthermore, sets of these things might be passed off to functions. This macro allows you to dry up your code.

Each field of the struct must be Extract, AND its kind must be type T<'a> = ….

The macro adds a lifetime to everything, so in the example the declared item comes out struct MyContext<'a>.

Example

#[v9::context]
pub struct MyContext {
    hi: self::my_table::Edit,
}