blob: 86611d72d448e330272f775ae7fb883e99aa4977 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 | use std::collections::HashMap;
use once_cell::sync::Lazy;
use crate::native::NativeFunction;
pub mod rand;
pub mod stdio;
pub static NATIVE_LIBRARY: Lazy<HashMap<&'static str, NativeFunction>> = Lazy::new(|| {
    let mut map = HashMap::new();
    // rand
    map.insert("rand$gen", rand::GEN_FUNCTION);
    map.insert("rand$gen_range", rand::GEN_RANGE_FUNCTION);
    // stdio
    map.insert("write", stdio::WRITE_FUNCTION);
    map.insert("read", stdio::READ_FUNCTION);
    // filesystem
    map
});
 |