Skip to main content

load

Function load 

Source
pub fn load(name: &str, bytes: &[u8]) -> Result<Language, String>
Expand description

Compile a grammar from a wasm side module.

~102 ms. Call once, at registration, on an off-thread task — never on the keystroke or frame path. The returned Language is what gets kept; the store used to load it is dropped here, which is sound because the Language owns the compiled module.

name must be the grammar’s tree-sitter name — the suffix of its tree_sitter_<name> export — or the module will load but expose no entry point.