Attribute Macro zero
#[zero]Available on crate feature
bank only.Expand description
Mark a bank-0 helper that drives banked code.
Unlike the entry point, a helper may be called from inside any bank, so it
cannot assume GroupZero: it must thread whatever token its caller holds and
restore that bank. So #[bank::zero] is Warp-colored like #[bank] (called
helper(args).drive()), but its Warp performs no bank switch, just
forwards the caller’s token. Any banked call inside then switches C -> target -> C, leaving the caller’s bank exactly as it found it.
Works on a fn (incl. generics), an impl block (each method becomes such a
helper, value.method(args).drive()), or a trait (its signatures are colored
-> impl Warp, like a banked trait; a #[bank::zero] impl supplies bodies).
§Examples
ⓘ
#[bank::zero]
pub fn update(state: u8) -> u8 {
enemy::ai(state).drive() // banked call inside; restores the caller's bank
}
// from anywhere with a bank token: `update(0).drive()`