pub fn compile(&self, source: impl AsRef<[u8]>) -> Vec<u8> {
        use std::os::raw::c_int;
        use std::ptr;

        let vector_lib = self.vector_lib.clone();
        let vector_lib = vector_lib.and_then(|lib| CString::new(lib).ok());
        let vector_lib = vector_lib.as_ref();
        let vector_ctor = self.vector_ctor.clone();
        let vector_ctor = vector_ctor.and_then(|ctor| CString::new(ctor).ok());
        let vector_ctor = vector_ctor.as_ref();

        let mutable_globals = self
            .mutable_globals
            .iter()
            .map(|name| CString::new(name.clone()).ok())
            .collect::<Option<Vec<_>>>()
            .unwrap_or_default();
        let mut mutable_globals = mutable_globals
            .iter()
            .map(|s| s.as_ptr())
            .collect::<Vec<_>>();
        let mut mutable_globals_ptr = ptr::null_mut();
        if !mutable_globals.is_empty() {
            mutable_globals.push(ptr::null());
            mutable_globals_ptr = mutable_globals.as_mut_ptr();
        }

        unsafe {
            let options = ffi::lua_CompileOptions {
                optimizationLevel: self.optimization_level as c_int,
                debugLevel: self.debug_level as c_int,
                coverageLevel: self.coverage_level as c_int,
                vectorLib: vector_lib.map_or(ptr::null(), |s| s.as_ptr()),
                vectorCtor: vector_ctor.map_or(ptr::null(), |s| s.as_ptr()),
                mutableGlobals: mutable_globals_ptr,
            };
            ffi::luau_compile(source.as_ref(), options)
        }
    }
/// Compiles the `source` into bytecode.
Compiles the `source` into bytecode.
Compiles the ` source ` into bytecode .
pub fn compile(&self, source: impl AsRef<[u8]>) -> Vec<u8> {
        use std::os::raw::c_int;
        use std::ptr;
        let vector_lib = self.vector_lib.clone();
        let vector_lib = vector_lib.and_then(|lib| CString::new(lib).ok());
        let vector_lib = vector_lib.as_ref();
        let vector_ctor = self.vector_ctor.clone();
        let vector_ctor = vector_ctor.and_then(|ctor| CString::new(ctor).ok());
        let vector_ctor = vector_ctor.as_ref();
        let mutable_globals = self
            .mutable_globals
            .iter()
            .map(|name| CString::new(name.clone()).ok())
            .collect::<Option<Vec<_>>>()
            .unwrap_or_default();
        let mut mutable_globals = mutable_globals
            .iter()
            .map(|s| s.as_ptr())
            .collect::<Vec<_>>();
        let mut mutable_globals_ptr = ptr::null_mut();
        if !mutable_globals.is_empty() {
            mutable_globals.push(ptr::null());
            mutable_globals_ptr = mutable_globals.as_mut_ptr();
        }
        unsafe {
            let options = ffi::lua_CompileOptions {
                optimizationLevel: self.optimization_level as c_int,
                debugLevel: self.debug_level as c_int,
                coverageLevel: self.coverage_level as c_int,
                vectorLib: vector_lib.map_or(ptr::null(), |s| s.as_ptr()),
                vectorCtor: vector_ctor.map_or(ptr::null(), |s| s.as_ptr()),
                mutableGlobals: mutable_globals_ptr,
            };
            ffi::luau_compile(source.as_ref(), options)
        }
    }
pub fn compile ( & self , source : impl AsRef < [ u8 ] > ) -> Vec < u8 > { use std :: os :: raw :: c_int ; use std :: ptr ; let vector_lib = self . vector_lib . clone ( ) ; let vector_lib = vector_lib . and_then ( | lib | CString :: new ( lib ) . ok ( ) ) ; let vector_lib = vector_lib . as_ref ( ) ; let vector_ctor = self . vector_ctor . clone ( ) ; let vector_ctor = vector_ctor . and_then ( | ctor | CString :: new ( ctor ) . ok ( ) ) ; let vector_ctor = vector_ctor . as_ref ( ) ; let mutable_globals = self . mutable_globals . iter ( ) . map ( | name | CString :: new ( name . clone ( ) ) . ok ( ) ) . collect :: < Option < Vec < _ > > > ( ) . unwrap_or_default ( ) ; let mut mutable_globals = mutable_globals . iter ( ) . map ( | s | s . as_ptr ( ) ) . collect :: < Vec < _ > > ( ) ; let mut mutable_globals_ptr = ptr :: null_mut ( ) ; if ! mutable_globals . is_empty ( ) { mutable_globals . push ( ptr :: null ( ) ) ; mutable_globals_ptr = mutable_globals . as_mut_ptr ( ) ; } unsafe { let options = ffi :: lua_CompileOptions { optimizationLevel : self . optimization_level as c_int , debugLevel : self . debug_level as c_int , coverageLevel : self . coverage_level as c_int , vectorLib : vector_lib . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) , vectorCtor : vector_ctor . map_or ( ptr :: null ( ) , | s | s . as_ptr ( ) ) , mutableGlobals : mutable_globals_ptr , } ; ffi :: luau_compile ( source . as_ref ( ) , options ) } }
Compiles the `source` into bytecode.
Compiles the ` source ` into bytecode .
&self
source
impl AsRef<[u8]>
&self
source
impl AsRef<[u8]>