Skip to main content

inherit

Macro inherit 

inherit!() { /* proc-macro */ }
Available on crate feature bank only.
Expand description

Declare a submodule as part of its parent module’s bank group.

Use bank::inherit!() (instead of bank::module!()) at the top of a child module so its #[bank] items share the parent’s bank rather than forming a separate group. (Named inherit because super is a reserved keyword.)

mod world {
    use gb_bank::*;
    bank::module!(4);            // world -> bank 4
    mod tiles {
        use gb_bank::*;
        bank::inherit!();        // tiles joins world -> also bank 4
        #[bank] pub fn load(i: u8) -> u8 { i }
    }
}