Skip to main content

Compiler

Struct Compiler 

Source
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

Source

pub fn new() -> Self

Create a Compiler with Luau’s default options (optimization level 1, debug level 1). Mirrors mlua::Compiler::new.

Source

pub fn set_optimization_level(self, level: u8) -> Self

Set the optimization level (0..=2). Mirrors mlua::Compiler::set_optimization_level.

Source

pub fn set_debug_level(self, level: u8) -> Self

Set the debug level (0..=2). Mirrors mlua::Compiler::set_debug_level.

Source

pub fn set_type_info_level(self, level: u8) -> Self

Set the type-info level. Mirrors mlua::Compiler::set_type_info_level.

Source

pub fn set_coverage_level(self, level: u8) -> Self

Set the coverage level (0..=2). Mirrors mlua::Compiler::set_coverage_level.

Source

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.

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Compiler

Source§

fn clone(&self) -> Compiler

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Compiler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Compiler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSend for T

Source§

impl<T> MaybeSync for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.