Skip to content

Instantly share code, notes, and snippets.

@andrei-cacio
Last active May 18, 2018 08:49
Show Gist options
  • Save andrei-cacio/d14af0c2275e5c8788d69d345484cdca to your computer and use it in GitHub Desktop.
Save andrei-cacio/d14af0c2275e5c8788d69d345484cdca to your computer and use it in GitHub Desktop.
Rust vector to JS example
#[no_mangle]
pub fn simple_arr() -> *mut i32 {
let vec = Box::new([100, 200, 300, 400]);
Box::into_raw(vec) as *mut i32
}
fn main() { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment