Crates.io | js-intern |
lib.rs | js-intern |
version | 0.3.1 |
source | src |
created_at | 2019-06-22 20:44:04.189488 |
updated_at | 2019-07-05 21:06:46.238909 |
description | A macro for interning JavaScript primitives |
homepage | https://github.com/That3Percent/js-intern |
repository | https://github.com/That3Percent/js-intern |
max_upload_size | |
id | 142891 |
size | 7,024 |
A macro for interning JavaScript primitives.
Stores one copy of each distinct JavaScript primitive.
For example, js_intern!("string")
evaluates to a &JsValue
but uses only one heap allocation
and a one-time translation from the utf-8 Rust string to the utf-16 JavaScript string the first time the expression is evaluated.
Furthermore, values are de-duplicated across the program.
So, any time js_intern!(1.0)
is used in the program, the same instance of the JavaScript number is used.
&'static str
Eg: js_intern!("str")
f64
, f32
u8
, u16
, u32
, i8
, i16
, i32
Eg: js_intern(1.0)
bool
Eg: js_intern(true)
If you like this, you may like these other crates by Zac Burns (That3Percent)