pub struct Compiler { /* private fields */ }Implementations§
Source§impl Compiler
impl Compiler
pub fn new() -> Self
Sourcepub fn with_host_fns(host_fns: Vec<HostFnSpec>) -> Self
pub fn with_host_fns(host_fns: Vec<HostFnSpec>) -> Self
Builds a compiler that recognises the given host fn names in eval-mode
programs. Each spec gets a wasm import declared in the module and an
entry the native dispatcher consults when emitting calls. Has no effect
in Script mode (entity-script bytecode imports env.*, not nomi.*).
pub fn compile( &mut self, program: &Program, symbols: &mut SymbolTable, ) -> Result<Vec<u8>>
pub fn compile_with_mode( &mut self, program: &Program, symbols: &mut SymbolTable, mode: CompileMode, ) -> Result<Vec<u8>>
Sourcepub fn compile_eval_with_type(
&mut self,
program: &Program,
symbols: &mut SymbolTable,
) -> Result<(Vec<u8>, Option<WasmType>)>
pub fn compile_eval_with_type( &mut self, program: &Program, symbols: &mut SymbolTable, ) -> Result<(Vec<u8>, Option<WasmType>)>
Compiles program in eval mode and returns the wasm bytes paired
with the form’s final result type. None for empty programs /
definition-only forms (nomi-eval returns ref.null any); Some(ty)
for any other terminator. Hosts decode the returned anyref via the
type hint — see scripting::runtime::decode_eval_result.
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 UnsafeUnpin 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
Mutably borrows from an owned value. Read more