rhai_components 0.5.3

JSX-like syntax extension for Rhai
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use nanoid::nanoid;

// Allow only characters that are safe for use in function names
const RHAI_GLOBAL_FN_SUFFIX_ALPHABET: [char; 62] = [
    '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
    'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B',
    'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
    'V', 'W', 'X', 'Y', 'Z',
];

pub fn rhai_safe_random_affix() -> String {
    nanoid!(16, &RHAI_GLOBAL_FN_SUFFIX_ALPHABET)
}