Skip to main content

harn_vm/
stdlib_modules.rs

1/// Embedded standard library modules.
2///
3/// Each module is a `.harn` source file compiled into the binary via `include_str!`.
4/// They are only parsed/executed when a script does `import "std/<module>"`.
5pub fn get_stdlib_source(module: &str) -> Option<&'static str> {
6    match module {
7        "text" => Some(include_str!("stdlib_text.harn")),
8        "collections" => Some(include_str!("stdlib_collections.harn")),
9        "math" => Some(include_str!("stdlib_math.harn")),
10        "path" => Some(include_str!("stdlib_path.harn")),
11        "json" => Some(include_str!("stdlib_json.harn")),
12        _ => None,
13    }
14}