Skip to main content

Module rust_ffi

Module rust_ffi 

Source
Expand description

JavaScript wiring for inline Rust FFI (rust { ... } blocks).

The heavy lifting lives in fusevm: fusevm::RustSugar scans and rewrites the block at the source level, and fusevm::ffi compiles/loads/marshals it. This module only supplies the JS-flavored fusevm::RustSugar config and the desugar entry the parser calls. The emitted __rust_compile(...) call and every exported bareword are resolved in crate::host::call_named.

Constants§

SUGAR
JavaScript desugar config: C-family braces with // and /* */ comments. newline_boundary is true so a top-level rust { ... } on its own line is recognized — rust { is never valid JS otherwise, so this only ever matches an intended FFI block. The desugar runs on raw source BEFORE lexing, so the block is replaced in place by a __rust_compile(...) expression statement.

Functions§

desugar
Rewrite every top-level rust { ... } block in JS source into a __rust_compile(...) call, before lexing. No-op when the source has no rust token.