pub struct Compiler { /* private fields */ }Expand description
Luau bytecode compiler options, mirroring mlua::Compiler.
Construct with Compiler::new, tune with the set_* builder methods, and
attach to a chunk with Chunk::set_compiler
(or to the whole VM with Lua::set_compiler).
use luaur_rt::Compiler;
let _c = Compiler::new()
.set_optimization_level(2)
.set_debug_level(1)
.set_vector_ctor("vector");Implementations§
Source§impl Compiler
impl Compiler
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a Compiler with Luau’s default options (optimization level 1,
debug level 1). Mirrors mlua::Compiler::new.
Sourcepub fn set_optimization_level(self, level: u8) -> Self
pub fn set_optimization_level(self, level: u8) -> Self
Set the optimization level (0..=2). Mirrors
mlua::Compiler::set_optimization_level.
Sourcepub fn set_debug_level(self, level: u8) -> Self
pub fn set_debug_level(self, level: u8) -> Self
Set the debug level (0..=2). Mirrors mlua::Compiler::set_debug_level.
Sourcepub fn set_type_info_level(self, level: u8) -> Self
pub fn set_type_info_level(self, level: u8) -> Self
Set the type-info level. Mirrors mlua::Compiler::set_type_info_level.
Sourcepub fn set_coverage_level(self, level: u8) -> Self
pub fn set_coverage_level(self, level: u8) -> Self
Set the coverage level (0..=2). Mirrors
mlua::Compiler::set_coverage_level.
Sourcepub fn set_vector_lib(self, lib: impl Into<Vec<u8>>) -> Self
pub fn set_vector_lib(self, lib: impl Into<Vec<u8>>) -> Self
Set the library name whose members are recognized as vector operations
(enables vector fastcalls). Mirrors mlua::Compiler::set_vector_lib.
Sourcepub fn set_vector_ctor(self, ctor: impl Into<Vec<u8>>) -> Self
pub fn set_vector_ctor(self, ctor: impl Into<Vec<u8>>) -> Self
Set the constructor name used to build vectors (enables compiling
vector(...) calls to the vector type). Mirrors
mlua::Compiler::set_vector_ctor.
Sourcepub fn set_vector_type(self, ty: impl Into<Vec<u8>>) -> Self
pub fn set_vector_type(self, ty: impl Into<Vec<u8>>) -> Self
Set the user vector type name used for field/method fastcalls.
Mirrors mlua::Compiler::set_vector_type.
Sourcepub fn set_mutable_globals(self, globals: Vec<String>) -> Self
pub fn set_mutable_globals(self, globals: Vec<String>) -> Self
Set the list of globals the compiler is allowed to treat as mutable
(so it won’t constant-fold reads of them). Mirrors
mlua::Compiler::set_mutable_globals.