Macro far
far!() { /* proc-macro */ }Available on crate feature
bank only.Expand description
Take a far pointer to a banked function, for heterogeneous dispatch.
far!(path::to::f) yields a Far to the banked function f (resolved
through the module’s group). Call .erase() on it to drop the static group
and collect functions from different banks into a single [DynFar<..>; N]
table, then dispatch with runtime arguments.
§Examples
ⓘ
let table: [DynFar<fn(u8)>; 2] = [
far!(sound::play).erase(),
far!(enemy::ai).erase(),
];
for entry in &table {
entry.invoke(bank, (level,)); // switch to each one's bank, run, restore
}