pub struct Compiler { /* private fields */ }luau only.Expand description
Luau compiler
Implementations§
Source§impl Compiler
impl Compiler
Sourcepub const fn new() -> Self
Available on crate features luau only.
pub const fn new() -> Self
luau only.Creates Luau compiler instance with default options
Sourcepub const fn set_optimization_level(self, level: u8) -> Self
Available on crate features luau only.
pub const fn set_optimization_level(self, level: u8) -> Self
luau only.Sets Luau compiler optimization level.
Possible values:
- 0 - no optimization
- 1 - baseline optimization level that doesn’t prevent debuggability (default)
- 2 - includes optimizations that harm debuggability such as inlining
Sourcepub const fn set_debug_level(self, level: u8) -> Self
Available on crate features luau only.
pub const fn set_debug_level(self, level: u8) -> Self
luau only.Sets Luau compiler debug level.
Possible values:
- 0 - no debugging support
- 1 - line info & function names only; sufficient for backtraces (default)
- 2 - full debug info with local & upvalue names; necessary for debugger
Sourcepub const fn set_type_info_level(self, level: u8) -> Self
Available on crate features luau only.
pub const fn set_type_info_level(self, level: u8) -> Self
luau only.Sets Luau type information level used to guide native code generation decisions.
Possible values:
- 0 - generate for native modules (default)
- 1 - generate for all modules
Sourcepub const fn set_coverage_level(self, level: u8) -> Self
Available on crate features luau only.
pub const fn set_coverage_level(self, level: u8) -> Self
luau only.Sets Luau compiler code coverage level.
Possible values:
- 0 - no code coverage support (default)
- 1 - statement coverage
- 2 - statement and expression coverage (verbose)
Sourcepub fn add_mutable_global(self, global: impl Into<StdString>) -> Self
Available on crate features luau only.
pub fn add_mutable_global(self, global: impl Into<StdString>) -> Self
luau only.Adds a mutable global.
It disables the import optimization for fields accessed through it.
Sourcepub fn set_mutable_globals<S: Into<StdString>>(
self,
globals: impl IntoIterator<Item = S>,
) -> Self
Available on crate features luau only.
pub fn set_mutable_globals<S: Into<StdString>>( self, globals: impl IntoIterator<Item = S>, ) -> Self
luau only.Sets a list of globals that are mutable.
It disables the import optimization for fields accessed through these.
Sourcepub fn add_userdata_type(self, type: impl Into<StdString>) -> Self
Available on crate features luau only.
pub fn add_userdata_type(self, type: impl Into<StdString>) -> Self
luau only.Adds a userdata type to the list that will be included in the type information.
Sourcepub fn set_userdata_types<S: Into<StdString>>(
self,
types: impl IntoIterator<Item = S>,
) -> Self
Available on crate features luau only.
pub fn set_userdata_types<S: Into<StdString>>( self, types: impl IntoIterator<Item = S>, ) -> Self
luau only.Sets a list of userdata types that will be included in the type information.
Sourcepub fn add_library_constant(
self,
name: impl AsRef<str>,
const: impl Into<CompileConstant>,
) -> Self
Available on crate features luau only.
pub fn add_library_constant( self, name: impl AsRef<str>, const: impl Into<CompileConstant>, ) -> Self
luau only.Adds a constant for a known library member.
The constants are used by the compiler to optimize the generated bytecode. Optimization level must be at least 2 for this to have any effect.
The name is a string in the format lib.member, where lib is the library name
and member is the member (constant) name.
Sourcepub fn add_disabled_builtin(self, builtin: impl Into<StdString>) -> Self
Available on crate features luau only.
pub fn add_disabled_builtin(self, builtin: impl Into<StdString>) -> Self
luau only.Adds a builtin that should be disabled.
Sourcepub fn set_disabled_builtins<S: Into<StdString>>(
self,
builtins: impl IntoIterator<Item = S>,
) -> Self
Available on crate features luau only.
pub fn set_disabled_builtins<S: Into<StdString>>( self, builtins: impl IntoIterator<Item = S>, ) -> Self
luau only.Sets a list of builtins that should be disabled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Compiler
impl RefUnwindSafe for Compiler
impl Send for Compiler
impl Sync for Compiler
impl Unpin for Compiler
impl UnwindSafe for Compiler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more