Macro v11::context[][src]

macro_rules! context {
    (pub struct $name:ident {
        $(pub $i:ident: $lock:path,)*
    }) => { ... };
}

Creates a struct that holds many table locks that implement Lockable. This is useful for ergonomically passing multiple locks to other functions. It is possible to 'transfer' one context into another using NewContext::from(universe, oldContext). Any unused locks will be dropped, and any new locks will be acquired.

Tuples of up to three contexts can be combined. Try nesting the tuples if you need more.

This macro can't be invoked more than once in the same module; you can invoke it in a sub-module if necessary.

Example

context! {
    pub struct MyContext {
        pub reader: data_table::Read,
        pub writer: data_log::Write,
    }
}

You might consider implementing convenience functions on the context struct.