compile

Macro compile 

Source
compile!() { /* proc-macro */ }
Expand description

Generates the final impl mlua::UserData block for a type.

This macro calls the helper functions generated by #[structure], #[implementation], and #[enumeration].

You must specify which helpers to include.

§Example (for a struct):

#[mlua_magic::structure]
struct Player { health: i32 }

#[mlua_magic::implementation]
impl Player {
    // ... methods ...
}

// Generates `impl mlua::UserData for Player`
mlua_magic::compile!(type_path = Player, fields = true, methods true);

§Example (for an enum):

#[mlua_magic::enumeration]
enum Status { Idle, Busy }

#[mlua_magic::implementation]
impl Status {
    // ... methods ...
}

// Generates `impl mlua::UserData for Status` and `impl mlua::IntoLua for Status`
mlua_magic::compile!(type_path = Status, variants = true, methods = true);